From 8095139ec8ab378c3dfd10ddd945ae12618775fa Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 6 Nov 2024 12:08:02 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-138249=20cpt=E6=94=AF=E6=8C=81=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=9B=BF=E6=8D=A2=20=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/TableDataTreePane.java | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) 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 e566004679..22c49df240 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 @@ -237,7 +237,17 @@ public class TableDataTreePane extends BasicTableDataTreePane { createAddMenuDef(); // 创建插件监听 createPluginListener(); + createToolbarDef(); + UIToolbar toolBar = ToolBarDef.createJToolBar(); + toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); + toolBar.setBorderPainted(true); + toolbarDef.updateToolBar(toolBar); + TreeSearchToolbarPane searchLayerdPane = new TreeSearchToolbarPane(toolBar); + searchLayerdPane.setPreferredSize(new Dimension(this.getWidth(), 23)); + return searchLayerdPane; + } + private void createToolbarDef() { editAction = new EditAction(); copyAction = new CopyAction(); pasteAction = new PasteAction(); @@ -249,20 +259,15 @@ public class TableDataTreePane extends BasicTableDataTreePane { switchAction = new SwitchAction(); toolbarDef = new ToolBarDef(); - toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction, SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction, esdAction, esdOffAction, switchAction); - initExtraAction(); - UIToolbar toolBar = ToolBarDef.createJToolBar(); - toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); - toolBar.setBorderPainted(true); - toolbarDef.updateToolBar(toolBar); - - TreeSearchToolbarPane searchLayerdPane = new TreeSearchToolbarPane(toolBar); - searchLayerdPane.setPreferredSize(new Dimension(this.getWidth(), 23)); - - return searchLayerdPane; + toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction); + ShortCut[] extraShortCut = initExtraAction(); + for (ShortCut shortCut: extraShortCut) { + toolbarDef.addShortCut(shortCut); + } + toolbarDef.addShortCut(SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction, esdAction, esdOffAction, switchAction); } - private void initExtraAction() { + private ShortCut[] initExtraAction() { Set toolBarActionProviders = ExtraDesignClassManager.getInstance().getArray(TableDataTreeToolBarActionProvider.XML_TAG); for (TableDataTreeToolBarActionProvider handler : toolBarActionProviders) { try { @@ -271,7 +276,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - toolbarDef.addShortCut(extraActions.toArray(new ShortCut[0])); + return extraActions.toArray(new ShortCut[0]); } /** @@ -348,7 +353,9 @@ public class TableDataTreePane extends BasicTableDataTreePane { public void on(PluginEvent event) { addMenuDef.clearShortCuts(); + toolbarDef.clearShortCuts(); createAddMenuDef(); + createToolbarDef(); } }, new PluginFilter() {