diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index 42db0d850..b3215ede1 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -310,7 +310,6 @@ public class SelectionModel { designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_DELETED); setSelectedCreator(isInPara ? designer.getParaComponent() : designer.getRootComponent()); - designer.getTopXCreators().refresh(); // 触发事件 diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java index f846f29bd..c002bceb3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java @@ -17,8 +17,6 @@ import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.HelpDialogManager; -import com.fr.design.mainframe.widget.topxcreator.BasicTopXCreator; -import com.fr.design.mainframe.widget.topxcreator.TopXCreator; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.module.DesignModuleFactory; import com.fr.form.ui.BaseChartEditor; @@ -231,6 +229,9 @@ public class XChartEditor extends XBorderStyleWidgetCreator { */ public void paint(Graphics g) { designerEditor.paintEditor(g, this.getSize()); + if (coverPanel != null) { + coverPanel.setSize(this.getSize()); + } super.paint(g); if (isEditing) { g.setColor(INNER_BORDER_COLOR); @@ -361,34 +362,4 @@ public class XChartEditor extends XBorderStyleWidgetCreator { return false; } - @Override - public BasicTopXCreator getTopXCreator() { - return new TopXChart(this); - } - - private class TopXChart extends TopXCreator { - private final DesignerEditor designerEditor; - - public TopXChart(XCreator creator) { - super(creator); - designerEditor = creator.getDesignerEditor(); - Rectangle bounds = getBounds(); - designerEditor.getEditorTarget().setBounds(bounds.x + 1, bounds.y + 1, bounds.width - 2, bounds.height - 2); - } - - /** - * 更新designerEditor的大小 - */ - protected void resetSize(Rectangle bounds) { - super.resetSize(bounds); - designerEditor.getEditorTarget().setBounds(bounds.x + 1, bounds.y + 1, bounds.width - 2, bounds.height - 2); - } - - @Override - public void paint(Graphics g) { - designerEditor.paintEditor(g, this.getSize()); - super.paint(g); - } - } - } 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 20f278811..5eb284c7b 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 @@ -19,22 +19,16 @@ import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.NoSupportAuthorityEdit; -import com.fr.design.mainframe.widget.topxcreator.BasicTopXCreator; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; import com.fr.stable.Constants; -import com.fr.stable.CoreGraphHelper; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import com.fr.third.javax.annotation.Nullable; import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JComponent; -import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.Border; import java.awt.BorderLayout; @@ -44,7 +38,6 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; import java.beans.IntrospectionException; import java.util.ArrayList; import java.util.List; @@ -812,32 +805,4 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo return false; } - /** - * 获得该组件的顶层显示组件 - */ - @Nullable - public BasicTopXCreator getTopXCreator() { - return new BasicTopXCreator(this) { - @Override - protected void addComponent() { - Icon icon = new ImageIcon(getImage()); - JLabel jLabel = new JLabel(icon, JLabel.CENTER); - jLabel.setSize(getSize()); - this.add(jLabel); - } - }; - } - - /** - * 获得组件的图像 - */ - public BufferedImage getImage() { - BufferedImage image = CoreGraphHelper.createBufferedImage(getWidth(), getHeight()); - Graphics g = image.createGraphics(); - this.paint(g); - return image; - } - - - } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 072e21fa9..0c4ea6313 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -343,4 +343,19 @@ public class XCreatorUtils { } return xCreator != null; } + + /** + * 获取组件的最顶层XMainBorderLayout,没有则返回null + * */ + @Nullable + public static XWCardMainBorderLayout getTopXMainBorderLayout(Container creator) { + XWCardMainBorderLayout result = null; + while (creator != null) { + if (creator instanceof XWCardMainBorderLayout) { + result = (XWCardMainBorderLayout) creator; + } + creator = creator.getParent(); + } + return result; + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index d84fd2e0c..718c30aeb 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -13,8 +13,6 @@ import com.fr.design.mainframe.widget.editors.ElementCaseToolBarEditor; import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.propertypane.BrowserFitPropertyEditor; -import com.fr.design.mainframe.widget.topxcreator.BasicTopXCreator; -import com.fr.design.mainframe.widget.topxcreator.TopXCreator; import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseProvider; import com.fr.form.FormProvider; @@ -374,19 +372,4 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme return true; } - @Override - public BasicTopXCreator getTopXCreator() { - return new TopXElementCase(this); - } - - private class TopXElementCase extends TopXCreator { - private UILabel imageLabel; - - public TopXElementCase(XCreator creator) { - super(creator); - imageLabel = initImageBackground(); - add(imageLabel); - } - } - } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java index 5db000e18..9a7d6dc97 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java @@ -7,7 +7,6 @@ import com.fr.design.form.util.XCreatorConstants; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; -import com.fr.design.mainframe.widget.topxcreator.BasicTopXCreator; import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.stable.core.PropertyChangeAdapter; @@ -132,8 +131,4 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout { return false; } - @Override - public BasicTopXCreator getTopXCreator() { - return null; - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 98143a7ea..da268b0e6 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -25,8 +25,6 @@ import com.fr.design.mainframe.FormArea; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetHelpDialog; import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.design.mainframe.widget.topxcreator.BasicTopXCreator; -import com.fr.design.mainframe.widget.topxcreator.TopXCreator; import com.fr.form.ui.Connector; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; @@ -610,8 +608,4 @@ public class XWAbsoluteLayout extends XLayoutContainer { } } - @Override - public BasicTopXCreator getTopXCreator() { - return new TopXCreator(this); - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java index 384ee07b6..3fc35a265 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java @@ -15,7 +15,6 @@ import com.fr.design.mainframe.widget.editors.BooleanEditor; import com.fr.design.mainframe.widget.editors.WidgetDisplayPosition; import com.fr.design.mainframe.widget.renderer.BackgroundRenderer; import com.fr.design.mainframe.widget.renderer.WidgetDisplayPositionRender; -import com.fr.design.mainframe.widget.topxcreator.BasicTopXCreator; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WParameterLayout; @@ -252,10 +251,6 @@ public class XWParameterLayout extends XWAbsoluteLayout { return false; } - @Override - public BasicTopXCreator getTopXCreator() { - return null; - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java index b8fe8f004..964f0aa03 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java @@ -7,7 +7,6 @@ import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRTitleLayoutAdapter; import com.fr.design.form.layout.FRTitleLayout; import com.fr.design.fun.WidgetPropertyUIProvider; -import com.fr.design.mainframe.widget.topxcreator.BasicTopXCreator; import com.fr.form.ui.Label; import com.fr.form.ui.Widget; import com.fr.form.ui.WidgetTitle; @@ -191,8 +190,4 @@ public class XWTitleLayout extends DedicateLayoutContainer { return creator.getWidgetPropertyUIProviders(); } - @Override - public BasicTopXCreator getTopXCreator() { - return getEditingChildCreator().getTopXCreator(); - } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index 3ad1463b9..5b37ad313 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -23,8 +23,6 @@ import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetHelpDialog; import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.design.mainframe.widget.topxcreator.BasicTopXCreator; -import com.fr.design.mainframe.widget.topxcreator.TopXCreator; import com.fr.form.event.Listener; import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.LayoutBorderStyle; @@ -515,8 +513,4 @@ public class XWCardMainBorderLayout extends XWBorderLayout { return true; } - @Override - public BasicTopXCreator getTopXCreator() { - return new TopXCreator(this); - } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java index 4dd84f528..ee667fd38 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java @@ -90,7 +90,6 @@ public class ComponentTree extends JTree { public void setSelectionPath(TreePath path) { // 不管点击哪一项,都要先退出编辑状态(图表、报表块、绝对布局、tab块) designer.stopEditing(path); - designer.getTopXCreators().refresh(); super.setSelectionPath(path); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java index 6dcf7f34b..4cb75e0e4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java @@ -316,7 +316,6 @@ public class EditingMouseListener extends MouseInputAdapter { XCreator component = designer.getComponentAt(e); setCoverPaneNotDisplay(component, e, false); - designer.getTopXCreators().displayCoverPane(e); if (processTopLayoutMouseMove(component, e)) { return; @@ -406,16 +405,7 @@ public class EditingMouseListener extends MouseInputAdapter { } private void setCoverPaneNotDisplay(XCreator component, MouseEvent e, boolean isLinkedHelpDialog) { - if (xElementCase != null) { - int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue(); - int y = getParentPositionY(xElementCase, 0) - designer.getArea().getVerticalValue(); - Rectangle rect = new Rectangle(x, y, xElementCase.getWidth(), xElementCase.getHeight()); - if (rect.contains(e.getPoint())) { - return; - } - xElementCase.displayCoverPane(false); - } if (xChartEditor != null) { xChartEditor.displayCoverPane(false); } @@ -426,6 +416,15 @@ public class EditingMouseListener extends MouseInputAdapter { if (xTopLayoutContainer != null) { xTopLayoutContainer.setMouseEnter(false); } + //不知道为什么要对XElementCase进行判断,但是直接return会有bug,所以把他放在最后 + if (xElementCase != null) { + int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue(); + int y = getParentPositionY(xElementCase, 0) - designer.getArea().getVerticalValue(); + Rectangle rect = new Rectangle(x, y, xElementCase.getWidth(), xElementCase.getHeight()); + if (!rect.contains(e.getPoint())) { + xElementCase.displayCoverPane(false); + } + } designer.repaint(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 40da109cf..eefeb01a3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -35,9 +35,8 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteBodyLayout; import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWBorderLayout; -import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; -import com.fr.design.designer.creator.XWTitleLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.dialog.FineJOptionPane; @@ -46,7 +45,6 @@ import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.fun.RightSelectionHandlerProvider; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; -import com.fr.design.mainframe.widget.topxcreator.TopXCreators; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; @@ -65,7 +63,6 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.WidgetValue; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WFitLayout; -import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory; @@ -837,47 +834,35 @@ public class FormDesigner extends TargetComponent