From 7997b8f973c0f31d18b3fef8c3d475e980e8008f Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 6 Jul 2020 16:46:28 +0800 Subject: [PATCH 01/10] =?UTF-8?q?KERNEL-3999=2010.0.7=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=8F=AF=E4=BD=BF=E7=94=A8JDK11=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/data/comp/MapDataTree.java | 16 +++---- .../mainframe/widget/UITreeComboBox.java | 48 ++++++++++++------- .../java/com/fr/poly/PolyComponentsBar.java | 28 ----------- 3 files changed, 39 insertions(+), 53 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java index 825634547f..5a223cbf0c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java @@ -45,9 +45,9 @@ public class MapDataTree extends JTree { public void selectDefaultTreeNode() { DefaultTreeModel m_model = (DefaultTreeModel) this.getModel(); DefaultMutableTreeNode root = (DefaultMutableTreeNode) m_model.getRoot(); - Enumeration children = root.children(); + Enumeration children = root.children(); if (children.hasMoreElements()) { - DefaultMutableTreeNode child = children.nextElement(); + DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement(); if(GEOJSONTreeHelper.getInstance().isSelectableTreeNode(child)){ selectTreeNode(child, m_model); @@ -59,9 +59,9 @@ public class MapDataTree extends JTree { } private void setFirstChildTreeNode(DefaultMutableTreeNode parent, DefaultTreeModel m_model){ - Enumeration children = parent.children(); + Enumeration children = parent.children(); if (children.hasMoreElements()){ - DefaultMutableTreeNode node = children.nextElement(); + DefaultMutableTreeNode node = (DefaultMutableTreeNode) children.nextElement(); selectTreeNode(node, m_model); } } @@ -89,9 +89,9 @@ public class MapDataTree extends JTree { DefaultTreeModel m_model = (DefaultTreeModel) this.getModel(); DefaultMutableTreeNode root = (DefaultMutableTreeNode) m_model.getRoot(); - Enumeration els = root.postorderEnumeration(); + Enumeration els = root.postorderEnumeration(); while(els.hasMoreElements()){ - DefaultMutableTreeNode el = els.nextElement(); + DefaultMutableTreeNode el = (DefaultMutableTreeNode) els.nextElement(); if(el == null || el.getUserObject() == null){ return null; } @@ -145,10 +145,10 @@ public class MapDataTree extends JTree { DefaultTreeModel m_model = (DefaultTreeModel) this.getModel(); DefaultMutableTreeNode root = (DefaultMutableTreeNode) m_model.getRoot(); - Enumeration els = root.postorderEnumeration(); + Enumeration els = root.postorderEnumeration(); while(els.hasMoreElements()){ - DefaultMutableTreeNode el = els.nextElement(); + DefaultMutableTreeNode el = (DefaultMutableTreeNode) els.nextElement(); String path = el.getUserObject().toString(); String fileName = ChartGEOJSONHelper.getPresentNameWithPath(path); if (StringUtils.contains(fileName, text) && GEOJSONTreeHelper.isValidDirPath(path)) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/UITreeComboBox.java index 4a59484e1d..aab50fbcc3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -3,16 +3,8 @@ package com.fr.design.mainframe.widget; /** * Created by xiaxiang on 2016/9/30. */ -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.plaf.*; -import javax.swing.plaf.basic.*; -import javax.swing.plaf.metal.*; -import javax.swing.tree.*; - import com.fr.design.constants.UIConstants; -import com.fr.design.designer.beans.*; +import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; @@ -20,8 +12,36 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxUI; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.mainframe.ComponentTree; -import com.sun.java.swing.plaf.motif.*; -import com.sun.java.swing.plaf.windows.*; +import com.sun.java.swing.plaf.motif.MotifComboBoxUI; + +import javax.swing.DefaultListCellRenderer; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.ListCellRenderer; +import javax.swing.MenuSelectionManager; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.plaf.ComboBoxUI; +import javax.swing.plaf.basic.ComboPopup; +import javax.swing.plaf.metal.MetalComboBoxUI; +import javax.swing.tree.TreeCellRenderer; +import javax.swing.tree.TreePath; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.event.KeyListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionAdapter; +import java.awt.event.MouseMotionListener; /** * 控件树下拉列表框 @@ -111,12 +131,6 @@ public class UITreeComboBox extends UIComboBox { } } - class WindowsJTreeComboBoxUI extends WindowsComboBoxUI{ - protected ComboPopup createPopup() { - return new TreePopup(comboBox); - } - } - class UIJTreeComboBoxUI extends UIComboBoxUI { protected ComboPopup createPopup() { return new TreePopup(comboBox); diff --git a/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java index d1c7ddd406..e443909f20 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java @@ -12,19 +12,12 @@ import com.fr.design.gui.itooltip.MultiLineToolTip; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.dnd.SerializableTransferable; -import com.fr.log.FineLoggerFactory; import com.fr.report.poly.PolyECBlock; -import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; import javax.swing.BorderFactory; -import javax.swing.JFrame; -import javax.swing.JPanel; import javax.swing.JToolBar; import javax.swing.JToolTip; import javax.swing.SwingConstants; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -147,25 +140,4 @@ public class PolyComponentsBar extends JToolBar { } } - /** - * 测试下 - * - * @param args 参数 - */ - public static void main(String... args) { - try { - UIManager.setLookAndFeel(new WindowsLookAndFeel()); - } catch (UnsupportedLookAndFeelException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - JFrame f = new JFrame(); - JPanel p = (JPanel) f.getContentPane(); - p.setLayout(FRGUIPaneFactory.createBorderLayout()); - PolyComponentsBar pbp = new PolyComponentsBar(); - p.add(pbp, BorderLayout.CENTER); - - f.setSize(400, 300); - f.setVisible(true); - - } } From cc64c95701134ca43aa667a577036960ce147c79 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Mon, 31 Aug 2020 11:20:27 +0800 Subject: [PATCH 02/10] =?UTF-8?q?REPORT-36985=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=20=E7=BB=84=E4=BB=B6=E6=A0=91=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E4=BC=98=E5=8C=96=E5=92=8C=E9=80=89=E6=8B=A9=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=E8=AE=A9=E5=85=B6=E6=B5=AE=E4=BA=8E=E9=A1=B6?= =?UTF-8?q?=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/SelectionModel.java | 8 +- .../fr/design/designer/creator/XButton.java | 15 +++ .../design/designer/creator/XChartEditor.java | 34 +++++++ .../fr/design/designer/creator/XCreator.java | 9 +- .../design/designer/creator/XElementCase.java | 22 +++++ .../creator/XWAbsoluteBodyLayout.java | 6 ++ .../designer/creator/XWAbsoluteLayout.java | 8 ++ .../designer/creator/XWParameterLayout.java | 7 ++ .../designer/creator/XWTitleLayout.java | 6 ++ .../cardlayout/XWCardMainBorderLayout.java | 11 ++- .../creator/cardlayout/XWCardTagLayout.java | 1 + .../creator/cardlayout/XWCardTitleLayout.java | 1 + .../fr/design/mainframe/ComponentTree.java | 66 +++++++++++++ .../com/fr/design/mainframe/CoverPane.java | 5 +- .../mainframe/EditingMouseListener.java | 17 ++++ .../com/fr/design/mainframe/FormDesigner.java | 59 +++++++++++- .../fr/design/mainframe/FormDesignerUI.java | 5 + .../mainframe/FormHierarchyTreePane.java | 7 ++ .../widget/topxcreator/BasicTopXCreator.java | 72 ++++++++++++++ .../widget/topxcreator/TopXCreator.java | 54 +++++++++++ .../widget/topxcreator/TopXCreators.java | 95 +++++++++++++++++++ 21 files changed, 499 insertions(+), 9 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/BasicTopXCreator.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreators.java 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 ff89f059ba..49e0f94d29 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 @@ -77,12 +77,14 @@ public class SelectionModel { * @param e 鼠标事件 */ public void selectACreatorAtMouseEvent(MouseEvent e) { + //单选因为要先从已选择的组件中筛选一遍,所以先选择再reset + XCreator comp = designer.getComponentAt(e); if (e.getButton() == MouseEvent.BUTTON3 || (!InputEventBaseOnOS.isControlDown(e) && !e.isShiftDown())) { // 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件 selection.reset(); } else { //按下Ctrl或者shift键时鼠标可以进行多选,两次点击同一控件就取消选中 - XCreator comp = designer.getComponentAt(e); + //XCreator comp = designer.getComponentAt(e); XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(comp).getTopLayout(); if (topLayout != null && !topLayout.isEditable()) { comp = topLayout; @@ -93,9 +95,10 @@ public class SelectionModel { selection.removeCreator(selected); } } + comp = designer.getComponentAt(e); } // 获取e所在的组件 - XCreator comp = designer.getComponentAt(e); + //XCreator comp = designer.getComponentAt(e); selectACreator(comp); } @@ -309,6 +312,7 @@ 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/XButton.java b/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java index 44996df8cd..5f5bb73b22 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java @@ -14,6 +14,7 @@ import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor; import com.fr.design.mainframe.widget.editors.ShortCutTextEditor; import com.fr.design.mainframe.widget.renderer.FontCellRenderer; import com.fr.design.mainframe.widget.renderer.IconCellRenderer; +import com.fr.design.mainframe.widget.topxcreator.BasicTopXCreator; import com.fr.form.parameter.FormSubmitButton; import com.fr.form.ui.Button; import com.fr.form.ui.FreeButton; @@ -309,4 +310,18 @@ public class XButton extends XWidgetCreator { } +/* @Override + public BasicTopCreator getTopXCreator(){ + return new BasicTopXCreator(this) { + @Override + protected void initEditor() { + XButton(XButton.this.toData(),this.getSize() + + } + } + + //return new XButton((Button)this.toData(),this.getSize()); + + }*/ + } 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 b0f6e11589..0ca125e930 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,6 +17,8 @@ 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; @@ -258,6 +260,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator { (e.getClickCount() == 2 || designer.getCursor().getType() == Cursor.HAND_CURSOR); displayCoverPane(!isEditing); selectionModel.selectACreatorAtMouseEvent(e); + editingMouseListener.refreshTopXCreator(isEditing); if (editingMouseListener.stopEditing()) { if (this != (XCreator) designer.getRootComponent()) { @@ -357,4 +360,35 @@ public class XChartEditor extends XBorderStyleWidgetCreator { public boolean supportMobileStyle() { 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 dcb6938836..0496d74787 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,6 +19,7 @@ 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; @@ -798,10 +799,16 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo /** * 是否支持共享-现只支持报表块、图表、tab块、绝对布局 - * @return */ public boolean isSupportShared() { return false; } + /** + * 获得该组件的顶层显示组件 + */ + public BasicTopXCreator getTopXCreator() { + return null; + } + } 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 ec06a1597d..a9fd877168 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,6 +13,8 @@ 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; @@ -319,6 +321,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public void respondClick(EditingMouseListener editingMouseListener,MouseEvent e){ HelpDialogManager.getInstance().setPane(coverPanel); super.respondClick(editingMouseListener, e); + editingMouseListener.refreshTopXCreator(); if (this.isHelpBtnOnFocus()) { coverPanel.setMsgDisplay(e); } else { @@ -370,4 +373,23 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public boolean isSupportShared() { return true; } + + @Override + public BasicTopXCreator getTopXCreator() { + return new TopXElementCase(this); + } + + private class TopXElementCase extends TopXCreator { + private UILabel imageLabel; + + public TopXElementCase(XCreator creator) { + super(creator); + if (creator instanceof XElementCase) { + XElementCase elementCase = (XElementCase) creator; + imageLabel = elementCase.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 6190ffaebb..5db000e189 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,6 +7,7 @@ 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; @@ -130,4 +131,9 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout { public boolean isSupportShared() { 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 b98c2a952d..98143a7ea0 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,6 +25,8 @@ 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; @@ -542,6 +544,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { selectionModel.selectACreatorAtMouseEvent(e); designer.repaint(); + editingMouseListener.refreshTopXCreator(isEditing); if (editingMouseListener.stopEditing()) { if (this != designer.getRootComponent()) { @@ -606,4 +609,9 @@ public class XWAbsoluteLayout extends XLayoutContainer { return super.getWidgetPropertyUIProviders(); } } + + @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 cb288c98cc..384ee07b64 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,6 +15,7 @@ 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; @@ -251,4 +252,10 @@ 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 2cc56ee9ba..b8fe8f0049 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,6 +7,7 @@ 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; @@ -189,4 +190,9 @@ public class XWTitleLayout extends DedicateLayoutContainer { XCreator creator = getPropertyDescriptorCreator(); 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 25da3e7754..3ad1463b97 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 @@ -16,16 +16,15 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWidgetCreator; -import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI; -import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.XCreatorConstants; -import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.icon.IconPathConstants; import com.fr.design.mainframe.DesignerContext; 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; @@ -438,6 +437,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout { setEditable(isEditing); selectionModel.selectACreatorAtMouseEvent(e); + editingMouseListener.refreshTopXCreator(isEditing); designer.repaint(); if (editingMouseListener.stopEditing()) { @@ -514,4 +514,9 @@ public class XWCardMainBorderLayout extends XWBorderLayout { public boolean isSupportShared() { return true; } + + @Override + public BasicTopXCreator getTopXCreator() { + return new TopXCreator(this); + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java index 49f246256c..010a382178 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java @@ -248,6 +248,7 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout { if (e.getClickCount() <= 1) { selectionModel.selectACreatorAtMouseEvent(e); } + editingMouseListener.refreshTopXCreator(); if (editingMouseListener.stopEditing()) { if (this != designer.getRootComponent()) { ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTitleLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTitleLayout.java index babc54b316..f6f6b2b411 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTitleLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTitleLayout.java @@ -204,6 +204,7 @@ public class XWCardTitleLayout extends XWBorderLayout { if (e.getClickCount() <= 1) { selectionModel.selectACreatorAtMouseEvent(e); } + editingMouseListener.refreshTopXCreator(); if (editingMouseListener.stopEditing()) { if (this != designer.getRootComponent()) { 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 a2f295f87d..cbf6852558 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 @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.treeview.ComponentTreeCellRenderer; import com.fr.design.designer.treeview.ComponentTreeModel; @@ -15,7 +16,9 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JTree; import javax.swing.SwingUtilities; +import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeCellRenderer; +import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; import java.awt.BorderLayout; @@ -30,6 +33,9 @@ import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.Vector; public class ComponentTree extends JTree { @@ -81,6 +87,7 @@ public class ComponentTree extends JTree { public void setSelectionPath(TreePath path) { // 不管点击哪一项,都要先退出编辑状态(图表、报表块、绝对布局、tab块) designer.stopEditing(path); + designer.getTopXCreators().refresh(); super.setSelectionPath(path); } @@ -129,6 +136,7 @@ public class ComponentTree extends JTree { setSelectionPaths(treepath); if (treepath.length > 0) { scrollPathToVisible(treepath[0]); + //expandPath(treepath[0]); } } @@ -228,6 +236,64 @@ public class ComponentTree extends JTree { repaint(); } + public void expandTree() { + TreePath[] paths = getSelectedTreePath(); + if (paths.length > 0) { + expandPath(getSelectedTreePath()[0]); + } + } + public void getExpandNodes(List searchList) { + getExpandNodes((XLayoutContainer)designer.getTopContainer(),searchList); + } + + public void getExpandNodes(XLayoutContainer container, List searchList) { + for (int i = 0, size = container.getXCreatorCount(); i < size; i++) { + XCreator creator = container.getXCreator(i); + TreePath treePath=buildTreePath(creator); + if(isExpanded(treePath)) searchList.add(treePath); + if (creator instanceof XLayoutContainer) { + getExpandNodes((XLayoutContainer) creator, searchList); + } + } + } + public void expandNodes(List list){ + for(TreePath treePath:list) { + if (treePath.getLastPathComponent() instanceof XLayoutContainer) { + XLayoutContainer creator= (XLayoutContainer) treePath.getLastPathComponent(); + if (XCreatorUtils.getParentXLayoutContainer(creator) == null) { + continue; + } + expandPath(treePath); + } + } + } +/* private void expandNode(JTree myTree, DefaultMutableTreeNode currNode, List list){ + if(currNode.getParent()==null){ + list.remove(0); + } + if(list.size()<=0) return; + + int childCount = currNode.getChildCount(); + String strNode = vNode.elementAt(0).toString(); + DefaultMutableTreeNode child = null; + boolean flag=false; + for(int i=0; i0){ + expandNode(myTree,child, vNode); + }else{ + myTree.expandPath(new TreePath(child.getPath())); + } + } + }*/ + private TreePath buildTreePath(Component comp) { ArrayList path = new ArrayList(); Component parent = comp; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java b/designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java index d692eaa5ea..5aa4f93ad5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java @@ -8,7 +8,7 @@ import com.fr.general.IOUtils; import com.fr.stable.Constants; -import javax.swing.JPanel; +import javax.swing.JComponent; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Component; @@ -28,7 +28,7 @@ import java.awt.Rectangle; * Date: 14-7-24 * Time: 上午9:09 */ -public class CoverPane extends JPanel { +public class CoverPane extends JComponent { private UIButton editButton; private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f); @@ -94,6 +94,7 @@ public class CoverPane extends JPanel { int preferWidth = editButton.getPreferredSize().width; int preferHeight = editButton.getPreferredSize().height; editButton.setBounds((width - preferWidth) / 2, (height - preferHeight) / 2, preferWidth, preferHeight); + System.out.println(width+"---"+height); } @Override 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 183c0b08c6..c59d37eaab 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 @@ -308,6 +308,7 @@ public class EditingMouseListener extends MouseInputAdapter { XCreator component = designer.getComponentAt(e); setCoverPaneNotDisplay(component, e, false); + designer.getTopXCreators().displayCoverPane(e); if (processTopLayoutMouseMove(component, e)) { return; @@ -692,6 +693,7 @@ public class EditingMouseListener extends MouseInputAdapter { currentXCreator.stopEditing(); currentXCreator = null; currentEditor = null; + refreshTopXCreator(); return true; } return true; @@ -719,4 +721,19 @@ public class EditingMouseListener extends MouseInputAdapter { } currentEditor.getEditorTarget().setBounds(bounds); } + + /** + * 刷新顶层组件 + * */ + public void refreshTopXCreator(boolean isEditing){ + designer.refreshTopXCreator(isEditing); + } + + /** + * 刷新顶层组件 + * */ + public void refreshTopXCreator(){ + refreshTopXCreator(false); + } + } 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 e5ce0f726f..191425df22 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,7 +35,9 @@ 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.properties.FormWidgetAuthorityEditPane; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.DesignerOpenedListener; @@ -43,6 +45,7 @@ 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; @@ -121,6 +124,7 @@ public class FormDesigner extends TargetComponent
implements TreeSelection private FormArea formArea; private ConnectorHelper connectorHelper; private boolean isReportBlockEditing = false; + private TopXCreators topXCreators; //组件重叠 private boolean isWidgetsIntersect = false; @@ -184,6 +188,8 @@ public class FormDesigner extends TargetComponent implements TreeSelection new FormDesignerDropTarget(this);// 添加Drag and Drop. this.switchAction = switchAction; + topXCreators=new TopXCreators(this); + add(topXCreators); // 必须刷新"参数/控件树"面板,否则,若最近一次打开模版为 cpt,重启设计器,打开 frm,控件树消失 populateParameterPropertyPane(); @@ -825,6 +831,39 @@ public class FormDesigner extends TargetComponent implements TreeSelection return null; } + /** + * 从已选择的组件中找x,y所在的组件 + */ + private XCreator xCreatorAt(int x, int y, XCreator[] xCreators) { + for (XCreator creator : xCreators) { + if (creator == null || !creator.isVisible()) { + continue; + } + if (creator instanceof XWAbsoluteBodyLayout || creator instanceof XWFitLayout || creator instanceof XWParameterLayout) { + continue; + } + x -= creator.getX(); + y -= creator.getY(); + Rectangle rect = ComponentUtils.computeVisibleRect(creator); + // 判断是否处于交叉区域 + if (isIntersectArea(x, y, rect)) { + if (creator instanceof XWTitleLayout) { + return creator.getEditingChildCreator(); + } + return creator; + } + } + return null; + } + + /** + * 刷新顶层组件 + * */ + public void refreshTopXCreator(boolean isEditing){ + topXCreators.refresh(); + topXCreators.setVisible(!isEditing); + } + private boolean isIntersectArea(int x, int y, Rectangle rect) { return x >= rect.getX() && (x <= (rect.getX() + rect.getWidth())) && (y >= rect.getY()) && (y <= (rect.getY() + rect.getHeight())); @@ -984,6 +1023,10 @@ public class FormDesigner extends TargetComponent implements TreeSelection invalidateLayout(); } + public TopXCreators getTopXCreators() { + return topXCreators; + } + public StateModel getStateModel() { return stateModel; } @@ -1001,9 +1044,19 @@ public class FormDesigner extends TargetComponent implements TreeSelection return getComponentAt(p.x, p.y); } + /** + * 先从已选择则的组件中去找,再遍历root去找 + * */ @Override public XCreator getComponentAt(int x, int y) { - return getComponentAt(x, y, null); + XLayoutContainer container = y < paraHeight - formArea.getVerticalValue() ? paraComponent : rootComponent; + if (container == null) { + container = rootComponent; + } + int relativeX = x + (int) (formArea.getHorizontalValue() / scale) - container.getX(); + int relativeY = y + (int) (formArea.getVerticalValue() / scale) - container.getY(); + XCreator result = xCreatorAt(relativeX, relativeY, selectionModel.getSelection().getSelectedCreators()); + return result == null ? getComponentAt(x, y, null) : result; } @Nullable @@ -1311,6 +1364,10 @@ public class FormDesigner extends TargetComponent implements TreeSelection } } + public void paintTopCreators(Graphics clipg){ + topXCreators.paint(clipg); + } + /** * 重置组件边界 */ 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 26547229bb..2a8e255e83 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 @@ -84,6 +84,7 @@ public class FormDesignerUI extends ComponentUI { // 设计参数面板 repaintPara(g, paraComponent, c); } + repaintTopXCreators(g); if (designer.isDrawLineMode() && designer.getDrawLineHelper().drawLining()) { designer.getDrawLineHelper().drawAuxiliaryLine(g); @@ -445,4 +446,8 @@ public class FormDesignerUI extends ComponentUI { ComponentUtils.resetBuffer(dbcomponents); } + private void repaintTopXCreators(Graphics g){ + designer.paintTopCreators(g); + } + } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java index 6822422b29..0695813eb4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -24,12 +24,14 @@ import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingUtilities; +import javax.swing.tree.TreePath; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.ArrayList; +import java.util.List; /** @@ -89,10 +91,13 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree /** * 刷新 */ + //TODO 太乱了,需要重写,监听器里加了监听器是什么意思,每次调用该方法都会添加一个新的监听器 public void refreshDockingView() { FormDesigner formDesigner = this.getEditingFormDesigner(); + Listlist=new ArrayList<>(); removeAll(); if (this.componentTree != null) { + componentTree.getExpandNodes(list); this.componentTree.removeAll(); } if (formDesigner == null) { @@ -100,6 +105,8 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree return; } componentTree = new ComponentTree(formDesigner); + //保证删除组件后组件树不收起 + componentTree.expandNodes(list); formDesigner.addDesignerEditListener(new DesignerEditListener() { @Override public void fireCreatorModified(DesignerEvent evt) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/BasicTopXCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/BasicTopXCreator.java new file mode 100644 index 0000000000..1b248a9d1b --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/BasicTopXCreator.java @@ -0,0 +1,72 @@ +package com.fr.design.mainframe.widget.topxcreator; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.mainframe.CoverReportPane; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.utils.ComponentUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseEvent; + +/** + * @Author: Yuan.Wang + * @Date: 2020/8/31 + */ +public class BasicTopXCreator extends JComponent { + private FormDesigner designer; + private XCreator creator; + + private JComponent editor; + + public BasicTopXCreator(XCreator creator) { + this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + this.creator = creator; + init(); + } + + private void init() { + setOpaque(false); + setBackground(null); + setLayout(null); + setBounds(calculateBounds(creator)); + initEditor(); + if(editor!=null) { + add(editor); + } + } + + + //子类可能会重写该方法 + protected void resetSize(Rectangle bounds) { + //do nothing + } + + protected void initEditor() { + + } + + /** + * 重新设置组件大小 + * */ + public void resizeTopXCreator() { + Rectangle bounds=calculateBounds(creator); + setBounds(bounds); + resetSize(bounds); + } + + public void displayCoverPane(MouseEvent e, boolean visible) {} + + /** + * 计算显示大小 + * */ + private Rectangle calculateBounds(XCreator xCreator) { + Rectangle rect = ComponentUtils.getRelativeBounds(creator); + Rectangle bounds = new Rectangle(0, 0, creator.getWidth(), creator.getHeight()); + bounds.x += (rect.x - designer.getHorizontalScaleValue()); + bounds.y += (rect.y - designer.getVerticalScaleValue()); + return bounds; + } + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java new file mode 100644 index 0000000000..6218fe83f7 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java @@ -0,0 +1,54 @@ +package com.fr.design.mainframe.widget.topxcreator; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.mainframe.CoverReportPane; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.utils.ComponentUtils; + +import java.awt.*; +import java.awt.event.MouseEvent; + +/** + * @Author: Yuan.Wang + * @Date: 2020/8/26 + */ +public class TopXCreator extends BasicTopXCreator { + + private final CoverReportPane coverPanel; + + public TopXCreator(XCreator creator) { + super(creator); + coverPanel = new CoverReportPane(); + init(); + } + + private void init() { + coverPanel.setSize(getSize()); + coverPanel.setVisible(false); + add(coverPanel); + } + + + protected void resetSize(Rectangle bounds) { + coverPanel.setSize(getSize()); + } + + public void setCoverPaneVisible(boolean visible) { + coverPanel.setVisible(visible); + } + + public void displayCoverPane(MouseEvent event, boolean visible) { + if (!visible) { + setVisible(false); + return; + } + Rectangle rect = getBounds(); + if (rect.contains(event.getX(), event.getY())) { + coverPanel.setVisible(true); + } else { + coverPanel.setVisible(false); + } + } + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreators.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreators.java new file mode 100644 index 0000000000..2f8ae3b406 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreators.java @@ -0,0 +1,95 @@ +package com.fr.design.mainframe.widget.topxcreator; + +import com.fr.design.designer.beans.models.SelectionModel; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.mainframe.FormDesigner; + +import java.awt.event.MouseEvent; + +import javax.swing.*; +import java.awt.*; + + +/** + * 需要显示顶层的组件层 + * + * @Author: Yuan.Wang + * @Date: 2020/8/25 + */ +public class TopXCreators extends JComponent { + final private FormDesigner designer; + + public TopXCreators(FormDesigner designer) { + this.designer = designer; + init(); + } + + private void init() { + setLayout(null); + setVisible(false); + setBackground(null); + setOpaque(false); + } + + /** + * 选中的组件有变化时刷新 + */ + public void refresh() { + removeAll(); + addXCreators(); + } + + @Override + public void paint(Graphics g) { + setSize(designer.getSize()); + resizeTopXCreators(); + super.paint(g); + } + + @Override + public void setVisible(boolean aFlag) { + super.setVisible(aFlag); + for (int i = 0, count = getComponentCount(); i < count; i++) { + if (getComponent(i) instanceof TopXCreator) { + TopXCreator xCreator = (TopXCreator) getComponent(i); + xCreator.setCoverPaneVisible(aFlag); + } + } + repaint(); + } + + /** + * 依据MouseEvent坐标来设置是否显示蒙层 + */ + public void displayCoverPane(MouseEvent e) { + for (int i = 0, count = getComponentCount(); i < count; i++) { + BasicTopXCreator xCreator = (BasicTopXCreator) getComponent(i); + xCreator.displayCoverPane(e, isVisible()); + } + } + + /** + * 加入被选择的组件 + */ + private void addXCreators() { + SelectionModel selectionModel = designer.getSelectionModel(); + XCreator[] xCreators = selectionModel.getSelection().getSelectedCreators(); + for (XCreator creator : xCreators) { + BasicTopXCreator topXCreator = creator.getTopXCreator(); + if (topXCreator != null) { + add(topXCreator); + } + } + } + + /** + * 更新顶层组件的位置和大小 + */ + private void resizeTopXCreators() { + for (int i = 0, count = getComponentCount(); i < count; i++) { + BasicTopXCreator topXCreator = (BasicTopXCreator) getComponent(i); + topXCreator.resizeTopXCreator(); + } + repaint(); + } +} From 72f8c306b78ac950b30fb6530d3692c4f1746a02 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Mon, 31 Aug 2020 16:36:01 +0800 Subject: [PATCH 03/10] =?UTF-8?q?REPORT-36985=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=20=E7=BB=84=E4=BB=B6=E6=A0=91=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E4=BC=98=E5=8C=96=E5=92=8C=E9=80=89=E6=8B=A9=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=E8=AE=A9=E5=85=B6=E6=B5=AE=E4=BA=8E=E9=A1=B6?= =?UTF-8?q?=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/SelectionModel.java | 2 - .../fr/design/designer/creator/XButton.java | 15 ------- .../design/designer/creator/XChartEditor.java | 8 ++-- .../fr/design/designer/creator/XCreator.java | 33 ++++++++++++++-- .../design/designer/creator/XElementCase.java | 7 +--- .../fr/design/mainframe/ComponentTree.java | 39 ++++--------------- .../com/fr/design/mainframe/CoverPane.java | 1 - .../com/fr/design/mainframe/FormDesigner.java | 11 +++--- .../widget/topxcreator/BasicTopXCreator.java | 21 +++++----- .../widget/topxcreator/TopXCreator.java | 8 +++- .../widget/topxcreator/TopXCreators.java | 9 ++++- 11 files changed, 74 insertions(+), 80 deletions(-) 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 49e0f94d29..42db0d8503 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 @@ -84,7 +84,6 @@ public class SelectionModel { selection.reset(); } else { //按下Ctrl或者shift键时鼠标可以进行多选,两次点击同一控件就取消选中 - //XCreator comp = designer.getComponentAt(e); XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(comp).getTopLayout(); if (topLayout != null && !topLayout.isEditable()) { comp = topLayout; @@ -98,7 +97,6 @@ public class SelectionModel { comp = designer.getComponentAt(e); } // 获取e所在的组件 - //XCreator comp = designer.getComponentAt(e); selectACreator(comp); } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java b/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java index 5f5bb73b22..d4e9758316 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java @@ -309,19 +309,4 @@ public class XButton extends XWidgetCreator { } } - -/* @Override - public BasicTopCreator getTopXCreator(){ - return new BasicTopXCreator(this) { - @Override - protected void initEditor() { - XButton(XButton.this.toData(),this.getSize() - - } - } - - //return new XButton((Button)this.toData(),this.getSize()); - - }*/ - } 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 0ca125e930..f846f29bd2 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 @@ -366,20 +366,20 @@ public class XChartEditor extends XBorderStyleWidgetCreator { return new TopXChart(this); } - private class TopXChart extends TopXCreator{ + private class TopXChart extends TopXCreator { private final DesignerEditor designerEditor; public TopXChart(XCreator creator) { super(creator); designerEditor = creator.getDesignerEditor(); - Rectangle bounds=getBounds(); + Rectangle bounds = getBounds(); designerEditor.getEditorTarget().setBounds(bounds.x + 1, bounds.y + 1, bounds.width - 2, bounds.height - 2); } /** * 更新designerEditor的大小 - * */ - protected void resetSize(Rectangle bounds){ + */ + protected void resetSize(Rectangle bounds) { super.resetSize(bounds); designerEditor.getEditorTarget().setBounds(bounds.x + 1, bounds.y + 1, bounds.width - 2, bounds.height - 2); } 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 0496d74787..82e7da5b2d 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 @@ -25,12 +25,12 @@ 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.JComponent; -import javax.swing.JPanel; +import javax.swing.*; import javax.swing.border.Border; import java.awt.BorderLayout; import java.awt.Color; @@ -39,6 +39,7 @@ 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; @@ -540,6 +541,8 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo selectionModel.selectACreatorAtMouseEvent(e); } + editingMouseListener.refreshTopXCreator(); + if (editingMouseListener.stopEditing() && this != designer.getRootComponent()) { ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter); @@ -807,8 +810,30 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo /** * 获得该组件的顶层显示组件 */ + @Nullable public BasicTopXCreator getTopXCreator() { - return null; + return new BasicTopXCreator(this){ + @Override + protected void addComponent() { + BufferedImage image=getImage(); + Icon icon = new ImageIcon(image); + 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/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index a9fd877168..d84fd2e0cd 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 @@ -384,11 +384,8 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public TopXElementCase(XCreator creator) { super(creator); - if (creator instanceof XElementCase) { - XElementCase elementCase = (XElementCase) creator; - imageLabel = elementCase.initImageBackground(); - add(imageLabel); - } + imageLabel = initImageBackground(); + add(imageLabel); } } 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 cbf6852558..2fdd1f8f1e 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 @@ -236,12 +236,9 @@ public class ComponentTree extends JTree { repaint(); } - public void expandTree() { - TreePath[] paths = getSelectedTreePath(); - if (paths.length > 0) { - expandPath(getSelectedTreePath()[0]); - } - } + /** + * 获得树的展开路径 + * */ public void getExpandNodes(List searchList) { getExpandNodes((XLayoutContainer)designer.getTopContainer(),searchList); } @@ -256,6 +253,10 @@ public class ComponentTree extends JTree { } } } + + /** + * 将树按照展开路径进行展开 + * */ public void expandNodes(List list){ for(TreePath treePath:list) { if (treePath.getLastPathComponent() instanceof XLayoutContainer) { @@ -267,32 +268,6 @@ public class ComponentTree extends JTree { } } } -/* private void expandNode(JTree myTree, DefaultMutableTreeNode currNode, List list){ - if(currNode.getParent()==null){ - list.remove(0); - } - if(list.size()<=0) return; - - int childCount = currNode.getChildCount(); - String strNode = vNode.elementAt(0).toString(); - DefaultMutableTreeNode child = null; - boolean flag=false; - for(int i=0; i0){ - expandNode(myTree,child, vNode); - }else{ - myTree.expandPath(new TreePath(child.getPath())); - } - } - }*/ private TreePath buildTreePath(Component comp) { ArrayList path = new ArrayList(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java b/designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java index 5aa4f93ad5..a4c4014408 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java @@ -94,7 +94,6 @@ public class CoverPane extends JComponent { int preferWidth = editButton.getPreferredSize().width; int preferHeight = editButton.getPreferredSize().height; editButton.setBounds((width - preferWidth) / 2, (height - preferHeight) / 2, preferWidth, preferHeight); - System.out.println(width+"---"+height); } @Override 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 191425df22..5cb0157f9e 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 @@ -846,12 +846,13 @@ public class FormDesigner extends TargetComponent implements TreeSelection y -= creator.getY(); Rectangle rect = ComponentUtils.computeVisibleRect(creator); // 判断是否处于交叉区域 - if (isIntersectArea(x, y, rect)) { - if (creator instanceof XWTitleLayout) { - return creator.getEditingChildCreator(); - } - return creator; + if (!isIntersectArea(x, y, rect)) { + continue; + } + if (creator instanceof XWTitleLayout) { + return creator.getEditingChildCreator(); } + return creator; } return null; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/BasicTopXCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/BasicTopXCreator.java index 1b248a9d1b..d70b07abb7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/BasicTopXCreator.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/BasicTopXCreator.java @@ -5,10 +5,12 @@ import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.ComponentUtils; +import com.fr.stable.CoreGraphHelper; import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; +import java.awt.image.BufferedImage; /** * @Author: Yuan.Wang @@ -18,8 +20,6 @@ public class BasicTopXCreator extends JComponent { private FormDesigner designer; private XCreator creator; - private JComponent editor; - public BasicTopXCreator(XCreator creator) { this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); this.creator = creator; @@ -30,11 +30,8 @@ public class BasicTopXCreator extends JComponent { setOpaque(false); setBackground(null); setLayout(null); - setBounds(calculateBounds(creator)); - initEditor(); - if(editor!=null) { - add(editor); - } + setBounds(calculateBounds()); + addComponent(); } @@ -43,7 +40,7 @@ public class BasicTopXCreator extends JComponent { //do nothing } - protected void initEditor() { + protected void addComponent() { } @@ -51,7 +48,7 @@ public class BasicTopXCreator extends JComponent { * 重新设置组件大小 * */ public void resizeTopXCreator() { - Rectangle bounds=calculateBounds(creator); + Rectangle bounds=calculateBounds(); setBounds(bounds); resetSize(bounds); } @@ -61,7 +58,7 @@ public class BasicTopXCreator extends JComponent { /** * 计算显示大小 * */ - private Rectangle calculateBounds(XCreator xCreator) { + private Rectangle calculateBounds() { Rectangle rect = ComponentUtils.getRelativeBounds(creator); Rectangle bounds = new Rectangle(0, 0, creator.getWidth(), creator.getHeight()); bounds.x += (rect.x - designer.getHorizontalScaleValue()); @@ -69,4 +66,8 @@ public class BasicTopXCreator extends JComponent { return bounds; } + @Override + public void paint(Graphics g) { + super.paint(g); + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java index 6218fe83f7..6ad9e1843d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java @@ -34,10 +34,16 @@ public class TopXCreator extends BasicTopXCreator { coverPanel.setSize(getSize()); } - public void setCoverPaneVisible(boolean visible) { + /** + * 设置是否显示蒙层 + * */ + public void displayCoverPane(boolean visible) { coverPanel.setVisible(visible); } + /** + * 依据鼠标事件和visible设置是否显示蒙层 + * */ public void displayCoverPane(MouseEvent event, boolean visible) { if (!visible) { setVisible(false); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreators.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreators.java index 2f8ae3b406..417ec80e80 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreators.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreators.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.widget.topxcreator; +import com.fr.design.designer.beans.events.DesignerEditListener; +import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.mainframe.FormDesigner; @@ -29,6 +31,11 @@ public class TopXCreators extends JComponent { setVisible(false); setBackground(null); setOpaque(false); + designer.addDesignerEditListener(e -> { + if (e.getCreatorEventID() == DesignerEvent.CREATOR_EDITED) { + refresh(); + } + }); } /** @@ -52,7 +59,7 @@ public class TopXCreators extends JComponent { for (int i = 0, count = getComponentCount(); i < count; i++) { if (getComponent(i) instanceof TopXCreator) { TopXCreator xCreator = (TopXCreator) getComponent(i); - xCreator.setCoverPaneVisible(aFlag); + xCreator.displayCoverPane(aFlag); } } repaint(); From 140dd5151536210b0cff7a2dc94ab7c7067adf78 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Mon, 31 Aug 2020 16:41:29 +0800 Subject: [PATCH 04/10] =?UTF-8?q?REPORT-36985=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/widget/topxcreator/BasicTopXCreator.java | 3 --- .../fr/design/mainframe/widget/topxcreator/TopXCreator.java | 3 --- .../fr/design/mainframe/widget/topxcreator/TopXCreators.java | 1 - 3 files changed, 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/BasicTopXCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/BasicTopXCreator.java index d70b07abb7..e49aaf6e85 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/BasicTopXCreator.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/BasicTopXCreator.java @@ -1,16 +1,13 @@ package com.fr.design.mainframe.widget.topxcreator; import com.fr.design.designer.creator.XCreator; -import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.ComponentUtils; -import com.fr.stable.CoreGraphHelper; import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; /** * @Author: Yuan.Wang diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java index 6ad9e1843d..52bae99f17 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java @@ -2,9 +2,6 @@ package com.fr.design.mainframe.widget.topxcreator; import com.fr.design.designer.creator.XCreator; import com.fr.design.mainframe.CoverReportPane; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.design.utils.ComponentUtils; import java.awt.*; import java.awt.event.MouseEvent; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreators.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreators.java index 417ec80e80..f271c3cc10 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreators.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreators.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.widget.topxcreator; -import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; From 017db0e76fe60cab7dec17b623cd49f2f4d491c3 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 31 Aug 2020 16:56:16 +0700 Subject: [PATCH 05/10] =?UTF-8?q?KERNEL-4069=20jdk11=20macos=E7=9A=84jdk?= =?UTF-8?q?=E9=87=8C=E9=9D=A2=E7=A7=BB=E9=99=A4=E4=BA=86windows=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84LAF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/icombobox/LazyComboBoxTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java index 37e9db1546..9906749b7b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java @@ -3,10 +3,10 @@ */ package com.fr.design.gui.icombobox; +import com.fr.design.gui.UILookAndFeel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.log.FineLoggerFactory; -import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; import javax.swing.JFrame; import javax.swing.JPanel; @@ -23,7 +23,7 @@ import java.awt.event.ItemListener; public class LazyComboBoxTest { public static void main(String[] args) { try { - UIManager.setLookAndFeel(new WindowsLookAndFeel()); + UIManager.setLookAndFeel(new UILookAndFeel()); } catch (UnsupportedLookAndFeelException e1) { FineLoggerFactory.getLogger().error(e1.getMessage(), e1); } From 292a5bc71eddaf35c8f9109eda61e591b7f04f1a Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Mon, 31 Aug 2020 19:05:36 +0800 Subject: [PATCH 06/10] =?UTF-8?q?REPORT-36985=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E4=BE=9D=E8=B5=96=EF=BC=8C=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/designer/creator/XButton.java | 1 - .../java/com/fr/design/designer/creator/XCreator.java | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java b/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java index d4e9758316..9a627ab2c0 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java @@ -14,7 +14,6 @@ import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor; import com.fr.design.mainframe.widget.editors.ShortCutTextEditor; import com.fr.design.mainframe.widget.renderer.FontCellRenderer; import com.fr.design.mainframe.widget.renderer.IconCellRenderer; -import com.fr.design.mainframe.widget.topxcreator.BasicTopXCreator; import com.fr.form.parameter.FormSubmitButton; import com.fr.form.ui.Button; import com.fr.form.ui.FreeButton; 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 82e7da5b2d..2eecf817c1 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 @@ -812,12 +812,12 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo */ @Nullable public BasicTopXCreator getTopXCreator() { - return new BasicTopXCreator(this){ + return new BasicTopXCreator(this) { @Override protected void addComponent() { - BufferedImage image=getImage(); + BufferedImage image = getImage(); Icon icon = new ImageIcon(image); - JLabel jLabel = new JLabel(icon,JLabel.CENTER); + JLabel jLabel = new JLabel(icon, JLabel.CENTER); jLabel.setSize(getSize()); this.add(jLabel); } @@ -826,7 +826,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo /** * 获得组件的图像 - * */ + */ public BufferedImage getImage() { BufferedImage image = CoreGraphHelper.createBufferedImage(getWidth(), getHeight()); Graphics g = image.createGraphics(); From add68778954f89a4d837e2dcbee83317d9cc7b0a Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Tue, 1 Sep 2020 09:23:20 +0800 Subject: [PATCH 07/10] =?UTF-8?q?REPORT-36985=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E4=BE=9D=E8=B5=96=EF=BC=8C=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/designer/creator/XCreator.java | 10 +++++++--- .../com/fr/design/mainframe/FormHierarchyTreePane.java | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) 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 2eecf817c1..20f2788117 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 @@ -30,7 +30,12 @@ import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.third.javax.annotation.Nullable; -import javax.swing.*; +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; import java.awt.Color; @@ -815,8 +820,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo return new BasicTopXCreator(this) { @Override protected void addComponent() { - BufferedImage image = getImage(); - Icon icon = new ImageIcon(image); + Icon icon = new ImageIcon(getImage()); JLabel jLabel = new JLabel(icon, JLabel.CENTER); jLabel.setSize(getSize()); this.add(jLabel); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java index 0695813eb4..f94475a768 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -94,7 +94,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree //TODO 太乱了,需要重写,监听器里加了监听器是什么意思,每次调用该方法都会添加一个新的监听器 public void refreshDockingView() { FormDesigner formDesigner = this.getEditingFormDesigner(); - Listlist=new ArrayList<>(); + List list = new ArrayList<>(); removeAll(); if (this.componentTree != null) { componentTree.getExpandNodes(list); From f01534c8c611621905b7ea7d46f6e258cbcd640e Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 1 Sep 2020 12:00:09 +0800 Subject: [PATCH 08/10] =?UTF-8?q?REPORT-38632=E3=80=90=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=88=A0=E9=99=A4=E3=80=91=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E9=A1=B5=20=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/start/fx/FastGifImage.java | 208 ------------------ .../com/fr/start/fx/PrismImageLoader2.java | 208 ------------------ .../main/java/com/fr/start/fx/SplashFx.java | 59 ----- .../java/com/fr/start/fx/SplashFxWindow.java | 194 ---------------- .../main/java/com/fr/start/jni/SplashJNI.java | 69 ------ .../main/java/com/fr/start/jni/SplashMac.java | 100 --------- .../resources/com/fr/start/jni/splash.dylib | Bin 57200 -> 0 bytes 7 files changed, 838 deletions(-) delete mode 100644 designer-realize/src/main/java/com/fr/start/fx/FastGifImage.java delete mode 100644 designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java delete mode 100644 designer-realize/src/main/java/com/fr/start/fx/SplashFx.java delete mode 100644 designer-realize/src/main/java/com/fr/start/fx/SplashFxWindow.java delete mode 100644 designer-realize/src/main/java/com/fr/start/jni/SplashJNI.java delete mode 100644 designer-realize/src/main/java/com/fr/start/jni/SplashMac.java delete mode 100755 designer-realize/src/main/resources/com/fr/start/jni/splash.dylib diff --git a/designer-realize/src/main/java/com/fr/start/fx/FastGifImage.java b/designer-realize/src/main/java/com/fr/start/fx/FastGifImage.java deleted file mode 100644 index 9eb3ecef27..0000000000 --- a/designer-realize/src/main/java/com/fr/start/fx/FastGifImage.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.fr.start.fx; - -import com.sun.imageio.plugins.gif.GIFImageReader; -import com.sun.imageio.plugins.gif.GIFImageReaderSpi; -import com.sun.javafx.tk.ImageLoader; -import com.sun.javafx.tk.PlatformImage; -import javafx.animation.KeyFrame; -import javafx.animation.Timeline; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.scene.image.WritableImage; -import javafx.util.Duration; - -import javax.imageio.stream.FileImageInputStream; -import java.io.File; -import java.lang.ref.WeakReference; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.regex.Pattern; - -/** - * 边加载边播放的gif加载器 - * - * @author daniel - */ -public class FastGifImage extends WritableImage { - private String url; - private int gifCount; - - public FastGifImage(String url, int w, int h) { - super(w, h); - this.url = validateUrl(url); - seekCount(); - initialize(); - } - - /** - * 给出gif帧数,加快加载速度 - * - * @param url gif url - * @param gifCount gif帧数 - * @param w 宽 - * @param h 高 - */ - public FastGifImage(String url, int gifCount, int w, int h) { - super(w, h); - this.url = validateUrl(url); - this.gifCount = gifCount; - initialize(); - } - - private void seekCount() { - try { - GIFImageReaderSpi spi = new GIFImageReaderSpi(); - GIFImageReader gifReader = (GIFImageReader) spi.createReaderInstance(); - gifReader.setInput(new FileImageInputStream(new File(new URI(url)))); - gifCount = gifReader.getNumImages(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private static final Pattern URL_QUICKMATCH = Pattern.compile("^\\p{Alpha}[\\p{Alnum}+.-]*:.*$"); - - private static String validateUrl(final String url) { - if (url == null) { - throw new NullPointerException("URL must not be null"); - } - - if (url.trim().isEmpty()) { - throw new IllegalArgumentException("URL must not be empty"); - } - - try { - if (!URL_QUICKMATCH.matcher(url).matches()) { - final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - URL resource; - if (url.charAt(0) == '/') { - resource = contextClassLoader.getResource(url.substring(1)); - } else { - resource = contextClassLoader.getResource(url); - } - if (resource == null) { - throw new IllegalArgumentException("Invalid URL or resource not found"); - } - return resource.toString(); - } - // Use URL constructor for validation - return new URL(url).toString(); - } catch (final IllegalArgumentException e) { - throw new IllegalArgumentException("Invalid URL" + e.getMessage()); - } catch (final MalformedURLException e) { - throw new IllegalArgumentException("Invalid URL" + e.getMessage()); - } - } - - private void finishImage(ImageLoader loader) { - initializeAnimatedImage(loader); - } - - // Generates the animation Timeline for multiframe images. - private void initializeAnimatedImage(ImageLoader loader) { - - animation = new Animation(this, loader); - animation.start(); - } - - // Support for animated images. - private Animation animation; - - private static final class Animation { - final WeakReference imageRef; - final Timeline timeline; - private ImageLoader loader; - - public Animation(final FastGifImage image, final ImageLoader loader) { - this.loader = loader; - imageRef = new WeakReference(image); - timeline = new Timeline(); - timeline.setCycleCount(Timeline.INDEFINITE); - - final int frameCount = loader.getFrameCount(); - int duration = 0; - - for (int i = 0; i < frameCount; ++i) { - addKeyFrame(i, duration); - duration = duration + loader.getFrameDelay(i); - } - - // Note: we need one extra frame in the timeline to define how long - // the last frame is shown, the wrap around is "instantaneous" - addKeyFrame(0, duration); - } - - public void start() { - timeline.play(); - } - - public void stop() { - timeline.stop(); - loader = null; - } - - private void updateImage(final int frameIndex) { - final FastGifImage image = imageRef.get(); - if (image != null) { - image.setPlatformImagePropertyImpl( - loader.getFrame(frameIndex)); - } else { - timeline.stop(); - } - } - - private void addKeyFrame(final int index, final double duration) { - timeline.getKeyFrames().add( - new KeyFrame(Duration.millis(duration), - new EventHandler() { - @Override - public void handle(Event event) { - updateImage(index); - } - } - )); - } - } - - private static Method method; - - static { - try { - method = FastGifImage.class.getSuperclass().getSuperclass().getDeclaredMethod("platformImagePropertyImpl"); - method.setAccessible(true); - } catch (Exception e) { - - } - } - - private void setPlatformImagePropertyImpl(PlatformImage image) { - try { - Object o = method.invoke(this); - Method method = o.getClass().getDeclaredMethod("set", Object.class); - method.setAccessible(true); - method.invoke(o, image); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } - } - - - private void initialize() { - finishImage(new PrismImageLoader2(url, gifCount, (int) getRequestedWidth(), (int) getRequestedHeight(), isPreserveRatio(), isSmooth())); - } - - /** - * 销毁gif动画 - */ - public void destroy() { - animation.stop(); - } - -} diff --git a/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java b/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java deleted file mode 100644 index 4529465c7a..0000000000 --- a/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.fr.start.fx; - -import com.fr.concurrent.NamedThreadFactory; -import com.fr.log.FineLoggerFactory; -import com.sun.javafx.iio.ImageFrame; -import com.sun.javafx.iio.ImageLoadListener; -import com.sun.javafx.iio.ImageLoader; -import com.sun.javafx.iio.ImageMetadata; -import com.sun.javafx.iio.ImageStorageException; -import com.sun.javafx.iio.common.ImageTools; -import com.sun.javafx.iio.gif.GIFImageLoaderFactory; -import com.sun.javafx.tk.PlatformImage; -import com.sun.prism.Image; -import com.sun.prism.impl.PrismSettings; - - -import java.io.IOException; -import java.io.InputStream; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -/** - * 边加载边播放的gif加载器 - * - * @author daniel - */ -class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader { - - private Image[] images; - private int[] delayTimes; - private int width; - private int height; - private int gifCount = 1; - private Exception exception; - - public PrismImageLoader2(final String url, int gifCount, final int width, final int height, - final boolean preserveRatio, final boolean smooth) { - this.gifCount = gifCount; - images = new Image[gifCount]; - delayTimes = new int[gifCount]; - this.width = width; - this.height = height; - ExecutorService es = Executors.newSingleThreadExecutor(new NamedThreadFactory("PrismImageLoader2")); - es.execute(new Runnable() { - @Override - public void run() { - InputStream inputStream = null; - try { - inputStream = ImageTools.createInputStream(url); - loadAll(inputStream, width, height, preserveRatio, smooth); - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - if (inputStream != null) { - inputStream.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - } - }); - es.shutdown(); - } - - @Override - public int getWidth() { - return width; - } - - @Override - public int getHeight() { - return height; - } - - @Override - public int getFrameCount() { - return gifCount; - } - - @Override - @SuppressWarnings("squid:S2142") - public PlatformImage getFrame(int index) { - while (images[index] == null) { - synchronized (this) { - if (images[index] == null) { - try { - this.wait(); - } catch (InterruptedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - } - } - return images[index]; - } - - - @Override - public int getFrameDelay(int index) { -// while (images[0] == null) { -// synchronized (this) { -// if(images[0] == null) { -// try { -// this.wait(); -// } catch (InterruptedException e) { -// e.printStackTrace(); -// } -// } -// } -// return 0; -// } -// return delayTimes[0]; - // 直接使用第一帧的时间 - return 40; - } - - @Override - public int getLoopCount() { - return 0; - } - - @Override - public Exception getException() { - return exception; - } - - - @SuppressWarnings("squid:S244") - private void loadAll(InputStream stream, int w, int h, - boolean preserveRatio, boolean smooth) { - ImageLoadListener listener = new PrismLoadListener(); - - try { - ImageLoader loader = null; - loader = GIFImageLoaderFactory.getInstance().createImageLoader(stream); - loader.addListener(listener); - - for (int i = 0; i < gifCount; i++) { - ImageFrame imageFrame = loader.load(i, w, h, preserveRatio, smooth); - images[i] = convert(imageFrame); - synchronized (this) { - notifyAll(); - } - } - } catch (ImageStorageException e) { - handleException(e); - } catch (Exception e) { - handleException(e); - } - } - - private void handleException(final ImageStorageException isException) { - // unwrap ImageStorageException if possible - final Throwable exceptionCause = isException.getCause(); - if (exceptionCause instanceof Exception) { - handleException((Exception) exceptionCause); - } else { - handleException((Exception) isException); - } - } - - private void handleException(final Exception exception) { - if (PrismSettings.verbose) { - exception.printStackTrace(System.err); - } - this.exception = exception; - } - - private Image convert(ImageFrame imgFrames) { - ImageFrame frame = imgFrames; - Image image = Image.convertImageFrame(frame); - ImageMetadata metadata = frame.getMetadata(); - if (metadata != null) { - Integer delay = metadata.delayTime; - if (delay != null) { - delayTimes[0] = delay.intValue(); - } - } - return image; - } - - - private class PrismLoadListener implements ImageLoadListener { - @Override - public void imageLoadWarning(ImageLoader loader, String message) { - - } - - @Override - public void imageLoadProgress(ImageLoader loader, - float percentageComplete) { - // progress only matters when backgroundLoading=true, but - // currently we are relying on AbstractRemoteResource for tracking - // progress of the InputStream, so there's no need to implement - // this for now; eventually though we might want to consider - // moving away from AbstractRemoteResource and instead use - // the built-in support for progress in the javafx-iio library... - } - - @Override - public void imageLoadMetaData(ImageLoader loader, ImageMetadata metadata) { - // We currently have no need to listen for ImageMetadata ready. - } - } - -} diff --git a/designer-realize/src/main/java/com/fr/start/fx/SplashFx.java b/designer-realize/src/main/java/com/fr/start/fx/SplashFx.java deleted file mode 100644 index f5c64bf792..0000000000 --- a/designer-realize/src/main/java/com/fr/start/fx/SplashFx.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.fr.start.fx; - -import com.fr.concurrent.NamedThreadFactory; -import com.fr.design.mainframe.DesignerContext; -import com.fr.start.SplashFxActionListener; -import com.fr.start.SplashStrategy; -import javafx.application.Application; -import javafx.application.Platform; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -/** - * JavaFx方式启动启动动画。这种方式在mac下与 - * swing一起启动会会出现线程死锁,jvm等问题, - * 所以这个方式仅用于windows上。 - * - * @author vito - * @date 2018/6/4 - * @see com.fr.start.jni.SplashMac - */ -public class SplashFx implements SplashStrategy { - - private SplashFxWindow fxWindow; - private static final ExecutorService SERVICE = Executors.newSingleThreadExecutor(new NamedThreadFactory("SplashFx")); - - @Override - public void show() { - Platform.setImplicitExit(false); - SERVICE.execute(new Runnable() { - @Override - public void run() { - Application.launch(SplashFxWindow.class); - } - }); - fxWindow = SplashFxWindow.waitForStartUpTest(); - fxWindow.addSplashActionListener(new SplashFxActionListener() { - @Override - public void splashClose() { - DesignerContext.getDesignerFrame().setVisible(true); - } - }); - } - - @Override - public void hide() { - fxWindow.close(); - } - - @Override - public void updateModuleLog(final String text) { - fxWindow.updateModuleInfo(text); - } - - @Override - public void updateThanksLog(final String text) { - fxWindow.updateThanks(text); - } -} diff --git a/designer-realize/src/main/java/com/fr/start/fx/SplashFxWindow.java b/designer-realize/src/main/java/com/fr/start/fx/SplashFxWindow.java deleted file mode 100644 index 00ad512939..0000000000 --- a/designer-realize/src/main/java/com/fr/start/fx/SplashFxWindow.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.fr.start.fx; - -import com.fr.log.FineLoggerFactory; -import com.fr.stable.OperatingSystem; -import com.fr.start.SplashContext; -import com.fr.start.SplashFxActionListener; -import javafx.application.Application; -import javafx.application.Platform; -import javafx.geometry.Rectangle2D; -import javafx.scene.Scene; -import javafx.scene.image.ImageView; -import javafx.scene.layout.AnchorPane; -import javafx.scene.paint.Color; -import javafx.scene.text.Font; -import javafx.scene.text.Text; -import javafx.stage.Screen; -import javafx.stage.Stage; -import javafx.stage.StageStyle; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CountDownLatch; - - -/** - * JavaFx启动动画窗口 - * - * @author vito - */ -public class SplashFxWindow extends Application { - - private static final String ARIAL_FONT_NAME = "Arial"; - private static final String PF_FONT_NAME = "PingFang"; - private static final String YAHEI_FONT_NAME = "Microsoft YaHei"; - private static final int MODULE_INFO_LEFT_MARGIN = 36; - private static final int MODULE_INFO_BOTTOM_MARGIN = 28; - private static final int THINKS_BOTTOM_RIGHT = 35; - private static final int THINKS_BOTTOM_MARGIN = 27; - private static final int WINDOW_WIDTH = 640; - private static final int WINDOW_HEIGHT = 360; - private static final int FONT = 12; - private static final int FRAME_COUNT = 315; - private static final String THINKS_COLOR = "#82b1ce"; - - private static final CountDownLatch LATCH = new CountDownLatch(1); - private static SplashFxWindow app = null; - - private Text moduleInfo; - private Text thanks; - private FastGifImage image; - private List listeners = new ArrayList(); - - /** - * 获取当前运行实例。黑科技 - * - * @return 运行实例 - */ - @SuppressWarnings("squid:S2142") - public static SplashFxWindow waitForStartUpTest() { - try { - LATCH.await(); - } catch (InterruptedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return app; - } - - private static void setApp(SplashFxWindow window) { - app = window; - LATCH.countDown(); - } - - public SplashFxWindow() { - setApp(this); - } - - @Override - public void start(Stage primaryStage) { - AnchorPane root = new AnchorPane(); - primaryStage.initStyle(StageStyle.TRANSPARENT); - image = new FastGifImage(SplashContext.SPLASH_PATH, FRAME_COUNT, WINDOW_WIDTH, WINDOW_HEIGHT); - - ImageView gif = new ImageView(image); - - AnchorPane.setBottomAnchor(gif, 0d); - AnchorPane.setTopAnchor(gif, 0d); - AnchorPane.setLeftAnchor(gif, 0d); - AnchorPane.setRightAnchor(gif, 0d); - Font font; - if (OperatingSystem.isWindows()) { - font = new Font(YAHEI_FONT_NAME, FONT); - } else if (OperatingSystem.isMacOS()) { - font = new Font(PF_FONT_NAME, FONT); - } else { - font = new Font(ARIAL_FONT_NAME, FONT); - } - - moduleInfo = new Text(); - moduleInfo.setFont(font); - moduleInfo.setFill(Color.WHITE); - AnchorPane.setLeftAnchor(moduleInfo,(double) MODULE_INFO_LEFT_MARGIN); - AnchorPane.setBottomAnchor(moduleInfo,(double) MODULE_INFO_BOTTOM_MARGIN); - thanks = new Text(); - thanks.setFont(font); - thanks.setFill(Color.valueOf(THINKS_COLOR)); - AnchorPane.setRightAnchor(thanks, (double) THINKS_BOTTOM_RIGHT); - AnchorPane.setBottomAnchor(thanks, (double) THINKS_BOTTOM_MARGIN); - - root.getChildren().add(gif); - root.getChildren().add(moduleInfo); - root.getChildren().add(thanks); - - primaryStage.setWidth(WINDOW_WIDTH); - primaryStage.setHeight(WINDOW_HEIGHT); - primaryStage.setScene(new Scene(root, WINDOW_WIDTH, WINDOW_HEIGHT, null)); - setWindowCenter(primaryStage); - primaryStage.show(); - } - - public void close() { - Platform.runLater(new Runnable() { - @Override - public void run() { - try { - ((Stage) moduleInfo.getScene().getWindow()).close(); - image.destroy(); - fireSplashClose(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - }); - } - - /** - * 设置窗口居中 - * - * @param stage 窗口 - */ - private void setWindowCenter(Stage stage) { - Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); - stage.setX(primaryScreenBounds.getMinX() + (primaryScreenBounds.getWidth() - stage.getWidth()) / 2.0); - stage.setY(primaryScreenBounds.getMinY() + (primaryScreenBounds.getHeight() - stage.getHeight()) / 2.0); - } - - /** - * 更新模块信息 - * - * @param s 文字 - */ - public void updateModuleInfo(final String s) { - Platform.runLater(new Runnable() { - @Override - public void run() { - if (moduleInfo != null) { - moduleInfo.setText(s); - } - } - }); - - } - - /** - * 更新欢迎信息 - * - * @param s 文字 - */ - public void updateThanks(final String s) { - Platform.runLater(new Runnable() { - @Override - public void run() { - if (thanks != null) { - thanks.setText(s); - } - } - }); - - } - - /** - * 添加一个动画状态监听 - * - * @param listener - */ - public void addSplashActionListener(SplashFxActionListener listener) { - listeners.add(listener); - } - - public void fireSplashClose() { - for (SplashFxActionListener listener : listeners) { - listener.splashClose(); - } - } -} diff --git a/designer-realize/src/main/java/com/fr/start/jni/SplashJNI.java b/designer-realize/src/main/java/com/fr/start/jni/SplashJNI.java deleted file mode 100644 index e71a44ca21..0000000000 --- a/designer-realize/src/main/java/com/fr/start/jni/SplashJNI.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.fr.start.jni; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; - -/** - * Splash JNI调用。jni类改名或者移包之后 - * 必须重新编译动态库 - * - * @author vito - * @date 2018/6/4 - */ -public class SplashJNI { - - static { - try { - System.setProperty("java.library.path", "."); - System.loadLibrary("splash"); - } catch (UnsatisfiedLinkError e) { - loadLibraryFromJar("/com/fr/start/jni/splash.dylib"); - } - } - - /** - * 显示启动动画窗口 - */ - public native void show(String path); - - /** - * 隐藏启动动画窗口 - */ - public native void hide(); - - /** - * 设置模块加载信息 - */ - public native void updateModuleLog(String text); - - /** - * 设置感谢文字 - */ - public native void updateThanksLog(String text); - - /** - * 从jar中加载动态库 - * - * @param path 路径,如/com/a/b - * @throws UnsatisfiedLinkError 没有找到合适的动态库 - */ - private static void loadLibraryFromJar(String path) throws UnsatisfiedLinkError { - try (InputStream inputStream = SplashJNI.class.getResourceAsStream(path)) { - File tempLib = File.createTempFile(path, ""); - - byte[] buffer = new byte[1024]; - int read = -1; - - try (FileOutputStream fileOutputStream = new FileOutputStream(tempLib)) { - while ((read = inputStream.read(buffer)) != -1) { - fileOutputStream.write(buffer, 0, read); - } - } - - System.load(tempLib.getAbsolutePath()); - } catch (Exception e) { - throw new UnsatisfiedLinkError("Unable to open " + path + " from jar file."); - } - } -} diff --git a/designer-realize/src/main/java/com/fr/start/jni/SplashMac.java b/designer-realize/src/main/java/com/fr/start/jni/SplashMac.java deleted file mode 100644 index 6d2a47a2e8..0000000000 --- a/designer-realize/src/main/java/com/fr/start/jni/SplashMac.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.fr.start.jni; - -import com.fr.log.FineLoggerFactory; -import com.fr.stable.ProductConstants; -import com.fr.stable.StableUtils; -import com.fr.stable.StringUtils; -import com.fr.start.SplashContext; -import com.fr.start.SplashStrategy; - -import javax.swing.JFrame; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -/** - * mac上使用jni方式绘制gif。不使用javafx有两个原因: - * 1.mac上javafx和swing同时启动会导致卡死; - * 2.platform.exit会导致设计器崩溃 - * - * @author vito - * @see com.fr.start.fx.SplashFx - */ -public class SplashMac implements SplashStrategy { - - - private SplashJNI jni; - private static final int EXILE = 10000; - - public SplashMac() { - jni = new SplashJNI(); - } - - /** - * 将jar中的资源拷贝到缓存文件夹 - * - * @return 路径 - */ - private static String loadResFromJar() { - File tempLib = null; - try (InputStream inputStream = SplashContext.class.getResourceAsStream(SplashContext.SPLASH_PATH)) { - if (inputStream == null) { - FineLoggerFactory.getLogger().error("Unable to copy " + SplashContext.SPLASH_PATH + " from jar file."); - return StringUtils.EMPTY; - } - tempLib = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SplashContext.SPLASH_CACHE_NAME)); - byte[] buffer = new byte[1024]; - int read = -1; - try (FileOutputStream fileOutputStream = new FileOutputStream(tempLib)) { - while ((read = inputStream.read(buffer)) != -1) { - fileOutputStream.write(buffer, 0, read); - } - } - return tempLib.getAbsolutePath(); - } catch (IOException e) { - if (tempLib != null) { - tempLib.deleteOnExit(); - } - // 直接抛异常 - throw new RuntimeException("Unable to copy " + SplashContext.SPLASH_PATH + " from jar file."); - } - } - - @Override - public void show() { - if (jni != null) { - // mac下安装版模糊的hack - JFrame jFrame = new JFrame(); - jFrame.setLocation(EXILE, EXILE); - jFrame.setVisible(true); - jFrame.setVisible(false); - File splash = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SplashContext.SPLASH_CACHE_NAME)); - String path = splash.exists() ? splash.getAbsolutePath() : loadResFromJar(); - jni.show(path); - } - } - - @Override - public void hide() { - if (jni != null) { - jni.hide(); - jni = null; - } - } - - @Override - public void updateModuleLog(String text) { - if (jni != null) { - jni.updateModuleLog(text); - } - - } - - @Override - public void updateThanksLog(String text) { - if (jni != null) { - jni.updateThanksLog(text); - } - } -} diff --git a/designer-realize/src/main/resources/com/fr/start/jni/splash.dylib b/designer-realize/src/main/resources/com/fr/start/jni/splash.dylib deleted file mode 100755 index 6ae677da37199ce7ebe825dbb5590452bdb081dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 57200 zcmeHwd3+Q_`gc!~fdImUBP=3l5D-v~Odybekqk+&Mc6UrxT9-y??x)&+naq z?yBdgr>dTM>UyfX^V#X|&vuj~L#!l89dPx;)p&^{)k_J8Nz$dbN!us;f%jU_J z^FSgvPQ=>_?DmR++Y9aGPH&0JQSNNh9w&vozY8HMtjdZgE0987VVT3@A%XhxeQf0^ zZxjMl_yY2%eBSEHw&lC>2A*=B5TL^6mRIQUx=UU21%tkP_Xv3(lHuZ~!W`1I4Ul&G z{K7)Jv#QWp>9u$o1ncB!i--1Q<4S3{W4@D2Szq53y7CcxK08+Rrw)F4c`JpyOi?I; zFQR-NXPMhsjNx7{FEEQ&CruQJV68lKDODAWQIwDAk0k2lCC%aT)Iu6Wrav^VpNJa4Z<%LAGD=+OPAxMk|1fO4CVMTd)g-fJrV=rkpbBd}zg0%8P zHfnODFYts{8Ex$^Q^>2)bPDY}u9rvSyo}3kw^^r7$;r0P6j{v^VNE1l`8y8NxTlrX z6>u7^J|R3&4bmu|$33d7qR>$`s;sntE~j&3Q8hx4@w-xzYLY23kC#J6s9ku-MUs?+ zPE%4UNi85zwJ49q+a>8!gq78jwDU4a>Vmjx)1)7|sEl{uQmce$n_uN(6rc@Ok|2`h z;2AZ!!smj~l~%Y$7OU7%vz=}aFrHCa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7Ov{a`w-gkVLv3^*u2YP+|+vnbKKh^xq z7LO`Q8-7|l^5?&0j+=OI_26UgWI7TC?%F%2!`~hq)i`bE&4JH~|7Gy+y6UCbA3ZpI z&yA-VyZ3(em49|@c{u%m`ObI0T(f%6QQ5aSE#>Ee+SnT^C!{@p>)@e-K41J^pP%wS z^Zu=A!1^U0j#_os@0R`hwc@g?@B8h@Z9YrO%i~Tj{$}%V*NKnbo3r-vnY*Wt9%4BD zR_C}Kn-fY4Z{F1V`Wc@rX}WXZYjrJN5p&zbkWZF{>!%hXNc?Zdrx%!t~3+sBt0^93Dxe^sFqI7BUGCd^FLPY^6I3f53a6V-17BjODdXvm$1IeRcm*A_V$L|8#+qa{iY=^Iz8{!Nk0th zoR)ptO}{29DU-6zpFMTuUek@wANr5EHetU~w91gMe$RDp#l7_YyTv2kK7H*kY13nvv-$Q98)%V zw*BSM(<6UL2zKq!Yry92YyQyt4&#GA4_z?r^d5TdjD4u2J@rO$Q4K^j5Y<3b15ph` zH4xQ6R0B~BL^TlAKvV-!4Ma5%)j(7OQ4K^j5Y<3b15ph`H4xQ6R0B~BL^TlAKvV-! z4Ma5%)j(7OQ4K^j5Y<3b15ph`H4xQ6R0B~BL^TlAKvV-!4Ma5%)j(7OQ4K^j5Y<3b v15ph`H4xQ6R0B~BL^TlAKvV-!4Ma5%)j(7OQ4K^j5Y<3b15pj=H1K}_*AGgV From 48d6dc686ca358efd0892b6a6125a05860e847a1 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Tue, 1 Sep 2020 12:12:21 +0800 Subject: [PATCH 09/10] =?UTF-8?q?REPORT-36985=20=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E7=82=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/widget/topxcreator/TopXCreator.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java index 52bae99f17..42371a44f9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/topxcreator/TopXCreator.java @@ -42,16 +42,8 @@ public class TopXCreator extends BasicTopXCreator { * 依据鼠标事件和visible设置是否显示蒙层 * */ public void displayCoverPane(MouseEvent event, boolean visible) { - if (!visible) { - setVisible(false); - return; - } - Rectangle rect = getBounds(); - if (rect.contains(event.getX(), event.getY())) { - coverPanel.setVisible(true); - } else { - coverPanel.setVisible(false); - } + boolean isVisible = visible && getBounds().contains(event.getX(), event.getY()); + coverPanel.setVisible(isVisible); } } From f1b091ce26c9a09f508a43a992131f47a1d6197b Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 2 Sep 2020 11:33:04 +0700 Subject: [PATCH 10/10] REPORT-38647 && REPORT-38357 --- .../fr/design/mainframe/DesignerFrameFileDealerPane.java | 2 +- .../designer/treeview/ComponentTreeCellRenderer.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index bcac7f946c..a9d9281e99 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -856,7 +856,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt BorderLayout.CENTER); - this.setSize(340, 180); + this.setSize(380, 180); this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Mkdir")); this.setResizable(false); this.setAlwaysOnTop(true); diff --git a/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java b/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java index 16ec4405df..78b606a7fc 100644 --- a/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java +++ b/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java @@ -4,6 +4,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.ilable.UILabel; +import com.fr.log.FineLoggerFactory; import javax.swing.Icon; import javax.swing.JTree; @@ -23,7 +24,12 @@ public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer { if (value instanceof XCreator) { String name = ((XCreator) value).toData().getWidgetName(); setText(name); - Icon icon = XCreatorUtils.getCreatorIcon((XCreator) value); + Icon icon = null; + try { + icon = XCreatorUtils.getCreatorIcon((XCreator) value); + } catch (Exception e) { + FineLoggerFactory.getLogger().info("{} has not icon or has been deleted", name); + } if (icon != null) { setIcon(icon); }