Browse Source

REPORT-35699 国际化修改对报表下拉框产生影响

feature/big-screen
Henry.Wang 4 years ago
parent
commit
83f01ae956
  1. 54
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

54
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -387,31 +387,35 @@ public final class GUICoreUtils {
* @param y y坐标 * @param y y坐标
*/ */
public static void showPopupMenu(JPopupMenu popup, Component parentComponent, int x, int y) { public static void showPopupMenu(JPopupMenu popup, Component parentComponent, int x, int y) {
if (popup == null) {// check null. if (popup == null) {// check null.
return; return;
} }
Point point = new Point(x, y); Point point = new Point(x, y);
SwingUtilities.convertPointToScreen(point, parentComponent); SwingUtilities.convertPointToScreen(point, parentComponent);
Dimension size = popup.getPreferredSize(); Dimension size = popup.getPreferredSize();
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP); screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP);
//父元素右边界的坐标
int showOnScreenX = Math.min(screen.width, parentComponent.getLocationOnScreen().x + parentComponent.getWidth()); int parentComponentRightBorderPosition = parentComponent.getLocationOnScreen().x + parentComponent.getWidth();
//设计器右边界的坐标
// peter:调整X的高度. Rectangle rectangle = DesignerContext.getDesignerFrame().getBounds();
if (point.x + size.width > showOnScreenX && size.width < showOnScreenX) { int designerRightBorderPosition = rectangle.x + rectangle.width;
x += (showOnScreenX - point.x - size.width); rectangle = SwingUtilities.getWindowAncestor(parentComponent).getBounds();
} designerRightBorderPosition = Math.max(designerRightBorderPosition, rectangle.x + rectangle.width);
// peter:调整X的高度.
// peter:调整y高度. if (point.x + size.width > designerRightBorderPosition && size.width < designerRightBorderPosition) {
if (point.y + size.height > screen.height && size.height < screen.height) { x += (parentComponentRightBorderPosition - point.x - size.width);
y -= size.height; }
}
// peter:调整y高度.
popup.show(parentComponent, x, y); if (point.y + size.height > screen.height && size.height < screen.height) {
} y -= size.height;
}
popup.show(parentComponent, x, y);
}
/** /**
* Set enabled.<br> * Set enabled.<br>

Loading…
Cancel
Save