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() {