Browse Source

REPORT-138249 cpt支持数据集替换 修改注入接口

release/11.0
Destiny.Lin 2 weeks ago
parent
commit
e4a36956f7
  1. 25
      designer-base/src/main/java/com/fr/design/data/datapane/AbstractTableDataTreeToolBarActionProvider.java
  2. 35
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  3. 25
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreeToolBarActionProvider.java

25
designer-base/src/main/java/com/fr/design/data/datapane/AbstractTableDataTreeToolBarActionProvider.java

@ -1,25 +0,0 @@
package com.fr.design.data.datapane;
import com.fr.stable.fun.mark.API;
/**
* 数据集Tree工具栏面板注入接口
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/11/1
*/
@API(level = TableDataTreeToolBarActionProvider.CURRENT_LEVEL)
public abstract class AbstractTableDataTreeToolBarActionProvider implements TableDataTreeToolBarActionProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

35
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -47,7 +47,6 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.LineSeparator; import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.esd.core.strategy.config.StrategyConfig; import com.fr.esd.core.strategy.config.StrategyConfig;
@ -148,7 +147,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
private EsdOffAction esdOffAction; private EsdOffAction esdOffAction;
private SwitchAction switchAction; private SwitchAction switchAction;
private PreviewTableDataAction previewTableDataAction; private PreviewTableDataAction previewTableDataAction;
private Set<AbstractExtraAction> extraActions = new HashSet<>(); private static Set<AbstractExtraAction> extraActions = new HashSet<>();
private JPanel serverDatasetAuthTipJPanel = new JPanel(); private JPanel serverDatasetAuthTipJPanel = new JPanel();
private TableDataSearchRemindPane remindPane; private TableDataSearchRemindPane remindPane;
@ -257,26 +256,38 @@ public class TableDataTreePane extends BasicTableDataTreePane {
esdAction = new EsdOnAction(); esdAction = new EsdOnAction();
esdOffAction = new EsdOffAction(); esdOffAction = new EsdOffAction();
switchAction = new SwitchAction(); switchAction = new SwitchAction();
extraActions = new HashSet<>();
toolbarDef = new ToolBarDef(); toolbarDef = new ToolBarDef();
toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction); toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction);
ShortCut[] extraShortCut = initExtraAction(); initExtraAction();
for (ShortCut shortCut: extraShortCut) {
toolbarDef.addShortCut(shortCut);
}
toolbarDef.addShortCut(SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction, esdAction, esdOffAction, switchAction); toolbarDef.addShortCut(SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction, esdAction, esdOffAction, switchAction);
} }
private ShortCut[] initExtraAction() { private void initExtraAction() {
Set<TableDataTreeToolBarActionProvider> toolBarActionProviders = ExtraDesignClassManager.getInstance().getArray(TableDataTreeToolBarActionProvider.XML_TAG); for (AbstractExtraAction action: extraActions) {
for (TableDataTreeToolBarActionProvider handler : toolBarActionProviders) {
try { try {
extraActions.add(handler.createAction()); toolbarDef.addShortCut(action);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
return extraActions.toArray(new ShortCut[0]); }
/**
* 注册ExtraAction
*
* @param extraAction TableDataTree工具栏的扩展接口Action
*/
public static void registerExtraAction(AbstractExtraAction extraAction) {
extraActions.add(extraAction);
}
/**
* 移除ExtraAction
*
* @param extraAction TableDataTree工具栏的扩展接口Action
*/
public static void removeExtraAction(AbstractExtraAction extraAction) {
extraActions.remove(extraAction);
} }
/** /**

25
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreeToolBarActionProvider.java

@ -1,25 +0,0 @@
package com.fr.design.data.datapane;
import com.fr.stable.fun.mark.Mutable;
/**
* 数据集Tree工具栏面板注入接口
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/11/1
*/
public interface TableDataTreeToolBarActionProvider extends Mutable {
String XML_TAG = "TableDataTreeToolBarActionProvider";
int CURRENT_LEVEL = 1;
/**
* 创建Action对象,用于提供针对数据集的额外操作
*
* @return 创建出来的Action对象
*/
TableDataTreePane.AbstractExtraAction createAction();
}
Loading…
Cancel
Save