diff --git a/build.gradle b/build.gradle index fa342ced2f..3580cbae0d 100644 --- a/build.gradle +++ b/build.gradle @@ -73,7 +73,7 @@ allprojects { implementation 'com.fr.decision:fine-decision:' + frVersion implementation 'com.fr.schedule:fine-schedule:' + frVersion implementation 'com.fr.report:fine-report-engine:' + frDevVersion - implementation 'com.fr.design:design-i18n' + frDevVersion + implementation 'com.fr.design:design-i18n:' + frDevVersion testImplementation 'org.easymock:easymock:3.5.1' testImplementation 'org.powermock:powermock-module-junit4:1.7.1' testImplementation 'org.powermock:powermock-api-easymock:1.7.1' 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 42db0d8503..b3215ede1c 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 f846f29bd2..c002bceb38 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 085ca7c52e..3f7bd47f4a 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,7 +19,6 @@ 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; @@ -812,31 +811,7 @@ 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 072e21fa9f..0c4ea6313f 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 c624386c00..c99c90c29b 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; @@ -377,21 +375,6 @@ 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 0d98e86937..51fb99ea20 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.NameFormBackground; import com.fr.form.ui.container.WAbsoluteBodyLayout; @@ -134,11 +133,6 @@ 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 98143a7ea0..da268b0e6c 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 384ee07b64..3fc35a265c 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 b8fe8f0049..964f0aa03d 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 3ad1463b97..5b37ad313f 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 4dd84f528b..ee667fd38c 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 6dcf7f34b7..4cb75e0e4a 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 40da109cf2..eefeb01a32 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