From 741fb208f77253b0fa80c07b32635c9e16da15bf Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 14 Jul 2021 19:59:59 +0800 Subject: [PATCH 01/50] =?UTF-8?q?REPORT-52641=20=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E9=9C=80=E8=A6=81=E9=99=90=E5=88=B6?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledatapane/FileTableDataPane.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java index 6eb802619f..4c9ad3cb58 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java @@ -26,6 +26,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -612,7 +613,7 @@ public class FileTableDataPane extends AbstractTableDataPane { private void setTextField(FileTableData ob) { if (ob.getFilePath() != null) { - if (ob.getFilePath().indexOf("http") != -1) { + if (ob.getFilePath().contains("http")) { urlRadioSelectAction(); urlText.setText(ob.getFilePath()); } else { @@ -625,6 +626,15 @@ public class FileTableDataPane extends AbstractTableDataPane { @Override public FileTableData updateBean() { String filePath = getFilePathFromUrlOrLocal(); + // 安全要求禁止 file 协议访问本地磁盘 + if (FileTableData.isInvalidFilePath(filePath)) { + JOptionPane.showMessageDialog(this, + Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid"), + Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip"), + JOptionPane.ERROR_MESSAGE); + // 阻止对话框关闭 + throw new RuntimeException(Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid")); + } if (StringUtils.isNotBlank(filePath)) { this.params = getEditorPaneParameter().length == 0 ? null : getEditorPaneParameter(); if (fileTypeComboBox.getSelectedIndex() == EXCEL) { @@ -786,6 +796,14 @@ public class FileTableDataPane extends AbstractTableDataPane { if (this.fileTableData == null) { return; } + String filePath = getFilePathFromUrlOrLocal(); + if (FileTableData.isInvalidFilePath(filePath)) { + JOptionPane.showMessageDialog(this, + Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid"), + Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip"), + JOptionPane.ERROR_MESSAGE); + return; + } PreviewTablePane.previewTableData(this.updateBean()); } @@ -802,7 +820,7 @@ public class FileTableDataPane extends AbstractTableDataPane { xmlNodeTree = new XMLNodeTree(); this.add(new JScrollPane(xmlNodeTree)); - keyPointLaber = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Key_Point") + ":"); + keyPointLaber = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Key_Point") + ":"); refreshAction = new RefreshParameterAction(); ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(refreshAction); @@ -820,7 +838,7 @@ public class FileTableDataPane extends AbstractTableDataPane { private class RefreshParameterAction extends UpdateAction { public RefreshParameterAction() { - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh")); + this.setName(Toolkit.i18nText("Fine-Design_Basic_Refresh")); this.setMnemonic('r'); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); } From e25091c0ccc7ecca11639784d1b40ad3e7ff170f Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 15 Jul 2021 09:29:37 +0800 Subject: [PATCH 02/50] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/tabledata/tabledatapane/FileTableDataPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java index 4c9ad3cb58..5d9d4146d6 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java @@ -628,7 +628,7 @@ public class FileTableDataPane extends AbstractTableDataPane { String filePath = getFilePathFromUrlOrLocal(); // 安全要求禁止 file 协议访问本地磁盘 if (FileTableData.isInvalidFilePath(filePath)) { - JOptionPane.showMessageDialog(this, + FineJOptionPane.showMessageDialog(this, Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid"), Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip"), JOptionPane.ERROR_MESSAGE); @@ -798,7 +798,7 @@ public class FileTableDataPane extends AbstractTableDataPane { } String filePath = getFilePathFromUrlOrLocal(); if (FileTableData.isInvalidFilePath(filePath)) { - JOptionPane.showMessageDialog(this, + FineJOptionPane.showMessageDialog(this, Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid"), Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip"), JOptionPane.ERROR_MESSAGE); From 1c6d9217cea3eeec4d9e5a47e3765dcc91ea8438 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 15 Jul 2021 10:16:38 +0800 Subject: [PATCH 03/50] =?UTF-8?q?REPORT-55178=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=AE=BE=E8=AE=A1=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E7=8E=B0=E5=9C=A8=E9=9C=80=E8=A6=81=E7=82=B9?= =?UTF-8?q?=E4=B8=A4=E4=B8=8B=E9=80=89=E4=B8=AD=E7=BB=84=E4=BB=B6=E6=89=8D?= =?UTF-8?q?=E8=83=BD=E5=87=BA=E7=8E=B0=E5=B7=A5=E5=85=B7=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/EditingMouseListener.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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 8a2bdcc6cc..1c14d739aa 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 @@ -631,9 +631,16 @@ public class EditingMouseListener extends MouseInputAdapter { selectionModel.selectACreatorAtMouseEvent(e); refreshTopXCreator(); XCreator[] xCreators = selectionModel.getSelection().getSelectedCreators(); - for (XCreator xCreator : xCreators) { - xCreator.setSelected(true); - } + // 放到事件队尾执行 + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + for (XCreator xCreator : xCreators) { + xCreator.setSelected(true); + } + } + }); + } else if (clickedNonCardButton && responseTabLayout(oldCreator, e)) { // do nothing } else { From 428e1e63b11cbfa3feba77a0c46b13e47f99e412 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 15 Jul 2021 10:48:45 +0800 Subject: [PATCH 04/50] =?UTF-8?q?REPORT-55188=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E7=BB=84=E4=BB=B6=E7=9B=AE=E5=BD=95=E6=A0=91?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E7=BB=84=E4=BB=B6=E5=BA=94=E4=B9=9F=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E4=B8=8B=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=B7=A5=E5=85=B7=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/ComponentTree.java | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) 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 134252487c..d96162559a 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 @@ -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.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.treeview.ComponentTreeCellRenderer; import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.design.file.HistoryTemplateListCache; @@ -378,22 +379,30 @@ public class ComponentTree extends JTree { @Override public void mouseClicked(MouseEvent e) { - // 鼠标左键 双击 - if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !designer.isFormParaDesigner()) { - Point p = e.getPoint(); - // 解析组件树路径 获取选中的组件 - int selRow = tree.getRowForLocation(p.x, p.y); - TreePath path = tree.getPathForRow(selRow); - Rectangle bounds = tree.getPathBounds(path); - if (bounds != null) { - Point point = bounds.getLocation(); - SwingUtilities.convertPointToScreen(point, tree); - XCreator comp = (XCreator) path.getLastPathComponent(); + Point p = e.getPoint(); + // 解析组件树路径 获取选中的组件 + int selRow = tree.getRowForLocation(p.x, p.y); + TreePath path = tree.getPathForRow(selRow); + Rectangle bounds = tree.getPathBounds(path); + if (bounds != null) { + Point point = bounds.getLocation(); + SwingUtilities.convertPointToScreen(point, tree); + XCreator comp = (XCreator) path.getLastPathComponent(); + // 鼠标左键 双击 + if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !designer.isFormParaDesigner()) { startEditing(comp, e); + } else if (e.getClickCount() == 1 && e.getButton() == MouseEvent.BUTTON1) { + showSelectedPopup(comp); } } } + private void showSelectedPopup(XCreator comp) { + Rectangle rectangle = getRelativeBounds(comp); + comp.showSelectedPopup(designer, rectangle, comp.acceptType(XWTitleLayout.class)); + comp.setSelected(true); + } + /** * 组件进入编辑状态 * From 2428f726947ac7e5376312af636e99c3b21de888 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 15 Jul 2021 11:13:16 +0800 Subject: [PATCH 05/50] =?UTF-8?q?REPORT-55188=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E7=BB=84=E4=BB=B6=E7=9B=AE=E5=BD=95=E6=A0=91?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E7=BB=84=E4=BB=B6=E5=BA=94=E4=B9=9F=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E4=B8=8B=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=B7=A5=E5=85=B7=E6=A0=8F=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/ComponentTree.java | 58 +++++++++++++++---- 1 file changed, 46 insertions(+), 12 deletions(-) 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 d96162559a..37094494b4 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 @@ -17,6 +17,7 @@ import com.fr.stable.StringUtils; import java.awt.Rectangle; import java.awt.event.MouseListener; import java.util.Stack; +import java.util.function.Consumer; import javax.swing.BorderFactory; import javax.swing.DropMode; import javax.swing.JPanel; @@ -350,6 +351,7 @@ public class ComponentTree extends JTree { private final class ComponetTreeMouseListener extends MouseAdapter { private final JTree tree; + private XCreator selectedCreator; private ComponetTreeMouseListener(JTree tree) { this.tree = tree; @@ -379,6 +381,49 @@ public class ComponentTree extends JTree { @Override public void mouseClicked(MouseEvent e) { + onMouseEvent(e, new Consumer() { + @Override + public void accept(XCreator creator) { + if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !designer.isFormParaDesigner()) { + startEditing(creator, e); + } + } + }); + + } + + @Override + public void mousePressed(MouseEvent e) { + onMouseEvent(e, new Consumer() { + @Override + public void accept(XCreator creator) { + if (e.getButton() == MouseEvent.BUTTON1) { + selectedCreator = creator; + } + } + }); + } + + @Override + public void mouseReleased(MouseEvent e) { + if (e.getButton() == MouseEvent.BUTTON1 && selectedCreator != null) { + showSelectedPopup(selectedCreator); + } + } + + private void showSelectedPopup(XCreator comp) { + Rectangle rectangle = getRelativeBounds(comp); + comp.showSelectedPopup(designer, rectangle, comp.acceptType(XWTitleLayout.class)); + comp.setSelected(true); + } + + /** + * 响应鼠标事件并解析选中的组件 + * + * @param e + * @param consumer + */ + private void onMouseEvent(final MouseEvent e, Consumer consumer) { Point p = e.getPoint(); // 解析组件树路径 获取选中的组件 int selRow = tree.getRowForLocation(p.x, p.y); @@ -388,21 +433,10 @@ public class ComponentTree extends JTree { Point point = bounds.getLocation(); SwingUtilities.convertPointToScreen(point, tree); XCreator comp = (XCreator) path.getLastPathComponent(); - // 鼠标左键 双击 - if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !designer.isFormParaDesigner()) { - startEditing(comp, e); - } else if (e.getClickCount() == 1 && e.getButton() == MouseEvent.BUTTON1) { - showSelectedPopup(comp); - } + consumer.accept(comp); } } - private void showSelectedPopup(XCreator comp) { - Rectangle rectangle = getRelativeBounds(comp); - comp.showSelectedPopup(designer, rectangle, comp.acceptType(XWTitleLayout.class)); - comp.setSelected(true); - } - /** * 组件进入编辑状态 * From 04af5fc75a79d21174d685b288d2afc04b0fc2d0 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 13 Jul 2021 17:51:41 +0800 Subject: [PATCH 06/50] =?UTF-8?q?REPORT-53175=20=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 子功能:图片边框 【问题原因】 交互重新设计 【改动思路】 【review建议】 --- .../design/images/transparent_background.jpg | Bin 24869 -> 0 bytes .../gui/xpane/BorderLineAndImagePane.java | 246 +++++++++++++----- 2 files changed, 183 insertions(+), 63 deletions(-) delete mode 100644 designer-base/src/main/resources/com/fr/design/images/transparent_background.jpg diff --git a/designer-base/src/main/resources/com/fr/design/images/transparent_background.jpg b/designer-base/src/main/resources/com/fr/design/images/transparent_background.jpg deleted file mode 100644 index b04da96ea64527351d96ba579a8195ffa940a785..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24869 zcmeI)KS&!<9KiASJk6go*W@5tjL3zkZK!pSYNHVwF*UYs6%i^3LJJkUYnOtHQbZ{2 zE?B#iwsw#@>7e4EOL0*AQ(ElSC9OjzmouldHlvUe zXYOZ&lu``lUc&w=(!%fY`n(>$&+F55f2mO(Gy(ymGF%oak5=oI#|n>qfwc1cQ-8tyP;i_hK&#()PBIDjB{rvDlt{ zSn=&g_s6MUhqHAL{xt2&{+Dk)ZMODhMxXV3sBT?~Pi{RoM#lOWm_woBzoO&xY#Qt2 zY+>SH4lN`n(Gz>_6=Ms`a>Y@|i!ab(rY_`6O+@i81_CV=qX5EW_cI2d1zMoxO5zT* zK#Sb28)#GSTA&45paoi>#mz}*sI-REw8-MAoyBvlNuNjyTa>n?-L0GCK?}4%i$)9@F=)h~ z5rakyG*nwdA}t~E+QPZNPg@#INNP3WfNbP`#nid2oO@M2qC)WlBEzkn3 bi>hg@_j_)iJ(`_&f1iG@=8=f5NPF)X8B;4H diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index fcd9ed0103..6c19c9a63f 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -20,6 +20,7 @@ import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UIIntNumberField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -44,11 +45,13 @@ import javax.swing.plaf.basic.BasicButtonUI; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; +import java.awt.geom.Line2D; import java.awt.geom.RoundRectangle2D; -import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.URI; @@ -65,7 +68,7 @@ import java.util.Arrays; public class BorderLineAndImagePane extends JPanel implements UIObserver { private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH; private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); - private final String TWEAK_NINE_POINT_HELP_URL = ""; + private final String TWEAK_NINE_POINT_HELP_URL = "https://help.fanruan.com/finereport/doc-view-4135.html"; private UIObserverListener uiObserverListener; @@ -415,18 +418,11 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { private void initComponents() { setLayout(new BorderLayout()); - setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Image_Config_Nine_Point_Fill_Preview"))); + setBorder(BorderFactory.createEmptyBorder()); + add(previewPane, BorderLayout.CENTER); - JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane(); - content.setBorder(BorderFactory.createEmptyBorder( - IntervalConstants.INTERVAL_W1, - IntervalConstants.INTERVAL_W1, - IntervalConstants.INTERVAL_W1, - IntervalConstants.INTERVAL_W1)); - content.add(previewPane); - previewPane.setPreferredSize(new Dimension(611, 457)); - - add(content, BorderLayout.CENTER); + previewPane.setPreferredSize(new Dimension(615, 462)); + previewPane.setBorder(BorderFactory.createEmptyBorder()); } @Override @@ -436,18 +432,23 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { } private class NinePointLinePreviewPane extends JPanel implements MouseMotionListener, MouseListener { - private final BufferedImage transparentImage = IOUtils.readImage("/com/fr/design/images/transparent_background.jpg"); - - public final Color PATCH_COLOR = new Color(0, 0, 0, 38); - public final Color DIVIDER_COLOR = new Color(250, 250, 250); - public final Color TEXT_COLOR = Color.WHITE; - public final int PADDING = 15; + public final Color BACKGROUND_PANE_COLOR = Color.WHITE; + public final Color BACKGROUND_IMG_COLOR = Color.lightGray; + public final Color DIVIDER_BACKGROUND_COLOR = Color.WHITE; + public final Color DIVIDER_FOREGROUND_COLOR = Color.BLACK; + public final Color HINT_BACKGROUND_COLOR = new Color(255, 255, 255, 100); + public final Color HINT_FOREGROUND_COLOR = Color.RED; + public final Color HINT_LINE_BACKGROUND_COLOR = Color.WHITE; + public final Color HINT_LINE_FOREGROUND_COLOR = Color.RED; + public final int PADDING = 20; private int ninePointLeft = -1; private int ninePointTop = -1; private int ninePointRight = -1; private int ninePointBottom = -1; + private static final int MIN_NINE_POINT = 0; + private int imgWidth; private int imgHeight; private int scaleImgWidth; @@ -456,9 +457,52 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { private int scaleImgY; private double scale = 1.0; + private final UIIntNumberField topField = createNumberField(); + private final UIIntNumberField bottomField = createNumberField(); + private final UIIntNumberField leftField = createNumberField(); + private final UIIntNumberField rightField = createNumberField(); + public NinePointLinePreviewPane() { + this.setLayout(null); this.addMouseMotionListener(this); this.addMouseListener(this); + this.setFocusable(true); + this.add(topField); + this.add(bottomField); + this.add(leftField); + this.add(rightField); + + topField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + int value = (int) topField.getValue(); + onNinePointTopChanged(value); + } + }); + + bottomField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + int value = (int) bottomField.getValue(); + onNinePointBottomChanged(value); + } + }); + + leftField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + int value = (int) leftField.getValue(); + onNinePointLeftChanged(value); + } + }); + + rightField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + int value = (int) rightField.getValue(); + onNinePointRightChanged(value); + } + }); } @Override @@ -466,7 +510,9 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; - g2d.drawImage(transparentImage, 0, 0, getWidth(), getHeight(), null); + + g2d.setColor(BACKGROUND_PANE_COLOR); + g2d.fillRect(0, 0, getWidth(), getHeight()); Image image = imagePreviewPane.getImage(); @@ -491,6 +537,8 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { scale = 1.0 * scaleImgHeight / imgHeight; } + g2d.setColor(BACKGROUND_IMG_COLOR); + g2d.fillRect(scaleImgX, scaleImgY, scaleImgWidth, scaleImgHeight); g2d.drawImage(image, scaleImgX, scaleImgY, scaleImgWidth, scaleImgHeight, null); int scaleLeft = (int) (ninePointLeft * scale); @@ -503,28 +551,45 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { double leftXInPane = scaleImgX + scaleLeft; double rightXInPane = scaleImgX + scaleImgWidth - scaleRight; - g2d.setColor(PATCH_COLOR); - // draw horizontal patch - GraphDrawHelper.fillRect(g2d, 0, topYInPane, getWidth(), scaleImgHeight - scaleTop - scaleBottom); - // draw vertical patch - GraphDrawHelper.fillRect(g2d, scaleImgX + scaleLeft, 0,scaleImgWidth - scaleLeft - scaleRight, getHeight()); - - g2d.setColor(DIVIDER_COLOR); - // draw top divider - GraphDrawHelper.drawLine(g2d, 0, topYInPane, getWidth(), topYInPane); - // draw bottom divider - GraphDrawHelper.drawLine(g2d, 0, bottomYInPane, getWidth(), bottomYInPane); - // draw left divider - GraphDrawHelper.drawLine(g2d, leftXInPane, 0, leftXInPane, getHeight()); - // draw right divider - GraphDrawHelper.drawLine(g2d, rightXInPane, 0, rightXInPane, getHeight()); - - g2d.setColor(TEXT_COLOR); - // draw nine point info - GraphDrawHelper.drawString(g2d, Integer.toString(ninePointTop), (leftXInPane + rightXInPane) / 2.0F, topYInPane / 2.0); - GraphDrawHelper.drawString(g2d, Integer.toString(ninePointBottom), (leftXInPane + rightXInPane) / 2.0F, (bottomYInPane + getHeight()) / 2.0); - GraphDrawHelper.drawString(g2d, Integer.toString(ninePointLeft), leftXInPane / 2.0, (topYInPane + bottomYInPane) / 2.0); - GraphDrawHelper.drawString(g2d, Integer.toString(ninePointRight), (rightXInPane + getWidth()) / 2.0, (topYInPane + bottomYInPane) / 2.0); + // 绘制分割线 + // 顶部 + drawLine(g2d, DIVIDER_BACKGROUND_COLOR, DIVIDER_FOREGROUND_COLOR, scaleImgX, topYInPane, scaleImgX + scaleImgWidth, topYInPane); + // 底部 + drawLine(g2d, DIVIDER_BACKGROUND_COLOR, DIVIDER_FOREGROUND_COLOR, scaleImgX, bottomYInPane, scaleImgX + scaleImgWidth, bottomYInPane); + // 左侧 + drawLine(g2d, DIVIDER_BACKGROUND_COLOR, DIVIDER_FOREGROUND_COLOR, leftXInPane, scaleImgY, leftXInPane, scaleImgY + scaleImgHeight); + // 右侧 + drawLine(g2d, DIVIDER_BACKGROUND_COLOR, DIVIDER_FOREGROUND_COLOR, rightXInPane, scaleImgY, rightXInPane, scaleImgY + scaleImgHeight); + + // 绘制分割线位置提示 + // 顶部 + drawLine(g2d, HINT_LINE_BACKGROUND_COLOR, HINT_LINE_FOREGROUND_COLOR, (leftXInPane + rightXInPane) / 2.0F, scaleImgY, (leftXInPane + rightXInPane) / 2.0F, topYInPane); + drawHint(g2d, Integer.toString(ninePointTop), (leftXInPane + rightXInPane) / 2.0F, (scaleImgY + topYInPane) / 2.0, topField); + // 底部 + drawLine(g2d, HINT_LINE_BACKGROUND_COLOR, HINT_LINE_FOREGROUND_COLOR, (leftXInPane + rightXInPane) / 2.0F, bottomYInPane, (leftXInPane + rightXInPane) / 2.0F, scaleImgY + scaleImgHeight); + drawHint(g2d, Integer.toString(ninePointBottom), (leftXInPane + rightXInPane) / 2.0F, (bottomYInPane + scaleImgY + scaleImgHeight) / 2.0, bottomField); + // 左侧 + drawLine(g2d, HINT_LINE_BACKGROUND_COLOR, HINT_LINE_FOREGROUND_COLOR, scaleImgX, (topYInPane + bottomYInPane) / 2.0, leftXInPane, (topYInPane + bottomYInPane) / 2.0); + drawHint(g2d, Integer.toString(ninePointLeft), (scaleImgX + leftXInPane) / 2.0, (topYInPane + bottomYInPane) / 2.0, leftField); + // 右侧 + drawLine(g2d, HINT_LINE_BACKGROUND_COLOR, HINT_LINE_FOREGROUND_COLOR, rightXInPane, (topYInPane + bottomYInPane) / 2.0, scaleImgX + scaleImgWidth, (topYInPane + bottomYInPane) / 2.0); + drawHint(g2d, Integer.toString(ninePointRight), (rightXInPane + scaleImgX + scaleImgWidth) / 2.0, (topYInPane + bottomYInPane) / 2.0, rightField); + } + + private void drawHint(Graphics2D g2d, String hint, double centerX, double centerY, UIIntNumberField hintField) { + FontMetrics metrics = GraphDrawHelper.getFontMetrics(g2d.getFont()); + double height = metrics.getAscent() + metrics.getDescent(); + double width = Math.max(metrics.stringWidth(" " + hint + " "), metrics.stringWidth(" 123 ")); + + hintField.setBounds((int) (centerX - width / 2.0), (int) (centerY - height / 2.0), (int) width, (int) height); + } + + private void drawLine(Graphics2D g2d, Color backgroundColor, Color foregroundColor, double x1, double y1, double x2, double y2) { + g2d.setColor(backgroundColor); + GraphDrawHelper.draw(g2d, new Line2D.Double(x1, y1, x2, y2), Constants.LINE_THIN, 2.0F); + + g2d.setColor(foregroundColor); + GraphDrawHelper.draw(g2d, new Line2D.Double(x1, y1, x2, y2), Constants.LINE_DASH, 1.0F); } @Override @@ -537,34 +602,22 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { switch (cursorType) { case Cursor.W_RESIZE_CURSOR: { int nextLeft = (int) ((x - scaleImgX) / scale); - if (1 <= nextLeft && nextLeft < imgWidth - ninePointRight) { - ninePointLeft = nextLeft; - repaint(); - } + this.onNinePointLeftChanged(nextLeft); return; } case Cursor.E_RESIZE_CURSOR: { int nextRight = (int) ((scaleImgX + scaleImgWidth - x) / scale); - if (1 <= nextRight && nextRight < imgWidth - ninePointLeft) { - ninePointRight = nextRight; - repaint(); - } + this.onNinePointRightChanged(nextRight); return; } case Cursor.N_RESIZE_CURSOR: { int nextTop = (int) ((y - scaleImgY) / scale); - if (1 <= nextTop && nextTop < imgHeight - ninePointBottom) { - ninePointTop = nextTop; - repaint(); - } + this.onNinePointTopChanged(nextTop); return; } case Cursor.S_RESIZE_CURSOR: { int nextBottom = (int) ((scaleImgY + scaleImgHeight - y) / scale); - if (1 <= nextBottom && nextBottom < imgHeight - ninePointTop) { - ninePointBottom = nextBottom; - repaint(); - } + this.onNinePointBottomChanged(nextBottom); } } } @@ -584,10 +637,17 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { // determine cursor int cursorType = Cursor.DEFAULT_CURSOR; - boolean hoveringLeftDivider = Math.abs(x - (scaleImgX + scaleLeft)) < 2; - boolean hoveringRightDivider = Math.abs(x - (scaleImgX + scaleImgWidth - scaleRight)) < 2; - boolean hoveringTopDivider = Math.abs(y - (scaleImgY + scaleTop)) < 2; - boolean hoveringBottomDivider = Math.abs(y - (scaleImgY + scaleImgHeight - scaleBottom)) < 2; + boolean hoveringLeftDivider = false; + boolean hoveringRightDivider = false; + boolean hoveringTopDivider = false; + boolean hoveringBottomDivider = false; + + if (scaleImgX - 2 <= x && x <= scaleImgX + scaleImgWidth + 2 && scaleImgY - 2 <= y && y <= scaleImgY + scaleImgHeight + 2) { + hoveringLeftDivider = Math.abs(x - (scaleImgX + scaleLeft)) < 2; + hoveringRightDivider = Math.abs(x - (scaleImgX + scaleImgWidth - scaleRight)) < 2; + hoveringTopDivider = Math.abs(y - (scaleImgY + scaleTop)) < 2; + hoveringBottomDivider = Math.abs(y - (scaleImgY + scaleImgHeight - scaleBottom)) < 2; + } if (hoveringLeftDivider) { cursorType = Cursor.W_RESIZE_CURSOR; @@ -609,7 +669,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { @Override public void mouseClicked(MouseEvent e) { - + requestFocus(); } @Override @@ -634,12 +694,72 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { } + private void onNinePointTopChanged(int value) { + if (value < MIN_NINE_POINT) { + value = MIN_NINE_POINT; + } else if (value >= imgHeight - ninePointBottom) { + value = imgHeight - ninePointBottom - MIN_NINE_POINT; + } + this.ninePointTop = value; + topField.setText(Integer.toString(value)); + repaint(); + } + + private void onNinePointBottomChanged(int value) { + if (value < MIN_NINE_POINT) { + value = MIN_NINE_POINT; + } else if (value >= imgHeight - ninePointTop) { + value = imgHeight - ninePointTop - MIN_NINE_POINT; + } + this.ninePointBottom = value; + bottomField.setText(Integer.toString(value)); + repaint(); + } + + private void onNinePointLeftChanged(int value) { + if (value < MIN_NINE_POINT) { + value = MIN_NINE_POINT; + } else if (value >= imgWidth - ninePointRight) { + value = imgWidth - ninePointRight - MIN_NINE_POINT; + } + this.ninePointLeft = value; + leftField.setText(Integer.toString(value)); + repaint(); + } + + private void onNinePointRightChanged(int value) { + if (value < MIN_NINE_POINT) { + value = MIN_NINE_POINT; + } else if (value >= imgWidth - ninePointLeft) { + value = imgWidth - ninePointLeft - MIN_NINE_POINT; + } + this.ninePointRight = value; + rightField.setText(Integer.toString(value)); + repaint(); + } + + private UIIntNumberField createNumberField() { + UIIntNumberField field = new UIIntNumberField(); + field.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1)); + field.setOpaque(true); + field.setMinValue(MIN_NINE_POINT); + field.setForeground(HINT_FOREGROUND_COLOR); + field.setBackground(HINT_BACKGROUND_COLOR); + field.setHorizontalAlignment(SwingConstants.CENTER); + return field; + } + public void setNinePoint(int[] ninePoint) { ninePointLeft = ninePoint[0]; ninePointTop = ninePoint[1]; ninePointRight = ninePoint[2]; ninePointBottom = ninePoint[3]; + + leftField.setValue(ninePointLeft); + rightField.setValue(ninePointRight); + topField.setValue(ninePointTop); + bottomField.setValue(ninePointBottom); } public int[] getNinePoint() { From c1e56841e16f55ea25b1a02dd0433f4e81809e1b Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 13 Jul 2021 18:30:18 +0800 Subject: [PATCH 07/50] =?UTF-8?q?REPORT-55211=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E5=9B=BE=E8=A1=A8=E5=9D=97=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E5=8B=BE=E9=80=89=E6=A0=87=E9=A2=98=E5=8F=AF=E8=A7=81?= =?UTF-8?q?=EF=BC=8C=E8=AE=BE=E7=BD=AE=E7=9A=84=E4=B8=BB=E4=BD=93=E8=83=8C?= =?UTF-8?q?=E6=99=AF=EF=BC=88=E9=A2=9C=E8=89=B2/=E6=B8=90=E5=8F=98?= =?UTF-8?q?=E8=89=B2/=E5=9B=BE=E7=89=87=EF=BC=89=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E7=95=8C=E9=9D=A2=E9=87=8C=E4=BC=9A=E9=81=AE?= =?UTF-8?q?=E7=9B=96=E4=BD=8F=E5=9B=BE=E8=A1=A8=EF=BC=8C=E5=8F=AF=E8=A7=81?= =?UTF-8?q?=E5=9B=BE=E3=80=82web=E6=95=88=E6=9E=9C=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 子功能: 设计器组件样式主体背景预览 【问题原因】 图表重写了paint方法,导致super.paint中的背景绘制在了图表图片上方 【改动思路】 将XBorderStyleWidgetCreator中的paint方法分成若干部分: clipByRoundedBorder: 圆角裁剪 paintBackground: 绘制背景 paintForeground: 绘制前景内容(在背景上方的组件内容) 图表可通过重写paintForeground方法实现之前的逻辑,同时保证内容不被背景遮盖 【review建议】 --- .../design/designer/creator/XAutoChartCreator.java | 8 ++++---- .../designer/creator/XBorderStyleWidgetCreator.java | 13 ++++++------- .../fr/design/designer/creator/XChartEditor.java | 11 ++++------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XAutoChartCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XAutoChartCreator.java index ec132a206d..4c5b669b48 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XAutoChartCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XAutoChartCreator.java @@ -18,8 +18,7 @@ import com.fr.stable.bridge.StableFactory; import javax.swing.JComponent; import javax.swing.JPanel; -import java.awt.Dimension; -import java.awt.Graphics; +import java.awt.*; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; @@ -102,7 +101,8 @@ public class XAutoChartCreator extends XChartEditor { } - public void paint(Graphics g) { + @Override + public void paintForeground(Graphics2D g) { BufferedImage bufferedImage = IOUtils.readImage("com/fr/design/form/images/auto_chart_preview.png"); GraphHelper.paintImage( g, this.getWidth(), this.getHeight(), bufferedImage, @@ -110,7 +110,7 @@ public class XAutoChartCreator extends XChartEditor { 0, 0, -1, -1 ); - super.paint(g); + super.paintForeground(g); } private void initChart(BaseChartCollection chartCollection) { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index fc40b1d123..754638783c 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -222,24 +222,23 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ } // 设计器预览界面中绘制组件背景效果 - private void paintBackground(Graphics2D g2d) { + public void paintBackground(Graphics2D g2d) { Background background4Painting = getBackground4Painting(); if (background4Painting != null) { background4Painting.paint(g2d, new Rectangle2D.Double(0, 0, getWidth(), getHeight())); } } - @Override - protected void paintComponent(Graphics g) { - this.paintBackground((Graphics2D) g); - super.paintComponent(g); + public void paintForeground(Graphics2D g2d) { + super.paint(g2d); + super.paintBorder(g2d); } @Override public void paint(Graphics g) { this.clipByRoundedBorder((Graphics2D) g); - super.paint(g); - paintBorder(g); + this.paintBackground((Graphics2D) g); + this.paintForeground((Graphics2D) g); } @Override 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 2e9b3e23a4..531a94ec6e 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 @@ -29,12 +29,8 @@ import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingUtilities; +import java.awt.*; import java.beans.IntrospectionException; -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Rectangle; import java.awt.event.MouseEvent; /** @@ -228,7 +224,8 @@ public class XChartEditor extends XBorderStyleWidgetCreator { /** * 渲染Painter */ - public void paint(Graphics g) { + @Override + public void paintForeground(Graphics2D g) { Dimension size = getSize(); PaddingMargin margin = toData().getMargin(); designerEditor.paintEditor(g, size, margin); @@ -237,7 +234,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator { int verticalMargin = margin != null ? margin.getTop() + margin.getBottom() : 0; coverPanel.setSize(size.width - horizonMargin, size.height - verticalMargin); } - super.paint(g); + super.paintForeground(g); if (isEditing) { g.setColor(INNER_BORDER_COLOR); GraphHelper.draw(g, new Rectangle(0, 0, getWidth(), getHeight()), Constants.LINE_MEDIUM); From 4b22027e3615ff6caed0b93a9129ad71ec4a58a1 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 14 Jul 2021 10:03:37 +0800 Subject: [PATCH 08/50] =?UTF-8?q?REPORT-53175=20=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 子功能: 组件尺寸比例锁定 【问题原因】 更新操作栏按钮图标 【改动思路】 【review建议】 --- .../design/images/control/aspect_ratio_lock.png | Bin 0 -> 272 bytes .../design/images/control/aspect_ratio_unlock.png | Bin 0 -> 273 bytes .../fr/design/designer/ui/PopupControlPanel.java | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/aspect_ratio_lock.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/aspect_ratio_unlock.png diff --git a/designer-base/src/main/resources/com/fr/design/images/control/aspect_ratio_lock.png b/designer-base/src/main/resources/com/fr/design/images/control/aspect_ratio_lock.png new file mode 100644 index 0000000000000000000000000000000000000000..b54cbbb18fed44a188e25c41678761f35ecfe35c GIT binary patch literal 272 zcmV+r0q_2aP)8XD0Ub6W3Q>qoEI_5P0F5J)C}y7bOd=D> zoc88^IsdsgC#F=HlH-4%s#?Q33O7j}x)OADR8_k;!4*ESg@YvLZCEQ*Rf~8*FUjNZ zVpXl;4ogX1n^+gLiTxxiqZg{`38zVhU5-^3w1e#=y#{oP%On>w2z@{KHRkcwh_HZn zY$UlKJ^L}Es_J7f;l~e>9L*kdh_SX?V)m09Pl~pTGt70&=>vO7o_~e@x>lyPM!o~ Date: Wed, 14 Jul 2021 15:33:14 +0800 Subject: [PATCH 09/50] =?UTF-8?q?REPORT-55187=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-body=E5=92=8C=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E9=87=8C=E7=9A=84=E6=8E=A7=E4=BB=B6=EF=BC=88frm?= =?UTF-8?q?=E5=8F=82=E9=9D=A2=E5=92=8Cbody=20=E4=BB=A5=E5=8F=8A=20cpt?= =?UTF-8?q?=E5=8F=82=E9=9D=A2=EF=BC=89=EF=BC=8C=E5=BA=94=E8=AF=A5=E4=B9=9F?= =?UTF-8?q?=E6=9C=89=E5=8F=AA=E6=98=BE=E7=A4=BA=E9=94=81=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E5=85=B7=E6=A0=8F=EF=BC=8C=E7=8E=B0=E5=9C=A8?= =?UTF-8?q?=E6=98=AF=E6=B2=A1=E6=9C=89=E5=B7=A5=E5=85=B7=E6=A0=8F=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 子功能: 组件尺寸比例锁定 & 组件工具栏 【问题原因】 工具栏按显示条件更新 【改动思路】 修改工具栏按钮的显示条件: 1. 编辑按钮仅在当前控件为标题控件(图表块/报表块)时可见 2. 比例锁定按钮仅在当前控件所在布局为绝对布局时可见 3. 设置按钮仅在当前控件为可复用组件时可见 4. 所有按钮在拖拽时不显示 4. 若没有按钮显示,则工具栏整体不显示 【review建议】 (cherry picked from commit 6a7996edba76858a8b99386fc40ba95cfea8a640) --- .../com/fr/design/designer/creator/XCreator.java | 2 +- .../fr/design/designer/ui/PopupControlPanel.java | 15 +++++++++++++-- .../design/designer/ui/SelectedPopupDialog.java | 4 ++++ .../com/fr/design/mainframe/FormDesignerUI.java | 2 +- 4 files changed, 19 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 0983dded9b..a7860faece 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -778,7 +778,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo int extraY = (int) (bounds.y * designer.getScale()); popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); popup.updatePane(designer); - popup.setVisible(selected && accept); + popup.setVisible(selected && accept && popup.hasVisibleButtons()); popup.setRelativeBounds(bounds); } diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java index 2dec13afa6..ebcfa472f0 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java @@ -4,6 +4,7 @@ import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.VerticalFlowLayout; @@ -58,7 +59,7 @@ public class PopupControlPanel extends JPanel { addButton(toggleButton, 1); addButton(settingButton, 2); - setButtonVisible(editButton, true); + setButtonVisible(editButton, false); setButtonVisible(toggleButton, false); setButtonVisible(settingButton, false); } @@ -139,7 +140,7 @@ public class PopupControlPanel extends JPanel { if (index > 0) { getComponent(2 * index - 1).setVisible(false); } - buttons.get(index).setVisible(true); + buttons.get(index).setVisible(visible); if (!visible) { // 如果当前按钮设置为不可见,且在当前按钮之前的其他按钮也不可见,则下一个可见按钮前无分割线 @@ -192,6 +193,7 @@ public class PopupControlPanel extends JPanel { } public void updatePane(FormDesigner designer) { + setButtonVisible(editButton, creator.acceptType(XWTitleLayout.class)); setButtonVisible(settingButton, creator.isShared()); setButtonVisible(toggleButton, AdapterBus.searchLayoutAdapter(designer, creator) instanceof FRAbsoluteLayoutAdapter); toggleButton.setSelected(creator.toData().isAspectRatioLocked()); @@ -199,6 +201,15 @@ public class PopupControlPanel extends JPanel { updateDimension(); } + public boolean hasVisibleButtons() { + for (int i = 0; i < buttons.size(); i++) { + if (buttons.get(i).isVisible()) { + return true; + } + } + return false; + } + private void updateDimension() { int height = 0; for (int i = 0; i < buttons.size(); i++) { diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java index 6702fe7f42..bceba44d30 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java @@ -34,6 +34,10 @@ public class SelectedPopupDialog extends JDialog { this.setSize(controlPanel.getDefaultDimension()); } + public boolean hasVisibleButtons() { + return controlPanel.hasVisibleButtons(); + } + public void setRelativeBounds(Rectangle rectangle) { this.controlPanel.setRelativeBounds(rectangle); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index c49902c8d9..893297081c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -326,7 +326,7 @@ public class FormDesignerUI extends ComponentUI { } creator.paintBorder(g, creatorBounds); // 拖拽时不绘制 - creator.showSelectedPopup(designer, creatorBounds, !designer.getStateModel().isDragging() && creator.acceptType(XWTitleLayout.class)); + creator.showSelectedPopup(designer, creatorBounds, !designer.getStateModel().isDragging()); } } From 31777798a4d35d7709982c81d287132d8395d9bb Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 15 Jul 2021 15:54:40 +0800 Subject: [PATCH 10/50] =?UTF-8?q?REPORT-55212=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-tab=E9=87=8C=E7=9A=84=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E5=9D=97=E5=92=8C=E6=8A=A5=E8=A1=A8=E5=9D=97=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E9=80=9A=E8=BF=87=E7=82=B9=E5=87=BB=E5=8E=9F=E6=9C=AC?= =?UTF-8?q?=E7=9A=84=E7=BC=96=E8=BE=91=E6=8C=89=E9=92=AE=E5=92=8C=E5=8F=8C?= =?UTF-8?q?=E5=87=BB=E8=A7=A6=E5=8F=91=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81?= =?UTF-8?q?=20=E5=B7=A5=E5=85=B7=E6=A0=8F=E7=9A=84=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=8F=AF=E4=BB=A5=E8=A7=A6=E5=8F=91=20&&=20R?= =?UTF-8?q?EPORT-55228=20=E3=80=90=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=20=E6=89=93=E5=BC=80=E5=85=B6=E4=BB=96=E6=A8=A1=E6=9D=BF=20?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=A0=8F=E4=BC=9A=E7=95=99=E5=9C=A8=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E9=A1=B5=E9=9D=A2=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EditingMouseListener.java | 4 ++- .../java/com/fr/design/mainframe/JForm.java | 27 +++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) 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 1c14d739aa..b393d29b06 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 @@ -624,6 +624,8 @@ public class EditingMouseListener extends MouseInputAdapter { creator = processTopLayoutMouseClick(creator); if (creator != null) { + // tab块处于未编辑状态 + boolean uneditedTab = designer.getCursor().getType() != Cursor.HAND_CURSOR && creator.acceptType(XWCardMainBorderLayout.class) && !((XWCardMainBorderLayout) creator).isEditable(); // 点击不在tab块的button中 boolean clickedNonCardButton = !creator.acceptType(XCardAddButton.class, XCardSwitchButton.class); if (clickedNonCardButton && e.getClickCount() == 1 && designer.getCursor().getType() != Cursor.HAND_CURSOR) { @@ -641,7 +643,7 @@ public class EditingMouseListener extends MouseInputAdapter { } }); - } else if (clickedNonCardButton && responseTabLayout(oldCreator, e)) { + } else if (clickedNonCardButton && uneditedTab && responseTabLayout(oldCreator, e)) { // do nothing } else { creator.respondClick(this, e); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 08969c91a0..bc32c5fd9e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -47,8 +47,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.form.FormECCompositeProvider; import com.fr.design.mainframe.form.FormECDesignerProvider; -import com.fr.design.mainframe.share.collect.ComponentCollector; -import com.fr.design.mainframe.share.util.ShareComponentUtils; import com.fr.design.mainframe.template.info.JFormProcessInfo; import com.fr.design.mainframe.template.info.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; @@ -79,10 +77,8 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WLayout; import com.fr.general.ComparatorUtils; -import com.fr.json.JSONArray; import com.fr.log.FineLoggerFactory; import com.fr.page.PaperSettingProvider; -import com.fr.plugin.observer.PluginEventListener; import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.report.worksheet.FormElementCase; @@ -93,6 +89,8 @@ import com.fr.stable.StringUtils; import com.fr.stable.bridge.StableFactory; import com.fr.web.controller.ViewRequestConstants; +import java.awt.event.ContainerAdapter; +import java.awt.event.ContainerEvent; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JComponent; @@ -135,18 +133,36 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm Date: Thu, 15 Jul 2021 15:55:30 +0800 Subject: [PATCH 11/50] =?UTF-8?q?REPORT-55228=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E6=89=93=E5=BC=80=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E6=A8=A1=E6=9D=BF=20=E5=B7=A5=E5=85=B7=E6=A0=8F?= =?UTF-8?q?=E4=BC=9A=E7=95=99=E5=9C=A8=E8=AE=BE=E8=AE=A1=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/designer/creator/XCreator.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 0983dded9b..c5b4dda506 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 @@ -830,4 +830,10 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } } + public void hidePopup() { + if (popup != null) { + popup.setVisible(false); + } + } + } From eebc59f53fc1d8565d9ba11b567e68217320f377 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 15 Jul 2021 17:32:34 +0800 Subject: [PATCH 12/50] =?UTF-8?q?REPORT-55214=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=BB=84=E4=BB=B6=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E7=8A=B6=E6=80=81=EF=BC=8C=E8=93=9D=E8=89=B2=E5=AE=9E?= =?UTF-8?q?=E7=BA=BF=E8=BE=B9=E6=A1=86=E6=84=9F=E8=A7=89=E4=B8=8D=E5=A4=AA?= =?UTF-8?q?=E6=98=8E=E6=98=BE=EF=BC=8C=E5=92=8C=E4=BA=A4=E4=BA=92=E5=9B=BE?= =?UTF-8?q?=E9=A2=84=E6=9C=9F=E6=95=88=E6=9E=9C=E4=B8=8D=E5=A4=AA=E4=B8=80?= =?UTF-8?q?=E6=A0=B7=EF=BC=9B=E9=98=B4=E5=BD=B1=E6=95=88=E6=9E=9C=E7=9C=8B?= =?UTF-8?q?=E8=B5=B7=E6=9D=A5=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 编辑时的内边框之前在XChartEditor的paintForeground里绘制,会被圆角效果裁剪 【改动思路】 编辑时的内边框放在paintBorder(Graphics g, Rectangle bounds)中绘制,该方法由 FormDesigner调用,不受组件内部影响 --- .../main/java/com/fr/design/designer/creator/XChartEditor.java | 3 +++ 1 file changed, 3 insertions(+) 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 531a94ec6e..8633c0bd51 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 @@ -146,6 +146,9 @@ public class XChartEditor extends XBorderStyleWidgetCreator { if (isEditing) { g.setColor(OUTER_BORDER_COLOR); GraphHelper.draw(g, new Rectangle(bounds.x - BORDER_WIDTH, bounds.y - BORDER_WIDTH, bounds.width + BORDER_WIDTH + 1, bounds.height + BORDER_WIDTH + 1), Constants.LINE_LARGE); + + g.setColor(INNER_BORDER_COLOR); + GraphHelper.draw(g, new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height), Constants.LINE_MEDIUM); } else if (!isHovering) { super.paintBorder(g, bounds); } From 3108b10c7bae76cec12a7d8122760d958ec26b8a Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 15 Jul 2021 17:37:37 +0800 Subject: [PATCH 13/50] =?UTF-8?q?REPORT-55149=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E5=9B=BE=E8=A1=A8=E5=9D=97?= =?UTF-8?q?=E6=B2=A1=E7=9C=8B=E5=88=B0=E5=86=85=E8=BE=B9=E8=B7=9D=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 设置内边距后,图表块进入编辑状态,图表编辑控件的尺寸正常,但是显示位置不对,没有留出 顶部和左侧内边距的空间 【改动思路】 需要在图表编辑器布局后,按照内边距重新调整下位置 --- .../design/designer/beans/events/DesignerEditor.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java b/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java index a1c9f1ff9f..f53f66d313 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java @@ -86,9 +86,15 @@ public class DesignerEditor implements PropertyChangeListe int horizonMargin = marginLeft + marginRight; int verticalMargin = marginTop + marginBottom; - comp.setSize(new Dimension(size.width - 2 - horizonMargin, size.height - 2 - verticalMargin)); + int x = 1 + marginLeft; + int y = 1 + marginTop; + int width = size.width - 2 - horizonMargin; + int height = size.height - 2 - verticalMargin; + + comp.setSize(new Dimension(width, height)); LayoutUtils.layoutContainer(comp); - Graphics clipg = g.create(1 + marginLeft, 1 + marginTop, size.width, size.height); + comp.setBounds(comp.getX() + x, comp.getY() + y, width, height); + Graphics clipg = g.create(x, y, width, height); this.comp.paint(clipg); } } From 2195581ea79235e79bed9fd45b603ec8bf5fab72 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 16 Jul 2021 10:45:12 +0800 Subject: [PATCH 14/50] =?UTF-8?q?REPORT-55191=20=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=8D=B8=E8=BD=BD=E9=87=8D=E5=90=AF=E5=90=8E=EF=BC=8C=E5=B7=B2?= =?UTF-8?q?=E6=89=93=E5=BC=80=E7=9A=84=E6=A8=A1=E6=9D=BF=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E6=95=B0=E6=8D=AE=E9=9B=86=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 9e8df6b85f..abd219ee7f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -17,6 +17,7 @@ import com.fr.design.actions.file.SaveAsTemplateAction; import com.fr.design.actions.file.SaveTemplateAction; import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.base.mode.DesignModeContext; +import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.designer.DesignerProxy; import com.fr.design.designer.TargetComponent; import com.fr.design.dialog.FineJOptionPane; @@ -389,6 +390,8 @@ public abstract class JTemplate> addCenterPane(); refreshToolArea(); + + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView(); } }); From f338b528f3626ad2f06db601fd061047b56b296d Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 16 Jul 2021 17:30:35 +0800 Subject: [PATCH 15/50] =?UTF-8?q?REPORT-55337=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=BB=84=E4=BB=B6=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E5=87=BA=E7=8E=B0=E5=B7=A5=E5=85=B7=E6=A0=8F=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E9=94=AE=E7=9B=98delete=E5=B0=B1=E5=88=A0=E4=B8=8D?= =?UTF-8?q?=E6=8E=89=E7=BB=84=E4=BB=B6=E4=BA=86=EF=BC=9B=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E5=B7=A5=E5=85=B7=E6=A0=8F=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=EF=BC=8C=E5=8F=AF=E4=BB=A5delete=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E9=94=AE=E5=88=A0=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/designer/ui/SelectedPopupDialog.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java index bceba44d30..c5f94d70eb 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java @@ -24,6 +24,7 @@ public class SelectedPopupDialog extends JDialog { super(DesignerContext.getDesignerFrame()); this.setUndecorated(true); this.setModal(false); + this.setFocusableWindowState(false); controlPanel = new PopupControlPanel(creator, designer); this.getContentPane().add(controlPanel); this.setSize(controlPanel.getDefaultDimension()); From de8c84681a30810f0e422da3216af708cc02d9ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 16 Jul 2021 17:35:05 +0800 Subject: [PATCH 16/50] =?UTF-8?q?REPORT-55339=20=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6=EF=BC=8C=E8=81=9A=E5=90=88=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E5=85=83=E6=A0=BC=E5=B1=9E=E6=80=A7=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=9D=A2=E6=9D=BF=EF=BC=8C=E5=9C=A8=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E7=BC=96=E8=BE=91=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E9=9D=A2=E6=9D=BF=E6=9C=AA=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/poly/creator/ECBlockPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java b/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java index 28b09fef79..bbf91f6409 100644 --- a/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java +++ b/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java @@ -18,6 +18,7 @@ import com.fr.design.actions.edit.HyperlinkAction; import com.fr.design.actions.edit.merge.MergeCellAction; import com.fr.design.actions.edit.merge.UnmergeCellAction; import com.fr.design.actions.utils.DeprecatedActionManager; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; import com.fr.design.file.HistoryTemplateListPane; @@ -55,10 +56,10 @@ public class ECBlockPane extends PolyElementCasePane { @Override public void selectionChanged(SelectionEvent e) { - if (!isEditable()) { + if (!isEditable() && !DesignModeContext.isAuthorityEditing()) { return; } - if (DesignerMode.isAuthorityEditing()) { + if (DesignModeContext.isAuthorityEditing()) { if (designer.getSelection().getEditingElementCasePane() == null) { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION_DISABLED); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(new NoSupportAuthorityEdit()); From 4c2f04c16d55e795386939cef9a0589238c33f32 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 19 Jul 2021 11:16:02 +0800 Subject: [PATCH 17/50] =?UTF-8?q?REPORT-55227=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=BB=84=E4=BB=B6=E6=82=AC?= =?UTF-8?q?=E5=81=9C1s=E5=90=8E=E5=88=A4=E6=96=AD=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=A7=BB=E5=85=A5tab=E5=86=85=E9=83=A8=EF=BC=8C=E8=BF=99?= =?UTF-8?q?=E6=97=B6=E5=80=99=E7=9A=84tab=E5=9D=97=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E9=A2=84=E6=9C=9F=E7=9A=84=E8=93=9D=E8=89=B2=E9=98=B4=E5=BD=B1?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cardlayout/XWCardMainBorderLayout.java | 10 ++++++++ .../mainframe/FormCreatorDropTarget.java | 4 ++++ .../fr/design/mainframe/FormDesignerUI.java | 23 ++++++++++++++++++- .../com/fr/design/mainframe/TabDragInner.java | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) 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 992fa00cc9..a762c59f44 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 @@ -3,6 +3,7 @@ */ package com.fr.design.designer.creator.cardlayout; +import com.fr.base.GraphHelper; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.LayoutAdapter; @@ -32,6 +33,8 @@ import com.fr.general.ComparatorUtils; import com.fr.general.act.BorderPacker; +import com.fr.stable.Constants; +import java.awt.Color; import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; @@ -50,6 +53,9 @@ import java.util.List; */ public class XWCardMainBorderLayout extends XWBorderLayout { + private static final int BORDER_WIDTH = 4; + private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30); + private static final int CENTER = 1; private static final int NORTH = 0; private static final int TITLE_STYLE = 2; @@ -345,6 +351,10 @@ public class XWCardMainBorderLayout extends XWBorderLayout { @Override public void paintBorder(Graphics g, Rectangle bounds){ + if (isDragInAble()) { + g.setColor(OUTER_BORDER_COLOR); + GraphHelper.draw(g, new Rectangle(bounds.x - BORDER_WIDTH, bounds.y - BORDER_WIDTH, bounds.width + BORDER_WIDTH + 3, bounds.height + BORDER_WIDTH + 3), Constants.LINE_LARGE); + } if (!isMouseEnter) { super.paintBorder(g, bounds); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 2fdbb5a29a..11fa1dc3bf 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -335,4 +335,8 @@ public class FormCreatorDropTarget extends DropTarget { } } } + + public TabDragInner getTabDragInner() { + return this.tabDragInner; + } } 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 893297081c..c48c881010 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 @@ -13,7 +13,7 @@ import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.designer.creator.XWTitleLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.utils.ComponentUtils; @@ -24,6 +24,7 @@ import com.fr.report.core.ReportUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; +import java.awt.dnd.DropTarget; import javax.swing.*; import javax.swing.plaf.ComponentUI; import java.awt.AlphaComposite; @@ -94,6 +95,7 @@ public class FormDesignerUI extends ComponentUI { } paintBorder(g); paintSelection(g); + paintDropBorderShadow(g); if (DesignerMode.isAuthorityEditing()) { paintAuthorityDetails(g, designer.getRootComponent()); @@ -330,6 +332,25 @@ public class FormDesignerUI extends ComponentUI { } } + /** + * 绘制可拖拽进tab块之前的阴影 + * + * @param g + */ + private void paintDropBorderShadow(Graphics g) { + DropTarget dropTarget = designer.getDropTarget(); + if (dropTarget instanceof FormCreatorDropTarget) { + FormCreatorDropTarget target = (FormCreatorDropTarget) dropTarget; + XLayoutContainer layoutContainer = target.getTabDragInner().getBelowXLayoutContainer(); + if (layoutContainer != null && layoutContainer.acceptType(XWCardMainBorderLayout.class)) { + Rectangle creatorBounds = ComponentUtils.getRelativeBounds(layoutContainer); + creatorBounds.x -= designer.getHorizontalScaleValue(); + creatorBounds.y -= designer.getVerticalScaleValue(); + layoutContainer.paintBorder(g, creatorBounds); + } + } + } + /** * 初始为自适应时,处理选中的范围 * @param bound diff --git a/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java b/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java index ce98d9d55b..fb6608c43a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java @@ -71,6 +71,7 @@ public class TabDragInner { ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, belowXLayoutContainer); if (adapter != null) { editingMouseListener.startEditing(belowXLayoutContainer, adapter.getDesignerEditor(), adapter); + belowXLayoutContainer.setDragInAble(false); } } } From 236228b2fa30aca4d4adb66f96d5c0a6dac0d2dd Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 19 Jul 2021 11:19:07 +0800 Subject: [PATCH 18/50] =?UTF-8?q?REPORT-55227=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=BB=84=E4=BB=B6=E6=82=AC?= =?UTF-8?q?=E5=81=9C1s=E5=90=8E=E5=88=A4=E6=96=AD=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=A7=BB=E5=85=A5tab=E5=86=85=E9=83=A8=EF=BC=8C=E8=BF=99?= =?UTF-8?q?=E6=97=B6=E5=80=99=E7=9A=84tab=E5=9D=97=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E9=A2=84=E6=9C=9F=E7=9A=84=E8=93=9D=E8=89=B2=E9=98=B4=E5=BD=B1?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/cardlayout/XWCardMainBorderLayout.java | 2 ++ 1 file changed, 2 insertions(+) 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 a762c59f44..22698ef5b9 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 @@ -352,8 +352,10 @@ public class XWCardMainBorderLayout extends XWBorderLayout { @Override public void paintBorder(Graphics g, Rectangle bounds){ if (isDragInAble()) { + Color oldColor = g.getColor(); g.setColor(OUTER_BORDER_COLOR); GraphHelper.draw(g, new Rectangle(bounds.x - BORDER_WIDTH, bounds.y - BORDER_WIDTH, bounds.width + BORDER_WIDTH + 3, bounds.height + BORDER_WIDTH + 3), Constants.LINE_LARGE); + g.setColor(oldColor); } if (!isMouseEnter) { super.paintBorder(g, bounds); From f902d06d5fa7b9e6720e6e49b097689e4d5415bd Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 14 Jul 2021 13:43:44 +0800 Subject: [PATCH 19/50] =?UTF-8?q?REPORT-54374=20=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E4=BF=AE=E6=94=B9tab=E9=87=8C=E7=9A=84=E7=BB=9D=E5=AF=B9?= =?UTF-8?q?=E7=94=BB=E5=B8=83=E5=9D=97=E9=AB=98=E5=BA=A6=EF=BC=8C=E7=BB=9D?= =?UTF-8?q?=E5=AF=B9=E7=94=BB=E5=B8=83=E5=9D=97=E9=94=99=E4=B9=B1=20?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=AB=98=E5=BA=A6=EF=BC=8C=E7=BB=9D=E5=AF=B9=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E5=9D=97=E5=86=85=E9=83=A8=E7=BB=84=E4=BB=B6=E4=BD=8D?= =?UTF-8?q?=E7=A7=BB=E6=88=90=E7=94=BB=E5=B8=83=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/XWFitLayout.java | 45 +++++++++++++------ .../fr/design/mainframe/FormSelection.java | 4 +- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index 896cbe37c5..cd0919d593 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java @@ -758,6 +758,11 @@ public class XWFitLayout extends XLayoutContainer { int[] veris = getVeris(true); int containerWidth = 0; int containerHeight = 0; + + PaddingMargin margin = toData().getMargin(); + int maxW = this.getWidth() - margin.getRight(); + int maxH = this.getHeight() - margin.getBottom(); + for (int index=0, n=this.getComponentCount(); index i) { + // 这里处理绝对画布块 仅局限于选中多个组件且其中包含了绝对画布块的情况 + boolean accept = creator.acceptType(XWAbsoluteLayout.class) && recs.size() > i && selection.size() > 1; + if (accept) { Rectangle rectangle = recs.get(i); check4ParaPane(rectangle); creator.setBackupBound(rectangle); From d87bc58e7ac85dd1556b949ee7001fbc6a8b20ce Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 19 Jul 2021 13:44:52 +0800 Subject: [PATCH 20/50] =?UTF-8?q?REPORT-53175=20-=20=E3=80=9010.0.18?= =?UTF-8?q?=E3=80=91=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB?= =?UTF-8?q?=E4=B8=BA=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 点九图编辑交互改动优化 【改动思路】 --- .../images/control/icon_cursor_drag_e.png | Bin 0 -> 503 bytes .../images/control/icon_cursor_drag_n.png | Bin 0 -> 522 bytes .../images/control/icon_cursor_drag_ne.png | Bin 0 -> 523 bytes .../images/control/icon_cursor_drag_nw.png | Bin 0 -> 511 bytes .../images/control/icon_cursor_drag_s.png | Bin 0 -> 522 bytes .../images/control/icon_cursor_drag_se.png | Bin 0 -> 511 bytes .../images/control/icon_cursor_drag_sw.png | Bin 0 -> 523 bytes .../images/control/icon_cursor_drag_w.png | Bin 0 -> 503 bytes .../gui/xpane/BorderLineAndImagePane.java | 329 ++++++++++-------- 9 files changed, 182 insertions(+), 147 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_e.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_n.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_ne.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_nw.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_s.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_se.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_sw.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_w.png diff --git a/designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_e.png b/designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_e.png new file mode 100644 index 0000000000000000000000000000000000000000..650567ee917c0105d1f6039dc43848d96bd2fe72 GIT binary patch literal 503 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fEa{HEjtmSN`?>!lvI6-QsS%!O zzP=1vKsE;hV|yk83y{SK#8N=az`(SC2`(bGfEmFCN!q^@OaLm*@^onge z9S3A(WMt;wxOvmwzT!iIe!yO_69r-l&0lYC&)-~ATl@9<+uP|JLUZiv?Zhus&vwX3 zVla4dqhUsDWaQ0fcXk#}ZcMvo#K5^YdV8L1N=nKfW|JrO9LzWCXU>>WC)}O*%VEpf zwQp4uCg`yox4H5mPgYj;^!@$y#Z1kQ7EGReS#kxNLaTU0aZ%B$KR-S;Uq65T{g+jt ztNoapRmImaXYBYiS>6BJr%#{uHMbdVJh`@W_UzxmadGz)7c74DkWIxeY zgN#1Ln=aCOl8$!OI((Hpk(Rijk?Ti;#F7aS&8r)-nhkjlsWF6{=<}7CEuopU@uj?| cbc-SbgY&z8dh)@{aiGxmboFyt=akR{0Ld!ErvLx| literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_n.png b/designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_n.png new file mode 100644 index 0000000000000000000000000000000000000000..1085265c0d7c8a0700bd095d84fd12411b771b2d GIT binary patch literal 522 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fEa{HEjtmSN`?>!lvI6-QsS%!O zzP=1vKsE;hV|yk83y{SK#8N=az`(SC2`(bGfEmFCN!q^@OaLmb^>lFzu@Fp7P!Rg_ z|Nnf^4&KfXzd1$=8hhgR*UhbeeQj;C!#2UfT^#{mKR-X8r>?%dxTmM5KJVV1o#Gig zj0A6e(Ej=Rd%kB(%$>jmtNtsTId$sS+n1M@S2whEKfd1SF1EsQ-O80O8BRE)oH>2^ z_q(&R&8-_h)$G_}{AdzG)+eT2WxozKv%hb?a%R5${Op&PmL9AA_QsOu(dkpCHmzK> z>K}uVZKLBCVHGzK2B|Y0EtS{T$M2ut+4<5uU=6#c%<{t#1vi;WSWo;;U@+l0$Hw)? zeOj~D!38r6Tvn(UWEt2fxHmU_b8IwjX87Eqe4$E!jnRyQRc&o!k#B&VhWGbLvzG3( ztN*vhIX3n$BRl(Xbulrq35x$6bMo@u`D=%-yTiUkK_ZJWQzT&Vh11jZ%QtV{T+b%S zb-1#!vb~{5a>>lLWl|XpZ<^WpzZn@DH+yaPUsqSRyzc+M*#2cbHhLEd-gb-YzuUTX x>)tPqkN2;9GPB89{6c|t!p}Vd9>P;sGISar+gN()&H_+`c)I$ztaD0e0su_R)W!e+ literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_ne.png b/designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_ne.png new file mode 100644 index 0000000000000000000000000000000000000000..8f8163a6fe2055317cb0f1750492a629fa376133 GIT binary patch literal 523 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn1|+R>-G2comUKs7M+SzC{oH>NS%G|u)CkWs zUtb0-Ae)1Mu|1Q41;}CqVksbIU|?Fn1Q!upz>HvnB-ci7v<51!^K@|xu@GE4`JmTf z2Z6TDp0~bS;97WT@q@J)eDk;;9c}+0Yx7IaiRI+g*-nb?dqZ+Rva&4P(i+pU%$J+@ z?7<|J&i^d#T^I7W+0-`AocsUw%{OZT%qlkNXe+MeS^ekZN`Xa7PfIY!9FmK<{ zyv;Xjmf0~ZIJkVnAO25QukBU1vpsjW?{T+UhevA}8ZHZlUohd?7GiO5vP!3!1kXL6 z%QlDic3cxZP|Tv)@21?#{DQOCM(*<5TaRa)c|P^b^UqA`L9WwMWf#xV{&&-6`zdaf zc}dpdg);RLZGwxr?H`J#2vpv<^i}KQ{$u+YznTgpUv>Jw85AR)u6{1-oD!M-G2comUKs7M+SzC{oH>NS%G|u)CkWs zUtb0-Ae)1Mu|1Q41;}CqVksbIU|?Fn1Q!upz>HvnB-ci7v<50J@^oqjKrwu9x=~Uf6l{ znRw^@@L56&J>MTZy?gifyXE(*%LOxM&C~3<)TY0E->IWh1(Xi%xw7iSHumO&hbwH> zZH-#H<7UpXFMi8|-RCIePd75)RK30|b6@d{orx0i``+6d>L-V6TGYg|=Jl@{3z>7F zp?l9?<2%a5;C)Jc0*is{)69Sjxm$CdntORP2`vj@Xv#mmDUXw3V$(6Z^aqDH5^6U_ zys2_v?R&guQgfhN;Ifn^VRPFDCqo=2hlbqU*Ia*H!@K41xyHYXChaZj(BN^lYn1!lvI6-QsS%!O zzP=1vKsE;hV|yk83y{SK#8N=az`(SC2`(bGfEmFCN!q^@OaLmb^>lFzu@Fp7P!Rg_ z|Nnf^4&KfXzd1$=8hhgR*UhbeeQj;C!#2UfT^#{mKR-X8r>?%dxTmM5KJVV1o#Gig zj0A6e(Ej=Rd%kB(%$>jmtNtsTId$sS+n1M@S2whEKfd1SF1EsQ-O80O8BRE)oH>2^ z_q(&R&8-_h)$G_}{AdzG)+eT2WxozKv%hb?a%R5${Op&PmL9AA_QsOu(dkpCHmzK> z>K}uVZKLBCVHGzK2B|Y0EtS{T$M2ut+4<5uU=6#c%<{t#1vi;WSWo;;U@+l0$Hw)? zeOj~D!38r6Tvn(UWEt2fxHmU_b8IwjX87Eqe4$E!jnRyQRc&o!k#B&VhWGbLvzG3( ztN*vhIX3n$BRl(Xbulrq35x$6bMo@u`D=%-yTiUkK_ZJWQzT&Vh11jZ%QtV{T+b%S zb-1#!vb~{5a>>lLWl|XpZ<^WpzZn@DH+yaPUsqSRyzc+M*#2cbHhLEd-gb-YzuUTX x>)tPqkN2;9GPB89{6c|t!p}Vd9>P;sGISar+gN()&H_+`c)I$ztaD0e0su_R)W!e+ literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_se.png b/designer-base/src/main/resources/com/fr/design/images/control/icon_cursor_drag_se.png new file mode 100644 index 0000000000000000000000000000000000000000..af33c873df87c3b398599062040f9db362e55163 GIT binary patch literal 511 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn1|+R>-G2comUKs7M+SzC{oH>NS%G|u)CkWs zUtb0-Ae)1Mu|1Q41;}CqVksbIU|?Fn1Q!upz>HvnB-ci7v<50J@^oqjKrwu9x=~Uf6l{ znRw^@@L56&J>MTZy?gifyXE(*%LOxM&C~3<)TY0E->IWh1(Xi%xw7iSHumO&hbwH> zZH-#H<7UpXFMi8|-RCIePd75)RK30|b6@d{orx0i``+6d>L-V6TGYg|=Jl@{3z>7F zp?l9?<2%a5;C)Jc0*is{)69Sjxm$CdntORP2`vj@Xv#mmDUXw3V$(6Z^aqDH5^6U_ zys2_v?R&guQgfhN;Ifn^VRPFDCqo=2hlbqU*Ia*H!@K41xyHYXChaZj(BN^lYn1-G2comUKs7M+SzC{oH>NS%G|u)CkWs zUtb0-Ae)1Mu|1Q41;}CqVksbIU|?Fn1Q!upz>HvnB-ci7v<51!^K@|xu@GE4`JmTf z2Z6TDp0~bS;97WT@q@J)eDk;;9c}+0Yx7IaiRI+g*-nb?dqZ+Rva&4P(i+pU%$J+@ z?7<|J&i^d#T^I7W+0-`AocsUw%{OZT%qlkNXe+MeS^ekZN`Xa7PfIY!9FmK<{ zyv;Xjmf0~ZIJkVnAO25QukBU1vpsjW?{T+UhevA}8ZHZlUohd?7GiO5vP!3!1kXL6 z%QlDic3cxZP|Tv)@21?#{DQOCM(*<5TaRa)c|P^b^UqA`L9WwMWf#xV{&&-6`zdaf zc}dpdg);RLZGwxr?H`J#2vpv<^i}KQ{$u+YznTgpUv>Jw85AR)u6{1-oD!M!lvI6-QsS%!O zzP=1vKsE;hV|yk83y{SK#8N=az`(SC2`(bGfEmFCN!q^@OaLm*@^onge z9S3A(WMt;wxOvmwzT!iIe!yO_69r-l&0lYC&)-~ATl@9<+uP|JLUZiv?Zhus&vwX3 zVla4dqhUsDWaQ0fcXk#}ZcMvo#K5^YdV8L1N=nKfW|JrO9LzWCXU>>WC)}O*%VEpf zwQp4uCg`yox4H5mPgYj;^!@$y#Z1kQ7EGReS#kxNLaTU0aZ%B$KR-S;Uq65T{g+jt ztNoapRmImaXYBYiS>6BJr%#{uHMbdVJh`@W_UzxmadGz)7c74DkWIxeY zgN#1Ln=aCOl8$!OI((Hpk(Rijk?Ti;#F7aS&8r)-nhkjlsWF6{=<}7CEuopU@uj?| cbc-SbgY&z8dh)@{aiGxmboFyt=akR{0Ld!ErvLx| literal 0 HcmV?d00001 diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index 6c19c9a63f..324213bc3d 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -20,7 +20,6 @@ import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UIIntNumberField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -38,15 +37,28 @@ import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JFileChooser; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.plaf.basic.BasicButtonUI; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Point; +import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; @@ -434,13 +446,36 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { private class NinePointLinePreviewPane extends JPanel implements MouseMotionListener, MouseListener { public final Color BACKGROUND_PANE_COLOR = Color.WHITE; public final Color BACKGROUND_IMG_COLOR = Color.lightGray; - public final Color DIVIDER_BACKGROUND_COLOR = Color.WHITE; - public final Color DIVIDER_FOREGROUND_COLOR = Color.BLACK; - public final Color HINT_BACKGROUND_COLOR = new Color(255, 255, 255, 100); - public final Color HINT_FOREGROUND_COLOR = Color.RED; - public final Color HINT_LINE_BACKGROUND_COLOR = Color.WHITE; - public final Color HINT_LINE_FOREGROUND_COLOR = Color.RED; + public final Color DIVIDER_BACKGROUND_COLOR = new Color(235, 29, 31); + public final Color DIVIDER_FOREGROUND_COLOR = Color.WHITE; + public final Color HINT_BACKGROUND_COLOR = new Color(0, 215, 215); + public final Color HINT_FOREGROUND_COLOR = Color.WHITE; + public final int HINT_GAP = 5; public final int PADDING = 20; + public final Cursor E_DRAG_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( + IOUtils.readImage("/com/fr/design/images/control/icon_cursor_drag_e.png"), + new Point(8, 8), "E_DRAG_CURSOR"); + public final Cursor S_DRAG_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( + IOUtils.readImage("/com/fr/design/images/control/icon_cursor_drag_s.png"), + new Point(8, 8), "S_DRAG_CURSOR"); + public final Cursor W_DRAG_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( + IOUtils.readImage("/com/fr/design/images/control/icon_cursor_drag_w.png"), + new Point(8, 8), "W_DRAG_CURSOR"); + public final Cursor N_DRAG_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( + IOUtils.readImage("/com/fr/design/images/control/icon_cursor_drag_n.png"), + new Point(8, 8), "N_DRAG_CURSOR"); + public final Cursor NE_DRAG_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( + IOUtils.readImage("/com/fr/design/images/control/icon_cursor_drag_ne.png"), + new Point(8, 8), "NE_DRAG_CURSOR"); + public final Cursor NW_DRAG_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( + IOUtils.readImage("/com/fr/design/images/control/icon_cursor_drag_nw.png"), + new Point(8, 8), "NW_DRAG_CURSOR"); + public final Cursor SE_DRAG_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( + IOUtils.readImage("/com/fr/design/images/control/icon_cursor_drag_se.png"), + new Point(8, 8), "SE_DRAG_CURSOR"); + public final Cursor SW_DRAG_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( + IOUtils.readImage("/com/fr/design/images/control/icon_cursor_drag_sw.png"), + new Point(8, 8), "SW_DRAG_CURSOR"); private int ninePointLeft = -1; private int ninePointTop = -1; @@ -455,54 +490,17 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { private int scaleImgHeight; private int scaleImgX; private int scaleImgY; - private double scale = 1.0; + private double imageScale = 1.0; - private final UIIntNumberField topField = createNumberField(); - private final UIIntNumberField bottomField = createNumberField(); - private final UIIntNumberField leftField = createNumberField(); - private final UIIntNumberField rightField = createNumberField(); + private boolean draggingLeftDivider = false; + private boolean draggingRightDivider = false; + private boolean draggingTopDivider = false; + private boolean draggingBottomDivider = false; public NinePointLinePreviewPane() { this.setLayout(null); this.addMouseMotionListener(this); this.addMouseListener(this); - this.setFocusable(true); - this.add(topField); - this.add(bottomField); - this.add(leftField); - this.add(rightField); - - topField.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent e) { - int value = (int) topField.getValue(); - onNinePointTopChanged(value); - } - }); - - bottomField.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent e) { - int value = (int) bottomField.getValue(); - onNinePointBottomChanged(value); - } - }); - - leftField.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent e) { - int value = (int) leftField.getValue(); - onNinePointLeftChanged(value); - } - }); - - rightField.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent e) { - int value = (int) rightField.getValue(); - onNinePointRightChanged(value); - } - }); } @Override @@ -528,68 +526,115 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { scaleImgHeight = (int) (1.0F * scaleImgWidth * imgHeight / imgWidth); scaleImgX = autoFixAreaX; scaleImgY = (autoFixAreaHeight - scaleImgHeight) / 2 + autoFixAreaY; // 垂直居中 - scale = 1.0 * scaleImgWidth / imgWidth; + imageScale = 1.0 * scaleImgWidth / imgWidth; } else { scaleImgHeight = autoFixAreaHeight; scaleImgWidth = (int) (1.0F * scaleImgHeight * imgWidth / imgHeight); scaleImgX = (autoFixAreaWidth - scaleImgWidth) / 2 + autoFixAreaX; // 水平居中 scaleImgY = autoFixAreaY; - scale = 1.0 * scaleImgHeight / imgHeight; + imageScale = 1.0 * scaleImgHeight / imgHeight; } g2d.setColor(BACKGROUND_IMG_COLOR); g2d.fillRect(scaleImgX, scaleImgY, scaleImgWidth, scaleImgHeight); g2d.drawImage(image, scaleImgX, scaleImgY, scaleImgWidth, scaleImgHeight, null); - int scaleLeft = (int) (ninePointLeft * scale); - int scaleTop = (int) (ninePointTop * scale); - int scaleRight = (int) (ninePointRight * scale); - int scaleBottom = (int) (ninePointBottom * scale); + int scaleLeft = (int) (ninePointLeft * imageScale); + int scaleTop = (int) (ninePointTop * imageScale); + int scaleRight = (int) (ninePointRight * imageScale); + int scaleBottom = (int) (ninePointBottom * imageScale); double topYInPane = scaleImgY + scaleTop; double bottomYInPane = scaleImgY + scaleImgHeight - scaleBottom; double leftXInPane = scaleImgX + scaleLeft; double rightXInPane = scaleImgX + scaleImgWidth - scaleRight; - // 绘制分割线 - // 顶部 - drawLine(g2d, DIVIDER_BACKGROUND_COLOR, DIVIDER_FOREGROUND_COLOR, scaleImgX, topYInPane, scaleImgX + scaleImgWidth, topYInPane); - // 底部 - drawLine(g2d, DIVIDER_BACKGROUND_COLOR, DIVIDER_FOREGROUND_COLOR, scaleImgX, bottomYInPane, scaleImgX + scaleImgWidth, bottomYInPane); - // 左侧 - drawLine(g2d, DIVIDER_BACKGROUND_COLOR, DIVIDER_FOREGROUND_COLOR, leftXInPane, scaleImgY, leftXInPane, scaleImgY + scaleImgHeight); - // 右侧 - drawLine(g2d, DIVIDER_BACKGROUND_COLOR, DIVIDER_FOREGROUND_COLOR, rightXInPane, scaleImgY, rightXInPane, scaleImgY + scaleImgHeight); - - // 绘制分割线位置提示 - // 顶部 - drawLine(g2d, HINT_LINE_BACKGROUND_COLOR, HINT_LINE_FOREGROUND_COLOR, (leftXInPane + rightXInPane) / 2.0F, scaleImgY, (leftXInPane + rightXInPane) / 2.0F, topYInPane); - drawHint(g2d, Integer.toString(ninePointTop), (leftXInPane + rightXInPane) / 2.0F, (scaleImgY + topYInPane) / 2.0, topField); - // 底部 - drawLine(g2d, HINT_LINE_BACKGROUND_COLOR, HINT_LINE_FOREGROUND_COLOR, (leftXInPane + rightXInPane) / 2.0F, bottomYInPane, (leftXInPane + rightXInPane) / 2.0F, scaleImgY + scaleImgHeight); - drawHint(g2d, Integer.toString(ninePointBottom), (leftXInPane + rightXInPane) / 2.0F, (bottomYInPane + scaleImgY + scaleImgHeight) / 2.0, bottomField); - // 左侧 - drawLine(g2d, HINT_LINE_BACKGROUND_COLOR, HINT_LINE_FOREGROUND_COLOR, scaleImgX, (topYInPane + bottomYInPane) / 2.0, leftXInPane, (topYInPane + bottomYInPane) / 2.0); - drawHint(g2d, Integer.toString(ninePointLeft), (scaleImgX + leftXInPane) / 2.0, (topYInPane + bottomYInPane) / 2.0, leftField); - // 右侧 - drawLine(g2d, HINT_LINE_BACKGROUND_COLOR, HINT_LINE_FOREGROUND_COLOR, rightXInPane, (topYInPane + bottomYInPane) / 2.0, scaleImgX + scaleImgWidth, (topYInPane + bottomYInPane) / 2.0); - drawHint(g2d, Integer.toString(ninePointRight), (rightXInPane + scaleImgX + scaleImgWidth) / 2.0, (topYInPane + bottomYInPane) / 2.0, rightField); - } - - private void drawHint(Graphics2D g2d, String hint, double centerX, double centerY, UIIntNumberField hintField) { + // 顶部分割线 + drawDivider(g2d, scaleImgX, topYInPane, scaleImgX + scaleImgWidth, topYInPane, draggingTopDivider); + if (draggingTopDivider) { + // 顶部提示 + drawHint(g2d, ninePointTop + "px", leftXInPane, scaleImgY, scaleImgWidth - scaleLeft - scaleRight, scaleTop, false); + } + // 底部分割线 + drawDivider(g2d, scaleImgX, bottomYInPane, scaleImgX + scaleImgWidth, bottomYInPane, draggingBottomDivider); + if (draggingBottomDivider) { + // 底部提示 + drawHint(g2d, ninePointBottom + "px", leftXInPane, bottomYInPane, scaleImgWidth - scaleLeft - scaleRight, scaleBottom, false); + } + // 左侧分割线 + drawDivider(g2d, leftXInPane, scaleImgY, leftXInPane, scaleImgY + scaleImgHeight, draggingLeftDivider); + if (draggingLeftDivider) { + // 左侧提示 + drawHint(g2d, ninePointLeft + "px", scaleImgX, topYInPane, scaleLeft, scaleImgHeight - scaleTop - scaleBottom, true); + } + // 右侧分割线 + drawDivider(g2d, rightXInPane, scaleImgY, rightXInPane, scaleImgY + scaleImgHeight, draggingRightDivider); + if (draggingRightDivider) { + // 右侧提示 + drawHint(g2d, ninePointRight + "px", rightXInPane, topYInPane, scaleRight, scaleImgHeight - scaleTop - scaleBottom, true); + } + } + + private void drawHint(Graphics2D g2d, String hint, double x, double y, double width, double height, boolean horizontal) { FontMetrics metrics = GraphDrawHelper.getFontMetrics(g2d.getFont()); - double height = metrics.getAscent() + metrics.getDescent(); - double width = Math.max(metrics.stringWidth(" " + hint + " "), metrics.stringWidth(" 123 ")); + double hintTextHeight = Math.max(metrics.getAscent() + metrics.getDescent(), 16); + double hintTextWidth = Math.max(metrics.stringWidth(hint), metrics.stringWidth("123")); + double hintFrameRadius = hintTextHeight / 2; + double hintFrameHeight = hintTextHeight; + double hintFrameWidth = hintTextWidth + 2 * hintFrameRadius; + + double centerX = x + width / 2; + double centerY = y + height / 2; + + double indent = 1.0; + double shortLine = 4.0; + + if (horizontal) { + if (width > hintFrameWidth) { + g2d.setColor(HINT_BACKGROUND_COLOR); + GraphDrawHelper.draw(g2d, new Line2D.Double(x + indent, centerY, x + width - indent, centerY), Constants.LINE_THIN, 1.0F); + GraphDrawHelper.draw(g2d, new Line2D.Double(x + indent, centerY - shortLine, x + indent, centerY + shortLine), Constants.LINE_THIN, 1.0F); + GraphDrawHelper.draw(g2d, new Line2D.Double(x + width - indent, centerY - shortLine, x + width - indent, centerY + shortLine), Constants.LINE_THIN, 1.0F); + } - hintField.setBounds((int) (centerX - width / 2.0), (int) (centerY - height / 2.0), (int) width, (int) height); + double hintFrameX = centerX - hintFrameWidth / 2; + double hintFrameY = centerY + HINT_GAP; + + g2d.setColor(HINT_BACKGROUND_COLOR); + GraphDrawHelper.fill(g2d, new RoundRectangle2D.Double(hintFrameX, hintFrameY, hintFrameWidth, hintFrameHeight, hintFrameRadius * 2, hintFrameRadius * 2)); + + g2d.setColor(HINT_FOREGROUND_COLOR); + GraphDrawHelper.drawString(g2d, hint, hintFrameX + (hintFrameWidth - hintTextWidth) / 2, hintFrameY + (hintFrameHeight + hintTextHeight) / 2.0 - metrics.getDescent()); + } else { + if (height > hintFrameHeight) { + g2d.setColor(HINT_BACKGROUND_COLOR); + GraphDrawHelper.draw(g2d, new Line2D.Double(centerX, y + indent, centerX, y + height - indent), Constants.LINE_THIN, 1.0F); + GraphDrawHelper.draw(g2d, new Line2D.Double(centerX - shortLine, y + indent, centerX + shortLine, y + indent), Constants.LINE_THIN, 1.0F); + GraphDrawHelper.draw(g2d, new Line2D.Double(centerX - shortLine, y + height - indent, centerX + shortLine, y + height - indent), Constants.LINE_THIN, 1.0F); + } + + double hintFrameX = centerX + HINT_GAP; + double hintFrameY = centerY - hintFrameHeight / 2; + + g2d.setColor(HINT_BACKGROUND_COLOR); + GraphDrawHelper.fill(g2d, new RoundRectangle2D.Double(hintFrameX, hintFrameY, hintFrameWidth, hintFrameHeight, hintFrameRadius * 2, hintFrameRadius * 2)); + + g2d.setColor(HINT_FOREGROUND_COLOR); + GraphDrawHelper.drawString(g2d, hint, hintFrameX + (hintFrameWidth - hintTextWidth) / 2, hintFrameY + (hintFrameHeight + hintTextHeight) / 2.0 - metrics.getDescent()); + } } - private void drawLine(Graphics2D g2d, Color backgroundColor, Color foregroundColor, double x1, double y1, double x2, double y2) { - g2d.setColor(backgroundColor); - GraphDrawHelper.draw(g2d, new Line2D.Double(x1, y1, x2, y2), Constants.LINE_THIN, 2.0F); + private void drawDivider(Graphics2D g2d, double x1, double y1, double x2, double y2, boolean dragging) { + if (dragging) { + g2d.setColor(DIVIDER_BACKGROUND_COLOR); + GraphDrawHelper.draw(g2d, new Line2D.Double(x1, y1, x2, y2), Constants.LINE_THIN, 2.0F); - g2d.setColor(foregroundColor); - GraphDrawHelper.draw(g2d, new Line2D.Double(x1, y1, x2, y2), Constants.LINE_DASH, 1.0F); + g2d.setColor(DIVIDER_FOREGROUND_COLOR); + GraphDrawHelper.draw(g2d, new Line2D.Double(x1, y1, x2, y2), Constants.LINE_THIN, 1.0F); + } else { + g2d.setColor(DIVIDER_BACKGROUND_COLOR); + GraphDrawHelper.draw(g2d, new Line2D.Double(x1, y1, x2, y2), Constants.LINE_DASH, 1.0F); + } } @Override @@ -597,28 +642,22 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { int x = e.getX(); int y = e.getY(); - int cursorType = getCursor().getType(); + Cursor cursor = getCursor(); - switch (cursorType) { - case Cursor.W_RESIZE_CURSOR: { - int nextLeft = (int) ((x - scaleImgX) / scale); - this.onNinePointLeftChanged(nextLeft); - return; - } - case Cursor.E_RESIZE_CURSOR: { - int nextRight = (int) ((scaleImgX + scaleImgWidth - x) / scale); - this.onNinePointRightChanged(nextRight); - return; - } - case Cursor.N_RESIZE_CURSOR: { - int nextTop = (int) ((y - scaleImgY) / scale); - this.onNinePointTopChanged(nextTop); - return; - } - case Cursor.S_RESIZE_CURSOR: { - int nextBottom = (int) ((scaleImgY + scaleImgHeight - y) / scale); - this.onNinePointBottomChanged(nextBottom); - } + if (cursor == W_DRAG_CURSOR || cursor == NW_DRAG_CURSOR || cursor == SW_DRAG_CURSOR) { + int nextLeft = (int) ((x - scaleImgX) / imageScale); + this.onNinePointLeftChanged(nextLeft); + } else if (cursor == E_DRAG_CURSOR || cursor == NE_DRAG_CURSOR || cursor == SE_DRAG_CURSOR) { + int nextRight = (int) ((scaleImgX + scaleImgWidth - x) / imageScale); + this.onNinePointRightChanged(nextRight); + } + + if (cursor == N_DRAG_CURSOR || cursor == NE_DRAG_CURSOR || cursor == NW_DRAG_CURSOR) { + int nextTop = (int) ((y - scaleImgY) / imageScale); + this.onNinePointTopChanged(nextTop); + } else if (cursor == S_DRAG_CURSOR || cursor == SE_DRAG_CURSOR || cursor == SW_DRAG_CURSOR) { + int nextBottom = (int) ((scaleImgY + scaleImgHeight - y) / imageScale); + this.onNinePointBottomChanged(nextBottom); } } @@ -629,13 +668,13 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { int x = e.getX(); int y = e.getY(); - double scaleLeft = ninePointLeft * scale; - double scaleTop = ninePointTop * scale; - double scaleRight = ninePointRight * scale; - double scaleBottom = ninePointBottom * scale; + double scaleLeft = ninePointLeft * imageScale; + double scaleTop = ninePointTop * imageScale; + double scaleRight = ninePointRight * imageScale; + double scaleBottom = ninePointBottom * imageScale; // determine cursor - int cursorType = Cursor.DEFAULT_CURSOR; + Cursor cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); boolean hoveringLeftDivider = false; boolean hoveringRightDivider = false; @@ -649,18 +688,31 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { hoveringBottomDivider = Math.abs(y - (scaleImgY + scaleImgHeight - scaleBottom)) < 2; } - if (hoveringLeftDivider) { - cursorType = Cursor.W_RESIZE_CURSOR; + if (hoveringLeftDivider && hoveringTopDivider) { + cursor = NW_DRAG_CURSOR; + } else if (hoveringLeftDivider && hoveringBottomDivider) { + cursor = SW_DRAG_CURSOR; + } else if (hoveringRightDivider && hoveringTopDivider) { + cursor = NE_DRAG_CURSOR; + } else if (hoveringRightDivider && hoveringBottomDivider) { + cursor = SE_DRAG_CURSOR; + } else if (hoveringLeftDivider) { + cursor = W_DRAG_CURSOR; } else if (hoveringRightDivider) { - cursorType = Cursor.E_RESIZE_CURSOR; + cursor = E_DRAG_CURSOR; } else if (hoveringTopDivider) { - cursorType = Cursor.N_RESIZE_CURSOR; + cursor = N_DRAG_CURSOR; } else if (hoveringBottomDivider) { - cursorType = Cursor.S_RESIZE_CURSOR; + cursor = S_DRAG_CURSOR; } - needRepaint = getCursor().getType() != cursorType; - this.setCursor(Cursor.getPredefinedCursor(cursorType)); + draggingLeftDivider = hoveringLeftDivider; + draggingRightDivider = hoveringRightDivider; + draggingTopDivider = hoveringTopDivider; + draggingBottomDivider = hoveringBottomDivider; + + needRepaint = getCursor() != cursor; + this.setCursor(cursor); if (needRepaint) { repaint(); @@ -680,6 +732,10 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { @Override public void mouseReleased(MouseEvent e) { this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + this.draggingLeftDivider = false; + this.draggingRightDivider = false; + this.draggingTopDivider = false; + this.draggingBottomDivider = false; repaint(); } @@ -701,7 +757,6 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { value = imgHeight - ninePointBottom - MIN_NINE_POINT; } this.ninePointTop = value; - topField.setText(Integer.toString(value)); repaint(); } @@ -712,7 +767,6 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { value = imgHeight - ninePointTop - MIN_NINE_POINT; } this.ninePointBottom = value; - bottomField.setText(Integer.toString(value)); repaint(); } @@ -723,7 +777,6 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { value = imgWidth - ninePointRight - MIN_NINE_POINT; } this.ninePointLeft = value; - leftField.setText(Integer.toString(value)); repaint(); } @@ -734,32 +787,14 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { value = imgWidth - ninePointLeft - MIN_NINE_POINT; } this.ninePointRight = value; - rightField.setText(Integer.toString(value)); repaint(); } - private UIIntNumberField createNumberField() { - UIIntNumberField field = new UIIntNumberField(); - field.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1)); - field.setOpaque(true); - field.setMinValue(MIN_NINE_POINT); - field.setForeground(HINT_FOREGROUND_COLOR); - field.setBackground(HINT_BACKGROUND_COLOR); - field.setHorizontalAlignment(SwingConstants.CENTER); - return field; - } - - public void setNinePoint(int[] ninePoint) { ninePointLeft = ninePoint[0]; ninePointTop = ninePoint[1]; ninePointRight = ninePoint[2]; ninePointBottom = ninePoint[3]; - - leftField.setValue(ninePointLeft); - rightField.setValue(ninePointRight); - topField.setValue(ninePointTop); - bottomField.setValue(ninePointBottom); } public int[] getNinePoint() { From df6a59529ba0f340317729e13b89f64ac91608a1 Mon Sep 17 00:00:00 2001 From: pengda Date: Mon, 19 Jul 2021 15:15:21 +0800 Subject: [PATCH 21/50] =?UTF-8?q?REPORT-51959=20=E3=80=90=E6=9D=A5?= =?UTF-8?q?=E6=BA=90=E4=BA=8E=E8=BF=AD=E4=BB=A3=E4=BB=BB=E5=8A=A1=E3=80=91?= =?UTF-8?q?=E3=80=9010.0.18=E3=80=91=E3=80=90V2.2.0=E3=80=91=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E7=8E=AF=E5=A2=83=E6=A3=80=E6=B5=8B=E5=8F=8A=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../versioncheck/VersionCheckUtils.java | 32 ++-- .../java/com/fr/env/CheckServiceDialog.java | 137 ++++++++++-------- 2 files changed, 91 insertions(+), 78 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index 045d54413f..c8fe8e8ada 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -87,23 +87,27 @@ public class VersionCheckUtils { public static void showVersionCheckDialog(String envName) { if (!VersionCheckUtils.versionCheck(envName)) { - NotificationDialog notificationDialog = new NotificationDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Sync_Prompt"), - false, NotificationDialog.WARNING_MESSAGE, Toolkit.i18nText("Fine-Design_Basic_Sync_Check_Brief_Info"), new NotificationDialogAction() { - @Override - public String name() { - return "VERSION_CHECK"; - } - - @Override - public void doClick() { - CheckServiceDialog checkServiceDialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), GeneralUtils.readFullBuildNO(), getRemoteBranch(envName),getNoExistServiceDescription(envName)); - checkServiceDialog.setVisible(true); - } - }); - notificationDialog.setVisible(true); + showNotificationDialog(envName); } } + private static void showNotificationDialog(String envName) { + NotificationDialog notificationDialog = new NotificationDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Sync_Prompt"), + false, NotificationDialog.WARNING_MESSAGE, Toolkit.i18nText("Fine-Design_Basic_Sync_Check_Brief_Info"), new NotificationDialogAction() { + @Override + public String name() { + return "VERSION_CHECK"; + } + + @Override + public void doClick() { + CheckServiceDialog checkServiceDialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), GeneralUtils.readFullBuildNO(), getRemoteBranch(envName), getNoExistServiceDescription(envName)); + checkServiceDialog.setVisible(true); + } + }); + notificationDialog.setVisible(true); + } + public static boolean checkLocalAndRemoteJartime(String envName) { DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName); diff --git a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java index 441a1fdecd..26cd7da732 100644 --- a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java +++ b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java @@ -167,13 +167,15 @@ public class CheckServiceDialog extends JDialog implements ActionListener { centerPanel.add(detailsPane, BorderLayout.CENTER); JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); - boolean Sync = false; - if (isOnline() && Sync) { + if (isOnline()) { ignoreButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_Ignore")); ignoreButton.addActionListener(this); syncButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_To_Local")); syncButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Sync_To_Local_Tip")); syncButton.addMouseListener(syncButtonClickListener); + if(jarConsistency && differentPlugins.isEmpty()){ + syncButton.setEnabled(false); + } progressBar = new JProgressBar(); progressBar.setUI(new MotifProgressBarUI()); progressBar.setForeground(UpdateConstants.BAR_COLOR); @@ -184,6 +186,8 @@ public class CheckServiceDialog extends JDialog implements ActionListener { buttonPanel.add(progressBar, BorderLayout.CENTER); buttonPanel.add(syncButton, BorderLayout.EAST); } else { + UILabel adviceLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Sync_Suggestion")); + centerPanel.add(adviceLabel, BorderLayout.SOUTH); UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm")); okButton.addActionListener(this); buttonPanel.add(okButton, BorderLayout.EAST); @@ -307,79 +311,84 @@ public class CheckServiceDialog extends JDialog implements ActionListener { private MouseListener syncButtonClickListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - ignoreButton.setEnabled(false); - syncButton.setEnabled(false); - String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; - if (!jarConsistency) { - int a = FineJOptionPane.showOptionDialog(getParent(), Toolkit.i18nText("Fine-Design_Basic_Sync_Info_Information"), - Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, IOUtils.readIcon("com/fr/design/icon/versioncheck/question.png"), option, 1); - if (0 == a) { - progressBar.setVisible(true); - progressBar.setString(Toolkit.i18nText("Fine-Design_Update_Info_Wait_Message")); - syncButton.setEnabled(false); - deletePreviousPropertyFile(); - final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB); - final JFrame frame = DesignerContext.getDesignerFrame(); - final RestartHelper helper = new RestartHelper(); - FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); - SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(frame, JSONArray.create()); - new SyncFileProcess(progressBar, remoteBuildNo, syncFailedPluginsDialog) { - @Override - public void onDownloadSuccess() { - deleteForDesignerUpdate(installLib); - progressBar.setVisible(false); - syncFailedPluginsDialog.showDialog(); - if (!syncFailedPluginsDialog.restartClicked()) { - helper.restartForUpdate(frame); - } - } + sync(); + } + }; - @Override - public void onDownloadFailed() { - progressBar.setVisible(false); - deleteForDesignerUpdate(installLib); - ErrorDialog errorDialog = new ErrorDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Sync_Fail")); - errorDialog.setVisible(true); + private void sync() { + ignoreButton.setEnabled(false); + syncButton.setEnabled(false); + String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; + if (!jarConsistency) { + int a = FineJOptionPane.showOptionDialog(getParent(), Toolkit.i18nText("Fine-Design_Basic_Sync_Info_Information"), + Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, IOUtils.readIcon("com/fr/design/icon/versioncheck/question.png"), option, 1); + if (0 == a) { + progressBar.setVisible(true); + progressBar.setString(Toolkit.i18nText("Fine-Design_Update_Info_Wait_Message")); + syncButton.setEnabled(false); + deletePreviousPropertyFile(); + final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB); + final JFrame frame = DesignerContext.getDesignerFrame(); + final RestartHelper helper = new RestartHelper(); + FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); + SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(frame, JSONArray.create()); + new SyncFileProcess(progressBar, remoteBuildNo, syncFailedPluginsDialog) { + @Override + public void onDownloadSuccess() { + deleteForDesignerUpdate(installLib); + progressBar.setVisible(false); + syncFailedPluginsDialog.showDialog(); + if (!syncFailedPluginsDialog.restartClicked()) { helper.restartForUpdate(frame); } - }.execute(); - } - } else { - //到这边说明主jar是一致的,就只尝试同步插件 - new SwingWorker() { - - @Override - protected JSONArray doInBackground() { - progressBar.setVisible(true); - progressBar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins")); - progressBar.setValue(0); - return VersionCheckUtils.syncPlugins(differentPlugins); } @Override - protected void done() { + public void onDownloadFailed() { progressBar.setVisible(false); - JSONArray syncFailedPlugins = null; - try { - syncFailedPlugins = get(); - } catch (Exception ex) { - FineLoggerFactory.getLogger().error(ex.getMessage(), ex); - } - if (syncFailedPlugins != null && syncFailedPlugins.size() > 0) { - SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(DesignerContext.getDesignerFrame(), syncFailedPlugins); - syncFailedPluginsDialog.setVisible(true); - } else { - FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Basic_Sync_Success"), - Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), - FineJOptionPane.INFORMATION_MESSAGE); - } - close(); + deleteForDesignerUpdate(installLib); + ErrorDialog errorDialog = new ErrorDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Sync_Fail")); + errorDialog.setVisible(true); + helper.restartForUpdate(frame); } }.execute(); } + } else { + //到这边说明主jar是一致的,就只尝试同步插件 + new SwingWorker() { + + @Override + protected JSONArray doInBackground() { + progressBar.setVisible(true); + progressBar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins")); + progressBar.setValue(0); + return VersionCheckUtils.syncPlugins(differentPlugins); + } + + @Override + protected void done() { + progressBar.setVisible(false); + JSONArray syncFailedPlugins = null; + try { + syncFailedPlugins = get(); + } catch (Exception ex) { + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); + } + if (syncFailedPlugins != null && syncFailedPlugins.size() > 0) { + SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(DesignerContext.getDesignerFrame(), syncFailedPlugins); + syncFailedPluginsDialog.setVisible(true); + } else { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Sync_Success"), + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + FineJOptionPane.INFORMATION_MESSAGE); + } + close(); + } + }.execute(); } - }; + } + private boolean deletePreviousPropertyFile() { File moveFile = new File(RestartHelper.MOVE_FILE); From 558907d9fad4b9dec762edd4be0d1939025a48bf Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 20 Jul 2021 11:11:05 +0800 Subject: [PATCH 22/50] =?UTF-8?q?REPORT-54580=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E6=96=B0=E5=A2=9E=E5=8F=82=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=90=8D=E7=A7=B0=20=E3=80=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91rt=20=E3=80=90=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91=E4=BF=AE=E6=94=B9=E4=B8=8B?= =?UTF-8?q?ParameterArrayPane=E4=B8=AD=E7=9A=84=E9=BB=98=E8=AE=A4=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/parameter/ParameterArrayPane.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java index adb0e48472..2703a2a2b8 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java @@ -18,6 +18,9 @@ import java.util.Arrays; import java.util.List; public class ParameterArrayPane extends JListControlPane { + + private static final String DEFAULT_PARAMETER_NAME_PREFIX = "para"; + /** * Constructor. */ @@ -63,7 +66,7 @@ public class ParameterArrayPane extends JListControlPane { new NameableSelfCreator(Toolkit.i18nText("Fine-Design_Basic_Engine_Parameter_Name"), Parameter.class, ParameterPane.class) { public Parameter createNameable(UnrepeatedNameHelper helper) { // 返回参数设置面板. - return new Parameter(helper.createUnrepeatedName("p")); + return new Parameter(helper.createUnrepeatedName(DEFAULT_PARAMETER_NAME_PREFIX)); } @Override From cc5eee3b51d9be0eb6830ab352637b4cf9dcb120 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 19 Jul 2021 13:46:18 +0800 Subject: [PATCH 23/50] =?UTF-8?q?REPORT-53175=20-=20=E3=80=9010.0.18?= =?UTF-8?q?=E3=80=91=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB?= =?UTF-8?q?=E4=B8=BA=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 设计器报表块预览优化:不显示行列头,否则当报表块较小时就无法预览到表格内容 【改动思路】 --- .../fr/design/mainframe/form/FormElementCaseDesigner.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java index 14895e90b3..7af39737dd 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java @@ -30,6 +30,7 @@ import com.fr.design.selection.Selectedable; import com.fr.design.selection.SelectionListener; import com.fr.form.FormElementCaseProvider; import com.fr.form.main.Form; +import com.fr.grid.Grid; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.Selection; import com.fr.log.FineLoggerFactory; @@ -138,7 +139,10 @@ public class FormElementCaseDesigner g.fillRect(0, 0, size.width, size.height); g.setColor(oldColor); - this.elementCasePane.paintComponents(g); + Grid grid = this.elementCasePane != null ? this.elementCasePane.getGrid() : null; + if (grid != null) { + grid.paintAll(g); + } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); From 1cb11fcd9f90cffcfae825856d51452ea1ae7d14 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 19 Jul 2021 16:22:43 +0800 Subject: [PATCH 24/50] =?UTF-8?q?REPORT-55370=20=E3=80=9010.0.18=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E5=8F=82=E6=95=B0=E6=8E=A7=E4=BB=B6TAb?= =?UTF-8?q?=E9=94=AE=E5=88=87=E6=8D=A2=E9=A1=BA=E5=BA=8F=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 迭代中右侧栏面板改动,需要将尺寸相关的属性放到高级属性上方,因此 高级属性所在的XXXDefinePane被设置了BorderLayout.CENTER 约束。而参数面板的DefinePane中,位于中间的尺寸面板,也被设置了 BorderLayout.CENTER约束,导致尺寸面板的尺寸变为最大尺寸。 【改动思路】 1. 中间加一层Pane,打破CENTER约束里还有CENTER约束的情况,使得 位于右侧栏参数面板属性底部,来自插件的ExtraUI占据最大尺寸 2. 参数面板的尺寸属性也需要放置在高级属性上方,与控件保持一致 --- .../fr/design/parameter/RootDesignDefinePane.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java index 5f45b57b09..2e96e6ed8d 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java @@ -62,13 +62,18 @@ public class RootDesignDefinePane extends AbstractDataModify { public void initComponent() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel inbuiltDefineContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.add(inbuiltDefineContentPane, BorderLayout.NORTH); + designerWidth = new UIBoundSpinner(1, Integer.MAX_VALUE, 1); - JPanel advancePane = createAdvancePane(); - UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane); - this.add(advanceExpandablePane, BorderLayout.NORTH); JPanel layoutPane = createBoundsPane(); UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Size"), 280, 20, layoutPane); - this.add(layoutExpandablePane, BorderLayout.CENTER); + inbuiltDefineContentPane.add(layoutExpandablePane, BorderLayout.NORTH); + + JPanel advancePane = createAdvancePane(); + UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane); + inbuiltDefineContentPane.add(advanceExpandablePane, BorderLayout.CENTER); + this.addExtraUIExpandablePaneFromPlugin(); } @@ -83,7 +88,7 @@ public class RootDesignDefinePane extends AbstractDataModify { panel.add(uiExpandablePane); } } - this.add(panel, BorderLayout.SOUTH); + this.add(panel, BorderLayout.CENTER); } public JPanel createBoundsPane() { From 9ae5af11644e2f9a15ca6240d5e5ee023a5f41af Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Tue, 20 Jul 2021 14:05:13 +0800 Subject: [PATCH 25/50] =?UTF-8?q?REPORT-53949=20UIBoundSpinner=E4=B9=9F?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E8=8E=B7=E5=8F=96=E7=84=A6=E7=82=B9=E5=90=8E?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E4=BF=AE=E6=94=B9=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/ispinner/UISpinner.java | 12 ++++++++---- .../widget/ui/designer/component/UIBoundSpinner.java | 6 ++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java index 9d10da3a72..22f6cb246e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java @@ -58,7 +58,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver * Spinner内的数字文本框长度 */ private int numberFieldColumns; - private boolean hasTextFieldFocus = false; + private boolean textFieldFocus = false; public UISpinner() { @@ -197,6 +197,10 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver this.nextButton.setEnabled(flag); } + public void setTextFieldFocus(boolean textFieldFocus) { + this.textFieldFocus = textFieldFocus; + } + @Override public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); @@ -319,7 +323,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver @Override public void mouseWheelMoved(MouseWheelEvent e) { - if (hasTextFieldFocus && isEnabled() && e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { + if (textFieldFocus && isEnabled() && e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { setValue(value - e.getWheelRotation()); } } @@ -333,12 +337,12 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver textField.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { - hasTextFieldFocus = true; + textFieldFocus = true; } @Override public void focusLost(FocusEvent e) { - hasTextFieldFocus = false; + textFieldFocus = false; textField.getDocument().removeDocumentListener(docListener); textField.setValue(value); textField.getDocument().addDocumentListener(docListener); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java index 426d27f1ae..ea90f3f397 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java @@ -23,8 +23,14 @@ public class UIBoundSpinner extends UISpinner{ @Override protected void initTextFiledListeners(){ this.getTextField().addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + setTextFieldFocus(true); + } + @Override public void focusLost(FocusEvent e) { + setTextFieldFocus(false); setTextFieldValue(getTextField().getValue()); setTextField(value); } From f3f80973c40f1e05c3c8c4e731b5fab577612436 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 20 Jul 2021 14:43:31 +0800 Subject: [PATCH 26/50] =?UTF-8?q?REPORT-55223=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E5=A4=9A=E5=B1=82tab=E5=B5=8C?= =?UTF-8?q?=E5=A5=971.=E5=A4=96=E5=B1=82tab=E5=9D=97=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E8=93=9D=E8=89=B2=E9=98=B4=E5=BD=B1=E7=9A=84=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E6=95=88=E6=9E=9C=202.=E5=8F=8C=E5=87=BB=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E6=A0=91tab=E5=9D=97=E5=86=85=E9=83=A8=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=80=89=E4=B8=AD=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cardlayout/XWCardMainBorderLayout.java | 16 ++++++--- .../fr/design/mainframe/ComponentTree.java | 15 ++++++++ .../mainframe/EditingMouseListener.java | 35 ++++++++++++++++--- .../fr/design/mainframe/FormDesignerUI.java | 26 ++++++++++---- .../fr/design/mainframe/FormSelection.java | 11 ++++++ 5 files changed, 87 insertions(+), 16 deletions(-) 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 22698ef5b9..523533e5e7 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 @@ -62,6 +62,8 @@ public class XWCardMainBorderLayout extends XWBorderLayout { private final int CARDMAINLAYOUT_CHILD_COUNT = 1; + private boolean showOuterShadowBorder; + /** * 构造函数 */ @@ -351,15 +353,18 @@ public class XWCardMainBorderLayout extends XWBorderLayout { @Override public void paintBorder(Graphics g, Rectangle bounds){ - if (isDragInAble()) { + if (!isMouseEnter) { + super.paintBorder(g, bounds); + } + } + + public void paintShadowBorder(Graphics g, Rectangle bounds) { + if (isDragInAble() || showOuterShadowBorder) { Color oldColor = g.getColor(); g.setColor(OUTER_BORDER_COLOR); GraphHelper.draw(g, new Rectangle(bounds.x - BORDER_WIDTH, bounds.y - BORDER_WIDTH, bounds.width + BORDER_WIDTH + 3, bounds.height + BORDER_WIDTH + 3), Constants.LINE_LARGE); g.setColor(oldColor); } - if (!isMouseEnter) { - super.paintBorder(g, bounds); - } } /** @@ -464,4 +469,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout { return LARGEPREFERREDSIZE; } + public void setShowOuterShadowBorder(boolean showOuterShadowBorder) { + this.showOuterShadowBorder = showOuterShadowBorder; + } } 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 37094494b4..25bf1f5de7 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 @@ -5,6 +5,7 @@ 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.creator.XWTitleLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.treeview.ComponentTreeCellRenderer; import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.design.file.HistoryTemplateListCache; @@ -453,6 +454,20 @@ public class ComponentTree extends JTree { if (ArrayUtils.isNotEmpty(listeners) && listeners[0] instanceof EditingMouseListener) { responseClickAll(creator, (EditingMouseListener) listeners[0], new MouseEvent(creator, MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), x, y, e.getClickCount(), false)); } + // 放到事件尾部执行 + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + //处理下tab块的选中 + if (comp.acceptType(XWCardMainBorderLayout.class)) { + XCreator xCreator = designer.getSelectionModel().getSelection().getSelectedCreator(); + if (xCreator != null) { + showSelectedPopup(xCreator); + } + } + } + }); + } /** 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 b393d29b06..783e984b9d 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 @@ -34,6 +34,7 @@ import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.ComparatorUtils; import com.fr.stable.Constants; +import java.util.LinkedList; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPopupMenu; @@ -613,6 +614,7 @@ public class EditingMouseListener extends MouseInputAdapter { int oldX = e.getX(); int oldY = e.getY(); offsetEventPoint(e); + selectionModel.getSelection().getTabList().clear(); XCreator creator = designer.getComponentAt(e); boolean isValidButton = e.getButton() == MouseEvent.BUTTON1 || e.getButton() == MouseEvent.BUTTON3; @@ -661,13 +663,36 @@ public class EditingMouseListener extends MouseInputAdapter { } private boolean responseTabLayout(XCreator creator, MouseEvent e) { - if (creator.acceptType(XWCardMainBorderLayout.class) ) { - creator.respondClick(this, e); + LinkedList list = selectionModel.getSelection().getTabList(); + if (creator.acceptType(XWCardMainBorderLayout.class)) { + list.add(creator); + } + while (creator.getParent() instanceof XCreator) { + creator = (XCreator) creator.getParent(); + if (creator.acceptType(XWCardMainBorderLayout.class)) { + list.add(creator); + } + } + // 至少存在一层以上tab块的嵌套 + if (list.size() > 1) { + XWCardMainBorderLayout firstCreator = (XWCardMainBorderLayout) list.getFirst(); + XWCardMainBorderLayout lastCreator = (XWCardMainBorderLayout) list.getLast(); + // 内层tab响应事件 + firstCreator.respondClick(this, e); + setCoverPaneNotDisplay(firstCreator, e, false); + final XCreator xCreator = selectionModel.getSelection().getSelectedCreator(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + xCreator.setSelected(true); + // 外层tab展示阴影边框效果 + lastCreator.setShowOuterShadowBorder(true); + } + }); return true; - } else if (creator.getParent() instanceof XCreator) { - return responseTabLayout((XCreator) creator.getParent(), e); + } else { + return false; } - return false; } 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 c48c881010..a8ddce03c9 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 @@ -95,7 +95,7 @@ public class FormDesignerUI extends ComponentUI { } paintBorder(g); paintSelection(g); - paintDropBorderShadow(g); + paintBorderShadow(g); if (DesignerMode.isAuthorityEditing()) { paintAuthorityDetails(g, designer.getRootComponent()); @@ -333,22 +333,34 @@ public class FormDesignerUI extends ComponentUI { } /** - * 绘制可拖拽进tab块之前的阴影 + * 绘制tab块的阴影 * * @param g */ - private void paintDropBorderShadow(Graphics g) { + private void paintBorderShadow(Graphics g) { + // 绘制可拖拽进tab块之前的阴影 DropTarget dropTarget = designer.getDropTarget(); if (dropTarget instanceof FormCreatorDropTarget) { FormCreatorDropTarget target = (FormCreatorDropTarget) dropTarget; XLayoutContainer layoutContainer = target.getTabDragInner().getBelowXLayoutContainer(); if (layoutContainer != null && layoutContainer.acceptType(XWCardMainBorderLayout.class)) { - Rectangle creatorBounds = ComponentUtils.getRelativeBounds(layoutContainer); - creatorBounds.x -= designer.getHorizontalScaleValue(); - creatorBounds.y -= designer.getVerticalScaleValue(); - layoutContainer.paintBorder(g, creatorBounds); + XWCardMainBorderLayout cardMainBorderLayout = (XWCardMainBorderLayout) layoutContainer; + cardMainBorderLayout.paintShadowBorder(g, getCreatorBounds(layoutContainer)); } } + // 绘制嵌套tab块时的阴影 + if (designer.getSelectionModel().getSelection().getTabList().size() > 1) { + XLayoutContainer layoutContainer = (XLayoutContainer) designer.getSelectionModel().getSelection().getTabList().getLast(); + XWCardMainBorderLayout cardMainBorderLayout = (XWCardMainBorderLayout) layoutContainer; + cardMainBorderLayout.paintShadowBorder(g, getCreatorBounds(layoutContainer)); + } + } + + private Rectangle getCreatorBounds(XLayoutContainer layoutContainer) { + Rectangle creatorBounds = ComponentUtils.getRelativeBounds(layoutContainer); + creatorBounds.x -= designer.getHorizontalScaleValue(); + creatorBounds.y -= designer.getVerticalScaleValue(); + return creatorBounds; } /** diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java index 7d3711a695..c25d99b1ae 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java @@ -13,6 +13,7 @@ import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWTitleLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.file.HistoryTemplateListCache; @@ -25,12 +26,15 @@ import java.awt.Component; import java.awt.LayoutManager; import java.awt.Rectangle; import java.util.ArrayList; +import java.util.LinkedList; public class FormSelection { private ArrayList selection; private Rectangle backupBounds; private ArrayList recs = new ArrayList(); + // 选中的组件外层嵌套的tab块 head->tail 由内向外 + private LinkedList tabList = new LinkedList<>(); public FormSelection() { selection = new ArrayList(); @@ -43,6 +47,9 @@ public class FormSelection { for (XCreator xCreator : selection) { xCreator.setSelected(false); } + for (XCreator xCreator : tabList) { + ((XWCardMainBorderLayout) xCreator).setShowOuterShadowBorder(false); + } selection.clear(); } @@ -404,4 +411,8 @@ public class FormSelection { } } } + + public LinkedList getTabList() { + return tabList; + } } From 1951770b8e9a5d60c5381f1e3d2a0a3a15c406e6 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 20 Jul 2021 16:16:37 +0800 Subject: [PATCH 27/50] =?UTF-8?q?REPORT-55497=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E5=88=9B=E5=BB=BA=E5=A4=8D?= =?UTF-8?q?=E7=94=A8=E7=BB=84=E4=BB=B6=E6=97=B6=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E5=8E=9F=E7=BB=84=E4=BB=B6=E8=B6=85=E8=BF=87=E8=A7=84=E5=AE=9A?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8=EF=BC=8C=E5=88=99=E5=A4=8D=E7=94=A8=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=BC=A9=E5=B0=8F=E8=87=B3=E8=A7=84=E5=AE=9A=E5=B0=BA?= =?UTF-8?q?=E5=AF=B8=E4=B8=94=E4=BF=9D=E6=8C=81=E5=8E=9F=E6=AF=94=E4=BE=8B?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 生成复用组件时,需限制复用组件的尺寸 【改动思路】 --- .../share/ui/generate/ShareGeneratePane.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java index 93f07b2603..99d6c556bd 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java @@ -65,6 +65,8 @@ public class ShareGeneratePane extends BasicPane { private static final Dimension DIALOG_SIZE = new Dimension(670, 760); private static final Dimension DIALOG_NORMAL_SIZE = new Dimension(670, 610); private static final Border DIALOG_BORDER = BorderFactory.createEmptyBorder(0, 6, 4, 6); + private static final double MAX_WIDTH = 500.0; + private static final double MAX_HEIGHT = 260.0; private JPanel mainPane = null; private ShareMainPane uploadPane = null; @@ -303,6 +305,7 @@ public class ShareGeneratePane extends BasicPane { } private DefaultSharableWidget transform(DefaultSharableWidget info) { + confineSize(info); //先屏蔽 //if (shareWidget instanceof AbstractBorderStyleWidget) { @@ -327,4 +330,18 @@ public class ShareGeneratePane extends BasicPane { } + private void confineSize(DefaultSharableWidget info) { + double width = info.getWidth(); + double height = info.getHeight(); + if (width > 0 && height > 0 && (width > MAX_WIDTH || height > MAX_HEIGHT)) { + double aspectRatio = width / height; + if (width / height > MAX_WIDTH / MAX_HEIGHT) { + info.setWidth((int) MAX_WIDTH); + info.setHeight((int) (MAX_WIDTH / aspectRatio)); + } else { + info.setHeight((int) MAX_HEIGHT); + info.setWidth((int) (MAX_HEIGHT * aspectRatio)); + } + } + } } From bdb220adc5cba2be71d6e77b24a44329ffba3cde Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 20 Jul 2021 16:50:33 +0800 Subject: [PATCH 28/50] =?UTF-8?q?REPORT-55428=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF-=E9=A2=84=E8=A7=88=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=BE=83=E9=95=BF=E7=9A=84=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E8=BF=87=E7=A8=8B=E6=97=B6=EF=BC=8C=E5=8A=A0=E8=BD=BD=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E7=95=8C=E9=9D=A2=E7=9A=84=E4=BD=8D=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledatapane/ProcedureDataPane.java | 25 +++++++++++-------- .../wrapper/StoreProcedureDataWrapper.java | 21 ++++++++++++++-- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java index d0bc499a29..f1d2433dbe 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java @@ -158,7 +158,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp private JToolBar creatToolBar() { ToolBarDef toolBarDef = new ToolBarDef(); - toolBarDef.addShortCut(new PreviewAction()); + toolBarDef.addShortCut(new PreviewAction(this)); toolBarDef.addShortCut(new RefreshAction()); toolBarDef.addShortCut(SeparatorDef.DEFAULT); isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData")); @@ -243,7 +243,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp this.storeProcedureWorkerListener = null; } - + private StoreProcedure updateBeanWithOutExecute() { String dbName = connectionTableProcedurePane.getSelectedDatabaseConnnectonName(); @@ -266,16 +266,16 @@ public class ProcedureDataPane extends AbstractTableDataPane imp return sp; } - + @Override public StoreProcedure updateBean() { - + final StoreProcedure sp = updateBeanWithOutExecute(); if (updateWorker != null) { updateWorker.cancel(true); } updateWorker = new SwingWorker() { - + @Override protected Void doInBackground() throws Exception { DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); @@ -284,7 +284,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp sp.refreshDataModelListAndResultNames(dataModels); return null; } - + @Override public void done() { DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); @@ -293,7 +293,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp fireDSChanged(); } }; - + updateWorker.execute(); return sp; } @@ -359,17 +359,20 @@ public class ProcedureDataPane extends AbstractTableDataPane imp } private class PreviewAction extends UpdateAction { - public PreviewAction() { + ProcedureDataPane procedureDataPane; + + public PreviewAction(ProcedureDataPane procedureDataPane) { this.setName(PREVIEW_BUTTON); this.setMnemonic('P'); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); + this.procedureDataPane = procedureDataPane; } @Override public void actionPerformed(ActionEvent evt) { - StoreProcedure sp = updateBeanWithOutExecute(); - StoreProcedureDataWrapper storeProcedureDataWrappe = new StoreProcedureDataWrapper(sp, StringUtils.EMPTY, queryText.getText()); - storeProcedureDataWrappe.previewData(StoreProcedureDataWrapper.PREVIEW_ALL); + StoreProcedure sp = updateBeanWithOutExecute(); + StoreProcedureDataWrapper storeProcedureDataWrapper = new StoreProcedureDataWrapper(this.procedureDataPane, sp, StringUtils.EMPTY, queryText.getText()); + storeProcedureDataWrapper.previewData(StoreProcedureDataWrapper.PREVIEW_ALL); } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java index 17fbf57888..f03a17c3fa 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java @@ -18,6 +18,7 @@ import com.fr.log.FineLoggerFactory; import javax.swing.Icon; import javax.swing.JFrame; import javax.swing.SwingWorker; +import java.awt.Component; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -52,7 +53,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { private int previewModel; public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName) { - this(storeProcedure, storeprocedureName, dsName, true); + this(null, storeProcedure, storeprocedureName, dsName, true); } @@ -62,6 +63,19 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { * @param storeprocedureName 存储过程的名字(某些情况下可以为空) */ public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) { + this(null, storeProcedure, storeprocedureName, dsName, needLoad); + } + + public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName) { + this(component, storeProcedure, storeprocedureName, dsName, true); + } + + /** + * @param dsName 存储过程一个返回数据集的名字 + * @param storeProcedure 存储过程 + * @param storeprocedureName 存储过程的名字(某些情况下可以为空) + */ + public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) { this.dsName = dsName; this.storeProcedure = storeProcedure; this.storeProcedure.setCalculating(false); @@ -69,7 +83,10 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { if (needLoad) { setWorker(); } - loadingBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) { + if (component == null) { + component = new JFrame(); + } + loadingBar = new AutoProgressBar(component, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) { public void doMonitorCanceled() { getWorker().cancel(true); } From 1a11b638bede58a7cab0641fb3d2903b519ba1eb Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 20 Jul 2021 16:56:49 +0800 Subject: [PATCH 29/50] =?UTF-8?q?REPORT-55428=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF-=E9=A2=84=E8=A7=88=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=BE=83=E9=95=BF=E7=9A=84=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E8=BF=87=E7=A8=8B=E6=97=B6=EF=BC=8C=E5=8A=A0=E8=BD=BD=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E7=95=8C=E9=9D=A2=E7=9A=84=E4=BD=8D=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wrapper/StoreProcedureDataWrapper.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java index f03a17c3fa..08274fd71d 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java @@ -56,12 +56,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { this(null, storeProcedure, storeprocedureName, dsName, true); } - - /** - * @param dsName 存储过程一个返回数据集的名字 - * @param storeProcedure 存储过程 - * @param storeprocedureName 存储过程的名字(某些情况下可以为空) - */ public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) { this(null, storeProcedure, storeprocedureName, dsName, needLoad); } @@ -69,12 +63,14 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName) { this(component, storeProcedure, storeprocedureName, dsName, true); } - + /** - * @param dsName 存储过程一个返回数据集的名字 - * @param storeProcedure 存储过程 - * @param storeprocedureName 存储过程的名字(某些情况下可以为空) - */ + * @param: component loadingBar的父弹框(如果不设置父弹框的话,可能出现loadingBar隐藏在一个弹框后的情况) + * @param: storeProcedure 存储过程 + * @param: storeprocedureName 存储过程的名字(某些情况下可以为空) + * @param: dsName 存储过程一个返回数据集的名字 + * @param: needLoad 是否要加载 + **/ public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) { this.dsName = dsName; this.storeProcedure = storeProcedure; From 76374c5ea96c9ac03aff728457181e7c41fba1d9 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 21 Jul 2021 10:20:05 +0800 Subject: [PATCH 30/50] =?UTF-8?q?REPORT-53900=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E8=87=AA=E5=8A=A8=E6=96=AD=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/socketio/DesignerSocketIO.java | 53 ++++++++++++++----- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 33b3b80f7d..157ce6f980 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -32,6 +32,8 @@ import javax.swing.*; import java.io.IOException; import java.net.URI; import java.net.URL; +import java.util.Timer; +import java.util.TimerTask; public class DesignerSocketIO { @@ -45,7 +47,7 @@ public class DesignerSocketIO { if (DesignerEnvManager.getEnvManager().isHttps()) { showConnectionLostDialog(); } - } + } }); } @@ -57,6 +59,8 @@ public class DesignerSocketIO { private static Socket socket = null; private static Status status = Status.Disconnected; + private static Timer disConnectHintTimer = null; + private static long disConnectHintTimerDelay = 3000; //维护一个当前工作环境的uri列表 private static String[] uri; //维护一个关于uri列表的计数器 @@ -87,18 +91,19 @@ public class DesignerSocketIO { createSocket(); } - private static void createSocket(){ + private static void createSocket() { //根据uri和计数器建立连接,并注册监听 try { - if(count Date: Wed, 21 Jul 2021 14:08:49 +0800 Subject: [PATCH 31/50] =?UTF-8?q?REPORT-55509=20&=20REPORT-54844=20?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E7=81=B0=E5=8C=96=E5=92=8C=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../versioncheck/VersionCheckUtils.java | 30 ++++++++++++------- .../java/com/fr/env/CheckServiceDialog.java | 26 +++++++++++----- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index c8fe8e8ada..24431cd957 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -26,6 +26,8 @@ import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.ProgressCallback; import com.fr.report.ReportHelper; +import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.rpc.Result; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; @@ -35,6 +37,7 @@ import com.fr.workspace.engine.base.FineObjectPool; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.exception.WorkspaceConnectionException; import com.fr.workspace.engine.rpc.WorkspaceProxyPool; +import com.fr.workspace.server.check.VersionInfoOperator; import java.lang.reflect.Method; import java.text.ParsePosition; import java.text.SimpleDateFormat; @@ -160,15 +163,22 @@ public class VersionCheckUtils { } public static String getRemoteBranch(DesignerWorkspaceInfo selectedEnv) { - String remoteBranch = StringUtils.EMPTY; - WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection(); - try { - remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); - } catch (WorkspaceConnectionException e) { - remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(GeneralUtils.readFullBuildNO()); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + String remoteBranch; + remoteBranch = WorkContext.getCurrent().get(VersionInfoOperator.class, new ExceptionHandler() { + @Override + public String callHandler(RPCInvokerExceptionInfo exceptionInfo) { + WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection(); + String remoteBranch = StringUtils.EMPTY; + try { + remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); + } catch (WorkspaceConnectionException e) { + remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(GeneralUtils.readFullBuildNO()); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return remoteBranch; + } + }).getFullBuildNO(); return remoteBranch; } @@ -252,7 +262,7 @@ public class VersionCheckUtils { Map pluginsNameMap = ReportHelper.getPluginNameMap(); for (int i = 0; i < remotePlugins.size(); i++) { remotePlugin = remotePlugins.getJSONObject(i); - if (ComparatorUtils.equals(remotePlugin.getString("running"), "false")) { + if (ComparatorUtils.equals(remotePlugin.getString("running"), "false") || (remotePlugin.containsKey("sync") && !remotePlugin.getBoolean("sync"))) { continue; } String remotePluginID = remotePlugin.getString(ID); diff --git a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java index 26cd7da732..a921a03229 100644 --- a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java +++ b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java @@ -36,6 +36,8 @@ import java.awt.Component; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.io.File; import java.util.List; import javax.swing.BorderFactory; @@ -172,7 +174,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener { ignoreButton.addActionListener(this); syncButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_To_Local")); syncButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Sync_To_Local_Tip")); - syncButton.addMouseListener(syncButtonClickListener); + syncButton.addActionListener(syncButtonActionListener); if(jarConsistency && differentPlugins.isEmpty()){ syncButton.setEnabled(false); } @@ -186,8 +188,10 @@ public class CheckServiceDialog extends JDialog implements ActionListener { buttonPanel.add(progressBar, BorderLayout.CENTER); buttonPanel.add(syncButton, BorderLayout.EAST); } else { - UILabel adviceLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Sync_Suggestion")); - centerPanel.add(adviceLabel, BorderLayout.SOUTH); + if (!(jarConsistency && differentPlugins.isEmpty())) { + UILabel adviceLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Sync_Suggestion")); + centerPanel.add(adviceLabel, BorderLayout.SOUTH); + } UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm")); okButton.addActionListener(this); buttonPanel.add(okButton, BorderLayout.EAST); @@ -198,6 +202,12 @@ public class CheckServiceDialog extends JDialog implements ActionListener { this.add(centerPanel, BorderLayout.CENTER); this.add(buttonPanel, BorderLayout.SOUTH); this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US) ? 750 : 600, 500)); + this.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + close(); + } + }); GUICoreUtils.centerWindow(this); } @@ -308,10 +318,10 @@ public class CheckServiceDialog extends JDialog implements ActionListener { } }; - private MouseListener syncButtonClickListener = new MouseAdapter() { + private ActionListener syncButtonActionListener = new ActionListener() { @Override - public void mouseClicked(MouseEvent e) { - sync(); + public void actionPerformed(ActionEvent e) { + sync(); } }; @@ -352,6 +362,9 @@ public class CheckServiceDialog extends JDialog implements ActionListener { helper.restartForUpdate(frame); } }.execute(); + } else { + ignoreButton.setEnabled(true); + syncButton.setEnabled(true); } } else { //到这边说明主jar是一致的,就只尝试同步插件 @@ -389,7 +402,6 @@ public class CheckServiceDialog extends JDialog implements ActionListener { } } - private boolean deletePreviousPropertyFile() { File moveFile = new File(RestartHelper.MOVE_FILE); File delFile = new File(RestartHelper.RECORD_FILE); From 6175d539aed6bedd8815e02d5ae8b435e42e270f Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 21 Jul 2021 14:40:03 +0800 Subject: [PATCH 32/50] =?UTF-8?q?REPORT-55509=20&=20REPORT-54844=20?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E7=81=B0=E5=8C=96=E5=92=8C=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/env/SyncFailedPluginsDialog.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java b/designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java index a93ea0460d..8117f87395 100644 --- a/designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java +++ b/designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java @@ -21,6 +21,8 @@ import java.awt.Dimension; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.util.Locale; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -96,6 +98,12 @@ public class SyncFailedPluginsDialog extends JDialog { this.setResizable(false); this.add(body, BorderLayout.CENTER); this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US) ? 400 : 380, 225)); + this.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + hideDialog(); + } + }); GUICoreUtils.centerWindow(this); } From 64760cabc3d531e200c1a74d60b35129f393a065 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 21 Jul 2021 17:42:21 +0800 Subject: [PATCH 33/50] =?UTF-8?q?REPORT-55545=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E4=B8=8B=E6=8B=89=E7=B1=BB?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=EF=BC=8Ccpt=E5=92=8Cfrm=E9=83=BD=E4=BC=9A?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=EF=BC=8C=E6=94=B6=E8=B5=B7=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E4=B8=8A=E6=96=B9=E4=BB=BB=E6=84=8F=E7=9A=84=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9=EF=BC=8C=E5=85=81=E8=AE=B8=E4=B8=BA=E7=A9=BA=E7=9A=84?= =?UTF-8?q?=E9=82=A3=E4=B8=89=E4=B8=AA=E9=80=89=E9=A1=B9=E5=B0=B1=E4=BC=9A?= =?UTF-8?q?=E6=9C=89=E9=97=B4=E9=9A=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit REPORT-55618 【组件背景分离】组件复用-安装自适应插件,报表块的内容显示方式和提示文字,跑到了最下面 REPORT-55370 【10.0.18冒烟】参数控件TAb键切换顺序展示有问题 【问题原因】 三个问题的原因是一样的。将尺寸/位置面板挪动到了高级属性的上方后,导致后续的面板中设置项出现了 BorderLayout.CENTER约束中嵌套BorderLayout.CENTER约束的情况,位于其中的组件高度变大。 【改动思路】 右侧栏有问题的设置项用BorderLayout包装起来,使用BorderLayout.North打破上述嵌套约束. --- .../mainframe/widget/ui/FormWidgetCardPane.java | 7 ++++--- .../fr/design/parameter/RootDesignDefinePane.java | 15 +++++---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index a5189e66f6..b9230546df 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -187,9 +187,10 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { }); DataModify definePane = rn.getDefinePane(); - JComponent jComponent = definePane.toSwingComponent(); - - attriCardPane.add(jComponent, BorderLayout.CENTER); + // 使用单独的JPane和BorderLayout.North进行包装,避免出现CENTER嵌套CENTER后,内容高度变大的情况 + JPanel definePaneWrapContent = FRGUIPaneFactory.createBorderLayout_S_Pane(); + definePaneWrapContent.add(definePane.toSwingComponent(), BorderLayout.NORTH); + attriCardPane.add(definePaneWrapContent, BorderLayout.CENTER); currentEditorDefinePane = definePane; } diff --git a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java index 2e96e6ed8d..5f45b57b09 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java @@ -62,18 +62,13 @@ public class RootDesignDefinePane extends AbstractDataModify { public void initComponent() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel inbuiltDefineContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(inbuiltDefineContentPane, BorderLayout.NORTH); - designerWidth = new UIBoundSpinner(1, Integer.MAX_VALUE, 1); - JPanel layoutPane = createBoundsPane(); - UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Size"), 280, 20, layoutPane); - inbuiltDefineContentPane.add(layoutExpandablePane, BorderLayout.NORTH); - JPanel advancePane = createAdvancePane(); UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane); - inbuiltDefineContentPane.add(advanceExpandablePane, BorderLayout.CENTER); - + this.add(advanceExpandablePane, BorderLayout.NORTH); + JPanel layoutPane = createBoundsPane(); + UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Size"), 280, 20, layoutPane); + this.add(layoutExpandablePane, BorderLayout.CENTER); this.addExtraUIExpandablePaneFromPlugin(); } @@ -88,7 +83,7 @@ public class RootDesignDefinePane extends AbstractDataModify { panel.add(uiExpandablePane); } } - this.add(panel, BorderLayout.CENTER); + this.add(panel, BorderLayout.SOUTH); } public JPanel createBoundsPane() { From 0eedb3bce5e840e71886ede6488c2cbb8e9cf9db Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 21 Jul 2021 18:07:06 +0800 Subject: [PATCH 34/50] =?UTF-8?q?REPORT-55603=20=E3=80=9010.0.18=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E3=80=90=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?-=E6=8E=A7=E4=BB=B6=E7=BB=84=E4=BB=B6=E7=B1=BB=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=9C=80=E6=96=B0jar=E4=B8=8B=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=8E=A7=E4=BB=B6=E5=A4=A7=E5=B0=8F=E3=80=81=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 插件控件的FormWidgetCardPane.initComponent方法在isExtraWidget后直接退出, 没有执行添加boundPane的逻辑 2. 插件控件的definePane既包含了基本属性,又包含了高级属性,FormWidgetCardPane 内部无法在基本属性和高级属性之前插入boundPane 【改动思路】 和产品沟通后确认,对于插件控件,暂时不改变右侧栏中位置*尺寸面板的位置,其余类型的内置 控件仍然需要将位置*尺寸面板放置在高级属性上方 --- .../widget/ui/FormWidgetCardPane.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index b9230546df..a76c96902c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -150,6 +150,11 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { freshPropertyMode(innerCreator); if (isExtraWidget) { + // REPORT-55603: 仅对于插件控件,将尺寸*位置面板放置在definePane下方,其余控件将尺寸*位置面板放置在definePane上方 + widgetBoundPane = createWidgetBoundPane(xCreator); + if (widgetBoundPane != null) { + attriCardPane.add(widgetBoundPane, BorderLayout.CENTER); + } return; } @@ -187,10 +192,18 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { }); DataModify definePane = rn.getDefinePane(); - // 使用单独的JPane和BorderLayout.North进行包装,避免出现CENTER嵌套CENTER后,内容高度变大的情况 - JPanel definePaneWrapContent = FRGUIPaneFactory.createBorderLayout_S_Pane(); - definePaneWrapContent.add(definePane.toSwingComponent(), BorderLayout.NORTH); - attriCardPane.add(definePaneWrapContent, BorderLayout.CENTER); + JComponent definePaneComponent = definePane.toSwingComponent(); + boolean isExtraWidget = FormWidgetDefinePaneFactoryBase.isExtraXWidget(creator.toData()); + + if (isExtraWidget) { + // REPORT-55603: 仅对于插件控件,将尺寸*位置面板放置在definePane下方,其余控件将尺寸*位置面板放置在definePane上方 + attriCardPane.add(definePaneComponent, BorderLayout.NORTH); + } else { + // 使用单独的JPane和BorderLayout.North进行包装,避免出现CENTER嵌套CENTER后,内容高度变大的情况 + JPanel definePaneWrapContent = FRGUIPaneFactory.createBorderLayout_S_Pane(); + definePaneWrapContent.add(definePaneComponent, BorderLayout.NORTH); + attriCardPane.add(definePaneWrapContent, BorderLayout.CENTER); + } currentEditorDefinePane = definePane; } From 624748dd870d072aa7ac6ddc149684566a5af461 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 22 Jul 2021 12:42:04 +0800 Subject: [PATCH 35/50] =?UTF-8?q?REPORT-55557=20=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=A0=8F=E5=85=B3=E9=97=AD=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=88cpt&frm=E5=90=88=E5=B9=B6=E4=B8=8B=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=EF=BC=89&&=20REPORT-55552=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E8=80=81=E7=BC=96=E8=BE=91=E5=92=8C=E5=B8=AE=E5=8A=A9?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesktopCardPane.java | 4 +++ .../com/fr/design/mainframe/JTemplate.java | 7 ++++- .../design/mainframe/TabChangeListener.java | 13 ++++++++ .../fr/design/designer/creator/XCreator.java | 8 ++++- .../designer/creator/XWAbsoluteLayout.java | 5 +--- .../cardlayout/XWCardMainBorderLayout.java | 5 +--- .../design/designer/ui/PopupControlPanel.java | 4 ++- .../designer/ui/SelectedPopupDialog.java | 9 ++++++ .../fr/design/mainframe/ComponentTree.java | 3 +- .../com/fr/design/mainframe/CoverPane.java | 21 ++++++++++--- .../fr/design/mainframe/CoverReportPane.java | 3 -- .../mainframe/EditingMouseListener.java | 15 +++++++--- .../com/fr/design/mainframe/FormDesigner.java | 14 +++++++++ .../java/com/fr/design/mainframe/JForm.java | 30 +++++-------------- .../com/fr/design/mainframe/JWorkBook.java | 16 ++++++++++ 15 files changed, 111 insertions(+), 46 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/TabChangeListener.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java index f540832d0d..f3afcacc98 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java @@ -56,6 +56,10 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener } else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing()) { DesignModeContext.switchTo(DesignerMode.NORMAL); } + // 切换时 + if (component != null) { + component.fireTabChange(); + } DesignerFrameFileDealerPane.getInstance().setCurrentEditingTemplate(jt); if (component != null) { layeredPane.remove(component); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index abd219ee7f..f1bc2cbafe 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -95,7 +95,7 @@ import java.util.concurrent.Callable; /** * 报表设计和表单设计的编辑区域(设计器编辑的IO文件) */ -public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, DesignerProxy, JTemplateSave { +public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, DesignerProxy, JTemplateSave, TabChangeListener { // TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null private static final int PREFIX_NUM = 3000; protected FILE editingFILE = null; @@ -218,6 +218,11 @@ public abstract class JTemplate> } } + @Override + public void fireTabChange() { + // do nothing + } + protected void addPane(PropertyItemPaneProvider provider) { // do nothing } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/TabChangeListener.java b/designer-base/src/main/java/com/fr/design/mainframe/TabChangeListener.java new file mode 100644 index 0000000000..a69706c551 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/TabChangeListener.java @@ -0,0 +1,13 @@ +package com.fr.design.mainframe; + +/** + * tab切换时对当前打开的模版处理些事件 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/7/22 + */ +public interface TabChangeListener { + + void fireTabChange(); +} 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 2f5f0e6282..fa9267b1a7 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -778,7 +778,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo int extraY = (int) (bounds.y * designer.getScale()); popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); popup.updatePane(designer); - popup.setVisible(selected && accept && popup.hasVisibleButtons()); + popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible()); popup.setRelativeBounds(bounds); } @@ -836,4 +836,10 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } } + public void processPopup(boolean canVisible) { + if (popup != null) { + popup.setCanVisible(canVisible); + } + } + } 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 c6d0067c3a..fdd62d1b0f 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 @@ -447,10 +447,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { super.paint(g); //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 if (isMouseEnter && !this.editable) { - CoverReportPane.paintEditButton(g, this); - if (isShared()) { - CoverReportPane.paintShareButton(g, this); - } + CoverReportPane.paintCover(g, this); } } 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 523533e5e7..6009711f71 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 @@ -344,10 +344,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout { super.paint(g); //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 if (isMouseEnter && !editable) { - CoverReportPane.paintEditButton(g, this); - if (isShared()) { - CoverReportPane.paintShareButton(g, this); - } + CoverReportPane.paintCover(g, this); } } diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java index ebcfa472f0..ad003ff692 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java @@ -4,7 +4,9 @@ import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWTitleLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.VerticalFlowLayout; @@ -193,7 +195,7 @@ public class PopupControlPanel extends JPanel { } public void updatePane(FormDesigner designer) { - setButtonVisible(editButton, creator.acceptType(XWTitleLayout.class)); + setButtonVisible(editButton, creator.acceptType(XWTitleLayout.class, XWCardMainBorderLayout.class) || creator.getClass().equals(XWAbsoluteLayout.class)); setButtonVisible(settingButton, creator.isShared()); setButtonVisible(toggleButton, AdapterBus.searchLayoutAdapter(designer, creator) instanceof FRAbsoluteLayoutAdapter); toggleButton.setSelected(creator.toData().isAspectRatioLocked()); diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java index c5f94d70eb..285bbc3b8b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java @@ -20,6 +20,8 @@ public class SelectedPopupDialog extends JDialog { private final PopupControlPanel controlPanel; + private boolean canVisible = true; + public SelectedPopupDialog(XCreator creator, FormDesigner designer) { super(DesignerContext.getDesignerFrame()); this.setUndecorated(true); @@ -43,4 +45,11 @@ public class SelectedPopupDialog extends JDialog { this.controlPanel.setRelativeBounds(rectangle); } + public boolean isCanVisible() { + return canVisible; + } + + public void setCanVisible(boolean canVisible) { + this.canVisible = canVisible; + } } 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 25bf1f5de7..0c838b61ec 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 @@ -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.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.treeview.ComponentTreeCellRenderer; @@ -414,7 +415,7 @@ public class ComponentTree extends JTree { private void showSelectedPopup(XCreator comp) { Rectangle rectangle = getRelativeBounds(comp); - comp.showSelectedPopup(designer, rectangle, comp.acceptType(XWTitleLayout.class)); + comp.showSelectedPopup(designer, rectangle, comp.acceptType(XWTitleLayout.class, XWCardMainBorderLayout.class, XWAbsoluteLayout.class)); comp.setSelected(true); } 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 f63c430554..6bafb317f3 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 @@ -42,9 +42,7 @@ public class CoverPane extends JComponent { Graphics2D g2d = (Graphics2D) g; Composite oldComposite = g2d.getComposite(); //画白色的编辑层 - g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 50 / 100.0F)); - g2d.setColor(XCreatorConstants.COVER_COLOR); - g2d.fillRect(x, y, w, h); + paintCover(g, component); //画编辑按钮所在框 FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, formDesigner.getCursor().getType() != Cursor.DEFAULT_CURSOR ? 0.9f : 0.7f); @@ -71,6 +69,21 @@ public class CoverPane extends JComponent { GraphHelper.draw(g, new Rectangle(BORDER_WIDTH, BORDER_WIDTH, w - BORDER_WIDTH * 2, h - BORDER_WIDTH * 2), Constants.LINE_MEDIUM); } + /** + * 绘制悬浮层 + * @param g + * @param component + */ + public static void paintCover(Graphics g, Component component) { + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + //画白色的编辑层 + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 50 / 100.0F)); + g2d.setColor(XCreatorConstants.COVER_COLOR); + g2d.fillRect(0, 0, component.getWidth(), component.getHeight()); + g2d.setComposite(oldComposite); + } + public CoverPane() { setBackground(null); setOpaque(false); @@ -87,6 +100,6 @@ public class CoverPane extends JComponent { public void paint(Graphics g) { super.paint(g); - paintEditButton(g, this); + paintCover(g, this); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java b/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java index 14b8aed7a3..ba687f5255 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java @@ -75,8 +75,5 @@ public class CoverReportPane extends CoverPane{ @Override public void paint(Graphics g) { super.paint(g); - if (isShared()) { - paintShareButton(g, this); - } } } 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 783e984b9d..5cd0458350 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 @@ -18,7 +18,9 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XEditorHolder; import com.fr.design.designer.creator.XElementCase; import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XCardAddButton; import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; import com.fr.design.designer.creator.cardlayout.XWCardLayout; @@ -383,6 +385,14 @@ public class EditingMouseListener extends MouseInputAdapter { } private boolean isEditButton(MouseEvent e, XCreator component, Insets insets) { + // 不显示编辑按钮 鼠标格式 + if (component.getParent() instanceof XCreator) { + XCreator parent = (XCreator) component.getParent(); + if (parent.acceptType(XWTitleLayout.class) || component.acceptType(XWCardMainBorderLayout.class, XWAbsoluteLayout.class)) { + return false; + } + } + int innerWidth = component.getWidth() - insets.left - insets.right; int innerHeight = component.getHeight() - insets.top - insets.bottom; @@ -458,10 +468,7 @@ public class EditingMouseListener extends MouseInputAdapter { if (designer.getCursor().getType() == Cursor.HAND_CURSOR) { designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } - if (isShareConfigButton(e, component, insets)) { - designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - component.setHelpBtnOnFocus(true); - } else if (isEditButton(e, component, insets)) { + if (isEditButton(e, component, insets)) { designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } } 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 1d4fad8e34..1a6d24ec55 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 @@ -1743,4 +1743,18 @@ public class FormDesigner extends TargetComponent
implements TreeSelection return false; } + public void processPopup(boolean canVisible) { + XCreator creator = this.getSelectionModel().getSelection().getSelectedCreator(); + if (creator != null) { + creator.processPopup(canVisible); + } + } + + public void hidePopup() { + XCreator creator = this.getSelectionModel().getSelection().getSelectedCreator(); + if (creator != null) { + creator.hidePopup(); + } + } + } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index bc32c5fd9e..8c9b1f2bc8 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -89,8 +89,6 @@ import com.fr.stable.StringUtils; import com.fr.stable.bridge.StableFactory; import com.fr.web.controller.ViewRequestConstants; -import java.awt.event.ContainerAdapter; -import java.awt.event.ContainerEvent; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JComponent; @@ -133,36 +131,16 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm implements BaseJForm { centerPane = new UIModeControlContainer(parameterPane, reportComposite = new ReportComponentComposite(this)) { @Override protected void onModeChanged() { + processPopup(isUpMode()); refreshToolArea(); } @@ -1221,4 +1222,19 @@ public class JWorkBook extends JTemplate { super.whenClose(); reportComposite.doRemoveAction(); } + + protected void processPopup(boolean visible) { + FormDesigner designer = (FormDesigner) parameterPane.getParaDesigner(); + if (designer != null) { + designer.processPopup(visible); + } + } + + @Override + public void fireTabChange() { + FormDesigner designer = (FormDesigner) parameterPane.getParaDesigner(); + if (designer != null) { + designer.hidePopup(); + } + } } From 232ffe723800768db25e2501417fa5b2119a95e2 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 21 Jul 2021 17:42:21 +0800 Subject: [PATCH 36/50] =?UTF-8?q?REPORT-55545=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E4=B8=8B=E6=8B=89=E7=B1=BB?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=EF=BC=8Ccpt=E5=92=8Cfrm=E9=83=BD=E4=BC=9A?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=EF=BC=8C=E6=94=B6=E8=B5=B7=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E4=B8=8A=E6=96=B9=E4=BB=BB=E6=84=8F=E7=9A=84=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9=EF=BC=8C=E5=85=81=E8=AE=B8=E4=B8=BA=E7=A9=BA=E7=9A=84?= =?UTF-8?q?=E9=82=A3=E4=B8=89=E4=B8=AA=E9=80=89=E9=A1=B9=E5=B0=B1=E4=BC=9A?= =?UTF-8?q?=E6=9C=89=E9=97=B4=E9=9A=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit REPORT-55618 【组件背景分离】组件复用-安装自适应插件,报表块的内容显示方式和提示文字,跑到了最下面 REPORT-55370 【10.0.18冒烟】参数控件TAb键切换顺序展示有问题 【问题原因】 三个问题的原因是一样的。将尺寸/位置面板挪动到了高级属性的上方后,导致后续的面板中设置项出现了 BorderLayout.CENTER约束中嵌套BorderLayout.CENTER约束的情况,位于其中的组件高度变大。 【改动思路】 右侧栏有问题的设置项用BorderLayout包装起来,使用BorderLayout.North打破上述嵌套约束. --- .../mainframe/widget/ui/FormWidgetCardPane.java | 7 ++++--- .../fr/design/parameter/RootDesignDefinePane.java | 15 +++++---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index a5189e66f6..b9230546df 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -187,9 +187,10 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { }); DataModify definePane = rn.getDefinePane(); - JComponent jComponent = definePane.toSwingComponent(); - - attriCardPane.add(jComponent, BorderLayout.CENTER); + // 使用单独的JPane和BorderLayout.North进行包装,避免出现CENTER嵌套CENTER后,内容高度变大的情况 + JPanel definePaneWrapContent = FRGUIPaneFactory.createBorderLayout_S_Pane(); + definePaneWrapContent.add(definePane.toSwingComponent(), BorderLayout.NORTH); + attriCardPane.add(definePaneWrapContent, BorderLayout.CENTER); currentEditorDefinePane = definePane; } diff --git a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java index 2e96e6ed8d..5f45b57b09 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java @@ -62,18 +62,13 @@ public class RootDesignDefinePane extends AbstractDataModify { public void initComponent() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel inbuiltDefineContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(inbuiltDefineContentPane, BorderLayout.NORTH); - designerWidth = new UIBoundSpinner(1, Integer.MAX_VALUE, 1); - JPanel layoutPane = createBoundsPane(); - UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Size"), 280, 20, layoutPane); - inbuiltDefineContentPane.add(layoutExpandablePane, BorderLayout.NORTH); - JPanel advancePane = createAdvancePane(); UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane); - inbuiltDefineContentPane.add(advanceExpandablePane, BorderLayout.CENTER); - + this.add(advanceExpandablePane, BorderLayout.NORTH); + JPanel layoutPane = createBoundsPane(); + UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Size"), 280, 20, layoutPane); + this.add(layoutExpandablePane, BorderLayout.CENTER); this.addExtraUIExpandablePaneFromPlugin(); } @@ -88,7 +83,7 @@ public class RootDesignDefinePane extends AbstractDataModify { panel.add(uiExpandablePane); } } - this.add(panel, BorderLayout.CENTER); + this.add(panel, BorderLayout.SOUTH); } public JPanel createBoundsPane() { From 794f0630b9c1ba52983922942effd5c16dc50939 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 21 Jul 2021 18:07:06 +0800 Subject: [PATCH 37/50] =?UTF-8?q?REPORT-55603=20=E3=80=9010.0.18=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E3=80=90=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?-=E6=8E=A7=E4=BB=B6=E7=BB=84=E4=BB=B6=E7=B1=BB=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=9C=80=E6=96=B0jar=E4=B8=8B=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=8E=A7=E4=BB=B6=E5=A4=A7=E5=B0=8F=E3=80=81=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 插件控件的FormWidgetCardPane.initComponent方法在isExtraWidget后直接退出, 没有执行添加boundPane的逻辑 2. 插件控件的definePane既包含了基本属性,又包含了高级属性,FormWidgetCardPane 内部无法在基本属性和高级属性之前插入boundPane 【改动思路】 和产品沟通后确认,对于插件控件,暂时不改变右侧栏中位置*尺寸面板的位置,其余类型的内置 控件仍然需要将位置*尺寸面板放置在高级属性上方 --- .../widget/ui/FormWidgetCardPane.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index b9230546df..a76c96902c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -150,6 +150,11 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { freshPropertyMode(innerCreator); if (isExtraWidget) { + // REPORT-55603: 仅对于插件控件,将尺寸*位置面板放置在definePane下方,其余控件将尺寸*位置面板放置在definePane上方 + widgetBoundPane = createWidgetBoundPane(xCreator); + if (widgetBoundPane != null) { + attriCardPane.add(widgetBoundPane, BorderLayout.CENTER); + } return; } @@ -187,10 +192,18 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { }); DataModify definePane = rn.getDefinePane(); - // 使用单独的JPane和BorderLayout.North进行包装,避免出现CENTER嵌套CENTER后,内容高度变大的情况 - JPanel definePaneWrapContent = FRGUIPaneFactory.createBorderLayout_S_Pane(); - definePaneWrapContent.add(definePane.toSwingComponent(), BorderLayout.NORTH); - attriCardPane.add(definePaneWrapContent, BorderLayout.CENTER); + JComponent definePaneComponent = definePane.toSwingComponent(); + boolean isExtraWidget = FormWidgetDefinePaneFactoryBase.isExtraXWidget(creator.toData()); + + if (isExtraWidget) { + // REPORT-55603: 仅对于插件控件,将尺寸*位置面板放置在definePane下方,其余控件将尺寸*位置面板放置在definePane上方 + attriCardPane.add(definePaneComponent, BorderLayout.NORTH); + } else { + // 使用单独的JPane和BorderLayout.North进行包装,避免出现CENTER嵌套CENTER后,内容高度变大的情况 + JPanel definePaneWrapContent = FRGUIPaneFactory.createBorderLayout_S_Pane(); + definePaneWrapContent.add(definePaneComponent, BorderLayout.NORTH); + attriCardPane.add(definePaneWrapContent, BorderLayout.CENTER); + } currentEditorDefinePane = definePane; } From de124d121be31b9c927479e0d2e17314c776c4ed Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 22 Jul 2021 15:09:22 +0800 Subject: [PATCH 38/50] =?UTF-8?q?REPORT-55549=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=BB=84=E4=BB=B6=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=BB=E4=BD=93=E8=83=8C=E6=99=AF=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E5=A4=84=E5=9C=A8=E8=AE=BE=E8=AE=A1=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E9=87=8C=E6=98=BE=E7=A4=BA=E4=BA=86=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E6=95=88=E6=9E=9C=EF=BC=8C=E4=BD=86web=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E6=B2=A1=E6=98=BE=E7=A4=BA=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 主体背景的生效范围暂时保持原样,不作用于与包含标题区域的整体范围内. 与前端实现保持一致 【改动思路】 临时注释设计器端带标题容器的背景效果 --- .../creator/XBorderStyleWidgetCreator.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index 754638783c..26d65cb5d1 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -194,13 +194,14 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ titleCreator.setBorder(new BottomLineBorder(color, thickness)); } - if (bodyXCreator instanceof XBorderStyleWidgetCreator) { - XBorderStyleWidgetCreator styledBodyXCreator = (XBorderStyleWidgetCreator) bodyXCreator; - Background background4Painting = styledBodyXCreator.getBackground4Painting(); - - styledBodyXCreator.setBackground4Painting(null); // body不绘制背景 - titleParent.setBackground4Painting(background4Painting); // 容器绘制完整背景 - } + // 主体背景的生效范围暂时保持原样,不作用于包含标题区域的整体范围内 +// if (bodyXCreator instanceof XBorderStyleWidgetCreator) { +// XBorderStyleWidgetCreator styledBodyXCreator = (XBorderStyleWidgetCreator) bodyXCreator; +// Background background4Painting = styledBodyXCreator.getBackground4Painting(); +// +// styledBodyXCreator.setBackground4Painting(null); // body不绘制背景 +// titleParent.setBackground4Painting(background4Painting); // 容器绘制完整背景 +// } } } } From f934a2d15611b355b0fbe930057a8a2bc2d798cc Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 22 Jul 2021 16:54:02 +0800 Subject: [PATCH 39/50] =?UTF-8?q?REPORT-55689=20mac=E6=89=93=E5=BC=80?= =?UTF-8?q?=E6=96=B0=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=E4=B9=9F=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=8F=90=E7=A4=BA=E4=B8=8B=E6=9B=B4=E6=96=B0=E6=96=B0?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/design/upm/UpmFinder.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java index db0661b1f8..f3284c11e5 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java @@ -15,7 +15,6 @@ import com.fr.event.Listener; import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; -import com.fr.stable.os.OperatingSystem; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; @@ -32,7 +31,7 @@ public class UpmFinder { private static final String UPM_DIR = "/upm"; private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html"; - private static final String JXBROWSER = OperatingSystem.isWindows() ? "com.teamdev.jxbrowser.browser.Browser" : "com.teamdev.jxbrowser.chromium.Browser"; + private static final String JXBROWSER = "com.teamdev.jxbrowser.browser.Browser"; public static String installHome = FRContext.getCommonOperator().getWebRootPath(); From 52edf38baaaf0d8e00b7fd9ac10aa633f43c082d Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 22 Jul 2021 16:01:55 +0800 Subject: [PATCH 40/50] =?UTF-8?q?REPORT-55491=20=E3=80=90=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=E9=AA=8C=E6=94=B6=E3=80=91=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E5=9C=A8=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=B1=9E=E6=80=A7=E4=B8=8B=E7=9A=84=E3=80=8C=E4=B8=BB?= =?UTF-8?q?=E4=BD=93=E8=83=8C=E6=99=AF=E3=80=8D=E8=AE=BE=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E5=9C=A8=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E4=B8=8D=E7=94=9F?= =?UTF-8?q?=E6=95=88=EF=BC=8C=E7=9C=8B=E4=B8=8D=E5=88=B0=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 绘制报表块缩略图时,填充了白色背景,导致组件样式背景被覆盖 2. 优化报表块缩略图时,即在ElementCaseImage中截取部分缩略图时,丢弃了Alpha通道 3. 表单布局预览绘制表格缩略图时使用了默认的白色纸张背景(表单报表块的表格没有纸张背景的概念) 【改动思路】 1. 绘制报表块缩略图时,不要使用白色背景填充,保持透明 2. 优化报表块缩略图时,使用subImage完成截取功能,保留Alpha通道 3. 表单布局预览绘制表格缩略图时,忽略纸张背景 4. 替换默认的报表块预览图(此图用于将报表块拖拽到面板中时显示作为 报表块的缩略图使用),因此也要支持半透明 --- .../design/designer/creator/XElementCase.java | 8 +++--- .../form/FormElementCaseDesigner.java | 26 +++++++++++-------- .../src/main/java/com/fr/grid/Grid.java | 11 ++++++++ .../src/main/java/com/fr/grid/GridUI.java | 6 +++-- 4 files changed, 35 insertions(+), 16 deletions(-) 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 7ed22c52dd..b5cc813ae8 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 @@ -41,7 +41,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme static { try { - DEFAULT_BACKGROUND = BaseUtils.readImageWithCache("com/fr/base/images/report/elementcase.png"); + DEFAULT_BACKGROUND = BaseUtils.readImageWithCache("com/fr/base/images/report/elementcase_translucent.png"); } catch (Throwable e) { //IBM jdk 1.5.0_22 并发下读取图片有时会异常(EOFException), 这个图片反正只有设计器用到, 捕获住 DEFAULT_BACKGROUND = CoreGraphHelper.createBufferedImage(0, 0); @@ -183,7 +183,8 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme if (editor == null) { setBorder(DEFALUTBORDER); editor = new JPanel(); - editor.setBackground(null); + editor.setOpaque(false); + editor.setBackground(new Color(0, 0, 0, 0)); editor.setLayout(null); imageLable = initImageBackground(); @@ -218,7 +219,8 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme private void setLabelBackground(Image image, UILabel imageLable) { ImageIcon icon = new ImageIcon(image); imageLable.setIcon(icon); - imageLable.setOpaque(true); + imageLable.setOpaque(false); + imageLable.setBackground(new Color(0, 0, 0, 0)); imageLable.setLayout(null); imageLable.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight()); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java index 7af39737dd..b2892e7221 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java @@ -43,9 +43,9 @@ import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JScrollBar; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Dimension; -import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Transparency; import java.awt.image.BufferedImage; /** @@ -129,19 +129,23 @@ public class FormElementCaseDesigner public BufferedImage getElementCaseImage(Dimension size) { BufferedImage image = null; try { - image = new java.awt.image.BufferedImage(size.width, size.height, - java.awt.image.BufferedImage.TYPE_INT_RGB); - Graphics g = image.getGraphics(); + int width = size.width; + int height = size.height; - //填充白色背景, 不然有黑框 - Color oldColor = g.getColor(); - g.setColor(Color.WHITE); - g.fillRect(0, 0, size.width, size.height); - g.setColor(oldColor); + image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); + Graphics2D g2d = image.createGraphics(); + // 创建一个支持透明背景的buffer image + image = g2d.getDeviceConfiguration().createCompatibleImage(width, height, Transparency.TRANSLUCENT); + g2d.dispose(); + g2d = image.createGraphics(); Grid grid = this.elementCasePane != null ? this.elementCasePane.getGrid() : null; if (grid != null) { - grid.paintAll(g); + boolean oldTranslucent = grid.isTranslucent(); + // 截缩图图时grid需支持半透明,不能用默认白色填充画布,否则会遮挡组件样式背景 + grid.setTranslucent(true); + grid.paint(g2d); + grid.setTranslucent(oldTranslucent); } } catch (Exception e) { diff --git a/designer-realize/src/main/java/com/fr/grid/Grid.java b/designer-realize/src/main/java/com/fr/grid/Grid.java index abbd60928a..b55f60bb53 100644 --- a/designer-realize/src/main/java/com/fr/grid/Grid.java +++ b/designer-realize/src/main/java/com/fr/grid/Grid.java @@ -134,6 +134,9 @@ public class Grid extends BaseGridComponent { private boolean needRequestFocus = true; + // 截取缩略图时需透明(不能用默认白色填充),否则会遮挡组件样式的背景,其余情况的绘制可以用白色等默认颜色填充 + private boolean isTranslucent = false; + public Grid(int resolution) { this.resolution = resolution; // 能触发processEvent,不管是否给component增加listener @@ -1458,4 +1461,12 @@ public class Grid extends BaseGridComponent { this.paginateLineShowType = paginateLineShowType; this.getElementCasePane().repaint(); } + + public boolean isTranslucent() { + return isTranslucent; + } + + public void setTranslucent(boolean translucent) { + isTranslucent = translucent; + } } diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index 711ecee832..10934a7cc4 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -1128,8 +1128,10 @@ public class GridUI extends ComponentUI { double realWidth = gridSize.getWidth();// 宽度 double realHeight = gridSize.getHeight();// 高度 - // 画背景 - this.paintBackground(g2d, grid, elementCase, resolution); + if (!grid.isTranslucent()) { + // 画背景 + this.paintBackground(g2d, grid, elementCase, resolution); + } // 画Grid Line this.paintGridLine(g2d, grid, elementCase, realWidth, realHeight, resolution); From 907cca3f83130780511bdb731c89592097a51a52 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 22 Jul 2021 16:57:50 +0800 Subject: [PATCH 41/50] =?UTF-8?q?REPORT-55672=20=E6=82=AC=E6=B5=AE?= =?UTF-8?q?=E5=85=83=E7=B4=A0-=E6=96=B0=E5=BB=BA=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=B7=BB=E5=8A=A0=E7=9A=84=E6=82=AC?= =?UTF-8?q?=E6=B5=AE=E5=85=83=E7=B4=A0=E4=B8=8D=E8=83=BD=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 resizingBackupBounds仅在拖拽改变尺寸,光标改变时初始化,所以导致拖拽移动时,出现NPE 【改动思路】 resizingBackupBounds只在等比例尺寸缩放拖拽改变尺寸时需要 --- .../java/com/fr/grid/GridMouseAdapter.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index 0ae21bf4d5..1cb3e6242a 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -408,11 +408,11 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous int currentWidth = currentRight - currentLeft; int currentHeight = currentBottom - currentTop; - int backupWidth= resizingBackupBounds[2]; - int backupHeight= resizingBackupBounds[3]; - if (cursorType == Cursor.NW_RESIZE_CURSOR || cursorType == Cursor.NE_RESIZE_CURSOR || cursorType == Cursor.SE_RESIZE_CURSOR || cursorType == Cursor.SW_RESIZE_CURSOR) { - if (aspectRatio) { + if (aspectRatio && resizingBackupBounds != null) { + int backupWidth= resizingBackupBounds[2]; + int backupHeight= resizingBackupBounds[3]; + double currentDiagonal = Math.pow(currentWidth, 2) + Math.pow(currentHeight, 2); double backupDiagonal = Math.pow(backupWidth, 2) + Math.pow(backupHeight, 2); @@ -452,7 +452,10 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous floatElement.setTopDistance(topDistance); floatElement.setHeight(FU.valueOfPix(currentBottom, resolution).subtract(floatY1_fu)); - if (aspectRatio) { + if (aspectRatio && resizingBackupBounds != null) { + int backupWidth= resizingBackupBounds[2]; + int backupHeight= resizingBackupBounds[3]; + currentWidth = backupWidth * currentHeight / backupHeight; currentRight = currentLeft + currentWidth; FU floatX1_fu = FU.valueOfPix(currentLeft, resolution); @@ -465,7 +468,10 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous floatElement.setLeftDistance(leftDistance); floatElement.setWidth(FU.valueOfPix(currentRight, resolution).subtract(floatX1_fu)); - if (aspectRatio) { + if (aspectRatio && resizingBackupBounds != null) { + int backupWidth= resizingBackupBounds[2]; + int backupHeight= resizingBackupBounds[3]; + currentHeight = backupHeight * currentWidth / backupWidth; currentBottom = currentTop + currentHeight; FU floatY1_fu = FU.valueOfPix(currentTop, resolution); From 4145aa26f3b1c367cfb12e426747a9b409cf7269 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 22 Jul 2021 20:03:22 +0800 Subject: [PATCH 42/50] =?UTF-8?q?REPORT-55694=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=BB=84=E4=BB=B6/=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E9=94=81=E5=AE=9A=E6=97=B6=EF=BC=8C=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF=E5=85=88?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=BD=E5=BA=A6=E6=97=B6=EF=BC=8C=E9=AB=98?= =?UTF-8?q?=E5=BA=A6=E4=B8=8D=E5=8F=98=EF=BC=9B=E4=BD=86=E5=87=8F=E5=B0=8F?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6=E6=97=B6=EF=BC=8C=E9=AB=98=E5=BA=A6=E4=BC=9A?= =?UTF-8?q?1=E5=8D=95=E4=BD=8D1=E5=8D=95=E4=BD=8D=E5=87=8F=E5=B0=8F?= =?UTF-8?q?=EF=BC=8C=E6=9C=80=E5=90=8E=E7=BB=84=E4=BB=B6=E5=8F=98=E6=88=90?= =?UTF-8?q?=E4=B8=80=E6=9D=A1=E6=A8=AA=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 直接编辑宽度和高度,互相联动,存在小数舍入的问题,比如20.75,只取20,导致越来越小 2. 在锁定比例功能从未启动到启动时,需要保存尺寸比例,并持久化,否则再次打开模版后,原有的比例数据 就消失了 【改动思路】 1. WidgetBoundPane.java中widthSpinner和heightSpinner互相关联时, 使用Math.round取整,而不是直接取整数部分 2. 在启用比例锁定时,保存当前的aspectRatioBackup,除非关闭比例锁定,否则不更新改值 3. 高度或宽度为0时,取消比例锁定,避免出现除0问题 4. 绝对布局内组件移入移出时,重新计算锁定的尺寸比例 --- .../layout/FRAbsoluteLayoutAdapter.java | 7 ++ .../designer/creator/XWAbsoluteLayout.java | 18 ++++- .../design/designer/ui/PopupControlPanel.java | 13 +++- .../mainframe/FormCreatorDropTarget.java | 7 +- .../designer/component/WidgetBoundPane.java | 68 ++++++++++++------- 5 files changed, 87 insertions(+), 26 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java index 4b3147c0ab..e4426f61ad 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java @@ -9,6 +9,7 @@ import com.fr.design.designer.properties.BoundsGroupModel; import com.fr.design.designer.properties.FRAbsoluteLayoutPropertiesGroupModel; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; +import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; @@ -295,6 +296,12 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { */ @Override public void fix(XCreator creator) { + Widget widget = creator.toData(); + Rectangle bounds = creator.getBounds(); + if (widget != null && widget.isAspectRatioLocked() && (bounds.width == 0 || bounds.height == 0)) { + widget.setAspectRatioLocked(false); + widget.setAspectRatioBackup(-1.0); + } WAbsoluteLayout wabs = (WAbsoluteLayout)container.toData(); fix(creator,creator.getX(),creator.getY()); wabs.setBounds(creator.toData(),creator.getBounds()); 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 fdd62d1b0f..44d1588dfa 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 @@ -386,7 +386,18 @@ public class XWAbsoluteLayout extends XLayoutContainer { if (!creator.acceptType(XWFitLayout.class)) { creator.setDirections(Direction.ALL); } - wabs.addWidget(new BoundsWidget(creator.toData(), creator.getBounds())); + Widget wgt = creator.toData(); + if (wgt != null && wgt.isAspectRatioLocked() && wgt.getAspectRatioBackup() <= 0) { + // 将比例锁定的组件重新移会绝对布局内时(如body修改绝对布局),尺寸比例可能失效,需要重新计算 + Rectangle bounds = creator.getBounds(); + if (bounds.width > 0 && bounds.height > 0) { + wgt.setAspectRatioBackup(1.0 * bounds.width / bounds.height); + } else { + wgt.setAspectRatioLocked(false); + wgt.setAspectRatioBackup(-1); + } + } + wabs.addWidget(new BoundsWidget(wgt, creator.getBounds())); } /** @@ -402,6 +413,11 @@ public class XWAbsoluteLayout extends XLayoutContainer { WAbsoluteLayout wlayout = this.toData(); XWidgetCreator xwc = ((XWidgetCreator) e.getChild()); Widget wgt = xwc.toData(); + + // 将比例锁定的组件重新移出绝对布局时(如body修改为自适应布局),锁定的尺寸比例失效 + if (wgt != null) { + wgt.setAspectRatioBackup(-1.0); + } BoundsWidget bw = new BoundsWidget(wgt, xwc.getBounds()); wlayout.removeWidget(bw); } diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java index ad003ff692..f806a72c0c 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java @@ -13,6 +13,7 @@ import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; +import com.fr.form.ui.Widget; import com.fr.general.IOUtils; import com.fr.stable.ArrayUtils; @@ -94,7 +95,17 @@ public class PopupControlPanel extends JPanel { JToggleButton toggleBtn = (JToggleButton) e.getSource(); String toolTipText = toggleBtn.isSelected() ? Toolkit.i18nText("Fine-Design_Form_Lock_Widget_Ratio") : Toolkit.i18nText("Fine-Design_Form_UnLock_Widget_Ratio"); toggleBtn.setToolTipText(toolTipText); - creator.toData().setAspectRatioLocked(toggleBtn.isSelected()); + Widget widget = creator.toData(); + if (widget != null) { + Rectangle bounds = new Rectangle(creator.getBounds()); + if (toggleBtn.isSelected() && bounds.width > 0 && bounds.height > 0) { + widget.setAspectRatioLocked(true); + widget.setAspectRatioBackup(1.0 * bounds.width / bounds.height); + } else { + widget.setAspectRatioLocked(false); + widget.setAspectRatioBackup(-1.0); + } + } designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_RESIZED); } }); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 11fa1dc3bf..d1aa9fc56e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -112,7 +112,12 @@ public class FormCreatorDropTarget extends DropTarget { if (addingXCreator.isShared()) { if (container.acceptType(XWAbsoluteLayout.class)) { // 绝对布局中新添加的共享组件默认锁定尺寸比例 - addingXCreator.toData().setAspectRatioLocked(true); + Rectangle bounds = new Rectangle(addingXCreator.getBounds()); + Widget addingWidget = addingXCreator.toData(); + if (addingWidget != null && bounds.width > 0 && bounds.height > 0) { + addingXCreator.toData().setAspectRatioLocked(true); + addingXCreator.toData().setAspectRatioBackup(1.0 * bounds.width / bounds.height); + } } String shareId = addingXCreator.getShareId(); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index d046a6a9e8..2fdec31e1f 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -103,14 +103,11 @@ public class WidgetBoundPane extends BasicPane { } public void populate() { - Rectangle bounds = new Rectangle(creator.getBounds()); - if (ratioLockedButton != null) { - // 临时禁止尺寸比例锁定,关掉widthSpinner/heightSpinner之间的数值关联,以更新其高度和宽度值 - ratioLockedButton.setLocked(false); - } - width.setValue(bounds.width); - height.setValue(bounds.height); - if (ratioLockedButton != null) { + if (ratioLockedButton == null) { + Rectangle bounds = new Rectangle(creator.getBounds()); + width.setValue(bounds.width); + height.setValue(bounds.height); + } else { ratioLockedButton.populate(creator); } } @@ -213,8 +210,7 @@ public class WidgetBoundPane extends BasicPane { private final UISpinner mWidthSpinner; private final UISpinner mHeightSpinner; - protected double width4Backup = 0; - protected double height4Backup = 0; + protected double aspectRatioBackup = 0; public AspectRatioLockedButton(UISpinner widthSpinner, UISpinner heightSpinner) { setUI(new BasicButtonUI()); @@ -229,12 +225,16 @@ public class WidgetBoundPane extends BasicPane { addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - // 改变图标icon - setLocked(!isLocked()); - - if (isLocked() && isLockEnabled()) { - width4Backup = mWidthSpinner.getValue(); - height4Backup = mHeightSpinner.getValue(); + double width = mWidthSpinner.getValue(); + double height = mHeightSpinner.getValue(); + boolean nextLocked = !isLocked(); + + if (nextLocked && width > 0 && height > 0) { + setLocked(true); + aspectRatioBackup = width / height; + } else { + setLocked(false); + aspectRatioBackup = -1; } if (globalNameListener != null) { @@ -250,16 +250,26 @@ public class WidgetBoundPane extends BasicPane { mWidthSpinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - if (isLockEnabled() && isLocked() && width4Backup > 0 && height4Backup > 0) { - mHeightSpinner.setValue(mWidthSpinner.getValue() * height4Backup / width4Backup, false); + if (isLockEnabled() && isLocked()) { + if (mWidthSpinner.getValue() == 0) { + setLocked(false); + aspectRatioBackup = -1; + } else if (aspectRatioBackup > 0) { + double value = mWidthSpinner.getValue() / aspectRatioBackup; + mHeightSpinner.setValue(Math.round(value), false); + } } } }); mHeightSpinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - if (isLockEnabled() && isLocked() && width4Backup > 0 && height4Backup > 0) { - mWidthSpinner.setValue(mHeightSpinner.getValue() * width4Backup / height4Backup, false); + if (isLockEnabled() && isLocked()) { + setLocked(false); + aspectRatioBackup = -1; + } else if (aspectRatioBackup > 0) { + double value = mHeightSpinner.getValue() * aspectRatioBackup; + mWidthSpinner.setValue(Math.round(value), false); } } }); @@ -301,14 +311,26 @@ public class WidgetBoundPane extends BasicPane { public void populate(XCreator creator) { Rectangle bounds = new Rectangle(creator.getBounds()); - width4Backup = bounds.width; - height4Backup = bounds.height; Widget widget = creator.toData(); + + aspectRatioBackup = widget.getAspectRatioBackup(); setLocked(widget.isAspectRatioLocked()); + + mWidthSpinner.setValue(bounds.width, false); + mHeightSpinner.setValue(bounds.height, false); } public void update(XCreator creator) { - creator.toData().setAspectRatioLocked(this.isLocked()); + Widget widget = creator.toData(); + if (widget != null) { + if (this.isLocked()) { + widget.setAspectRatioLocked(true); + widget.setAspectRatioBackup(this.aspectRatioBackup); + } else { + widget.setAspectRatioLocked(false); + widget.setAspectRatioBackup(-1.0); + } + } } @Override From ada963198322026d313a8ba21bfef5576b7ffd7d Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 23 Jul 2021 01:50:34 +0800 Subject: [PATCH 43/50] =?UTF-8?q?REPORT-55491=20=E3=80=90=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=E9=AA=8C=E6=94=B6=E3=80=91=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E5=9C=A8=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=B1=9E=E6=80=A7=E4=B8=8B=E7=9A=84=E3=80=8C=E4=B8=BB?= =?UTF-8?q?=E4=BD=93=E8=83=8C=E6=99=AF=E3=80=8D=E8=AE=BE=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E5=9C=A8=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E4=B8=8D=E7=94=9F?= =?UTF-8?q?=E6=95=88=EF=BC=8C=E7=9C=8B=E4=B8=8D=E5=88=B0=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 绘制图表块时,填充了白色背景,导致组件样式背景被覆盖 2. 图表进入编辑模式下,ChartComponent被绘制两次,差 了一个像素,又因为ChartComponent支持半透明,导致出现了 重影 【改动思路】 1. 表单布局面板上预览报表块时,不使用白色背景填充,保持透明 2. DesignerEditor绘制Editor时,补充下差了的一个 像素(默认灰色边框) --- .../java/com/fr/design/chart/gui/ChartComponent.java | 12 +++++++----- .../design/designer/beans/events/DesignerEditor.java | 2 +- .../com/fr/design/designer/creator/XChartEditor.java | 3 +++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java index 1a5088a272..1ce2fbffd9 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java @@ -43,6 +43,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene public ChartComponent() { super(); + setOpaque(true); addMouseListener(this); addMouseMotionListener(this); } @@ -148,11 +149,12 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene chartCollection4Design.setPredefinedStyleName(getGlobalPredefinedStyleName(), false); Graphics2D g2d = (Graphics2D) g; - Paint oldPaint = g2d.getPaint(); - - g2d.setPaint(Color.WHITE); - g2d.fillRect(0, 0, this.getBounds().width, this.getBounds().height); - g2d.setPaint(oldPaint); + if (this.isOpaque()) { + Paint oldPaint = g2d.getPaint(); + g2d.setPaint(Color.WHITE); + g2d.fillRect(0, 0, this.getBounds().width, this.getBounds().height); + g2d.setPaint(oldPaint); + } g2d.translate(ChartConstants.PREGAP4BOUNDS/2, ChartConstants.PREGAP4BOUNDS/2); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java b/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java index f53f66d313..58f58c0758 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java @@ -93,7 +93,7 @@ public class DesignerEditor implements PropertyChangeListe comp.setSize(new Dimension(width, height)); LayoutUtils.layoutContainer(comp); - comp.setBounds(comp.getX() + x, comp.getY() + y, width, height); + comp.setBounds(comp.getX() + x - 1, comp.getY() + y - 1, width, height); Graphics clipg = g.create(x, y, width, height); this.comp.paint(clipg); } 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 8633c0bd51..ad328b85e7 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 @@ -231,7 +231,9 @@ public class XChartEditor extends XBorderStyleWidgetCreator { public void paintForeground(Graphics2D g) { Dimension size = getSize(); PaddingMargin margin = toData().getMargin(); + designerEditor.paintEditor(g, size, margin); + if (coverPanel != null) { int horizonMargin = margin != null ? margin.getLeft() + margin.getRight() : 0; int verticalMargin = margin != null ? margin.getTop() + margin.getBottom() : 0; @@ -289,6 +291,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator { final MiddleChartComponent chartComponent = DesignModuleFactory.getChartComponent(((BaseChartEditor) data).getChartCollection()); if (chartComponent != null) { JComponent jChart = chartComponent; + chartComponent.setOpaque(false); jChart.setBorder(BorderFactory.createLineBorder(Color.lightGray)); designerEditor = new DesignerEditor(jChart); chartComponent.addStopEditingListener(designerEditor); From 5cd2c395b1c3a25c056e53391f69c51f0db398fe Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 23 Jul 2021 10:50:05 +0800 Subject: [PATCH 44/50] =?UTF-8?q?REPORT-55629=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E6=8E=A7=E4=BB=B6/=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=88=9A=E6=8B=96=E5=85=A5=E8=AE=BE=E8=AE=A1=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E6=97=B6=EF=BC=8C=E5=B7=A5=E5=85=B7=E6=A0=8F=E6=B2=A1?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=AE=8C=E5=85=A8=EF=BC=8C=E5=8F=AA=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=BA=86=E4=B8=80=E6=9D=A1=E7=BA=BF=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E9=BC=A0=E6=A0=87=E7=9A=84=E8=AF=9D=E6=89=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/creator/XCreator.java | 15 +++++++++++---- 1 file changed, 11 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 fa9267b1a7..185c834f75 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 @@ -33,6 +33,7 @@ import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; +import javax.swing.SwingUtilities; import javax.swing.border.Border; import java.awt.BorderLayout; import java.awt.Color; @@ -776,10 +777,16 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } int extraX = (int) ((bounds.x + bounds.width + SelectedPopupDialog.OFFSET_X) * designer.getScale()); int extraY = (int) (bounds.y * designer.getScale()); - popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); - popup.updatePane(designer); - popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible()); - popup.setRelativeBounds(bounds); + // 放到事件尾部执行 + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); + popup.updatePane(designer); + popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible()); + popup.setRelativeBounds(bounds); + } + }); } /** From bace88981dd5994bbbe2e577617df973df797477 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 23 Jul 2021 10:50:53 +0800 Subject: [PATCH 45/50] =?UTF-8?q?REPORT-55228=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E5=81=B6=E7=8E=B0=EF=BC=8C?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=A0=8F=E4=BC=9A=E7=95=99=E5=9C=A8=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E9=A1=B5=E9=9D=A2=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/PluginClassRefreshManager.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java index 4ff6beda24..9e1d57dfd9 100644 --- a/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java +++ b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java @@ -27,6 +27,8 @@ public class PluginClassRefreshManager { private final PluginEventListener pluginAfterRunEventListener = new PluginEventListener() { @Override public void on(PluginEvent event) { + // 重载模版之前 触发下hide + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTabChange(); // 兼容之前版本特性 for (String tag : context) { if (event.getContext().contain(tag)) { @@ -51,6 +53,7 @@ public class PluginClassRefreshManager { public void on(PluginEvent event) { PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, pluginAfterRunEventListener); if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) { + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTabChange(); HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); } } From 888488b9e87cac871d90546cb9eb22acb63e9bf9 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 23 Jul 2021 12:53:13 +0800 Subject: [PATCH 46/50] =?UTF-8?q?REPORT-55492=20=E3=80=90=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=E9=AA=8C=E6=94=B6=E3=80=91=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91macos=E4=B8=AD?= =?UTF-8?q?=E5=B0=8F=E5=B7=A5=E5=85=B7=E6=A0=8F=E7=9A=84=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E6=B5=AE=E5=88=B0=E6=9C=80=E4=B8=8A=E9=9D=A2?= =?UTF-8?q?=E6=9D=A5=E4=BA=86=EF=BC=88=E5=BA=94=E8=AF=A5=E8=A2=ABdialog?= =?UTF-8?q?=E8=A6=86=E7=9B=96=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/DesignerFrame.java | 6 ++++++ .../java/com/fr/design/designer/ui/SelectedPopupDialog.java | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 890b6fa04b..b7bc518385 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -212,6 +212,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } + @Override + public void windowIconified(WindowEvent e) { + // 最小化时 hide工具栏 + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTabChange(); + } + }; private JComponent closeButton = new JComponent() { diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java index 285bbc3b8b..44978ad667 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java @@ -3,8 +3,11 @@ package com.fr.design.designer.ui; import com.fr.design.designer.creator.XCreator; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormDesigner; +import com.fr.stable.os.OperatingSystem; + import java.awt.Rectangle; import javax.swing.JDialog; +import javax.swing.JFrame; /** * @author hades @@ -23,7 +26,7 @@ public class SelectedPopupDialog extends JDialog { private boolean canVisible = true; public SelectedPopupDialog(XCreator creator, FormDesigner designer) { - super(DesignerContext.getDesignerFrame()); + super(OperatingSystem.isMacos() ? new JFrame() : DesignerContext.getDesignerFrame()); this.setUndecorated(true); this.setModal(false); this.setFocusableWindowState(false); From f90fa77a28952cb376743015b3edf260096a71b6 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 23 Jul 2021 13:01:11 +0800 Subject: [PATCH 47/50] =?UTF-8?q?REPORT-55553=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=8E=B0=E5=9C=A8=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=B3=E4=BE=A7=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E7=9A=84=E5=B1=82=E6=AC=A1=E6=95=88=E6=9E=9C=E5=92=8C=E8=A7=86?= =?UTF-8?q?=E8=A7=89=E7=A8=BF=E4=B8=8D=E4=B8=80=E6=A0=B7=EF=BC=8C=E5=B1=82?= =?UTF-8?q?=E6=AC=A1=E9=97=B4=E9=9A=94=E4=B8=8D=E6=B8=85=E6=99=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1.windows上边框线没显示出来 2.变动下层级结构,突出背景只作用于控件主体 【改动思路】 1. 绘制边框线时,边框线的大小应该是thickness的2倍 2. 修改Body样式面板的效果,去除多余的文字标签 3. 修改层级结构 --- .../fr/design/gui/xpane/LayoutStylePane.java | 89 +++++++++++++------ 1 file changed, 63 insertions(+), 26 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java index 81ce5fa7e1..c0ad60ad4f 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java @@ -1,10 +1,8 @@ package com.fr.design.gui.xpane; -import com.fr.base.GraphHelper; import com.fr.base.Utils; import com.fr.base.svg.IconUtils; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.constants.UIConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.formula.TinyFormulaPane; @@ -13,7 +11,6 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; @@ -105,42 +102,46 @@ public class LayoutStylePane extends BasicBeanPane { boolean currentIsRootLayout = currentEditingTemplate != null && !currentEditingTemplate.isJWorkBook() && ((JForm)currentEditingTemplate).isSelectRootPane(); JPanel titlePane = createTitleStylePane(); + JPanel bodyContentPane = currentIsRootLayout ? createBodyContentPane4RootLayout() : createBodyContentPane(); + JPanel backgroundPane = createBackgroundStylePane(); + if (titlePane != null) { container.add(titlePane, BorderLayout.NORTH); if (currentIsRootLayout) { titlePane.setVisible(false); } } + JPanel nextContainerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + container.add(nextContainerPane, BorderLayout.CENTER); - //界面上表单主体只有背景和透明度可以设置 - JPanel mainStylePane = currentIsRootLayout ? createMainStylePane4RootLayout() : createMainStylePane4WidgetLayout(); - if (mainStylePane != null) { - container.add(mainStylePane, BorderLayout.CENTER); + if (bodyContentPane != null) { + //界面上表单主体只有背景和透明度可以设置 + nextContainerPane.add(bodyContentPane, BorderLayout.NORTH); + } + if (backgroundPane != null) { + nextContainerPane.add(backgroundPane, BorderLayout.CENTER); + if (currentIsRootLayout) { + backgroundPane.setVisible(false); + } } this.add(container, BorderLayout.CENTER); } - protected void initMainComponents() { + protected JPanel createBackgroundStylePane() { borderStyleCombo = new UIComboBox(BORDER_STYLE); borderLineAndImagePane = new BorderLineAndImagePane(); cornerSpinner = new UISpinner(0,1000,1,0); - backgroundPane = new LayoutBackgroundSpecialPane(); - backgroundOpacityPane = new UIPercentDragPane(); - } - protected JPanel createMainStylePane4WidgetLayout() { - initMainComponents(); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] rowSize = {p, p, p, p, p}; + double[] rowSize = {p, p, p, p}; double[] columnSize = {SETTING_LABEL_WIDTH, f}; JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame_Style")), null}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Background_Style")), null}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Render_Style")), borderStyleCombo}, {this.borderLineAndImagePane, null}, - {this.createMainBackgroundAndOpacityPane(), null}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")), cornerSpinner}, }, rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); @@ -153,16 +154,23 @@ public class LayoutStylePane extends BasicBeanPane { return container; } - protected JPanel createMainStylePane4RootLayout() { - initMainComponents(); + protected JPanel createBodyContentPane() { + backgroundPane = new LayoutBackgroundSpecialPane(); + backgroundOpacityPane = new UIPercentDragPane(); + double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] rowSize = {p, p}; double[] columnSize = {SETTING_LABEL_WIDTH, f}; + JPanel bodyBackground = createBackgroundAndOpacityPane( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Fill"), + this.backgroundPane, + this.backgroundOpacityPane); + JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame_Style")), null}, - {this.createMainBackgroundAndOpacityPane(), null}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Content")), null}, + {bodyBackground, null}, }, rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); @@ -174,11 +182,31 @@ public class LayoutStylePane extends BasicBeanPane { return container; } - protected JPanel createMainBackgroundAndOpacityPane() { - return createBackgroundAndOpacityPane( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Background"), + protected JPanel createBodyContentPane4RootLayout() { + backgroundPane = new LayoutBackgroundSpecialPane(); + backgroundOpacityPane = new UIPercentDragPane(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p}; + double[] columnSize = {SETTING_LABEL_WIDTH, f}; + + JPanel bodyBackground = createBackgroundAndOpacityPane( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Fill"), this.backgroundPane, this.backgroundOpacityPane); + + JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ + {bodyBackground, null}, + }, + rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); + contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + + JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); + container.setBorder(new BottomLineBorder()); + container.add(contentPane, BorderLayout.NORTH); + + return container; } protected void initTitleComponents() { @@ -489,16 +517,25 @@ public class LayoutStylePane extends BasicBeanPane { protected static class BottomLineBorder extends LineBorder { public BottomLineBorder() { - super(Color.lightGray, 1); + super(new Color(217, 218, 221), 1); } @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D g2d = (Graphics2D) g; + Color oldColor = g2d.getColor(); - g2d.setColor(this.lineColor); - GraphHelper.drawLine(g, 0, height, width, height, 1); + Stroke oldStroke = g2d.getStroke(); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + g2d.setColor(getLineColor()); + g2d.setStroke(new BasicStroke(getThickness() * 2)); + g2d.drawLine(0, height, width, height); + + g2d.setStroke(oldStroke); g2d.setColor(oldColor); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } } From 2f0a6e485c7b444c28dfb22be7ada47cbcc5a73f Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 23 Jul 2021 13:23:52 +0800 Subject: [PATCH 48/50] =?UTF-8?q?REPORT-55709=20frm=E4=B8=ADbody=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E8=AE=BE=E7=BD=AE=E4=BA=86=E8=83=8C=E6=99=AF=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E9=80=8F=E6=98=8E=E5=BA=A6=E8=AE=BE=E7=BD=AE0%?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=80=8F=E6=98=8E=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 绘制背景时没有考虑透明度 【改动思路】 绘制组件主体背景和标题背景时设置透明度 --- .../designer/creator/XBorderStyleWidgetCreator.java | 4 ++++ .../java/com/fr/design/designer/creator/XLabel.java | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index 26d65cb5d1..645f38706e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -226,7 +226,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ public void paintBackground(Graphics2D g2d) { Background background4Painting = getBackground4Painting(); if (background4Painting != null) { + BorderPacker style = toData().getBorderStyle(); + Composite oldComposite = g2d.getComposite(); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, style.getAlpha())); background4Painting.paint(g2d, new Rectangle2D.Double(0, 0, getWidth(), getHeight())); + g2d.setComposite(oldComposite); } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java b/designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java index 154091a296..13358f2b20 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java @@ -19,6 +19,7 @@ import com.fr.form.ui.Label; import com.fr.form.ui.container.WParameterLayout; import com.fr.general.Background; +import com.fr.general.act.BorderPacker; import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; import com.fr.stable.core.PropertyChangeAdapter; @@ -91,8 +92,13 @@ public class XLabel extends XWidgetCreator { Label label = (Label) data; Dimension size = this.getSize(); //先画背景,再画标题 - if (toData().getBackground() != null) { - toData().getBackground().paint(g, new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight())); + Background background = label.getBackground(); + if (background != null) { + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, label.getBackgroundOpacity())); + background.paint(g, new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight())); + g2d.setComposite(oldComposite); } if (label.getWidgetValue() != null) { Graphics2D g2d = (Graphics2D) g.create(); From e527377c5cd696b02b462aadab3ed27278e084c2 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 23 Jul 2021 13:43:01 +0800 Subject: [PATCH 49/50] =?UTF-8?q?REPORT-55694=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=BB=84=E4=BB=B6/=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E9=94=81=E5=AE=9A=E6=97=B6=EF=BC=8C=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF=E5=85=88?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=BD=E5=BA=A6=E6=97=B6=EF=BC=8C=E9=AB=98?= =?UTF-8?q?=E5=BA=A6=E4=B8=8D=E5=8F=98=EF=BC=9B=E4=BD=86=E5=87=8F=E5=B0=8F?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6=E6=97=B6=EF=BC=8C=E9=AB=98=E5=BA=A6=E4=BC=9A?= =?UTF-8?q?1=E5=8D=95=E4=BD=8D1=E5=8D=95=E4=BD=8D=E5=87=8F=E5=B0=8F?= =?UTF-8?q?=EF=BC=8C=E6=9C=80=E5=90=8E=E7=BB=84=E4=BB=B6=E5=8F=98=E6=88=90?= =?UTF-8?q?=E4=B8=80=E6=9D=A1=E6=A8=AA=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 直接编辑宽度和高度,互相联动,存在小数舍入的问题,比如20.75,只取20,导致越来越小 2. 在锁定比例功能从未启动到启动时,需要保存尺寸比例,并持久化,否则再次打开模版后,原有的比例数据 就消失了 【改动思路】 1. WidgetBoundPane.java中widthSpinner和heightSpinner互相关联时, 使用Math.round取整,而不是直接取整数部分 2. 在启用比例锁定时,保存当前的aspectRatioBackup,除非关闭比例锁定,否则不更新改值 3. 高度或宽度为0时,取消比例锁定,避免出现除0问题 4. 绝对布局内组件移入移出时,重新计算锁定的尺寸比例 --- .../ui/designer/component/WidgetBoundPane.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index 2fdec31e1f..a462a8aed6 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -265,11 +265,13 @@ public class WidgetBoundPane extends BasicPane { @Override public void stateChanged(ChangeEvent e) { if (isLockEnabled() && isLocked()) { - setLocked(false); - aspectRatioBackup = -1; - } else if (aspectRatioBackup > 0) { - double value = mHeightSpinner.getValue() * aspectRatioBackup; - mWidthSpinner.setValue(Math.round(value), false); + if (mHeightSpinner.getValue() == 0) { + setLocked(false); + aspectRatioBackup = -1; + }else if (aspectRatioBackup > 0) { + double value = mHeightSpinner.getValue() * aspectRatioBackup; + mWidthSpinner.setValue(Math.round(value), false); + } } } }); From a821024929f83bde6ee045b69f957359aa69bf18 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 23 Jul 2021 15:45:26 +0800 Subject: [PATCH 50/50] =?UTF-8?q?REPORT-55228=20=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=A0=8F=E9=97=AE=E9=A2=98=20=20&&=20REPORT-55228=20=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8=E5=BC=95=E5=AF=BC=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=B8=8E=E5=88=87=E6=8D=A2=E8=B4=A6=E5=8F=B7=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=20=E4=B9=9F=E8=A6=81=E6=8F=90=E7=A4=BA"=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=9B=B8=E5=85=B3=E7=BB=84=E4=BB=B6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/login/DesignerLoginHelper.java | 4 +++- .../com/fr/design/login/DesignerLoginShowDialog.java | 2 ++ .../com/fr/design/login/guide/DesignerGuideHelper.java | 2 +- .../java/com/fr/design/designer/creator/XCreator.java | 10 +++++++++- .../com/fr/design/mainframe/EditingMouseListener.java | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java b/designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java index 5da006fa76..2d2dd935d1 100644 --- a/designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java +++ b/designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java @@ -6,6 +6,7 @@ import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.os.impl.SupportOSImpl; +import com.fr.design.plugin.DesignerPluginContext; import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.general.GeneralContext; import java.awt.Dialog; @@ -25,7 +26,7 @@ import javax.swing.WindowConstants; public class DesignerLoginHelper { private static final String MAIN_RESOURCE_PATH = "/com/fr/design/login/login.html"; - private static final String JXBROWSER = "com.teamdev.jxbrowser.chromium.Browser"; + private static final String JXBROWSER = "com.teamdev.jxbrowser.browser.Browser"; private static UIDialog dialog = null; @@ -91,6 +92,7 @@ public class DesignerLoginHelper { dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setVisible(false); dialog = null; + DesignerPluginContext.setPluginDialog(null); } } diff --git a/designer-base/src/main/java/com/fr/design/login/DesignerLoginShowDialog.java b/designer-base/src/main/java/com/fr/design/login/DesignerLoginShowDialog.java index 031ec4941f..53e4556e4e 100644 --- a/designer-base/src/main/java/com/fr/design/login/DesignerLoginShowDialog.java +++ b/designer-base/src/main/java/com/fr/design/login/DesignerLoginShowDialog.java @@ -1,6 +1,7 @@ package com.fr.design.login; import com.fr.design.dialog.UIDialog; +import com.fr.design.plugin.DesignerPluginContext; import com.fr.design.utils.gui.GUICoreUtils; import java.awt.BorderLayout; import java.awt.Component; @@ -36,6 +37,7 @@ public class DesignerLoginShowDialog extends UIDialog { setSize(DEFAULT); GUICoreUtils.centerWindow(this); setResizable(false); + DesignerPluginContext.setPluginDialog(this); } @Override diff --git a/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java b/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java index 92e4171460..b3513bb6da 100644 --- a/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java +++ b/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java @@ -22,7 +22,7 @@ import javax.swing.WindowConstants; public class DesignerGuideHelper { private static final String MAIN_RESOURCE_PATH = "/com/fr/design/login/guide.html"; - private static final String JXBROWSER = "com.teamdev.jxbrowser.chromium.Browser"; + private static final String JXBROWSER = "com.teamdev.jxbrowser.browser.Browser"; private static final long ONE_WEEK = 7 * 24 * 3600 * 1000L; private static final long ONE_MONTH = 30 * 24 * 3600 * 1000L; private static final long SIX_MONTH = 6 * ONE_MONTH; 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 185c834f75..dbc956c857 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 @@ -23,6 +23,7 @@ import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.NoSupportAuthorityEdit; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.plugin.DesignerPluginContext; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; @@ -783,12 +784,19 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public void run() { popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); popup.updatePane(designer); - popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible()); + popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible() && !isShowPluginDialog()); popup.setRelativeBounds(bounds); } }); } + private boolean isShowPluginDialog() { + if (DesignerPluginContext.getPluginDialog() == null) { + return false; + } + return DesignerPluginContext.getPluginDialog().isVisible(); + } + /** * 创建右击弹出菜单 * 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 5cd0458350..c1d834fa94 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 @@ -647,7 +647,7 @@ public class EditingMouseListener extends MouseInputAdapter { @Override public void run() { for (XCreator xCreator : xCreators) { - xCreator.setSelected(true); + xCreator.setSelected(!e.isShiftDown()); } } });