|
@@ -1,14 +1,15 @@ |
1 |
1 |
|
// This Source Code is in the Public Domain per: http://litesoft.org/License.txt |
2 |
2 |
|
package org.litesoft.GWT.client.widgets; |
3 |
3 |
|
|
4 |
|
- |
import com.google.gwt.user.client.*; |
5 |
|
- |
import com.google.gwt.user.client.ui.*; |
6 |
4 |
|
import org.litesoft.GWT.client.*; |
7 |
5 |
|
import org.litesoft.GWT.client.widgets.nonpublic.*; |
8 |
6 |
|
import org.litesoft.core.simpletypes.*; |
9 |
7 |
|
import org.litesoft.core.util.*; |
10 |
8 |
|
import org.litesoft.uipopupsupport.*; |
11 |
9 |
|
|
|
10 |
+ |
import com.google.gwt.user.client.*; |
|
11 |
+ |
import com.google.gwt.user.client.ui.*; |
|
12 |
+ |
|
12 |
13 |
|
public abstract class AbstractContextPopup extends PopupPanel |
13 |
14 |
|
{ |
14 |
15 |
|
private static final String ERROR_FROM = "AbstractContextPopup"; |
|
@@ -47,9 +48,7 @@ |
47 |
48 |
|
* @param pPopupRelativeMeetingPoint the Popup's "meeting" point. null defaults to "CornerTopLeft" |
48 |
49 |
|
*/ |
49 |
50 |
|
public void showContextPopup( Event pEvent, // |
50 |
|
- |
RectangleContainmentStrategy pRectangleContainmentStrategy, |
51 |
|
- |
CommonRectangularPoint pSourceElementRelativeMeetingPoint, |
52 |
|
- |
CommonRectangularPoint pPopupRelativeMeetingPoint ) |
|
51 |
+ |
RectangleContainmentStrategy pRectangleContainmentStrategy, CommonRectangularPoint pSourceElementRelativeMeetingPoint, CommonRectangularPoint pPopupRelativeMeetingPoint ) |
53 |
52 |
|
{ |
54 |
53 |
|
Widget zWidget; |
55 |
54 |
|
try |
|
@@ -68,11 +67,9 @@ |
68 |
67 |
|
|
69 |
68 |
|
setWidget( zWidget ); |
70 |
69 |
|
|
71 |
|
- |
setPopupPositionAndShow( new MyPositionCallback( pRectangleContainmentStrategy, |
72 |
|
- |
pSourceElementRelativeMeetingPoint, pEvent, |
73 |
|
- |
(pPopupRelativeMeetingPoint != null) ? // |
74 |
|
- |
pPopupRelativeMeetingPoint : // |
75 |
|
- |
CommonRectangularPoint.LeftTop ) ); |
|
70 |
+ |
setPopupPositionAndShow( new MyPositionCallback( pRectangleContainmentStrategy, pSourceElementRelativeMeetingPoint, pEvent, (pPopupRelativeMeetingPoint != null) ? // |
|
71 |
+ |
pPopupRelativeMeetingPoint : // |
|
72 |
+ |
CommonRectangularPoint.LeftTop ) ); |
76 |
73 |
|
} |
77 |
74 |
|
|
78 |
75 |
|
@Override |
|
@@ -103,17 +100,14 @@ |
103 |
100 |
|
{ |
104 |
101 |
|
private ContextPopupPositioner mPositioner; |
105 |
102 |
|
|
106 |
|
- |
public MyPositionCallback( RectangleContainmentStrategy pRectangleContainmentStrategy, |
107 |
|
- |
CommonRectangularPoint pSourceElementRelativeMeetingPoint, Event pEvent, |
108 |
|
- |
CommonRectangularPoint pPopupRelativeMeetingPoint ) |
|
103 |
+ |
public MyPositionCallback( RectangleContainmentStrategy pRectangleContainmentStrategy, CommonRectangularPoint pSourceElementRelativeMeetingPoint, Event pEvent, CommonRectangularPoint pPopupRelativeMeetingPoint ) |
109 |
104 |
|
{ |
110 |
105 |
|
SizeXY zClientSize = new SizeXY( Window.getClientWidth(), Window.getClientHeight() ); |
111 |
106 |
|
PointXY zClientPos = new PointXY( DOM.eventGetClientX( pEvent ), DOM.eventGetClientY( pEvent ) ); |
112 |
107 |
|
|
113 |
108 |
|
if ( pSourceElementRelativeMeetingPoint == null ) |
114 |
109 |
|
{ |
115 |
|
- |
mPositioner = new ContextPopupPositioner( pRectangleContainmentStrategy, |
116 |
|
- |
pPopupRelativeMeetingPoint,// |
|
110 |
+ |
mPositioner = new ContextPopupPositioner( pRectangleContainmentStrategy, pPopupRelativeMeetingPoint,// |
117 |
111 |
|
zClientPos, zClientSize ); |
118 |
112 |
|
} |
119 |
113 |
|
else |
|
@@ -125,11 +119,7 @@ |
125 |
119 |
|
int zSrcElementYsize = CommonElementHelper.getOffsetHeight( zTargetElement ); |
126 |
120 |
|
Rect zSourceElementRect = new Rect( zSrcElementXpos, zSrcElementYpos, // |
127 |
121 |
|
zSrcElementXsize, zSrcElementYsize ); |
128 |
|
- |
mPositioner = new SourceRelativeContextPopupPositioner( pRectangleContainmentStrategy, |
129 |
|
- |
pPopupRelativeMeetingPoint, |
130 |
|
- |
zClientPos, zClientSize, |
131 |
|
- |
pSourceElementRelativeMeetingPoint, |
132 |
|
- |
zSourceElementRect ); |
|
122 |
+ |
mPositioner = new SourceRelativeContextPopupPositioner( pRectangleContainmentStrategy, pPopupRelativeMeetingPoint, zClientPos, zClientSize, pSourceElementRelativeMeetingPoint, zSourceElementRect ); |
133 |
123 |
|
} |
134 |
124 |
|
} |
135 |
125 |
|
|