diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 0983dded9b..a7860faece 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -778,7 +778,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo int extraY = (int) (bounds.y * designer.getScale()); popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); popup.updatePane(designer); - popup.setVisible(selected && accept); + popup.setVisible(selected && accept && popup.hasVisibleButtons()); popup.setRelativeBounds(bounds); } diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java index ee0db4571d..14f92581be 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java @@ -4,6 +4,7 @@ import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.VerticalFlowLayout; @@ -58,7 +59,7 @@ public class PopupControlPanel extends JPanel { addButton(toggleButton, 1); addButton(settingButton, 2); - setButtonVisible(editButton, true); + setButtonVisible(editButton, false); setButtonVisible(toggleButton, false); setButtonVisible(settingButton, false); } @@ -139,7 +140,7 @@ public class PopupControlPanel extends JPanel { if (index > 0) { getComponent(2 * index - 1).setVisible(false); } - buttons.get(index).setVisible(true); + buttons.get(index).setVisible(visible); if (!visible) { // 如果当前按钮设置为不可见,且在当前按钮之前的其他按钮也不可见,则下一个可见按钮前无分割线 @@ -192,6 +193,7 @@ public class PopupControlPanel extends JPanel { } public void updatePane(FormDesigner designer) { + setButtonVisible(editButton, creator.acceptType(XWTitleLayout.class)); setButtonVisible(settingButton, creator.isShared()); setButtonVisible(toggleButton, AdapterBus.searchLayoutAdapter(designer, creator) instanceof FRAbsoluteLayoutAdapter); toggleButton.setSelected(creator.toData().isAspectRatioLocked()); @@ -199,6 +201,15 @@ public class PopupControlPanel extends JPanel { updateDimension(); } + public boolean hasVisibleButtons() { + for (int i = 0; i < buttons.size(); i++) { + if (buttons.get(i).isVisible()) { + return true; + } + } + return false; + } + private void updateDimension() { int height = 0; for (int i = 0; i < buttons.size(); i++) { diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java index 6702fe7f42..bceba44d30 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java @@ -34,6 +34,10 @@ public class SelectedPopupDialog extends JDialog { this.setSize(controlPanel.getDefaultDimension()); } + public boolean hasVisibleButtons() { + return controlPanel.hasVisibleButtons(); + } + public void setRelativeBounds(Rectangle rectangle) { this.controlPanel.setRelativeBounds(rectangle); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index c49902c8d9..893297081c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -326,7 +326,7 @@ public class FormDesignerUI extends ComponentUI { } creator.paintBorder(g, creatorBounds); // 拖拽时不绘制 - creator.showSelectedPopup(designer, creatorBounds, !designer.getStateModel().isDragging() && creator.acceptType(XWTitleLayout.class)); + creator.showSelectedPopup(designer, creatorBounds, !designer.getStateModel().isDragging()); } }