() {
+ @Override
+ protected Void doInBackground() throws Exception {
+ for (TableDataWrapper tableDataWrapper : tableDataWrapperList) {
+ doWithTableDataWrapper(tableDataWrapper);
+ }
+ return null;
+ }
+
+ @Override
+ protected void done() {
+ refreshDockingView();
+ }
+ }.execute();
+ }
+ }
+
+ private class EsdOnAction extends AbstractESDAction {
+
+ @Override
+ public String getName() {
+ return Toolkit.i18nText("Fine-Design_ESD_Batch_Enable");
+ }
+
+ @Override
+ public String getIconResource() {
+ return "/com/fr/design/images/control/batch_esd_on";
+ }
+
+ @Override
+ public void doWithTableDataWrapper(TableDataWrapper wrapper) {
+ String dsName = wrapper.getTableDataName();
+ if (wrapper.getTableData() instanceof DBTableData) {
+ StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName);
+ strategyConfig.setEnable(true);
+ strategyConfig.setUseGlobal(false);
+ StrategyConfigAttrUtils.addStrategyConfig(strategyConfig);
+ DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
+ }
+ }
+ }
+
+ private class EsdOffAction extends AbstractESDAction {
+
+ @Override
+ public String getName() {
+ return Toolkit.i18nText("Fine-Design_ESD_Batch_Disable");
+ }
+
+ @Override
+ public String getIconResource() {
+ return "/com/fr/design/images/control/batch_esd_off";
+ }
+
+ @Override
+ public void doWithTableDataWrapper(TableDataWrapper wrapper) {
+ String dsName = wrapper.getTableDataName();
+ if (wrapper.getTableData() instanceof DBTableData) {
+ ((DBTableData) wrapper.getTableData()).setShare(false);
+ StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName);
+ strategyConfig.setEnable(false);
+ strategyConfig.setUseGlobal(false);
+ StrategyConfigAttrUtils.addStrategyConfig(strategyConfig);
+ DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
+ }
+ }
+ }
+
+ private @NotNull StrategyConfig getOrCreateStrategyConfig(String dsName) {
+ StrategyConfig config = StrategyConfigAttrUtils.getStrategyConfig(dsName);
+
+ if (config == null) {
+ config = StrategyConfigHelper.createStrategyConfig(true);
+ config.setDsName(dsName);
+ }
+
+ return config;
+ }
+
+ /**
+ * 新建数据集
+ *
+ * 抽象化,支持不同类型数据集创建
+ */
+ private abstract class AddAction extends UpdateAction {
+
+ protected abstract String getTDName();
+
+ protected abstract Icon getTDIcon();
+
+ protected abstract String getNamePrefix();
+
+ protected abstract TemplateTableDataWrapper getTableDataInstance();
+
+ private PaneActionType paneActionType=PaneActionType.ADD;
+
+ public AddAction() {
+ this.setName(this.getTDName());
+ this.setSmallIcon(this.getTDIcon());
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ dgEdit(getTableDataInstance().creatTableDataPane(), createDsName(getNamePrefix()), false,paneActionType);
+ }
+ }
+
+
+ private class EditAction extends UpdateAction {
+ private PaneActionType paneActionType=PaneActionType.EDIT;
+ public EditAction() {
+ this.setName(Toolkit.i18nText("Fine-Design_Basic_Edit"));
+ this.setMnemonic('E');
+ this.setSmallIcon("/com/fr/design/images/control/edit");
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ final NameObject selectedNO = tableDataTree.getSelectedNameObject();
+ if (selectedNO == null) {
+ return;
+ }
+ //final boolean group= ((TableDataWrapper) selectedNO.getObject()).getTableData() instanceof DSGroupTableData;
+
+ String dsName = selectedNO.getName();
+ DesignTableDataManager.removeSelectedColumnNames(dsName);
+
+ AbstractTableDataWrapper wrapper = (AbstractTableDataWrapper) selectedNO.getObject();
+
+ AbstractTableDataPane> tableDataPane = wrapper.creatTableDataPane();
+
+ if (TableDataAuthHelper.needCheckAuthWhenEdit(wrapper.getTableData())) {
+ // 先打开一个Loading面板
+ TableDataLoadingPane loadingPane = new TableDataLoadingPane();
+ BasicDialog loadingDialog = loadingPane.showLargeWindow(SwingUtilities.getWindowAncestor(GroupTableDataTreePane.this), null);
+ // 查询权限
+ new SwingWorker() {
+ @Override
+ protected Boolean doInBackground() throws Exception {
+ // 获取无权限连接名称集合
+ Collection noAuthConnections = TableDataAuthHelper.getNoAuthConnections();
+ // 获取当前数据集对应的数据连接名称
+ String connectionName = TableDataAuthHelper.getConnectionNameByDBTableData((DBTableData) wrapper.getTableData());
+ return !noAuthConnections.contains(connectionName);
+ }
+
+ @Override
+ protected void done() {
+ try {
+ Boolean hasAuth = get();
+ if (hasAuth) {
+ // 有权限时,关闭Loading面板,打开编辑面板
+ loadingDialog.setVisible(false);
+ dgEdit(tableDataPane, dsName, false,paneActionType);
+ } else {
+ // 无权限时,给出无权限提示
+ loadingPane.switchTo(TableDataLoadingPane.NO_AUTH_PANE_NAME);
+ }
+ } catch (Exception e) {
+ FineLoggerFactory.getLogger().error("loading connection error in remote design", e.getMessage());
+ // 查询权限失败时,给出报错提示
+ loadingPane.switchTo(TableDataLoadingPane.ERROR_NAME);
+ }
+ }
+ }.execute();
+ loadingDialog.setVisible(true);
+ } else {
+ // 无需检查权限时,直接打开数据库查询编辑面板
+ //下面创建creatTableDataPane后会直接populate,所以populate时不能用后设置的一些参数,比如name
+ dgEdit(tableDataPane, dsName, false,paneActionType);
+ }
+ }
+ }
+
+ private class RemoveAction extends UpdateAction {
+
+ public RemoveAction() {
+ this.setName(Toolkit.i18nText("Fine-Design_Basic_Remove"));
+ this.setMnemonic('R');
+ this.setSmallIcon("/com/fr/design/images/control/remove");
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ NameObject[] selectedNameObjects = tableDataTree.getSelectedTableDataNameObjects();
+ if (selectedNameObjects == null || selectedNameObjects.length == 0) {
+ FineLoggerFactory.getLogger().error("Table Data to remove is null or not selected");
+ return;
+ }
+ // 可以半选的CheckBoxList
+ CheckBoxListWithPartialSelect tableDataCheckBoxPane = new CheckBoxListWithPartialSelect(selectedNameObjects);
+ UIScrollPane scrollPane = new UIScrollPane(tableDataCheckBoxPane);
+ UILabel tips = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Select_Source_To_Remove"));
+ BasicPane basicPane = new BasicPane() {
+ @Override
+ protected String title4PopupWindow() {
+ return Toolkit.i18nText("Fine-Design_Basic_Remove");
+ }
+ };
+ basicPane.setLayout(new BorderLayout());
+ basicPane.add(tips, BorderLayout.NORTH);
+ basicPane.add(scrollPane, BorderLayout.CENTER);
+ BasicDialog basicDialog = basicPane.showSmallWindow(SwingUtilities.getWindowAncestor(GroupTableDataTreePane.this), new DialogActionAdapter() {
+ @Override
+ public void doOk() {
+ List selectedValues = tableDataCheckBoxPane.getSelectedObjects();
+ // 删除时如果正在搜索,跳回原树
+ if (TableDataTreeSearchManager.getInstance().isInSearchMode()) {
+ TableDataTreeSearchManager.getInstance().outOfSearchMode();
+ }
+ for (Object toRemove : selectedValues) {
+ try {
+ doRemove((String) toRemove);
+ } catch (Exception e) {
+ FineLoggerFactory.getLogger().error(e, "remove table data failed for {}", toRemove);
+ }
+ }
+ }
+
+ @Override
+ public void doCancel() {
+ super.doCancel();
+ }
+ });
+ basicDialog.setVisible(true);
+ }
+
+ private void doRemove(String toRemove) throws Exception {
+ // richer:这个地方为什么要在DataSourceTree里面去remove呢?多此一举吧
+ op.removeAction(toRemove);
+ tableDataTree.refresh();
+ // Richie:默认最后一行获得焦点.
+ tableDataTree.requestFocus();
+ tableDataTree.setSelectionRow(tableDataTree.getRowCount() - 1);
+ fireDSChanged();
+ checkButtonEnabled();
+
+ //删掉缓存配置
+ StrategyConfigAttrUtils.removeStrategyConfig(toRemove);
+
+ // 如果一个模版是平台开启,这个数据集的配置不会存xml,预览模版时直接从全局配置copy,这样
+ // 导致删除的时候StrategyConfigsAttrSavedHook没有通过前后配置比较感知数据集被删除,因此不会发出事件让其失效
+ // 这里额外发出一次数据集修改事件
+ StrategyEventsNotifier.modifyDataSet(new DSMapping(getTplPath(), new DsNameTarget(toRemove)));
+ DesignTableDataManager.removeSelectedColumnNames(toRemove);
+ DesignModelAdapter.getCurrentModelAdapter().removeTableDataParameters(toRemove);
+ FineLoggerFactory.getLogger().info("remove table data succeeded for {}", toRemove);
+ }
+ }
+
+ private class CopyAction extends UpdateAction {
+
+ public CopyAction() {
+ this.setName(Toolkit.i18nText("Fine-Design_Basic_Copy"));
+ this.setMnemonic('C');
+ this.setSmallIcon("/com/fr/design/images/m_edit/copy");
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ NameObject[] selectedNameObjects = tableDataTree.getSelectedTableDataNameObjects();
+ Map dataWrapperMap = TableDataTreeClipboard.getInstance().transferNameObjectArray2Map(selectedNameObjects);
+ TableDataTreeClipboard.getInstance().addToClip(dataWrapperMap);
+ }
+ }
+
+ private class PasteAction extends UpdateAction {
+
+ public PasteAction() {
+ this.setName(Toolkit.i18nText("Fine-Design_Basic_Action_Paste_Name"));
+ this.setMnemonic('P');
+ this.setSmallIcon("/com/fr/design/images/m_edit/paste");
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FineLoggerFactory.getLogger().info("ds-group:开始粘贴");
+ // 粘贴时如果正在搜索,跳回原树
+ if (TableDataTreeSearchManager.getInstance().isInSearchMode()) {
+ TableDataTreeSearchManager.getInstance().outOfSearchMode();
+ }
+ Map dataWrapperMap = TableDataTreeClipboard.getInstance().takeFromClip();
+ for (Map.Entry dataWrapperEntry : dataWrapperMap.entrySet()) {
+ // 处理数据集名称
+ String dsName = getNoRepeatedDsName4Paste(dataWrapperEntry.getKey());
+ AbstractTableDataWrapper wrapper = dataWrapperEntry.getValue();
+ AbstractTableDataPane> tableDataPane = TableDataFollowingPasteUtils.generateTableDataPaneWhenPaste(wrapper);
+ if (tableDataPane != null) {
+ FineLoggerFactory.getLogger().info("ds-group:开始粘贴:"+dsName);
+ addDataPane(tableDataPane, dsName);
+ }
+ }
+ FineLoggerFactory.getLogger().info("ds-group:结束粘贴");
+ }
+ }
+
+ public String getNoRepeatedDsName4Paste(String oldName) {
+ while (isDsNameRepeaded(oldName)) {
+ oldName = oldName + Toolkit.i18nText("Fine-Design_Table_Data_Copy_Of_Table_Data");
+ }
+ return oldName;
+ }
+
+ private class SwitchAction extends UpdateAction {
+
+ public SwitchAction() {
+ this.setName(Toolkit.i18nText("Fine-Design_Basic_Search"));
+ this.setMnemonic('S');
+ this.setSmallIcon("/com/fr/design/images/data/search");
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ // 交换层级
+ toolbarPane.switchPane(TreeSearchToolbarPane.SEARCH_PANE);
+ TableDataTreeSearchManager.getInstance().switchToSearch(TableDataSearchMode.match(buttonGroup.getSelectedIndex()), DesignTableDataManager.getEditingTableDataSource());
+ }
+ }
+
+ @Override
+ public void checkEnable() {
+ this.checkButtonEnabled();
+ }
+
+
+}
diff --git a/src/main/java/com/fr/plugins/dsgroup/LocaleFinder.java b/src/main/java/com/fr/plugins/dsgroup/LocaleFinder.java
new file mode 100644
index 0000000..674f418
--- /dev/null
+++ b/src/main/java/com/fr/plugins/dsgroup/LocaleFinder.java
@@ -0,0 +1,21 @@
+package com.fr.plugins.dsgroup;
+
+import com.fr.stable.fun.impl.AbstractLocaleFinder;
+
+/**
+ * Created by phetran_ye on 2018/8/7.
+ */
+public class LocaleFinder extends AbstractLocaleFinder {
+ @Override
+
+ public int currentAPILevel() {
+ return CURRENT_LEVEL;
+ }
+
+ @Override
+
+ public String find() {
+ return "com/fr/plugins/dsgroup/locale/locale";
+ }
+
+}
diff --git a/src/main/java/com/fr/plugins/dsgroup/PaneActionType.java b/src/main/java/com/fr/plugins/dsgroup/PaneActionType.java
new file mode 100644
index 0000000..1d49300
--- /dev/null
+++ b/src/main/java/com/fr/plugins/dsgroup/PaneActionType.java
@@ -0,0 +1,9 @@
+package com.fr.plugins.dsgroup;
+
+/**
+ * @author phetran_ye
+ * 2023-03-18
+ */
+public enum PaneActionType {
+ ADD,EDIT;
+}
diff --git a/src/main/java/com/fr/plugins/dsgroup/TableDataAware.java b/src/main/java/com/fr/plugins/dsgroup/TableDataAware.java
new file mode 100644
index 0000000..92a95ef
--- /dev/null
+++ b/src/main/java/com/fr/plugins/dsgroup/TableDataAware.java
@@ -0,0 +1,13 @@
+package com.fr.plugins.dsgroup;
+
+import com.fr.design.DesignModelAdapter;
+import com.fr.design.data.datapane.TableDataSourceOP;
+
+/**
+ * @author phetran_ye
+ * 2022-09-12
+ */
+public interface TableDataAware {
+ DesignModelAdapter getTC();
+ TableDataSourceOP getOp();
+}
diff --git a/src/main/java/com/fr/plugins/dsgroup/TableDataPaneProcessorImpl.java b/src/main/java/com/fr/plugins/dsgroup/TableDataPaneProcessorImpl.java
new file mode 100644
index 0000000..6b93093
--- /dev/null
+++ b/src/main/java/com/fr/plugins/dsgroup/TableDataPaneProcessorImpl.java
@@ -0,0 +1,37 @@
+package com.fr.plugins.dsgroup;
+
+import com.fr.design.DesignModelAdapter;
+import com.fr.design.actions.server.GlobalTableDataAction;
+import com.fr.design.data.BasicTableDataTreePane;
+import com.fr.design.data.datapane.TableDataPaneController;
+import com.fr.design.fun.impl.AbstractTDPaneProcessor;
+import com.fr.design.menu.ShortCut;
+import com.fr.general.GeneralUtils;
+import com.fr.stable.ProductConstants;
+
+
+/**
+ * Created by phetran_ye on 2018/8/8.
+ */
+public class TableDataPaneProcessorImpl extends AbstractTDPaneProcessor {
+ @Override
+ public BasicTableDataTreePane createTableDataTreePane(DesignModelAdapter, ?> tc) {
+ return GroupTableDataTreePane.getInstance(tc);
+ }
+
+ @Override
+ public TableDataPaneController createServerTableDataPane(DesignModelAdapter, ?> tc) {
+ return new GroupTableDataPaneListPane();
+ }
+
+ @Override
+ public ShortCut createServerTDAction() {
+ return new GlobalTableDataAction();
+ }
+
+ @Override
+ public int currentAPILevel() {
+ return CURRENT_LEVEL;
+ }
+
+}
diff --git a/src/main/java/com/fr/plugins/dsgroup/fun/DSGroupTableData.java b/src/main/java/com/fr/plugins/dsgroup/fun/DSGroupTableData.java
new file mode 100644
index 0000000..6b1f98a
--- /dev/null
+++ b/src/main/java/com/fr/plugins/dsgroup/fun/DSGroupTableData.java
@@ -0,0 +1,172 @@
+package com.fr.plugins.dsgroup.fun;
+
+
+import com.fr.config.holder.Conf;
+import com.fr.config.holder.impl.SimConf;
+import com.fr.data.AbstractParameterTableData;
+import com.fr.design.mainframe.WestRegionContainerPane;
+import com.fr.general.data.DataModel;
+import com.fr.script.Calculator;
+import com.fr.stable.StringUtils;
+import com.fr.stable.xml.XMLPrintWriter;
+import com.fr.stable.xml.XMLableReader;
+
+/**
+ * Created by richie on 2016/10/8.
+ */
+public class DSGroupTableData extends AbstractParameterTableData {
+
+ private static final String XML_ATTR_TAG = "QueryTableDataAttr";
+
+ private static final String separator="&;";
+ private static final String childrenAttrName="children_DS_names";
+ private static final String parentAttrName="parent_DS_name";
+ private Conf attrParentDSName=new SimConf<>(null);
+ private Conf attrChildrenDSNames=new SimConf<>(null);
+
+ public Conf getAttrParentDSName() {
+ return attrParentDSName;
+ }
+
+ public void setAttrParentDSName(Conf attrParentDSName) {
+ this.attrParentDSName = attrParentDSName;
+ }
+
+ public Conf getAttrChildrenDSNames() {
+ return attrChildrenDSNames;
+ }
+
+ public void setAttrChildrenDSNames(Conf attrChildrenDSNames) {
+ this.attrChildrenDSNames = attrChildrenDSNames;
+ }
+
+ public static String getSeparator() {
+ return separator;
+ }
+
+ public String getChildrenDSNames() {
+ return attrChildrenDSNames.get();
+ }
+
+ public boolean hasChildren(){
+ return attrChildrenDSNames.get()!=null;
+ }
+
+ public boolean hasParent(){
+ return attrParentDSName.get()!=null;
+ }
+
+ public void setChildrenDSNames(String childrenDSNames) {
+ this.attrChildrenDSNames.set(childrenDSNames);
+ }
+
+ public String getParentDSName() {
+ return attrParentDSName.get();
+ }
+
+ public void setParentDSName(String parentDSName) {
+ this.attrParentDSName.set(parentDSName);
+ }
+
+ public void addChildren(String children){
+ if(StringUtils.isEmpty(children)){
+ return;
+ }
+ if(this.hasChildren()){
+ this.setChildrenDSNames(this.getChildrenDSNames()+separator+children);
+ }else{
+ this.setChildrenDSNames(children);
+ }
+ }
+
+ public void removeParent(){
+ this.setParentDSName(null);
+ }
+
+ public void removeChild(String childName){
+ if(!hasChildren()){
+ return;
+ }
+ String children=this.getChildrenDSNames();
+ children=wrapDsName(children);
+ childName=wrapDsName(childName);
+ children=children.replace(childName,separator).replaceAll("^"+separator+"{1}","").replaceAll(separator+"${1}","");
+ if(children.length()==0){
+ children=null;
+ }
+ this.setChildrenDSNames(children);
+ }
+
+ public boolean hasChild(String childName){
+ if(!hasChildren()){
+ return false;
+ }else{
+ childName=wrapDsName(childName);
+ String myChildren=wrapDsName(this.getChildrenDSNames());
+ return myChildren.indexOf(childName)>-1;
+ }
+ }
+
+ public boolean isChildOf(String parentName){
+ return parentName.equals(this.getParentDSName());
+ }
+
+ public void changeChildName(String oldChildName,String newChildName){
+ if(!hasChildren()||StringUtils.isEmpty(newChildName)){
+ return;
+ }
+ String children=this.getChildrenDSNames();
+ children=wrapDsName(children);
+ oldChildName=wrapDsName(oldChildName);
+ newChildName=wrapDsName(newChildName);
+ children=children.replace(oldChildName,newChildName).replaceAll("^"+separator+"{1}","").replaceAll(separator+"${1}","");
+ this.setChildrenDSNames(children);
+ }
+
+ private String wrapDsName(String name){
+ return separator+name+separator;
+ }
+
+ @Override
+ public DataModel createDataModel(Calculator calculator) {
+ //return new QueryDataModel(processParameters(calculator));
+ return null;
+ }
+
+ @Override
+ public void readXML(XMLableReader reader) {
+ super.readXML(reader);
+ if (reader.isChildNode()) {
+ String tagName = reader.getTagName();
+ if (tagName.equals(XML_ATTR_TAG)) {
+ attrParentDSName = new SimConf<>(reader.getAttrAsString(parentAttrName, null));
+ attrChildrenDSNames = new SimConf<>(reader.getAttrAsString(childrenAttrName, null));
+ }
+ }
+ }
+
+ @Override
+ public void writeXML(XMLPrintWriter writer) {
+ super.writeXML(writer);
+ writer.startTAG(XML_ATTR_TAG);
+ writer.attr(parentAttrName, attrParentDSName.get());
+ writer.attr(childrenAttrName, attrChildrenDSNames.get());
+ writer.end();
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ DSGroupTableData cloned = (DSGroupTableData)super.clone();
+ cloned.attrParentDSName=(SimConf)this.attrParentDSName.clone();
+ cloned.attrChildrenDSNames=(SimConf)this.attrChildrenDSNames.clone();
+ return cloned;
+ }
+
+ public DSGroupTableData newData(){
+ try{
+ return (DSGroupTableData)this.clone();
+ }catch (CloneNotSupportedException e){
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/com/fr/plugins/dsgroup/rpc/GroupStableKeyArgsProvider.java b/src/main/java/com/fr/plugins/dsgroup/rpc/GroupStableKeyArgsProvider.java
new file mode 100644
index 0000000..ee396d7
--- /dev/null
+++ b/src/main/java/com/fr/plugins/dsgroup/rpc/GroupStableKeyArgsProvider.java
@@ -0,0 +1,25 @@
+package com.fr.plugins.dsgroup.rpc;
+
+import com.fr.module.StableKey;
+import com.fr.stable.fun.impl.AbstractStableKeyArgsProvider;
+import com.fr.workspace.base.WorkspaceKey;
+import com.fr.workspace.pool.WorkRPCRegister;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author phetran_ye
+ * 2022-04-20
+ */
+public class GroupStableKeyArgsProvider extends AbstractStableKeyArgsProvider>{
+ @Override
+ protected List> createArgs() {
+ return Arrays.asList( WorkRPCRegister.wrap(GroupTableDataOperator.class, GroupTableDataOperatorImpl.getInstance()) );
+ }
+
+ @Override
+ public StableKey> getKey() {
+ return WorkspaceKey.RPC;
+ }
+}
diff --git a/src/main/java/com/fr/plugins/dsgroup/rpc/GroupTableDataOperator.java b/src/main/java/com/fr/plugins/dsgroup/rpc/GroupTableDataOperator.java
new file mode 100644
index 0000000..df071d4
--- /dev/null
+++ b/src/main/java/com/fr/plugins/dsgroup/rpc/GroupTableDataOperator.java
@@ -0,0 +1,13 @@
+package com.fr.plugins.dsgroup.rpc;
+
+import com.fr.base.TableDataBean;
+
+import java.util.List;
+
+/**
+ * @author phetran_ye
+ * 2022-04-20
+ */
+public interface GroupTableDataOperator {
+ boolean saveTableData(List toDeleted, List tableDataBeanList) throws Exception;
+}
diff --git a/src/main/java/com/fr/plugins/dsgroup/rpc/GroupTableDataOperatorImpl.java b/src/main/java/com/fr/plugins/dsgroup/rpc/GroupTableDataOperatorImpl.java
new file mode 100644
index 0000000..f5da326
--- /dev/null
+++ b/src/main/java/com/fr/plugins/dsgroup/rpc/GroupTableDataOperatorImpl.java
@@ -0,0 +1,50 @@
+package com.fr.plugins.dsgroup.rpc;
+
+import com.fr.base.TableDataBean;
+import com.fr.file.ConfigChangeProcessor;
+import com.fr.file.TableDataConfig;
+import com.fr.transaction.Configurations;
+import com.fr.transaction.WorkerFacade;
+
+import java.util.List;
+
+/**
+ * @author phetran_ye
+ * 2022-04-20
+ */
+public class GroupTableDataOperatorImpl implements GroupTableDataOperator{
+ private static final GroupTableDataOperator INSTANCE = new GroupTableDataOperatorImpl();
+
+ public static GroupTableDataOperator getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public boolean saveTableData(List toDeleted, List tableDataBeanList) throws Exception {
+ return save(tableDataBeanList, new Runnable() {
+ @Override
+ public void run() {
+ removeDeleted(toDeleted);
+ }
+ });
+ }
+
+ private boolean save(List tableDataBeanList, Runnable deleteAction) {
+ ConfigChangeProcessor.getInstance().applyForTableData(tableDataBeanList);
+ return Configurations.modify(new WorkerFacade(TableDataConfig.class) {
+ @Override
+ public void run() {
+ deleteAction.run();
+ for (TableDataBean tableDataBean : tableDataBeanList) {
+ TableDataConfig.getInstance().addTableData(tableDataBean.getName(), tableDataBean.getTableData());
+ }
+ }
+ });
+ }
+
+ private void removeDeleted(List toDeleted) {
+ for (String name : toDeleted) {
+ TableDataConfig.getInstance().removeTableData(name);
+ }
+ }
+}
diff --git a/src/main/java/com/fr/plugins/dsgroup/ui/DSGroupPane.java b/src/main/java/com/fr/plugins/dsgroup/ui/DSGroupPane.java
new file mode 100644
index 0000000..1d0c85d
--- /dev/null
+++ b/src/main/java/com/fr/plugins/dsgroup/ui/DSGroupPane.java
@@ -0,0 +1,91 @@
+package com.fr.plugins.dsgroup.ui;
+
+/**
+ * Created by phetran_ye on 2018/8/7.
+ */
+import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
+import com.fr.design.gui.itextfield.UITextField;
+import com.fr.design.i18n.Toolkit;
+import com.fr.design.mainframe.WestRegionContainerPane;
+import com.fr.plugins.dsgroup.fun.DSGroupTableData;
+import javax.swing.*;
+import java.awt.*;
+
+public class DSGroupPane extends AbstractTableDataPane {
+
+ //private static final String PREVIEW_BUTTON = Inter.getLocText("Preview");
+
+
+ private UITextField contentTextField;
+ private DSGroupTableData tableData;
+
+
+ public DSGroupPane() {
+ WestRegionContainerPane wp=WestRegionContainerPane.getInstance();
+ setLayout(new BorderLayout());
+ //add(createToolBar(), BorderLayout.NORTH);
+ JPanel contentPane = new JPanel();
+ JLabel infoLbl=new JLabel();
+ String info="提示:
";
+ info+="1.选中分组,然后添加数据集即可在该分组下添加数据集。
";
+ info+="2.拖动数据集到某分组上即可将数据集添加到该分组下。
";
+ info+="3.拖动数据集到数据集面板空白处即可将该数据集移到最外部。
";
+ infoLbl.setText(info);
+ contentPane.setLayout(new BorderLayout());
+ contentPane.add(infoLbl, BorderLayout.NORTH);
+ add(contentPane, BorderLayout.CENTER);
+ }
+
+ /*private JToolBar createToolBar() {
+ ToolBarDef toolBarDef = new ToolBarDef();
+ //toolBarDef.addShortCut(new PreviewQueryTableDataAction());
+ UIToolbar editToolBar = ToolBarDef.createJToolBar();
+ toolBarDef.updateToolBar(editToolBar);
+ return editToolBar;
+ }*/
+
+ /* private void addChildrenToParent(JPanel contentPane) {
+ double p = TableLayout.PREFERRED;
+ double f = TableLayout.FILL;
+ double[] rowSize = {p};
+ double[] columnSize = {p, f};
+
+ JPanel panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{
+ {new UILabel("名字"), contentTextField = new UITextField()}
+ }, rowSize, columnSize);
+ contentPane.add(panel, BorderLayout.CENTER);
+ }*/
+
+ @Override
+ public void populateBean(DSGroupTableData ob) {
+ /*if (ob != null) {
+ contentTextField.setText(ob.getText());
+ }*/
+ tableData=ob;
+ }
+
+ @Override
+ public DSGroupTableData updateBean() {
+ //DSGroupTableData tableData = new DSGroupTableData();
+ //tableData.setText(contentTextField.getText());
+ return tableData;
+ }
+
+ @Override
+ protected String title4PopupWindow() {
+ return Toolkit.i18nText("Data_Set_Group");
+ }
+
+ /*private class PreviewQueryTableDataAction extends UpdateAction {
+ public PreviewQueryTableDataAction() {
+ this.setName(PREVIEW_BUTTON);
+ this.setMnemonic('P');
+ this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png"));
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ PreviewTablePane.previewTableData(DSGroupPane.this.updateBean());
+ }
+ }*/
+}
+
diff --git a/src/main/resources/com/fr/plugins/dsgroup/locale/locale.properties b/src/main/resources/com/fr/plugins/dsgroup/locale/locale.properties
new file mode 100644
index 0000000..2d29a66
--- /dev/null
+++ b/src/main/resources/com/fr/plugins/dsgroup/locale/locale.properties
@@ -0,0 +1,9 @@
+Plugin-Data_Set_Group=Data Set Group
+Data_Set_Group=Data Set Group
+Default_Group_Name=unnamed group
+Template=Template
+DS-TableData=DS-TableData
+DS-Server_TableData=DS-Server_TableData
+FR-Designer_Edit=FR-Designer_Edit
+FR-Designer_Remove=FR-Designer_Remove
+Utils-Are_you_sure_to_remove_the_selected_item=Are you sure to remove the selected item
\ No newline at end of file
diff --git a/src/main/resources/com/fr/plugins/dsgroup/locale/locale_en_US.properties b/src/main/resources/com/fr/plugins/dsgroup/locale/locale_en_US.properties
new file mode 100644
index 0000000..2d29a66
--- /dev/null
+++ b/src/main/resources/com/fr/plugins/dsgroup/locale/locale_en_US.properties
@@ -0,0 +1,9 @@
+Plugin-Data_Set_Group=Data Set Group
+Data_Set_Group=Data Set Group
+Default_Group_Name=unnamed group
+Template=Template
+DS-TableData=DS-TableData
+DS-Server_TableData=DS-Server_TableData
+FR-Designer_Edit=FR-Designer_Edit
+FR-Designer_Remove=FR-Designer_Remove
+Utils-Are_you_sure_to_remove_the_selected_item=Are you sure to remove the selected item
\ No newline at end of file
diff --git a/src/main/resources/com/fr/plugins/dsgroup/locale/locale_zh_CN.properties b/src/main/resources/com/fr/plugins/dsgroup/locale/locale_zh_CN.properties
new file mode 100644
index 0000000..c310ca3
--- /dev/null
+++ b/src/main/resources/com/fr/plugins/dsgroup/locale/locale_zh_CN.properties
@@ -0,0 +1,9 @@
+Plugin-Data_Set_Group=\u6570\u636e\u96c6\u5206\u7ec4
+Data_Set_Group=\u6570\u636e\u96c6\u5206\u7ec4
+Default_Group_Name=\u672a\u547d\u540d\u5206\u7ec4
+Template=\u6a21\u677f
+DS-TableData=\u6570\u636e\u96c6
+DS-Server_TableData=\u670d\u52a1\u5668\u6570\u636e\u96c6
+FR-Designer_Edit=\u7f16\u8f91
+FR-Designer_Remove=\u5220\u9664
+Utils-Are_you_sure_to_remove_the_selected_item=\u4f60\u786e\u5b9e\u51b3\u5b9a\u5220\u9664\u9009\u4e2d\u7684\u9879
\ No newline at end of file
diff --git a/src/main/resources/com/fr/plugins/dsgroup/ui/images/query.png b/src/main/resources/com/fr/plugins/dsgroup/ui/images/query.png
new file mode 100644
index 0000000000000000000000000000000000000000..a186bdee8fd20cbc36493b23f1590752e2851055
GIT binary patch
literal 215
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`^E_P~Ln>}1CoEulp!-inDdzj`
zpe66hZLP#~{-5{1!0>R_{;7*f_y12mtYo_X^~Wr+l|LW0pG|wX%l@Cz*8Sg@Z@%An
zve_^|pLxPZ;nimydYK%Y3wH9XdZx}C$GUa@_2kWwE1s3FEqHsrY=YDtwg-n5oDZ-)
z_#&?u^ZWKZCGiFxNj5ft9=9g8D}Rp7oxqV8aPQ#kDIb9pW2(cdCn*dM1)c@;JeOJx
PbSZ