From 1c6d9217cea3eeec4d9e5a47e3765dcc91ea8438 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 15 Jul 2021 10:16:38 +0800 Subject: [PATCH 1/5] =?UTF-8?q?REPORT-55178=20=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-=E8=AE=BE=E8=AE=A1=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E7=8E=B0=E5=9C=A8=E9=9C=80=E8=A6=81=E7=82=B9=E4=B8=A4?= =?UTF-8?q?=E4=B8=8B=E9=80=89=E4=B8=AD=E7=BB=84=E4=BB=B6=E6=89=8D=E8=83=BD?= =?UTF-8?q?=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 2/5] =?UTF-8?q?REPORT-55188=20=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-=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E7=BB=84=E4=BB=B6=E7=9B=AE=E5=BD=95=E6=A0=91=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E7=BB=84=E4=BB=B6=E5=BA=94=E4=B9=9F=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E4=B8=8B=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=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 3/5] =?UTF-8?q?REPORT-55188=20=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-=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E7=BB=84=E4=BB=B6=E7=9B=AE=E5=BD=95=E6=A0=91=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E7=BB=84=E4=BB=B6=E5=BA=94=E4=B9=9F=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E4=B8=8B=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=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 31777798a4d35d7709982c81d287132d8395d9bb Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 15 Jul 2021 15:54:40 +0800 Subject: [PATCH 4/5] =?UTF-8?q?REPORT-55212=20=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-tab=E9=87=8C=E7=9A=84=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=9D=97=E5=92=8C=E6=8A=A5=E8=A1=A8=E5=9D=97=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=82=B9=E5=87=BB=E5=8E=9F=E6=9C=AC=E7=9A=84?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=8C=89=E9=92=AE=E5=92=8C=E5=8F=8C=E5=87=BB?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81=20?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=A0=8F=E7=9A=84=E7=BC=96=E8=BE=91=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=8F=AF=E4=BB=A5=E8=A7=A6=E5=8F=91=20&&=20REPORT-552?= =?UTF-8?q?28=20=E3=80=90=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86?= =?UTF-8?q?=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8=20?= =?UTF-8?q?=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 5/5] =?UTF-8?q?REPORT-55228=20=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-=E6=89=93=E5=BC=80=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=20=E5=B7=A5=E5=85=B7=E6=A0=8F=E4=BC=9A?= =?UTF-8?q?=E7=95=99=E5=9C=A8=E8=AE=BE=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 --- .../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); + } + } + }