|
@@ -1,32 +1,32 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.components.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.core.simpletypes.*; |
5 |
|
- |
import org.litesoft.core.util.*; |
6 |
|
- |
|
7 |
|
- |
import com.google.gwt.user.client.*; |
8 |
|
- |
import com.google.gwt.user.client.ui.*; |
9 |
|
- |
|
10 |
|
- |
public class PopupPanelVisiblePositionCallBack implements PopupPanel.PositionCallback { |
11 |
|
- |
private PopupPanel mPopupPanel; |
12 |
|
- |
private int mDesiredXpos; |
13 |
|
- |
private int mDesiredYpos; |
14 |
|
- |
|
15 |
|
- |
public PopupPanelVisiblePositionCallBack( PopupPanel pPopupPanel, int pDesiredXpos, int pDesiredYpos ) { |
16 |
|
- |
mPopupPanel = pPopupPanel; |
17 |
|
- |
mDesiredXpos = pDesiredXpos; |
18 |
|
- |
mDesiredYpos = pDesiredYpos; |
19 |
|
- |
} |
20 |
|
- |
|
21 |
|
- |
@Override |
22 |
|
- |
public void setPosition( int pPopupXsize, int pPopupYsize ) { |
23 |
|
- |
Rect zPopupRect = new Rect( mDesiredXpos, mDesiredYpos, pPopupXsize, pPopupYsize ); |
24 |
|
- |
Rect zWindowRect = new Rect( 0, 0, Window.getClientWidth(), Window.getClientHeight() ); |
25 |
|
- |
|
26 |
|
- |
PointXY zPoint = LeftRightAndUpDownRectContainmentStrategy.INSTANCE.moveToFitIn( zPopupRect, zWindowRect ); |
27 |
|
- |
|
28 |
|
- |
int zX = (zPoint != null) ? zPoint.getX() : mDesiredXpos; |
29 |
|
- |
int zY = (zPoint != null) ? zPoint.getY() : mDesiredYpos; |
30 |
|
- |
mPopupPanel.setPopupPosition( zX, zY ); |
31 |
|
- |
} |
32 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.components.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.core.simpletypes.*; |
|
5 |
+ |
import org.litesoft.core.util.*; |
|
6 |
+ |
|
|
7 |
+ |
import com.google.gwt.user.client.*; |
|
8 |
+ |
import com.google.gwt.user.client.ui.*; |
|
9 |
+ |
|
|
10 |
+ |
public class PopupPanelVisiblePositionCallBack implements PopupPanel.PositionCallback { |
|
11 |
+ |
private PopupPanel mPopupPanel; |
|
12 |
+ |
private int mDesiredXpos; |
|
13 |
+ |
private int mDesiredYpos; |
|
14 |
+ |
|
|
15 |
+ |
public PopupPanelVisiblePositionCallBack( PopupPanel pPopupPanel, int pDesiredXpos, int pDesiredYpos ) { |
|
16 |
+ |
mPopupPanel = pPopupPanel; |
|
17 |
+ |
mDesiredXpos = pDesiredXpos; |
|
18 |
+ |
mDesiredYpos = pDesiredYpos; |
|
19 |
+ |
} |
|
20 |
+ |
|
|
21 |
+ |
@Override |
|
22 |
+ |
public void setPosition( int pPopupXsize, int pPopupYsize ) { |
|
23 |
+ |
Rect zPopupRect = new Rect( mDesiredXpos, mDesiredYpos, pPopupXsize, pPopupYsize ); |
|
24 |
+ |
Rect zWindowRect = new Rect( 0, 0, Window.getClientWidth(), Window.getClientHeight() ); |
|
25 |
+ |
|
|
26 |
+ |
PointXY zPoint = LeftRightAndUpDownRectContainmentStrategy.INSTANCE.moveToFitIn( zPopupRect, zWindowRect ); |
|
27 |
+ |
|
|
28 |
+ |
int zX = (zPoint != null) ? zPoint.getX() : mDesiredXpos; |
|
29 |
+ |
int zY = (zPoint != null) ? zPoint.getY() : mDesiredYpos; |
|
30 |
+ |
mPopupPanel.setPopupPosition( zX, zY ); |
|
31 |
+ |
} |
|
32 |
+ |
} |