From 741fb208f77253b0fa80c07b32635c9e16da15bf Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 14 Jul 2021 19:59:59 +0800 Subject: [PATCH 01/19] =?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 6eb802619..4c9ad3cb5 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/19] =?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 4c9ad3cb5..5d9d4146d 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/19] =?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 8a2bdcc6c..1c14d739a 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/19] =?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 134252487..d96162559 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/19] =?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 d96162559..37094494b 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/19] =?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 fcd9ed010..6c19c9a63 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/19] =?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 ec132a206..4c5b669b4 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 fc40b1d12..754638783 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 2e9b3e23a..531a94ec6 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/19] =?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/19] =?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 0983dded9..a7860faec 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 2dec13afa..ebcfa472f 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 6702fe7f4..bceba44d3 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 c49902c8d..893297081 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/19] =?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 1c14d739a..b393d29b0 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 08969c91a..bc32c5fd9 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/19] =?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 0983dded9..c5b4dda50 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/19] =?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 531a94ec6..8633c0bd5 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/19] =?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 a1c9f1ff9..f53f66d31 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/19] =?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 9e8df6b85..abd219ee7 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/19] =?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 bceba44d3..c5f94d70e 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/19] =?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 28b09fef7..bbf91f640 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/19] =?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 992fa00cc..a762c59f4 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 2fdbb5a29..11fa1dc3b 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 893297081..c48c88101 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 ce98d9d55..fb6608c43 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/19] =?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 a762c59f4..22698ef5b 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/19] =?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 896cbe37c..cd0919d59 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);