From 15fd3a259d1068ab202b4fc89fbb1f5defacba22 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 11 May 2021 14:05:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-51442=20=E8=8F=9C=E5=8D=95=E6=A0=8F?= =?UTF-8?q?=E5=92=8C=E6=95=B0=E6=8D=AE=E9=9B=86=E9=9D=A2=E6=9D=BF=E7=81=B0?= =?UTF-8?q?=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/BasicTableDataTreePane.java | 26 +++++++++++++++++-- .../data/datapane/TableDataTreePane.java | 14 +++++----- .../fr/design/mainframe/DesignerFrame.java | 2 ++ .../fr/design/mainframe/DesktopCardPane.java | 17 ++++++++++++ .../mainframe/toolbar/ToolBarMenuDock.java | 6 +++++ .../main/java/com/fr/design/menu/MenuDef.java | 14 +++++----- .../java/com/fr/design/menu/ToolBarDef.java | 25 ++++++++++++++++++ 7 files changed, 88 insertions(+), 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index bfdd11bd4..b72ae2f15 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -6,7 +6,6 @@ import com.fr.data.TableDataSource; import com.fr.data.api.StoreProcedureAssist; import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.design.DesignModelAdapter; -import com.fr.design.actions.ForbiddenUpdateAction; import com.fr.design.actions.UpdateAction; import com.fr.design.data.datapane.TableDataCreatorProducer; import com.fr.design.data.datapane.TableDataNameObjectCreator; @@ -25,16 +24,20 @@ import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UILockButton; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; +import com.fr.design.i18n.Toolkit; import com.fr.design.icon.IconPathConstants; import com.fr.design.mainframe.DockingView; import com.fr.design.menu.LineSeparator; import com.fr.design.menu.MenuDef; +import com.fr.design.menu.ToolBarDef; import com.fr.general.ComparatorUtils; import com.fr.general.NameObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; +import java.util.HashSet; +import java.util.Set; import javax.swing.AbstractButton; import javax.swing.Action; import javax.swing.DefaultCellEditor; @@ -61,6 +64,16 @@ import java.util.Objects; * Time: 16:23 */ public abstract class BasicTableDataTreePane extends DockingView implements ResponseDataSourceChange { + + private static final Set FORBIDDEN_SET = new HashSet<>(); + + static { + FORBIDDEN_SET.add(Toolkit.i18nText("Fine-Design_Basic_Edit")); + FORBIDDEN_SET.add(Toolkit.i18nText("Fine-Design_Basic_Remove")); + FORBIDDEN_SET.add(Toolkit.i18nText("Fine-Design_Basic_Preview")); + FORBIDDEN_SET.add(Toolkit.i18nText("Fine-Design_Basic_Action_Add")); + } + protected static final int PROCEDURE_NAME_INDEX = 4; protected static final int TEMPLATE_TABLE_DATA = 0; protected static final int SERVER_TABLE_DATA = 1; @@ -69,6 +82,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp protected UIHeadGroup buttonGroup; protected String[] allDSNames; protected ConnectionTableAction connectionTableAction; + protected ToolBarDef toolbarDef; private String type = ""; @@ -399,7 +413,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp return prefix + count; } - protected class PreviewTableDataAction extends ForbiddenUpdateAction { + protected class PreviewTableDataAction extends UpdateAction { private TableDataTree dataTree; public PreviewTableDataAction(TableDataTree dataTree) { @@ -482,4 +496,12 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp } + public void refreshToolBar() { + toolbarDef.refreshToolBar(FORBIDDEN_SET); + } + + public void checkEnable() { + + } + } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 36cd0a4fe..31630b85c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -1,12 +1,10 @@ package com.fr.design.data.datapane; -import com.fr.base.BaseUtils; import com.fr.base.TableData; import com.fr.data.TableDataSource; import com.fr.data.impl.TableDataSourceDependent; import com.fr.design.DesignModelAdapter; import com.fr.design.ExtraDesignClassManager; -import com.fr.design.actions.ForbiddenUpdateAction; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; import com.fr.design.data.BasicTableDataTreePane; @@ -102,7 +100,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { removeAction = new RemoveAction(); previewTableDataAction = new PreviewTableDataAction(dataTree); connectionTableAction = new ConnectionTableAction(); - ToolBarDef toolbarDef = new ToolBarDef(); + toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction, SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction); UIToolbar toolBar = ToolBarDef.createJToolBar(); toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); @@ -244,7 +242,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { dg.setVisible(true); } - private class EditAction extends ForbiddenUpdateAction { + private class EditAction extends UpdateAction { public EditAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); this.setMnemonic('E'); @@ -261,7 +259,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { } } - private class RemoveAction extends ForbiddenUpdateAction { + private class RemoveAction extends UpdateAction { public RemoveAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); @@ -343,8 +341,10 @@ public class TableDataTreePane extends BasicTableDataTreePane { dataTree.refresh(); } - - + @Override + public void checkEnable() { + this.checkButtonEnabled(); + } public void addDataPane(final AbstractTableDataPane uPanel, String paneName) { final NamePane nPanel = uPanel.asNamePane(); 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 abedf3880..debbaf14c 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 @@ -12,6 +12,7 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; +import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.dialog.FineJOptionPane; @@ -821,6 +822,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta ((UIToolbar ) toolbarComponent).refreshUIToolBar(); } combineUp.refreshUIToolBar(); + this.ad.updateEnable(); } public JComponent getToolbarComponent() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java index 9558d44d6..8361016ca 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java @@ -6,12 +6,14 @@ package com.fr.design.mainframe; import com.fr.base.iofile.attr.DesignBanCopyAttrMark; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignerMode; +import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.dialog.BasicPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; import java.awt.BorderLayout; import java.awt.Component; +import javax.swing.JComponent; import javax.swing.JLayeredPane; @@ -97,6 +99,11 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener DesignerContext.getDesignerFrame().refreshUIToolBar(); DesignerFrameFileDealerPane.getInstance().stateChange(); EastRegionContainerPane.getInstance().updateAllPropertyPane(); + JComponent downPane = WestRegionContainerPane.getInstance().getDownPane(); + if (downPane instanceof BasicTableDataTreePane) { + BasicTableDataTreePane dataTreePane = (BasicTableDataTreePane) downPane; + dataTreePane.refreshToolBar(); + } checkLoadingPane(); layeredPane.moveToFront(loadingPane); } @@ -110,12 +117,22 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener layeredPane.moveToFront(transparentPane); DesignerContext.getDesignerFrame().refreshUIToolBar(); EastRegionContainerPane.getInstance().updateAllPropertyPane(); + JComponent downPane = WestRegionContainerPane.getInstance().getDownPane(); + if (downPane instanceof BasicTableDataTreePane) { + BasicTableDataTreePane dataTreePane = (BasicTableDataTreePane) downPane; + dataTreePane.refreshToolBar(); + } } public void hideCover() { transparentPane.stop(); layeredPane.moveToFront(component); EastRegionContainerPane.getInstance().updateAllPropertyPane(); + JComponent downPane = WestRegionContainerPane.getInstance().getDownPane(); + if (downPane instanceof BasicTableDataTreePane) { + BasicTableDataTreePane dataTreePane = (BasicTableDataTreePane) downPane; + dataTreePane.checkEnable(); + } } protected JTemplate getSelectedJTemplate() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index aca9bcc36..3dbdac094 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -169,6 +169,12 @@ public abstract class ToolBarMenuDock { } } + public void updateEnable() { + for (int i = 0, count = ArrayUtils.getLength(menus); i < count; i++) { + menus[i].updateEnable(); + } + } + /** * 更新toolbar */ diff --git a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java index cee1658b9..798d4870a 100644 --- a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java @@ -293,6 +293,10 @@ public class MenuDef extends ShortCut { } } + public void updateEnable() { + setEnabled(checkEnable()); + } + /** * 更新菜单 * @@ -406,14 +410,13 @@ public class MenuDef extends ShortCut { toolBar.add(this.createUIButton()); } - private boolean checkEnable(JComponent component) { - if (FORBIDDEN_SET.contains(component.getName())) { + private boolean checkEnable() { + if (FORBIDDEN_SET.contains(this.getName())) { JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); boolean flag = true; if (template != null) { flag = template.checkEnable(); } - component.setEnabled(flag); if (!flag) { return false; } @@ -442,9 +445,6 @@ public class MenuDef extends ShortCut { if (!(source instanceof JMenu)) { return; } - if (!checkEnable(createJMenu())) { - return; - } MenuDef.this.updateMenu(); } }; @@ -454,7 +454,7 @@ public class MenuDef extends ShortCut { public void mouseReleased(MouseEvent evt) { Object source = evt.getSource(); UIButton button = (UIButton) source; - if (!checkEnable(button)) { + if (!button.isEnabled()) { return; } if (isEastAttr) { diff --git a/designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java b/designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java index 07c51312e..8617ded9b 100644 --- a/designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java @@ -1,7 +1,11 @@ package com.fr.design.menu; +import com.fr.design.actions.UpdateAction; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.mainframe.JTemplate; +import java.util.Set; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -82,4 +86,25 @@ public class ToolBarDef { } } + public void refreshToolBar(Set set) { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (template != null) { + for (int i = 0; i < getShortCutCount(); i++) { + ShortCut shortCut = getShortCut(i); + if (shortCut instanceof MenuDef) { + MenuDef menuDef = (MenuDef) shortCut; + if (set.contains(menuDef.getName())) { + menuDef.setEnabled(template.checkEnable()); + } + } + if (shortCut instanceof UpdateAction) { + UpdateAction updateAction = (UpdateAction) shortCut; + if (set.contains(updateAction.getName())) { + updateAction.setEnabled(template.checkEnable()); + } + } + } + } + } + } \ No newline at end of file From 90dfc04e35f3ef671dad5a56cd4ebcf86115d8cf Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 11 May 2021 15:07:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-51188=20=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E7=9A=84tab=E5=9D=97=EF=BC=8C=E5=9C=A8=E7=BB=9D?= =?UTF-8?q?=E5=AF=B9=E5=B8=83=E5=B1=80=E4=B8=8B=E6=8B=96=E6=8B=BD=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=BC=A9=E5=B0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/FormArea.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java index f127f8ea0..56458a461 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java @@ -411,8 +411,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent { if (root.acceptType(XWFitLayout.class)) { XWFitLayout layout = (XWFitLayout) root; layout.setContainerPercent(value / DEFAULT_SLIDER); - traverAndAdjust(layout, percent); layout.adjustCreatorsWhileSlide(percent); + traverAndAdjust(layout, percent); // 拖动滑块,先将内部组件百分比大小计算,再计算容器大小 From 868cf0bd1507e2d5165f2d17adab4cf0209bd6ef Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 12 May 2021 10:35:52 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-52085=20=E8=A3=85=E6=9C=89=E8=80=81?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=9A=84=E6=96=B0=E8=87=AA=E9=80=82=E5=BA=94?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20frm=E6=97=A0=E6=B3=95=E6=89=93=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/app/FormApp.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java index 05454fcbe..02692c991 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java @@ -18,6 +18,7 @@ import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.form.main.Form; import com.fr.form.ui.container.WBorderLayout; +import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.bridge.StableFactory; @@ -57,20 +58,33 @@ class FormApp extends AbstractAppProvider { @Override public JTemplate call() throws Exception { OpenResult result = worker.getResult(); - return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, - new Object[]{result.getBaseBook(), tplFile, result.getRef()}, classType, BaseJForm.class); + return compatibleForm(result.getBaseBook(), result.getRef(), tplFile, classType); } }); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", tplFile.getName()) + "..."); worker.start(tplFile.getPath()); OpenResult result = worker.getResult(); if (result != null) { - return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, - new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class); + return compatibleForm(result.getBaseBook(), new Parameter[0], tplFile, classType); } return emptyForm; } + /** + * 兼容外部注册的frm类型 + * + * @return + */ + private JTemplate compatibleForm(Form form, Parameter[] parameters, FILE tplFile, HashMap classType) { + if (ComparatorUtils.equals(StableFactory.getRegisteredClass(BaseJForm.XML_TAG).getName(), JForm.class)) { + return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, + new Object[]{form, tplFile, parameters}, classType, BaseJForm.class); + } else { + return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, + new Object[]{form, tplFile}, classType, BaseJForm.class); + } + } + @Override public Form asIOFile(FILE file) {