Browse Source

REPORT-35692 国际化-页面设置-单位改为INCH,显示不全 撤销一些代码

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

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

@ -27,7 +27,6 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.style.color.ColorCell; import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorFactory; import com.fr.design.style.color.ColorFactory;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
@ -388,35 +387,31 @@ 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 parentComponentRightBorderPosition = parentComponent.getLocationOnScreen().x + parentComponent.getWidth(); int showOnScreenX = Math.min(screen.width, parentComponent.getLocationOnScreen().x + parentComponent.getWidth());
//设计器右边界的坐标
Rectangle rectangle = DesignerContext.getDesignerFrame().getBounds(); // peter:调整X的高度.
int designerRightBorderPosition = rectangle.x + rectangle.width; if (point.x + size.width > showOnScreenX && size.width < showOnScreenX) {
rectangle = SwingUtilities.getWindowAncestor(parentComponent).getBounds(); x += (showOnScreenX - point.x - size.width);
designerRightBorderPosition = Math.max(designerRightBorderPosition, rectangle.x + rectangle.width); }
// peter:调整X的高度.
if (point.x + size.width > designerRightBorderPosition && size.width < designerRightBorderPosition) { // peter:调整y高度.
x += (parentComponentRightBorderPosition - point.x - size.width); if (point.y + size.height > screen.height && size.height < screen.height) {
} y -= size.height;
}
// peter:调整y高度.
if (point.y + size.height > screen.height && size.height < screen.height) { popup.show(parentComponent, x, y);
y -= size.height; }
}
popup.show(parentComponent, x, y);
}
/** /**
* Set enabled.<br> * Set enabled.<br>

Loading…
Cancel
Save