From c3584e98a6362473e5fb992770b6ae79ca74787a Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Tue, 27 Oct 2020 11:05:58 +0800 Subject: [PATCH 01/12] =?UTF-8?q?REPORT-40027=20=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=9A=84=E7=BB=84=E4=BB=B6=E6=A0=91=E5=B1=95?= =?UTF-8?q?=E5=BC=80=E8=B7=AF=E5=BE=84=EF=BC=8C=E5=9C=A8=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=9A=84=E6=97=B6=E5=80=99=E4=BF=9D=E8=AF=81?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=A0=91=E7=9A=84=E5=B1=95=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/ComponentTree.java | 105 +++++++++++------- .../mainframe/FormHierarchyTreePane.java | 80 ++++++------- .../java/com/fr/design/mainframe/JForm.java | 19 +++- 3 files changed, 121 insertions(+), 83 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 ee667fd38..2643f9596 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,11 +4,9 @@ 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.XWAbsoluteBodyLayout; -import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; import com.fr.design.designer.treeview.ComponentTreeCellRenderer; import com.fr.design.designer.treeview.ComponentTreeModel; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.itree.UITreeUI; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.StringUtils; @@ -19,9 +17,7 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JTree; import javax.swing.SwingUtilities; -import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeCellRenderer; -import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; import java.awt.BorderLayout; @@ -37,8 +33,9 @@ import java.awt.image.BufferedImage; import java.io.IOException; import java.util.ArrayList; import java.util.Enumeration; +import java.util.HashMap; import java.util.List; -import java.util.Vector; +import java.util.Map; public class ComponentTree extends JTree { @@ -46,6 +43,8 @@ public class ComponentTree extends JTree { private ComponentTreeModel model; private UITreeUI uiTreeUI = new UITreeUI(); private PopupPreviewPane previewPane; + + private static final Map> treePathCache = new HashMap<>(); private static final int PADDING_LEFT = 5; private static final int PADDING_TOP = 5; @@ -85,6 +84,7 @@ public class ComponentTree extends JTree { public ComponentTree(FormDesigner designer, ComponentTreeModel model) { this(designer); this.setModel(model); + expandTree(); } public void setSelectionPath(TreePath path) { @@ -138,7 +138,6 @@ public class ComponentTree extends JTree { setSelectionPaths(treepath); if (treepath.length > 0) { scrollPathToVisible(treepath[0]); - //expandPath(treepath[0]); } } @@ -193,6 +192,20 @@ public class ComponentTree extends JTree { return paths; } + @Override + protected void setExpandedState(TreePath path, boolean state) { + super.setExpandedState(path, state); + saveTreePath(); + } + + /** + * 删除key对应的缓存展开路径 + */ + public void removeTreePath(String key) { + if (!StringUtils.isEmpty(key)) { + treePathCache.remove(key); + } + } private void setSelectionPath() { @@ -232,6 +245,7 @@ public class ComponentTree extends JTree { public void refreshTreeRoot() { model = new ComponentTreeModel(designer, designer.getTopContainer()); setModel(model); + expandTree(); setDragEnabled(false); setDropMode(DropMode.ON_OR_INSERT); setTransferHandler(new TreeTransferHandler()); @@ -239,49 +253,62 @@ public class ComponentTree extends JTree { } /** - * 获得树的展开路径 - * */ - public void getExpandNodes(List searchList) { - getExpandNodes((XLayoutContainer)designer.getTopContainer(),searchList); + * 从缓存中获取展开路径并进行展开 + */ + public void expandTree() { + expandTree(loadTreePath()); } - public void getExpandNodes(XLayoutContainer container, List searchList) { - TreePath treePath = buildTreePath(container); - if (isExpanded(treePath)) { - searchList.add(treePath); - for (int i = 0, size = container.getXCreatorCount(); i < size; i++) { - XCreator creator = container.getXCreator(i); - if (creator.acceptType(XLayoutContainer.class) || creator.acceptType(XCardSwitchButton.class)) { - getExpandNodes((XLayoutContainer) creator.getXCreator(), searchList); - } - } + /** + * 按照传入参数展开组件树 + */ + private void expandTree(List list) { + if (list == null) { + return; } - //对绝对布局做特殊处理 - if (container.acceptType(XWFitLayout.class)) { - XWFitLayout bodyFitLayout = (XWFitLayout) container; - for (int j = 0; j < bodyFitLayout.getXCreatorCount(); j++) { - //类型是绝对布局并且还是body - if (bodyFitLayout.getXCreator(j).acceptType(XWAbsoluteBodyLayout.class)) { - container = (XLayoutContainer) bodyFitLayout.getXCreator(j); - getExpandNodes(container, searchList); + for (TreePath treePath : list) { + if (treePath.getLastPathComponent() instanceof XLayoutContainer) { + XLayoutContainer creator = (XLayoutContainer) treePath.getLastPathComponent(); + if (XCreatorUtils.getParentXLayoutContainer(creator) == null) { + continue; } + expandPath(treePath); } } } /** - * 将树按照展开路径进行展开 - * */ - public void expandNodes(List list){ - for(TreePath treePath:list) { - if (treePath.getLastPathComponent() instanceof XLayoutContainer) { - XLayoutContainer creator= (XLayoutContainer) treePath.getLastPathComponent(); - if (XCreatorUtils.getParentXLayoutContainer(creator) == null) { - continue; - } - expandPath(treePath); + * 获得树的展开路径 + */ + private List getExpandTreePaths() { + List result = new ArrayList<>(); + TreePath rootTreePath = buildTreePath(designer.getTopContainer()); + Enumeration enumeration = getExpandedDescendants(rootTreePath); + if (enumeration != null) { + while (enumeration.hasMoreElements()) { + result.add(enumeration.nextElement()); } } + return result; + } + + private void saveTreePath() { + String templateID = designer.getTarget().getTemplateID(); + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (templateID != null && jt != null && StringUtils.equals(templateID, jt.getTarget().getTemplateID())) { + String key = jt.getEditingFILE().getPath() + templateID; + treePathCache.put(key, getExpandTreePaths()); + } + } + + private List loadTreePath() { + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jt == null) { + return null; + } + String key = jt.getEditingFILE().getPath() + designer.getTarget().getTemplateID(); + + return treePathCache.get(key); } private TreePath buildTreePath(Component comp) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java index f94475a76..fdb8881c7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -4,7 +4,6 @@ import com.fr.base.BaseUtils; import com.fr.design.actions.UndoableAction; import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.events.DesignerEditListener; -import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XWAbsoluteBodyLayout; import com.fr.design.designer.creator.XWParameterLayout; @@ -24,14 +23,12 @@ import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingUtilities; -import javax.swing.tree.TreePath; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.ArrayList; -import java.util.List; /** @@ -48,6 +45,10 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree private ShortCut4JControlPane[] shorts; private ComponentTree componentTree; + private final DesignerEditListener designerEditListener = evt -> { + refreshComponentTree(); + }; + public static FormHierarchyTreePane getInstance() { return HOLDER.singleton; } @@ -94,10 +95,8 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree //TODO 太乱了,需要重写,监听器里加了监听器是什么意思,每次调用该方法都会添加一个新的监听器 public void refreshDockingView() { FormDesigner formDesigner = this.getEditingFormDesigner(); - List list = new ArrayList<>(); removeAll(); if (this.componentTree != null) { - componentTree.getExpandNodes(list); this.componentTree.removeAll(); } if (formDesigner == null) { @@ -106,13 +105,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree } componentTree = new ComponentTree(formDesigner); //保证删除组件后组件树不收起 - componentTree.expandNodes(list); - formDesigner.addDesignerEditListener(new DesignerEditListener() { - @Override - public void fireCreatorModified(DesignerEvent evt) { - refreshComponentTree(); - } - }); + formDesigner.addDesignerEditListener(designerEditListener); ComponentTreeModel treeModel = (ComponentTreeModel) componentTree.getModel(); XCreator root = (XCreator) treeModel.getRoot(); @@ -128,6 +121,38 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree refreshComponentTree(); } + public void removeTreePath(String key) { + componentTree.removeTreePath(key); + } + + /** + * 刷新树 + */ + public void refreshRoot() { + componentTree.refreshTreeRoot(); + } + + @Override + /** + * 位置 + * + * @return 位置 + */ + public Location preferredLocation() { + return Location.WEST_BELOW; + } + + protected ShortCut4JControlPane[] createShortcuts() { + ArrayList shortCutList = new ArrayList<>(); + FormDesigner designer = getEditingFormDesigner(); + + for (Action action : designer.getActions()) { + shortCutList.add(new WidgetEnableShortCut((UndoableAction) action)); + } + + return shortCutList.toArray(new ShortCut4JControlPane[shortCutList.size()]); + } + private void refreshComponentTree() { componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath()); SwingUtilities.invokeLater(new Runnable() { @@ -178,17 +203,6 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree return toolBarPaneWrapper; } - protected ShortCut4JControlPane[] createShortcuts() { - ArrayList shortCutList = new ArrayList<>(); - FormDesigner designer = getEditingFormDesigner(); - - for (Action action : designer.getActions()) { - shortCutList.add(new WidgetEnableShortCut((UndoableAction) action)); - } - - return shortCutList.toArray(new ShortCut4JControlPane[shortCutList.size()]); - } - /** * 调整结构树para和body的位置 * @@ -212,26 +226,6 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree componentTree = new ComponentTree(formDesigner, treeModel); } - /** - * 刷新树 - */ - public void refreshRoot() { - if (componentTree == null) { - return; - } - componentTree.refreshTreeRoot(); - } - - @Override - /** - * 位置 - * - * @return 位置 - */ - public Location preferredLocation() { - return Location.WEST_BELOW; - } - private class WidgetEnableShortCut extends ShortCut4JControlPane { public WidgetEnableShortCut(ShortCut shortCut) { this.shortCut = shortCut; 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 7cdd7fd60..7f5eb87d6 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 @@ -307,6 +307,23 @@ public class JForm extends JTemplate implements BaseJForm jt) { + + } + + @Override + public void templateSaved(JTemplate jt) { + + } + + @Override + public void templateClosed(JTemplate jt) { + String key = jt.getEditingFILE().getPath() + template.getTemplateID(); + FormHierarchyTreePane.getInstance().removeTreePath(key); + } + }); return tabCenterPane; } @@ -998,7 +1015,7 @@ public class JForm extends JTemplate implements BaseJForm Date: Tue, 27 Oct 2020 11:41:05 +0800 Subject: [PATCH 02/12] =?UTF-8?q?REPORT-40646=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=AF=B9=E6=8E=A5=E5=B9=B3=E5=8F=B0=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 52 ++++-- .../design/dialog/link/MessageWithLink.java | 55 +++++++ .../main/java/com/fr/env/RemoteEnvPane.java | 19 ++- .../java/com/fr/env/RemoteWorkspaceURL.java | 2 + .../java/com/fr/env/TestConnectionResult.java | 155 +++++++++++++++++- 5 files changed, 266 insertions(+), 17 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/dialog/link/MessageWithLink.java diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index ce495cdb9..382709c92 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -5,6 +5,7 @@ import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.dialog.link.MessageWithLink; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; @@ -18,7 +19,10 @@ import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.DesignUtils; import com.fr.env.CheckServiceDialog; import com.fr.env.EnvListPane; +import com.fr.env.RemoteWorkspaceURL; +import com.fr.env.TestConnectionResult; import com.fr.exit.DesignerExiter; +import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; import com.fr.invoke.Reflect; import com.fr.json.JSONArray; @@ -40,6 +44,7 @@ import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.engine.base.FineObjectPool; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.exception.WorkspaceAuthException; +import com.fr.workspace.engine.exception.WorkspaceCheckException; import com.fr.workspace.engine.exception.WorkspaceConnectionException; import com.fr.workspace.engine.rpc.WorkspaceProxyPool; @@ -145,21 +150,28 @@ public class EnvChangeEntrance { strategy.showTip(new PopTip() { @Override public void show() { - FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), + Toolkit.i18nText("Fine-Design_Basic_Error"), + ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon")); } }); return false; + } catch (WorkspaceCheckException e) { + handleWorkspaceCheckException(e, strategy, connectionInfo); + return false; } catch (Exception exception) { - FineLoggerFactory.getLogger().error(exception.getMessage(), exception); - strategy.showTip(new PopTip() { - @Override - public void show() { - FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); - } - }); - + if (exception.getCause() instanceof WorkspaceCheckException) { + handleWorkspaceCheckException((WorkspaceCheckException) exception.getCause(), strategy, connectionInfo); + } else { + FineLoggerFactory.getLogger().error(exception.getMessage(), exception); + strategy.showTip(() -> FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), + Toolkit.i18nText("Fine-Design_Basic_Error"), + ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon"))); + } return false; } TemplateTreePane.getInstance().refreshDockingView(); @@ -170,6 +182,24 @@ public class EnvChangeEntrance { return true; } + private void handleWorkspaceCheckException(WorkspaceCheckException e, PopTipStrategy strategy, WorkspaceConnectionInfo info) { + TestConnectionResult result = TestConnectionResult.parseByException(e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); + if (ComparatorUtils.equals(result, TestConnectionResult.AUTH_FAILED)) { + strategy.showTip(() -> FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), + Toolkit.i18nText("Fine-Design_Basic_Error"), + ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon"))); + } else { + strategy.showTip(() -> FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + new MessageWithLink(result.getText(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Modify_PassWord"), info.getUrl() + RemoteWorkspaceURL.SYSTEM_LOGIN_PATH), + Toolkit.i18nText("Fine-Design_Basic_Error"), + ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon"))); + } + } + /** * 这个功能留着,可能会加回来,先做注释处理 * 切换远程环境之前,进行版本检测,当版本不一致的时候,提示。 diff --git a/designer-base/src/main/java/com/fr/design/dialog/link/MessageWithLink.java b/designer-base/src/main/java/com/fr/design/dialog/link/MessageWithLink.java new file mode 100644 index 000000000..8a1f55cbd --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/dialog/link/MessageWithLink.java @@ -0,0 +1,55 @@ +package com.fr.design.dialog.link; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; +import java.awt.Color; +import java.awt.Desktop; +import java.awt.Font; +import java.net.URI; +import javax.swing.JEditorPane; +import javax.swing.event.HyperlinkEvent; + +/** + * 用来构建JOptionPane带超链的消息提示 + * + * @author hades + * @version 10.0 + * Created by hades on 2020/10/23 + */ +public class MessageWithLink extends JEditorPane { + + public MessageWithLink(String message, String linkName, String link) { + super("text/html", "" + message + "" + linkName + "" + ""); + addHyperlinkListener(e -> { + if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { + try { + Desktop.getDesktop().browse(URI.create(link)); + } catch (Exception exception) { + FineLoggerFactory.getLogger().error(exception.getMessage(), exception); + } + } + }); + setEditable(false); + setBorder(null); + } + + public MessageWithLink(String linkName, String link ) { + this(StringUtils.EMPTY, linkName, link); + } + + private static StringBuilder getStyle() { + // 构建和相同风格样式 + UILabel label = new UILabel(); + Font font = label.getFont(); + Color color = label.getBackground(); + + StringBuilder style = new StringBuilder("font-family:" + font.getFamily() + ";"); + style.append("font-weight:").append(font.isBold() ? "bold" : "normal").append(";"); + style.append("font-size:").append(font.getSize()).append("pt;"); + style.append("background-color: rgb(").append(color.getRed()).append(",").append(color.getGreen()).append(",").append(color.getBlue()).append(");"); + + return style; + } + +} diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 5257e74f4..0b7d64ee1 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -4,6 +4,8 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.border.UITitledBorder; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.dialog.link.MessageWithLink; import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.ibutton.UIButton; @@ -16,6 +18,7 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.scrollruler.ModLineBorder; import com.fr.license.exception.RegistEditionException; import com.fr.log.FineLoggerFactory; @@ -25,6 +28,7 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.engine.exception.WorkspaceAuthException; +import com.fr.workspace.engine.exception.WorkspaceCheckException; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JDialog; @@ -53,12 +57,13 @@ import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; -import java.util.function.Supplier; + import static com.fr.design.layout.TableLayout.FILL; import static com.fr.design.layout.TableLayout.PREFERRED; import static com.fr.env.TestConnectionResult.AUTH_FAILED; import static com.fr.third.guava.base.Optional.fromNullable; +import static javax.swing.JOptionPane.ERROR_MESSAGE; /** * @author yaohwu @@ -583,6 +588,8 @@ public class RemoteEnvPane extends BasicBeanPane { } catch (RegistEditionException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); throw e; + } catch (WorkspaceCheckException e) { + return TestConnectionResult.parseByException(e); } } @@ -591,6 +598,14 @@ public class RemoteEnvPane extends BasicBeanPane { okButton.setEnabled(true); try { TestConnectionResult result = get(); + if (result.isVerifyResult()) { + dialog.dispose(); + FineJOptionPane.showMessageDialog(RemoteEnvPane.this, + new MessageWithLink(result.getText(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Modify_PassWord"), connection.getUrl() + RemoteWorkspaceURL.SYSTEM_LOGIN_PATH), + Toolkit.i18nText("Fine-Design_Basic_Dialog_Message_Title"), + ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon")); + } message.setText(result.getText()); uiLabel.setIcon(result.getIcon()); } catch (Exception e) { @@ -635,7 +650,7 @@ public class RemoteEnvPane extends BasicBeanPane { message.setBorder(BorderFactory.createEmptyBorder(8, 5, 0, 0)); okButton.setEnabled(false); - dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane.this), UIManager.getString("OptionPane.messageDialogTitle"), true); + dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane.this), Toolkit.i18nText("Fine-Design_Basic_Dialog_Message_Title"), true); dialog.setSize(new Dimension(308, 132)); okButton.setEnabled(false); diff --git a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java index dee40422c..4ea950e84 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java +++ b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java @@ -9,6 +9,8 @@ import com.fr.stable.StringUtils; */ public class RemoteWorkspaceURL implements FCloneable { + public static final String SYSTEM_LOGIN_PATH = "#management/system/login"; + /** * 默认 web app name */ diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java index 4524254f4..5d96612cb 100644 --- a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -1,14 +1,20 @@ package com.fr.env; +import com.fr.decision.webservice.exception.login.UserLoginLockException; +import com.fr.decision.webservice.exception.login.UserPasswordNeedUpdateException; +import com.fr.decision.webservice.exception.user.UserPasswordStrengthLimitException; import com.fr.design.i18n.Toolkit; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.AssistUtils; -import com.fr.workspace.WorkContext; +import com.fr.exception.RemoteDesignPermissionDeniedException; +import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; import com.fr.workspace.connect.WorkspaceConnectionInfo; -import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; +import com.fr.workspace.engine.exception.WorkspaceCheckException; +import java.util.HashSet; +import java.util.Set; import javax.swing.Icon; import javax.swing.UIManager; +import org.json.Test; /** * 测试连接的结果。 @@ -76,12 +82,127 @@ public enum TestConnectionResult { public String getText() { return Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); } + }, + + /** + * 登录锁定 + */ + LOGIN_LOCK { + + private String value; + + @Override + public Icon getIcon() { + return UIManager.getIcon("OptionPane.errorIcon"); + } + + @Override + public String getText() { + return Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Login_Lock", value); + } + + @Override + public String errorCode() { + return UserLoginLockException.ERROR_CODE; + } + + @Override + public void setValue(String lockMin) { + this.value = lockMin; + } + + @Override + public boolean isVerifyResult() { + return true; + } + }, + + /** + * 没有远程设计权限 + */ + PERMISSION_DENIED { + @Override + public Icon getIcon() { + return UIManager.getIcon("OptionPane.errorIcon"); + } + + @Override + public String getText() { + return Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Permission_Denied"); + } + + @Override + public String errorCode() { + return RemoteDesignPermissionDeniedException.ERROR_CODE; + } + }, + + /** + * 弱密码 + */ + PASSWORD_STRENGTH_LIMIT () { + @Override + public Icon getIcon() { + return UIManager.getIcon("OptionPane.errorIcon"); + } + + @Override + public String getText() { + return Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Weak_Password"); + } + + @Override + public String errorCode() { + return UserPasswordStrengthLimitException.ERROR_CODE; + } + + @Override + public boolean isVerifyResult() { + return true; + } + }, + + /** + * 密码更新 + */ + PASSWORD_NEED_UPDATE { + @Override + public Icon getIcon() { + return UIManager.getIcon("OptionPane.errorIcon"); + } + + @Override + public String getText() { + return Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Update_Password"); + } + + @Override + public String errorCode() { + return UserPasswordNeedUpdateException.ERROR_CODE; + } + + @Override + public boolean isVerifyResult() { + return true; + } }; public abstract Icon getIcon(); public abstract String getText(); + public void setValue(String value) { + // do noting + } + + public String errorCode() { + return StringUtils.EMPTY; + } + + public boolean isVerifyResult() { + return false; + } + public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) { if (value == null) { return AUTH_FAILED; @@ -92,4 +213,30 @@ public enum TestConnectionResult { //去掉测试连接时所做的检测 return FULLY_SUCCESS; } + + public static TestConnectionResult parseByException(WorkspaceCheckException e) { + for (TestConnectionResult result : values()) { + if (ComparatorUtils.equals(e.errorCode(), result.errorCode())) { + // 登录锁定 获取下锁定的时间 + if (ComparatorUtils.equals(result, LOGIN_LOCK)) { + result.setValue(e.getMessage().replaceAll("\\D+", StringUtils.EMPTY)); + } + return result; + } + + } + return AUTH_FAILED; + } + + private final static Set VERIFY_SET = new HashSet<>(); + + static { + VERIFY_SET.add(LOGIN_LOCK); + VERIFY_SET.add(PASSWORD_NEED_UPDATE); + VERIFY_SET.add(PASSWORD_STRENGTH_LIMIT); + } + + public static boolean isVerifyResult(TestConnectionResult result) { + return VERIFY_SET.contains(result); + } } From 358d972dee8097028365832a103cd98d85d94abd Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 27 Oct 2020 12:10:49 +0800 Subject: [PATCH 03/12] =?UTF-8?q?REPORT-40646=20=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/env/TestConnectionResult.java | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java index 5d96612cb..c44f18487 100644 --- a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -10,11 +10,8 @@ import com.fr.stable.StringUtils; import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.engine.exception.WorkspaceCheckException; -import java.util.HashSet; -import java.util.Set; import javax.swing.Icon; import javax.swing.UIManager; -import org.json.Test; /** * 测试连接的结果。 @@ -223,20 +220,7 @@ public enum TestConnectionResult { } return result; } - } return AUTH_FAILED; } - - private final static Set VERIFY_SET = new HashSet<>(); - - static { - VERIFY_SET.add(LOGIN_LOCK); - VERIFY_SET.add(PASSWORD_NEED_UPDATE); - VERIFY_SET.add(PASSWORD_STRENGTH_LIMIT); - } - - public static boolean isVerifyResult(TestConnectionResult result) { - return VERIFY_SET.contains(result); - } } From 08f4f30d67b7da04dbe43b6ae17df2d87596961d Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Tue, 27 Oct 2020 16:50:37 +0800 Subject: [PATCH 04/12] =?UTF-8?q?REPORT-40027=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JTemplateActionListenerAdapter.java | 22 +++++++++++++++++++ .../fr/design/mainframe/ComponentTree.java | 10 ++------- .../java/com/fr/design/mainframe/JForm.java | 12 +--------- 3 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/JTemplateActionListenerAdapter.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateActionListenerAdapter.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateActionListenerAdapter.java new file mode 100644 index 000000000..7065f3e94 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateActionListenerAdapter.java @@ -0,0 +1,22 @@ +package com.fr.design.mainframe; + +/** + * @Author: Yuan.Wang + * @Date: 2020/10/27 + */ +public class JTemplateActionListenerAdapter implements JTemplateActionListener { + @Override + public void templateOpened(JTemplate jt) { + + } + + @Override + public void templateSaved(JTemplate jt) { + + } + + @Override + public void templateClosed(JTemplate jt) { + + } +} 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 2643f9596..e1ac304b2 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 @@ -202,7 +202,7 @@ public class ComponentTree extends JTree { * 删除key对应的缓存展开路径 */ public void removeTreePath(String key) { - if (!StringUtils.isEmpty(key)) { + if (StringUtils.isNotEmpty(key)) { treePathCache.remove(key); } } @@ -267,13 +267,7 @@ public class ComponentTree extends JTree { return; } for (TreePath treePath : list) { - if (treePath.getLastPathComponent() instanceof XLayoutContainer) { - XLayoutContainer creator = (XLayoutContainer) treePath.getLastPathComponent(); - if (XCreatorUtils.getParentXLayoutContainer(creator) == null) { - continue; - } - expandPath(treePath); - } + expandPath(treePath); } } 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 7f5eb87d6..03934d035 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 @@ -307,17 +307,7 @@ public class JForm extends JTemplate implements BaseJForm jt) { - - } - - @Override - public void templateSaved(JTemplate jt) { - - } - + addJTemplateActionListener(new JTemplateActionListenerAdapter() { @Override public void templateClosed(JTemplate jt) { String key = jt.getEditingFILE().getPath() + template.getTemplateID(); From f40e87fcba78af38409d3f57a2652c054087d731 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Tue, 27 Oct 2020 17:55:29 +0800 Subject: [PATCH 05/12] REPORT-40027 NPE --- .../src/main/java/com/fr/design/mainframe/JForm.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 03934d035..b7fb90fcb 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 @@ -310,7 +310,10 @@ public class JForm extends JTemplate implements BaseJForm jt) { - String key = jt.getEditingFILE().getPath() + template.getTemplateID(); + if (jt == null) { + return; + } + String key = jt.getEditingFILE().getPath() + jt.getTarget().getTemplateID(); FormHierarchyTreePane.getInstance().removeTreePath(key); } }); From 025d334b104b60fd41ff03933638d002a5a18234 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 15 Oct 2020 19:01:56 +0800 Subject: [PATCH 06/12] =?UTF-8?q?REPORT-38688=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=9C=A8=E5=8F=8C=E5=B1=8F=E4=B8=8B=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E4=BC=9A=E6=9C=89=E5=8D=A1=E5=B1=8F=E7=9A=84=E7=8E=B0=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/DesignerFrame.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 2f65fca0a..b73411061 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 @@ -548,9 +548,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta contentHeight = layeredPane.getHeight(); contentWidth = layeredPane.getWidth(); - layeredPane.remove(basePane); + // 这个地方remove和add都是一个对象 完全没有必要remove再add 改变了窗口大小重新设置下 然后有repaint即可 basePane.setBounds(0, 0, contentWidth, contentHeight); - layeredPane.add(basePane); layeredPane.repaint(); } From ec637d5ba2846e62d3cd59db5dd90b9ccf3e2206 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 20 Oct 2020 10:55:50 +0800 Subject: [PATCH 07/12] =?UTF-8?q?REPORT-38688=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=9C=A8=E5=8F=8C=E5=B1=8F=E4=B8=8B=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E4=BC=9A=E6=9C=89=E5=8D=A1=E5=B1=8F=E7=9A=84=E7=8E=B0=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/DesignerFrame.java | 1 + 1 file changed, 1 insertion(+) 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 b73411061..490b4e7e9 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 @@ -551,6 +551,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // 这个地方remove和add都是一个对象 完全没有必要remove再add 改变了窗口大小重新设置下 然后有repaint即可 basePane.setBounds(0, 0, contentWidth, contentHeight); layeredPane.repaint(); + layeredPane.revalidate(); } /** From 513bc582103494089b8438c2c813011c57ff8876 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 28 Oct 2020 16:43:17 +0800 Subject: [PATCH 08/12] =?UTF-8?q?REPORT-40515=20jar=E5=8C=85=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=88=B0=E6=9C=80=E6=96=B0=E5=90=8E=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=87=E6=8D=A2=E8=BF=9C=E7=A8=8B=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java index 37a671eeb..f9de1cfa4 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java @@ -169,7 +169,8 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { return result; } try { - result = WorkContext.getConnector().testConnection(connection); + WorkContext.getConnector().validateVT(connection); + result = true; } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); return result; From 91bf9018377842bc1f58d3b432526e9aa0aeae21 Mon Sep 17 00:00:00 2001 From: Yvan Date: Wed, 28 Oct 2020 18:53:31 +0800 Subject: [PATCH 09/12] =?UTF-8?q?REPORT-34739=20=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E5=B8=83=E5=B1=80=E4=B8=8B=E8=B0=83=E6=95=B4=E7=BB=9D?= =?UTF-8?q?=E5=AF=B9=E7=94=BB=E5=B8=83=E5=9D=97=E9=AB=98=E5=BA=A6,?= =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E7=94=BB=E5=B8=83=E5=9D=97=E4=B9=B1=E8=B7=B3?= =?UTF-8?q?=E5=B9=B6=E5=AF=BC=E8=87=B4=E6=92=A4=E9=94=80=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=A4=B1=E6=95=88=20=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=E3=80=91=E5=9C=A8=E8=B0=83=E6=95=B4=E7=BB=9D=E5=AF=B9?= =?UTF-8?q?=E7=94=BB=E5=B8=83=E5=9D=97=E7=9A=84=E9=AB=98=E5=BA=A6=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=9B=A0=E4=B8=BA=E5=89=8D=E9=9D=A2=E5=AF=B9=E7=BB=9D?= =?UTF-8?q?=E5=AF=B9=E7=94=BB=E5=B8=83=E5=9D=97=E7=9A=84backupBounds?= =?UTF-8?q?=E5=81=9A=E4=BA=86=E5=A4=84=E7=90=86=EF=BC=8C=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E4=BA=86=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E5=9D=97=E9=AB=98?= =?UTF-8?q?=E5=BA=A6=E5=B8=A6=E6=9D=A5=E7=9A=84=E5=81=8F=E7=A7=BB=E9=87=8F?= =?UTF-8?q?=EF=BC=8C=E6=89=80=E4=BB=A5=E4=BC=9A=E5=AF=BC=E8=87=B4=E5=85=B6?= =?UTF-8?q?=E4=B9=B1=E8=B7=B3=E5=B9=B6=E4=B8=94=E6=92=A4=E9=94=80=E5=87=BA?= =?UTF-8?q?=E9=94=99=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=96=B9=E6=A1=88?= =?UTF-8?q?=E3=80=91=E5=9C=A8com.fr.design.designer.beans.adapters.layout.?= =?UTF-8?q?FRFitLayoutAdapter.fix(com.fr.design.designer.creator.XCreator)?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=B8=AD=E5=8A=A0=E4=B8=AA=E5=88=A4=E6=96=AD?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=98=AF=E7=BB=9D=E5=AF=B9=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E5=9D=97=EF=BC=8C=E5=B0=B1=E5=B0=86=E6=BC=8F=E7=AE=97?= =?UTF-8?q?=E7=9A=84=E5=81=8F=E7=A7=BB=E9=87=8F=E5=8A=A0=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/adapters/layout/FRFitLayoutAdapter.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index 24c3a19db..5c5fa1518 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -5,6 +5,7 @@ package com.fr.design.designer.beans.adapters.layout; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.GroupModel; +import com.fr.design.designer.TargetComponent; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.painters.FRFitLayoutPainter; @@ -19,7 +20,14 @@ import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.properties.FRFitLayoutConstraints; import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.FormWidgetOptionProvider; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrame; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.container.WAbsoluteLayout; @@ -342,7 +350,12 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { //拖拽组件原大小、位置 Rectangle backupBound = creator.getBackupBound(); backupBound.x -= container.getX(); - backupBound.y -= container.getY(); + // REPORT-34739 对绝对画布块的backupBound.y的调整还需要考虑一下参数面板块的高度造成的偏移 + int paraHeight = 0; + if (creator instanceof XWAbsoluteLayout) { + paraHeight = WidgetPropertyPane.getInstance().getEditingFormDesigner().getParaHeight(); + } + backupBound.y -= (container.getY() - paraHeight); //当前拖拽组件的位置 int x = creator.getX(); int y = creator.getY(); From ab1c026e2d0c243741ef1e52a0c5d1f6d23c56f7 Mon Sep 17 00:00:00 2001 From: Yvan Date: Wed, 28 Oct 2020 18:54:15 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E5=AF=BC=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/adapters/layout/FRFitLayoutAdapter.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index 5c5fa1518..401e05975 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -5,7 +5,6 @@ package com.fr.design.designer.beans.adapters.layout; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.GroupModel; -import com.fr.design.designer.TargetComponent; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.painters.FRFitLayoutPainter; @@ -20,13 +19,7 @@ import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.properties.FRFitLayoutConstraints; import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; -import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.FormWidgetOptionProvider; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrame; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.LayoutBorderStyle; From 5b5c5393469981af20ba55fac30ad80d68caecee Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 29 Oct 2020 09:14:54 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/adapters/layout/FRFitLayoutAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index 401e05975..a5ceb8bb2 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -345,7 +345,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { backupBound.x -= container.getX(); // REPORT-34739 对绝对画布块的backupBound.y的调整还需要考虑一下参数面板块的高度造成的偏移 int paraHeight = 0; - if (creator instanceof XWAbsoluteLayout) { + if (creator.acceptType(XWAbsoluteLayout.class)) { paraHeight = WidgetPropertyPane.getInstance().getEditingFormDesigner().getParaHeight(); } backupBound.y -= (container.getY() - paraHeight); From 4852af659e399f4cdaff6902c9f8db41b99b28d6 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 29 Oct 2020 11:41:43 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E6=8D=A2?= =?UTF-8?q?=E4=B8=80=E7=A7=8D=E6=96=B9=E5=BC=8F=E8=8E=B7=E5=8F=96=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=9D=A2=E6=9D=BF=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/adapters/layout/FRFitLayoutAdapter.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index a5ceb8bb2..c0eb39297 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -19,7 +19,11 @@ import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.properties.FRFitLayoutConstraints; import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.FormWidgetOptionProvider; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.LayoutBorderStyle; @@ -346,7 +350,10 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { // REPORT-34739 对绝对画布块的backupBound.y的调整还需要考虑一下参数面板块的高度造成的偏移 int paraHeight = 0; if (creator.acceptType(XWAbsoluteLayout.class)) { - paraHeight = WidgetPropertyPane.getInstance().getEditingFormDesigner().getParaHeight(); + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jTemplate instanceof JForm) { + paraHeight = ((JForm) jTemplate).getFormDesign().getParaHeight(); + } } backupBound.y -= (container.getY() - paraHeight); //当前拖拽组件的位置