diff --git a/designer/designer.iml b/designer/designer.iml
index c798a6fe09..276f91e810 100644
--- a/designer/designer.iml
+++ b/designer/designer.iml
@@ -17,5 +17,6 @@
+
\ No newline at end of file
diff --git a/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java b/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java
index 0632fe01db..5cfcb6261b 100644
--- a/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java
+++ b/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java
@@ -6,7 +6,7 @@ import java.util.List;
import com.fr.base.FRContext;
import com.fr.general.NameObject;
import com.fr.design.condition.HighLightConditionAttributesPane;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.general.Inter;
@@ -15,7 +15,7 @@ import com.fr.report.cell.cellattr.highlight.Highlight;
import com.fr.report.cell.cellattr.highlight.HighlightGroup;
import com.fr.stable.Nameable;
-public class ConditionAttributesGroupPane extends JControlPane {
+public class ConditionAttributesGroupPane extends JListControlPane {
@Override
public NameableCreator[] createNameableCreators() {
diff --git a/designer/src/com/fr/design/present/StyleArrayPane.java b/designer/src/com/fr/design/present/StyleArrayPane.java
index 6107da1b7b..061107462e 100644
--- a/designer/src/com/fr/design/present/StyleArrayPane.java
+++ b/designer/src/com/fr/design/present/StyleArrayPane.java
@@ -2,7 +2,7 @@ package com.fr.design.present;
import com.fr.base.Style;
import com.fr.design.gui.controlpane.AbstractNameableCreator;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
import com.fr.design.gui.ilist.ListModelElement;
@@ -18,7 +18,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-public class StyleArrayPane extends JControlPane {
+public class StyleArrayPane extends JListControlPane {
/**
* Constructor.
diff --git a/designer/src/com/fr/design/report/share/ConfusionManagerPane.java b/designer/src/com/fr/design/report/share/ConfusionManagerPane.java
index eac62da913..89b3dbb9e8 100644
--- a/designer/src/com/fr/design/report/share/ConfusionManagerPane.java
+++ b/designer/src/com/fr/design/report/share/ConfusionManagerPane.java
@@ -10,7 +10,7 @@ import java.util.List;
import com.fr.data.TableDataSource;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.design.file.HistoryTemplateListPane;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane;
@@ -23,7 +23,7 @@ import com.fr.general.NameObject;
*
* @date: 2015-3-9-上午9:10:20
*/
-public class ConfusionManagerPane extends JControlPane {
+public class ConfusionManagerPane extends JListControlPane {
/**
* 获取当前面板的编辑对象
diff --git a/designer/src/com/fr/design/widget/WidgetConfigPane.java b/designer/src/com/fr/design/widget/WidgetConfigPane.java
index a362af72f7..78088920f2 100644
--- a/designer/src/com/fr/design/widget/WidgetConfigPane.java
+++ b/designer/src/com/fr/design/widget/WidgetConfigPane.java
@@ -1,6 +1,6 @@
package com.fr.design.widget;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.core.WidgetConstants;
@@ -17,7 +17,7 @@ import java.util.List;
/**
* Widget配置面板
*/
-public class WidgetConfigPane extends JControlPane {
+public class WidgetConfigPane extends JListControlPane {
/**
* 创建用户自定义widget组件
diff --git a/designer_base/designer_base.iml b/designer_base/designer_base.iml
index 9f8c89a0b5..15ff9cc8c6 100644
--- a/designer_base/designer_base.iml
+++ b/designer_base/designer_base.iml
@@ -1,7 +1,7 @@
-
+
diff --git a/designer_base/src/com/fr/design/ExtraDesignClassManager.java b/designer_base/src/com/fr/design/ExtraDesignClassManager.java
index 76d5d88afb..a11ff53a6c 100644
--- a/designer_base/src/com/fr/design/ExtraDesignClassManager.java
+++ b/designer_base/src/com/fr/design/ExtraDesignClassManager.java
@@ -126,7 +126,7 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
private DesignerEnvProcessor envProcessor;
- private TableDataTreePaneProcessor tableDataTreePaneProcessor;
+ private TableDataPaneProcessor tableDataPaneProcessor;
private Set elementUIProviders;
@@ -134,13 +134,13 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
private Set exportAttrTabProviders;
- public TableDataTreePaneProcessor getTableDataTreePaneProcessor() {
- return tableDataTreePaneProcessor;
+ public TableDataPaneProcessor getTableDataPaneProcessor() {
+ return tableDataPaneProcessor;
}
- public void setTableDataSourceOPProcessor(Level level, PluginSimplify simplify) {
- validAPILevel(level, TableDataTreePaneProcessor.CURRENT_LEVEL, simplify.getPluginName());
- tableDataTreePaneProcessor = (TableDataTreePaneProcessor) level;
+ public void setTableDataPaneProcessor(Level level, PluginSimplify simplify) {
+ validAPILevel(level, TableDataPaneProcessor.CURRENT_LEVEL, simplify.getPluginName());
+ tableDataPaneProcessor = (TableDataPaneProcessor) level;
}
public DesignerEnvProcessor getEnvProcessor() {
@@ -858,8 +858,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
addSupportDesignApps(impl, simplify);
} else if (tagName.equals(DesignerEnvProcessor.XML_TAG)) {
setEnvProcessor(impl, simplify);
- } else if (tagName.equals(TableDataTreePaneProcessor.XML_TAG)) {
- setTableDataSourceOPProcessor(impl, simplify);
+ } else if (tagName.equals(TableDataPaneProcessor.XML_TAG)) {
+ setTableDataPaneProcessor(impl, simplify);
} else if (tagName.equals(ElementUIProvider.MARK_STRING)) {
addElementUIProvider(impl, simplify);
} else if (tagName.equals(WidgetPropertyUIProvider.XML_TAG)) {
diff --git a/designer_base/src/com/fr/design/data/datapane/ReportTableDataPane.java b/designer_base/src/com/fr/design/data/datapane/ReportTableDataPane.java
index e62aaa5304..003a478b17 100644
--- a/designer_base/src/com/fr/design/data/datapane/ReportTableDataPane.java
+++ b/designer_base/src/com/fr/design/data/datapane/ReportTableDataPane.java
@@ -4,6 +4,9 @@
package com.fr.design.data.datapane;
import com.fr.data.TableDataSource;
+import com.fr.design.ExtraDesignClassManager;
+import com.fr.design.fun.TableDataPaneProcessor;
+import com.fr.design.gui.controlpane.JControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.layout.FRGUIPaneFactory;
@@ -19,19 +22,24 @@ import java.util.Map;
* 创建于2011-6-14
*/
public class ReportTableDataPane extends LoadingBasicPane {
- private TableDataListPane tdListPane;
+ private JControlPane tdPane;
@Override
protected void initComponents(JPanel container) {
container.setLayout(FRGUIPaneFactory.createBorderLayout());
- this.tdListPane = new TableDataListPane() {
+ TableDataPaneProcessor paneProcessor = ExtraDesignClassManager.getInstance().getTableDataPaneProcessor();
+ JControlPane pane = null;
+ if (paneProcessor != null) {
+ pane = paneProcessor.createServerTableDataPane();
+ }
+ tdPane = pane == null ? new TableDataListPane() {
@Override
public NameableCreator[] createNameableCreators() {
return TableDataCreatorProducer.getInstance().createReportTableDataCreator();
}
- };
- container.add(tdListPane, BorderLayout.CENTER);
+ } : pane;
+ container.add(tdPane, BorderLayout.CENTER);
}
@Override
@@ -40,11 +48,11 @@ public class ReportTableDataPane extends LoadingBasicPane {
}
public void populate(TableDataSource tds) {
- tdListPane.populate(tds);
+ tdPane.populate(tds);
}
public void update(TableDataSource tds) {
- tdListPane.update(tds);
+ tdPane.update(tds);
}
/**
@@ -53,10 +61,10 @@ public class ReportTableDataPane extends LoadingBasicPane {
* @throws Exception 异常
*/
public void checkValid() throws Exception {
- this.tdListPane.checkValid();
+ this.tdPane.checkValid();
}
public Map getDsNameChangedMap() {
- return tdListPane.getDsNameChangedMap();
+ return tdPane.getDsNameChangedMap();
}
}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/data/datapane/TableDataListPane.java b/designer_base/src/com/fr/design/data/datapane/TableDataListPane.java
index 8de293f292..5c641d5151 100644
--- a/designer_base/src/com/fr/design/data/datapane/TableDataListPane.java
+++ b/designer_base/src/com/fr/design/data/datapane/TableDataListPane.java
@@ -4,7 +4,7 @@ import com.fr.base.TableData;
import com.fr.data.TableDataSource;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.DesignTableDataManager;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.file.DatasourceManagerProvider;
@@ -21,9 +21,7 @@ import java.util.*;
/**
* TableDataList Pane.
*/
-public class TableDataListPane extends JControlPane {
- private Map dsNameChangedMap = new HashMap();
- private boolean isNamePermitted = true;
+public class TableDataListPane extends JListControlPane {
public TableDataListPane() {
super();
diff --git a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
index 1065783624..fcaa7c6e71 100644
--- a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
+++ b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
@@ -14,7 +14,7 @@ import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
-import com.fr.design.fun.TableDataTreePaneProcessor;
+import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextfield.UITextField;
@@ -47,7 +47,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
public synchronized static BasicTableDataTreePane getInstance(DesignModelAdapter, ?> tc) {
- TableDataTreePaneProcessor treePaneProcessor = ExtraDesignClassManager.getInstance().getTableDataTreePaneProcessor();
+ TableDataPaneProcessor treePaneProcessor = ExtraDesignClassManager.getInstance().getTableDataPaneProcessor();
if (treePaneProcessor != null) {
return treePaneProcessor.createTableDataTreePane(tc);
}
diff --git a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java
index 1d5dd260aa..725a65ad33 100644
--- a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java
+++ b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java
@@ -4,7 +4,7 @@ import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.design.ExtraDesignClassManager;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.file.DatasourceManagerProvider;
@@ -22,7 +22,7 @@ import java.util.*;
/**
* Connection List Pane.
*/
-public class ConnectionListPane extends JControlPane {
+public class ConnectionListPane extends JListControlPane {
public static final String TITLE_NAME = Inter.getLocText("Server-Define_Data_Connection");
private boolean isNamePermitted = true;
private HashMap renameMap = new HashMap();
diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureListPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureListPane.java
index 5f56516280..636bc4b768 100644
--- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureListPane.java
+++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureListPane.java
@@ -3,7 +3,7 @@ package com.fr.design.data.tabledata.tabledatapane;
import com.fr.data.TableDataSource;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.DesignTableDataManager;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement;
@@ -19,7 +19,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-public class ProcedureListPane extends JControlPane {
+public class ProcedureListPane extends JListControlPane {
public ProcedureListPane() {
super();
this.addEditingListner(new PropertyChangeAdapter() {
diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java
index 55f975e385..0ff2ec8816 100644
--- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java
+++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java
@@ -1,7 +1,10 @@
package com.fr.design.data.tabledata.tabledatapane;
import com.fr.base.FRContext;
+import com.fr.design.ExtraDesignClassManager;
import com.fr.design.data.datapane.TableDataListPane;
+import com.fr.design.fun.TableDataPaneProcessor;
+import com.fr.design.gui.controlpane.JControlPane;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
@@ -18,7 +21,7 @@ import java.util.Map;
public class TableDataManagerPane extends LoadingBasicPane {
private UITextField tableDataTextField;
- private TableDataListPane tableDataListPane;
+ private JControlPane tableDataPane;
@Override
protected void initComponents(JPanel container) {
@@ -36,13 +39,18 @@ public class TableDataManagerPane extends LoadingBasicPane {
this.tableDataTextField = new UITextField();
tableDataPathPane.add(tableDataTextField, BorderLayout.CENTER);
this.tableDataTextField.setEditable(false);
- tableDataListPane = new TableDataListPane(){
- protected void rename(String oldName,String newName){
- super.rename(oldName,newName);
- renameConnection(oldName, newName);
- }
- };
- container.add(tableDataListPane, BorderLayout.CENTER);
+ TableDataPaneProcessor paneProcessor = ExtraDesignClassManager.getInstance().getTableDataPaneProcessor();
+ JControlPane pane = null;
+ if (paneProcessor != null) {
+ pane = paneProcessor.createServerTableDataPane();
+ }
+ tableDataPane = pane == null ? new TableDataListPane() {
+ protected void rename(String oldName, String newName) {
+ super.rename(oldName, newName);
+ renameConnection(oldName, newName);
+ }
+ } : pane;
+ container.add(tableDataPane, BorderLayout.CENTER);
}
@@ -51,7 +59,7 @@ public class TableDataManagerPane extends LoadingBasicPane {
* @return 是则返回true
*/
public boolean isNamePermitted(){
- return tableDataListPane.isNamePermitted();
+ return tableDataPane.isNamePermitted();
}
/**
@@ -59,7 +67,7 @@ public class TableDataManagerPane extends LoadingBasicPane {
* @throws Exception 异常
*/
public void checkValid() throws Exception {
- tableDataListPane.checkValid();
+ tableDataPane.checkValid();
}
@Override
@@ -70,15 +78,15 @@ public class TableDataManagerPane extends LoadingBasicPane {
public void populate(DatasourceManagerProvider datasourceManager) {
this.tableDataTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME
+ File.separator + datasourceManager.fileName());
- this.tableDataListPane.populate(datasourceManager);
+ this.tableDataPane.populate(datasourceManager);
}
public void update(DatasourceManagerProvider datasourceManager) {
- this.tableDataListPane.update(datasourceManager);
+ this.tableDataPane.update(datasourceManager);
}
public Map getDsChangedNameMap () {
- return this.tableDataListPane.getDsNameChangedMap();
+ return this.tableDataPane.getDsNameChangedMap();
}
/**
@@ -87,6 +95,6 @@ public class TableDataManagerPane extends LoadingBasicPane {
* @param index 选中项的序列号
*/
public void setSelectedIndex(int index) {
- this.tableDataListPane.setSelectedIndex(index);
+ this.tableDataPane.setSelectedIndex(index);
}
}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/formula/FunctionManagerPane.java b/designer_base/src/com/fr/design/formula/FunctionManagerPane.java
index 4af0c27997..fd41df3256 100644
--- a/designer_base/src/com/fr/design/formula/FunctionManagerPane.java
+++ b/designer_base/src/com/fr/design/formula/FunctionManagerPane.java
@@ -6,7 +6,7 @@ import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ibutton.UIButton;
@@ -97,7 +97,7 @@ public class FunctionManagerPane extends BasicPane {
/**
* CellRenderer.
*/
- class FunctionControlPane extends JControlPane {
+ class FunctionControlPane extends JListControlPane {
public FunctionControlPane() {
super();
diff --git a/designer_base/src/com/fr/design/fun/TableDataTreePaneProcessor.java b/designer_base/src/com/fr/design/fun/TableDataPaneProcessor.java
similarity index 60%
rename from designer_base/src/com/fr/design/fun/TableDataTreePaneProcessor.java
rename to designer_base/src/com/fr/design/fun/TableDataPaneProcessor.java
index 1789c2ca26..f1f4ac2182 100644
--- a/designer_base/src/com/fr/design/fun/TableDataTreePaneProcessor.java
+++ b/designer_base/src/com/fr/design/fun/TableDataPaneProcessor.java
@@ -2,6 +2,7 @@ package com.fr.design.fun;
import com.fr.design.DesignModelAdapter;
import com.fr.design.data.BasicTableDataTreePane;
+import com.fr.design.gui.controlpane.JControlPane;
import com.fr.stable.fun.Level;
/**
@@ -10,8 +11,8 @@ import com.fr.stable.fun.Level;
* Date: 2016/4/18
* Time: 9:04
*/
-public interface TableDataTreePaneProcessor extends Level {
- String XML_TAG = "TableDataTreePaneProcessor";
+public interface TableDataPaneProcessor extends Level {
+ String XML_TAG = "TableDataPaneProcessor";
int CURRENT_LEVEL = 1;
/**
@@ -20,4 +21,10 @@ public interface TableDataTreePaneProcessor extends Level {
*/
BasicTableDataTreePane createTableDataTreePane(DesignModelAdapter, ?> tc);
+ /**
+ * 服务器数据集面板(模板数据集面板)
+ * @return 服务器数据集面板
+ */
+ JControlPane createServerTableDataPane();
+
}
diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractTDTreePaneProcessor.java b/designer_base/src/com/fr/design/fun/impl/AbstractTDPaneProcessor.java
similarity index 55%
rename from designer_base/src/com/fr/design/fun/impl/AbstractTDTreePaneProcessor.java
rename to designer_base/src/com/fr/design/fun/impl/AbstractTDPaneProcessor.java
index 635739a07b..e5f591a65c 100644
--- a/designer_base/src/com/fr/design/fun/impl/AbstractTDTreePaneProcessor.java
+++ b/designer_base/src/com/fr/design/fun/impl/AbstractTDPaneProcessor.java
@@ -1,13 +1,13 @@
package com.fr.design.fun.impl;
-import com.fr.design.fun.TableDataTreePaneProcessor;
+import com.fr.design.fun.TableDataPaneProcessor;
/**
* Coder: zack
* Date: 2016/4/18
* Time: 10:30
*/
-public abstract class AbstractTDTreePaneProcessor implements TableDataTreePaneProcessor {
+public abstract class AbstractTDPaneProcessor implements TableDataPaneProcessor {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
diff --git a/designer_base/src/com/fr/design/gui/controlpane/JControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/JControlPane.java
index e58a136150..615cee6a0e 100644
--- a/designer_base/src/com/fr/design/gui/controlpane/JControlPane.java
+++ b/designer_base/src/com/fr/design/gui/controlpane/JControlPane.java
@@ -1,1026 +1,247 @@
-package com.fr.design.gui.controlpane;
-
-import com.fr.base.BaseUtils;
-import com.fr.base.FRContext;
-import com.fr.design.data.tabledata.tabledatapane.GlobalMultiTDTableDataPane;
-import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane;
-import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane;
-import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane;
-import com.fr.design.actions.UpdateAction;
-import com.fr.design.beans.BasicBeanPane;
-import com.fr.design.file.HistoryTemplateListPane;
-import com.fr.design.gui.icontainer.UIScrollPane;
-import com.fr.design.gui.ilable.UILabel;
-import com.fr.design.gui.itoolbar.UIToolbar;
-import com.fr.design.gui.ilist.JNameEdList;
-import com.fr.design.gui.ilist.ListModelElement;
-import com.fr.design.gui.ilist.ModNameActionListener;
-import com.fr.design.layout.FRGUIPaneFactory;
-import com.fr.design.mainframe.JTemplate;
-import com.fr.design.menu.*;
-import com.fr.design.dialog.BasicPane;
-import com.fr.general.ComparatorUtils;
-import com.fr.general.Inter;
-import com.fr.stable.ArrayUtils;
-import com.fr.stable.Nameable;
-import com.fr.stable.core.PropertyChangeAdapter;
-import com.fr.design.utils.gui.GUICoreUtils;
-
-import javax.swing.*;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.Comparator;
-
-public abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper {
- public static final String LIST_NAME = "JControl_List";
- private static final int SHORT_WIDTH = 30; //每加一个short Divider位置加30
-
- private ShortCut4JControlPane[] shorts;
- private NameableCreator[] creators;
- protected JNameEdList nameableList;
- protected JControlUpdatePane controlUpdatePane;
-
- private ToolBarDef toolbarDef;
- private UIToolbar toolBar;
-
- // peter:这是整体的一个cardLayout Pane
- private CardLayout cardLayout;
- private JPanel cardPane;
- protected int editingIndex;
- protected String selectedName;
- private boolean isNameRepeated = false;
-
- public JControlPane() {
- this.initComponentPane();
- }
-
- /**
- * 生成添加按钮的NameableCreator
- * @return 按钮的NameableCreator
- */
- public abstract NameableCreator[] createNameableCreators();
-
- protected void initComponentPane() {
- this.setLayout(FRGUIPaneFactory.createBorderLayout());
- this.creators = this.createNameableCreators();
- this.controlUpdatePane = new JControlUpdatePane();
-
- // p: edit card layout
- this.cardLayout = new CardLayout();
- cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
- cardPane.setLayout(this.cardLayout);
- // p:选择的Label
- UILabel selectLabel = new UILabel();
- cardPane.add(selectLabel, "SELECT");
- cardPane.add(controlUpdatePane, "EDIT");
- // SplitPane
- JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane);
- mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
- mainSplitPane.setOneTouchExpandable(true);
-
- this.add(mainSplitPane, BorderLayout.CENTER);
- mainSplitPane.setDividerLocation(getLeftPreferredSize());
- this.checkButtonEnabled();
- }
-
-
- protected JPanel getLeftPane(){
- // LeftPane
- JPanel leftPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
-
- initNameList(leftPane);
-
- shorts = this.createShortcuts();
- if (ArrayUtils.isEmpty(shorts)) {
- return leftPane;
- }
-
- toolbarDef = new ToolBarDef();
- for (ShortCut4JControlPane sj : shorts) {
- toolbarDef.addShortCut(sj.getShortCut());
- }
- toolBar = ToolBarDef.createJToolBar();
- toolbarDef.updateToolBar(toolBar);
- leftPane.add(toolBar, BorderLayout.NORTH);
- return leftPane;
- }
-
-
- private void initNameList(JPanel leftPane) {
- nameableList = createJNameList();
- nameableList.setName(LIST_NAME);
- leftPane.add(new UIScrollPane(nameableList), BorderLayout.CENTER);
-
-
- nameableList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- nameableList.addMouseListener(listMouseListener);
- nameableList.addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent evt) {
- // richie:避免多次update和populate大大降低效率
- if (!evt.getValueIsAdjusting()) {
- // shoc 切换的时候加检验
- if (hasInvalid(false)) {
- return;
- }
- JControlPane.this.controlUpdatePane.update();
- JControlPane.this.controlUpdatePane.populate();
- JControlPane.this.checkButtonEnabled();
- }
- }
- });
- }
-
- public JNameEdList createJNameList() {
- JNameEdList nameEdList = new JNameEdList(new DefaultListModel()) {
- protected void doAfterLostFocus() {
- JControlPane.this.updateControlUpdatePane();
- }
- };
- nameEdList.setCellRenderer(new NameableListCellRenderer());
- return nameEdList;
- }
-
- public void updateControlUpdatePane() {
- controlUpdatePane.update();
- }
-
- protected void doWhenPopulate(BasicBeanPane beanPane){
-
- }
-
- protected int getLeftPreferredSize() {
- return shorts.length * SHORT_WIDTH;
- }
-
- protected ShortCut4JControlPane[] createShortcuts() {
- return new ShortCut4JControlPane[]{
- addItemShortCut(),
- removeItemShortCut(),
- copyItemShortCut(),
- moveUpItemShortCut(),
- moveDownItemShortCut(),
- sortItemShortCut()
- };
- }
-
- protected ShortCut4JControlPane addItemShortCut() {
- ShortCut addItemShortCut;
- if (creators.length == 1) {
- addItemShortCut = new AddItemUpdateAction(creators);
- } else {
- addItemShortCut = new AddItemMenuDef(creators);
- }
- return new AbsoluteEnableShortCut(addItemShortCut);
- }
-
- protected ShortCut4JControlPane removeItemShortCut() {
- return new NormalEnableShortCut(new RemoveItemAction());
- }
-
- protected ShortCut4JControlPane copyItemShortCut() {
- return new NormalEnableShortCut(new CopyItemAction());
- }
-
- protected ShortCut4JControlPane moveUpItemShortCut() {
- return new NormalEnableShortCut(new MoveUpItemAction());
- }
-
- protected ShortCut4JControlPane moveDownItemShortCut() {
- return new NormalEnableShortCut(new MoveDownItemAction());
- }
-
- protected ShortCut4JControlPane sortItemShortCut() {
- return new NormalEnableShortCut(new SortItemAction());
- }
-
- public void setNameListEditable(boolean editable) {
- this.nameableList.setEditable(editable);
- }
-
- public Nameable[] update() {
- java.util.List res = new java.util.ArrayList();
- this.controlUpdatePane.update();
- DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
- for (int i = 0, len = listModel.getSize(); i < len; i++) {
- res.add(((ListModelElement) listModel.getElementAt(i)).wrapper);
- }
-
- return res.toArray(new Nameable[res.size()]);
- }
-
- public void populate(Nameable[] nameableArray) {
- DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
- listModel.removeAllElements();
- if (ArrayUtils.isEmpty(nameableArray)) {
- return;
- }
-
- for (Nameable aNameableArray : nameableArray) {
- listModel.addElement(new ListModelElement(aNameableArray));
- }
-
- if (listModel.size() > 0) {
- this.nameableList.setSelectedIndex(0);
- }
- this.checkButtonEnabled();
- }
-
- /**
- * 添加名字改变时的listener
- *
- * @param l 名字改变时的监听
- */
- public void addModNameActionListener(ModNameActionListener l) {
- this.nameableList.addModNameActionListener(l);
- }
-
- /**
- * 添加Editinglistener
- *
- * @param l 监听
- */
- public void addEditingListner(PropertyChangeAdapter l) {
- this.nameableList.addEditingListner(l);
- }
-
- /*
- * 刷新当前的选中的UpdatePane
- */
- protected void populateSelectedValue() {
- JControlPane.this.controlUpdatePane.populate();
- }
-
- /**
- * 根据name,选中JNameEdList中的item
- */
- public void setSelectedName(String name) {
- DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
- for (int i = 0, len = listModel.getSize(); i < len; i++) {
- Nameable item = ((ListModelElement) listModel.getElementAt(i)).wrapper;
- if (ComparatorUtils.equals(name, item.getName())) {
- this.nameableList.setSelectedIndex(i);
- break;
- }
- }
- }
-
- public String getEditingName() {
- return this.nameableList.getEditingName();
- }
-
- public Object getEditingType() {
- return this.nameableList.getAllTypes()[editingIndex];
- }
-
- public void setWarnigText(int index) {
- this.nameableList.setWarnigText(index);
- }
-
- /**
- * 获取选中的名字
- */
- public String getSelectedName() {
- ListModelElement el = (ListModelElement) this.nameableList.getSelectedValue();
-
- return el == null ? null : el.wrapper.getName();
- }
-
- /**
- * 刷新 NameableCreator
- *
- * @param creators 生成器
- */
- public void refreshNameableCreator(NameableCreator[] creators) {
- this.creators = creators;
- shorts = this.createShortcuts();
- toolbarDef.clearShortCuts();
- for (ShortCut4JControlPane sj : shorts) {
- toolbarDef.addShortCut(sj.getShortCut());
- }
-
- toolbarDef.updateToolBar(toolBar);
- toolBar.validate();
- toolBar.repaint();
- this.repaint();
- }
-
- protected boolean isNameRepeted(java.util.List[] list, String name) {
- for (int i = 0; i < list.length; i++) {
- if (list[i].contains(name)) {
- isNameRepeated = true;
- return true;
- }
- }
- isNameRepeated = false;
- return false;
- }
-
- /**
- * 名字是否重复
- * @return 重复则返回true
- */
- public boolean isNameRepeated() {
- return isNameRepeated;
- }
-
- /**
- * 添加 Nameable
- *
- * @param nameable 添加的Nameable
- * @param index 序号
- */
- public void addNameable(Nameable nameable, int index) {
- JNameEdList nameEdList = JControlPane.this.nameableList;
- DefaultListModel model = (DefaultListModel) nameEdList.getModel();
-
- ListModelElement el = new ListModelElement(nameable);
- model.add(index, el);
- nameableList.setSelectedIndex(index);
- nameableList.ensureIndexIsVisible(index);
-
- nameEdList.repaint();
- }
-
- /**
- * 是否重命名
- * @return 是则true
- */
- public boolean isContainsRename() {
- String rename = Inter.getLocText("FR-Please_Rename") + "!";
- String[] names = this.nameableList.getAllNames();
- for (int i = names.length - 1; i >= 0; i--) {
- if (ComparatorUtils.equals(names[i], rename)) {
- return true;
- }
- }
- return false;
- }
-
- protected DefaultListModel getModel() {
- return (DefaultListModel) JControlPane.this.nameableList.getModel();
- }
-
- private String createUnrepeatedCopyName(String suffix) {
- DefaultListModel model = this.getModel();
- String[] names = new String[model.getSize()];
- for (int i = 0; i < model.size(); i++) {
- names[i] = ((ListModelElement) model.get(i)).wrapper.getName();
- }
- String lastName = "CopyOf" + suffix;
- while (ArrayUtils.contains(names, lastName)) {
- lastName = "CopyOf" + lastName;
- }
- return lastName;
- }
-
-
- /**
- * 生成不重复的名字
- *
- * @param prefix 名字前缀
- * @return 名字
- */
- public String createUnrepeatedName(String prefix) {
- DefaultListModel model = this.getModel();
- Nameable[] all = new Nameable[model.getSize()];
- for (int i = 0; i < model.size(); i++) {
- all[i] = ((ListModelElement) model.get(i)).wrapper;
- }
- // richer:生成的名字从1开始. kunsnat: 添加属性从0开始.
- int count = all.length + 1;
- while (true) {
- String name_test = prefix + count;
- boolean repeated = false;
- for (int i = 0, len = model.size(); i < len; i++) {
- Nameable nameable = all[i];
- if (ComparatorUtils.equals(nameable.getName(), name_test)) {
- repeated = true;
- break;
- }
- }
-
- if (!repeated) {
- return name_test;
- }
-
- count++;
- }
- }
-
- /**
- * 增加项的UpdateAction
- */
- protected class AddItemUpdateAction extends UpdateAction {
- final NameableCreator creator;
-
- public AddItemUpdateAction(NameableCreator[] creators) {
- this.creator = creators[0];
- this.setName(Inter.getLocText("FR-Action_Add"));
- this.setMnemonic('A');
- this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"));
- }
-
- public void actionPerformed(ActionEvent e) {
- Nameable nameable = creator.createNameable(JControlPane.this);
-
- JControlPane.this.addNameable(nameable, getModel().getSize());
- }
- }
-
- /*
- * 增加项的MenuDef
- */
- protected class AddItemMenuDef extends MenuDef {
- public AddItemMenuDef(NameableCreator[] creators) {
- this.setName(Inter.getLocText("FR-Action_Add"));
- this.setMnemonic('A');
- this.setIconPath("/com/fr/design/images/control/addPopup.png");
- wrapActionListener(creators);
- }
-
- private void wrapActionListener(NameableCreator[] creators) {
- for (final NameableCreator creator : creators) {
- if (!whetherAdd(creator.menuName())){
- continue;
- }
- boolean isTrue = ComparatorUtils.equals(creator.menuName(), Inter.getLocText("Datasource-Stored_Procedure")) ||
- ComparatorUtils.equals(creator.menuName(), Inter.getLocText("DS-Relation_TableData")) || ComparatorUtils.equals(creator.menuName(), Inter.getLocText("DS-Multi_Dimensional_Database"));
- if (isTrue) {
- this.addShortCut(new LineSeparator());
- }
- this.addShortCut(new UpdateAction() {
- {
- this.setName(creator.menuName());
- Icon icon = creator.menuIcon();
- if (icon != null) {
- this.setSmallIcon(icon);
- }
- }
-
- public void actionPerformed(ActionEvent e) {
- if (hasInvalid(true)) {
- return;
- }
-
- Nameable nameable = creator.createNameable(JControlPane.this);
-
- JControlPane.this.addNameable(nameable, getModel().getSize());
- }
- });
- }
- }
-
- private boolean whetherAdd(String itemName){
- JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
- if (jTemplate == null) {
- return false;
- }
- //先屏蔽掉这个,之后还有别的
- String[] names = {Inter.getLocText("FR-Hyperlink_Chart_Float")};
- for (String name : names){
- if(!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, name)){
- return false;
- }
- }
- String formName = Inter.getLocText("Hyperlink-Form_link");
- return !(jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, formName));
- }
- }
-
- /*
- * 移除item
- */
- private class RemoveItemAction extends UpdateAction {
- public RemoveItemAction() {
- this.setName(Inter.getLocText("FR-Action_Remove"));
- this.setMnemonic('R');
- this.setSmallIcon(BaseUtils
- .readIcon("/com/fr/base/images/cell/control/remove.png"));
- }
-
- public void actionPerformed(ActionEvent evt) {
- try {
- JControlPane.this.nameableList.getCellEditor()
- .stopCellEditing();
- } catch (Exception ignored) {
- }
- // bug:在选中一个NameObject并删除,会遗留下Name.
- doBeforeRemove();
- if (GUICoreUtils.removeJListSelectedNodes(SwingUtilities
- .getWindowAncestor(JControlPane.this), nameableList)) {
- checkButtonEnabled();
- doAfterRemove();
- }
- }
- }
-
- /*
- * CopyItem
- */
- private class CopyItemAction extends UpdateAction {
- public CopyItemAction() {
- this.setName(Inter.getLocText("FR-Action_Copy"));
- this.setMnemonic('C');
- this.setSmallIcon(BaseUtils
- .readIcon("/com/fr/base/images/cell/control/copy.png"));
- }
-
- public void actionPerformed(ActionEvent evt) {
- // p:选中的值.
- ListModelElement selectedValue = (ListModelElement) nameableList.getSelectedValue();
- if (selectedValue == null) {
- return;
- }
-
- controlUpdatePane.update();
-
- Nameable selectedNameable = selectedValue.wrapper;
-
- // p: 用反射机制实现
- try {
- Nameable newNameable = (Nameable) BaseUtils.cloneObject(selectedNameable);
- newNameable.setName(createUnrepeatedCopyName(selectedNameable.getName()));
-
- JControlPane.this.addNameable(newNameable, nameableList.getSelectedIndex() + 1);
- } catch (Exception e) {
- FRContext.getLogger().error(e.getMessage(), e);
- }
- }
- }
-
- /*
- * 上移Item
- */
- private class MoveUpItemAction extends UpdateAction {
- public MoveUpItemAction() {
- this.setName(Inter.getLocText("Utils-Move_Up"));
- this.setMnemonic('U');
- this.setSmallIcon(BaseUtils
- .readIcon("/com/fr/design/images/control/up.png"));
- }
-
- public void actionPerformed(ActionEvent evt) {
- int selectedIndex = nameableList.getSelectedIndex();
- if (selectedIndex == -1) {
- return;
- }
-
- // 上移
- if (selectedIndex > 0) {
- DefaultListModel listModel = (DefaultListModel) nameableList
- .getModel();
-
- Object selecteObj1 = listModel.get(selectedIndex - 1);
- listModel.set(selectedIndex - 1, listModel.get(selectedIndex));
- listModel.set(selectedIndex, selecteObj1);
-
- nameableList.setSelectedIndex(selectedIndex - 1);
- nameableList.ensureIndexIsVisible(selectedIndex - 1);
- }
- }
- }
-
- /*
- * 下移Item
- */
- private class MoveDownItemAction extends UpdateAction {
- public MoveDownItemAction() {
- this.setName(Inter.getLocText("Utils-Move_Down"));
- this.setMnemonic('D');
- this.setSmallIcon(BaseUtils
- .readIcon("/com/fr/design/images/control/down.png"));
- }
-
- public void actionPerformed(ActionEvent evt) {
- int selectedIndex = nameableList.getSelectedIndex();
- if (selectedIndex == -1) {
- return;
- }
-
- if (selectedIndex < nameableList.getModel().getSize() - 1) {
- DefaultListModel listModel = (DefaultListModel) nameableList
- .getModel();
-
- Object selecteObj1 = listModel.get(selectedIndex + 1);
- listModel.set(selectedIndex + 1, listModel.get(selectedIndex));
- listModel.set(selectedIndex, selecteObj1);
-
- nameableList.setSelectedIndex(selectedIndex + 1);
- nameableList.ensureIndexIsVisible(selectedIndex + 1);
- }
- }
- }
-
- private class SortItemAction extends UpdateAction {
- private boolean isAtoZ = false;
-
- public SortItemAction() {
- this.setName(Inter.getLocText("FR-Action_Sort"));
- this.setMnemonic('S');
- this.setSmallIcon(BaseUtils
- .readIcon("/com/fr/design/images/control/sortAsc.png"));
- }
-
- public void actionPerformed(ActionEvent evt) {
- // p:选中的值.
- Object selectedValue = nameableList.getSelectedValue();
-
- DefaultListModel listModel = (DefaultListModel) nameableList
- .getModel();
- Nameable[] nameableArray = new Nameable[listModel.getSize()];
- if (nameableArray.length <= 0) {
- return;
- }
-
- for (int i = 0; i < listModel.getSize(); i++) {
- nameableArray[i] = ((ListModelElement) listModel.getElementAt(i)).wrapper;
- }
-
- // p:排序.
- if (isAtoZ) {
- Comparator nameableComparator = new Comparator() {
- public int compare(Nameable o1, Nameable o2) {
- return -ComparatorUtils.compare(o1.getName(), o2
- .getName());
- }
- };
- isAtoZ = !isAtoZ;
- Arrays.sort(nameableArray, nameableComparator);
- } else {
- Comparator nameableComparator = new Comparator() {
- public int compare(Nameable o1, Nameable o2) {
- return ComparatorUtils.compare(o1.getName(), o2
- .getName());
- }
- };
- isAtoZ = !isAtoZ;
- Arrays.sort(nameableArray, nameableComparator);
- }
-
- for (int i = 0; i < nameableArray.length; i++) {
- listModel.set(i, new ListModelElement(nameableArray[i]));
- }
-
- // p:需要选中以前的那个值.
- if (selectedValue != null) {
- nameableList.setSelectedValue(selectedValue, true);
- }
-
- checkButtonEnabled();
- // p:需要repaint.
- nameableList.repaint();
- }
- }
-
- /*
- * JNameEdList的鼠标事件
- */
- private MouseListener listMouseListener = new MouseAdapter() {
- public void mouseReleased(MouseEvent evt) {
- nameableList.stopEditing();
- if (evt.getClickCount() >= 2
- && SwingUtilities.isLeftMouseButton(evt)) {
- editingIndex = nameableList.getSelectedIndex();
- selectedName = nameableList.getNameAt(editingIndex);
- nameableList.editItemAt(nameableList.getSelectedIndex());
- }
- // peter:处理右键的弹出菜单
- if (!SwingUtilities.isRightMouseButton(evt)) {
- return;
- }
-
- // peter: 注意,在checkButtonEnabled()方法里面,设置了所有的Action的Enabled.
- checkButtonEnabled();
-
- // p:右键菜单.
- JPopupMenu popupMenu = new JPopupMenu();
-
- for (ShortCut4JControlPane sj : shorts) {
- sj.getShortCut().intoJPopupMenu(popupMenu);
- }
-
- // peter: 只有弹出菜单有子菜单的时候,才需要弹出来.
- GUICoreUtils.showPopupMenu(popupMenu, nameableList, evt.getX() - 1,
- evt.getY() - 1);
- }
-
- public void mouseMoved(MouseEvent e) {
-
- }
- };
-
- /**
- * 检查按钮可用状态 Check button enabled.
- */
- public void checkButtonEnabled() {
- int selectedIndex = nameableList.getSelectedIndex();
- if (selectedIndex == -1) {
- this.cardLayout.show(cardPane, "SELECT");
- } else {
- this.cardLayout.show(cardPane, "EDIT");
- }
- for (ShortCut4JControlPane sj : this.shorts) {
- sj.checkEnable();
- }
- }
-
- protected void doBeforeRemove(){
-
- }
-
- protected void doAfterRemove(){
-
- }
-
- public NameableCreator[] creators() {
- return creators == null ? new NameableCreator[0] : creators;
- }
-
- /*
- * Nameable的ListCellRenerer
- */
- private class NameableListCellRenderer extends
- DefaultListCellRenderer {
- public Component getListCellRendererComponent(JList list, Object value,
- int index, boolean isSelected, boolean cellHasFocus) {
- super.getListCellRendererComponent(list, value, index, isSelected,
- cellHasFocus);
-
- if (value instanceof ListModelElement) {
- Nameable wrappee = ((ListModelElement) value).wrapper;
- this.setText(((ListModelElement) value).wrapper.getName());
-
- boolean iconSet = false;
- for (NameableCreator creator : JControlPane.this.creators) {
- if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) {
- this.setIcon(creator.menuIcon());
- this.setToolTipText(creator.createTooltip());
- iconSet = true;
- break;
- }
- }
- if (!iconSet) {
- this.setIcon(BaseUtils.readIcon("/com/fr/base/images/oem/cpt.png"));
- }
- }
-
- return this;
- }
- }
-
- public class AbsoluteEnableShortCut extends ShortCut4JControlPane {
- public AbsoluteEnableShortCut(ShortCut shortCut) {
- this.shortCut = shortCut;
- }
-
- /**
- * 检查是否可用
- */
- public void checkEnable() {
- this.shortCut.setEnabled(true);
- }
- }
-
- public class NormalEnableShortCut extends ShortCut4JControlPane {
- public NormalEnableShortCut(ShortCut shortCut) {
- this.shortCut = shortCut;
- }
-
- /**
- * 检查是否可用
- */
- public void checkEnable() {
- this.shortCut.setEnabled(getModel()
- .getSize() > 0
- && JControlPane.this.nameableList.getSelectedIndex() != -1);
- }
- }
-
- public class SortEnableShortCut extends ShortCut4JControlPane {
- public SortEnableShortCut(ShortCut shortCut) {
- this.shortCut = shortCut;
- }
-
- /**
- * 检查是否可用
- */
- @Override
- public void checkEnable() {
- this.shortCut.setEnabled(getModel().getSize() > 1);
- }
-
- }
-
- public class MoveUpEnableShortCut extends ShortCut4JControlPane {
- public MoveUpEnableShortCut(ShortCut shortCut) {
- this.shortCut = shortCut;
- }
-
- /**
- * 检查是否可用
- */
- @Override
- public void checkEnable() {
- this.shortCut.setEnabled(getModel().getSize() > 1
- && JControlPane.this.nameableList.getSelectedIndex() > 0);
- }
-
- }
-
- public class MoveDownEnableShortCut extends ShortCut4JControlPane {
- public MoveDownEnableShortCut(ShortCut shortCut) {
- this.shortCut = shortCut;
- }
-
- /**
- * 检查是否可用
- */
- @Override
- public void checkEnable() {
- this.shortCut.setEnabled(getModel().getSize() > 1
- && JControlPane.this.nameableList.getSelectedIndex() < JControlPane.this.nameableList.getModel().getSize() - 1);
- }
-
- }
-
- private class JControlUpdatePane extends JPanel {
- private CardLayout card;
- private JPanel cardPane;
- private BasicBeanPane[] updatePanes;
-
- private ListModelElement elEditing;
-
- public JControlUpdatePane() {
- initUpdatePane();
- }
-
- private void initUpdatePane() {
- if (creators == null) {
- return;
- }
- card = new CardLayout();
- cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
- cardPane.setLayout(card);
- this.setLayout(FRGUIPaneFactory.createBorderLayout());
- this.add(cardPane);
- int len = creators.length;
- updatePanes = new BasicBeanPane[len];
- }
-
- public void populate() {
- ListModelElement el = (ListModelElement) JControlPane.this.nameableList.getSelectedValue();
- if (el == null) {
- return;
- }
-
- elEditing = el;
-
- for (int i = 0, len = updatePanes.length; i < len; i++) {
- Object ob2Populate = creators[i].acceptObject2Populate(el.wrapper);
- if (ob2Populate != null) {
- if (updatePanes[i] == null) {
- if (isMulti(creators[i].getUpdatePane()) || isTree(creators[i].getUpdatePane())) {
- updatePanes[i] = createPaneByCreators(creators[i], el.wrapper.getName());
- } else {
- updatePanes[i] = createPaneByCreators(creators[i]);
- }
- cardPane.add(updatePanes[i], String.valueOf(i));
- }
- card.show(cardPane, String.valueOf(i));
- updatePanes[i].populateBean(ob2Populate);
- doWhenPopulate(updatePanes[i]);
- break;
- }
- }
- }
-
- public boolean isMulti(Class _class){
- return ComparatorUtils.equals(_class, GlobalMultiTDTableDataPane.class) || ComparatorUtils.equals(_class, MultiTDTableDataPane.class);
- }
-
- public boolean isTree(Class _class){
- return ComparatorUtils.equals(_class, GlobalTreeTableDataPane.class) || ComparatorUtils.equals(_class, TreeTableDataPane.class);
- }
-
- public void update() {
- for (int i = 0; i < updatePanes.length; i++) {
- BasicBeanPane pane = updatePanes[i];
-
- if (pane != null && pane.isVisible()) {
- Object bean = pane.updateBean();
- if (i < JControlPane.this.creators.length) {
- JControlPane.this.creators[i].saveUpdatedBean(elEditing, bean);
- }
- }
- }
- }
-
- public void checkValid() throws Exception {
- if (updatePanes != null) {
- for (int i = 0; i < updatePanes.length; i++) {
- if (updatePanes[i] != null) {
- updatePanes[i].checkValid();
- }
- }
- }
- }
- }
-
- protected BasicBeanPane createPaneByCreators(NameableCreator creator) {
- try {
- return creator.getUpdatePane().newInstance();
- } catch (InstantiationException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- }
-
- protected BasicBeanPane createPaneByCreators(NameableCreator creator, String string) {
- Constructor constructor = null;
- try {
- constructor = creator.getUpdatePane().getDeclaredConstructor(new Class[]{String.class});
- constructor.setAccessible(true);
- return (BasicBeanPane) constructor.newInstance(string);
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- } catch (InstantiationException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- // 选项添加个数有限制等情况下 要求能控制快捷按钮的状态
- protected void setToolbarDefEnable(int shortCutIndex, int itemIndex, boolean enabled) {
- if (this.toolbarDef.getShortCutCount() > shortCutIndex) {
- ShortCut sc = this.toolbarDef.getShortCut(shortCutIndex);
- if (sc instanceof AddItemMenuDef) {
- AddItemMenuDef am = (AddItemMenuDef) sc;
- if (am.getShortCutCount() > itemIndex) {
- am.getShortCut(itemIndex).setEnabled(enabled);
- }
- }
- }
- }
-
- /**
- * 检查是否符合规范
- *
- * @throws Exception
- */
- public void checkValid() throws Exception {
- this.controlUpdatePane.checkValid();
- }
-
- private int getInValidIndex() {
- BasicBeanPane[] p = controlUpdatePane.updatePanes;
- if (p != null) {
- for (int i = 0; i < p.length; i++) {
- if (p[i] != null) {
- try {
- p[i].checkValid();
- } catch (Exception e) {
- return i;
- }
- }
- }
- }
- return -1;
- }
-
- private boolean hasInvalid(boolean isAdd) {
- int idx = JControlPane.this.getInValidIndex();
- if (isAdd || nameableList.getSelectedIndex() != idx) {
- try {
- checkValid();
- } catch (Exception exp) {
- JOptionPane.showMessageDialog(JControlPane.this, exp.getMessage());
- nameableList.setSelectedIndex(idx);
- return true;
- }
- }
- return false;
- }
-
-
- /**
- * 设置选中项
- *
- * @param index 选中项的序列号
- */
- public void setSelectedIndex(int index) {
- nameableList.setSelectedIndex(index);
- }
-}
\ No newline at end of file
+package com.fr.design.gui.controlpane;
+
+import com.fr.data.TableDataSource;
+import com.fr.design.dialog.BasicPane;
+import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.gui.itoolbar.UIToolbar;
+import com.fr.design.layout.FRGUIPaneFactory;
+import com.fr.design.menu.ToolBarDef;
+import com.fr.design.utils.gui.GUICoreUtils;
+import com.fr.file.DatasourceManagerProvider;
+import com.fr.stable.ArrayUtils;
+import com.fr.stable.Nameable;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Coder: zack
+ * Date: 2016/5/17
+ * Time: 15:07
+ */
+public abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper {
+ private static final int SHORT_WIDTH = 30; //每加一个short Divider位置加30
+
+ private ShortCut4JControlPane[] shorts;
+ private NameableCreator[] creators;
+ protected JPanel controlUpdatePane;
+
+ private ToolBarDef toolbarDef;
+ private UIToolbar toolBar;
+
+ // peter:这是整体的一个cardLayout Pane
+ private CardLayout cardLayout;
+ private JPanel cardPane;
+ protected String selectedName;
+ protected boolean isNamePermitted = true;
+ protected Map dsNameChangedMap = new HashMap();
+ private boolean isNameRepeated = false;
+
+ public JControlPane() {
+ this.initComponentPane();
+ }
+
+ /**
+ * 生成添加按钮的NameableCreator
+ *
+ * @return 按钮的NameableCreator
+ */
+ public abstract NameableCreator[] createNameableCreators();
+
+ protected void initComponentPane() {
+ this.setLayout(FRGUIPaneFactory.createBorderLayout());
+ this.creators = this.createNameableCreators();
+ this.controlUpdatePane = new JPanel();
+
+ // p: edit card layout
+ this.cardLayout = new CardLayout();
+ cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
+ cardPane.setLayout(this.cardLayout);
+ // p:选择的Label
+ UILabel selectLabel = new UILabel();
+ cardPane.add(selectLabel, "SELECT");
+ cardPane.add(controlUpdatePane, "EDIT");
+ // SplitPane
+ JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane);
+ mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
+ mainSplitPane.setOneTouchExpandable(true);
+
+ this.add(mainSplitPane, BorderLayout.CENTER);
+ mainSplitPane.setDividerLocation(getLeftPreferredSize());
+ this.checkButtonEnabled();
+ }
+
+
+ protected JPanel getLeftPane() {
+ // LeftPane
+ JPanel leftPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
+
+ init(leftPane);
+
+ shorts = this.createShortcuts();
+ if (ArrayUtils.isEmpty(shorts)) {
+ return leftPane;
+ }
+
+ toolbarDef = new ToolBarDef();
+ for (ShortCut4JControlPane sj : shorts) {
+ toolbarDef.addShortCut(sj.getShortCut());
+ }
+ toolBar = ToolBarDef.createJToolBar();
+ toolbarDef.updateToolBar(toolBar);
+ leftPane.add(toolBar, BorderLayout.NORTH);
+ return leftPane;
+ }
+
+ /**
+ * 初始化
+ */
+ protected void init(JPanel leftPane) {
+
+ }
+
+ protected int getLeftPreferredSize() {
+ return shorts.length * SHORT_WIDTH;
+ }
+
+ public Map getDsNameChangedMap() {
+ return dsNameChangedMap;
+ }
+
+ public void setDsNameChangedMap(Map dsNameChangedMap) {
+ this.dsNameChangedMap = dsNameChangedMap;
+ }
+
+ protected ShortCut4JControlPane[] createShortcuts() {
+ return new ShortCut4JControlPane[]{
+ addItemShortCut(),
+ removeItemShortCut(),
+ copyItemShortCut(),
+ moveUpItemShortCut(),
+ moveDownItemShortCut(),
+ sortItemShortCut()
+ };
+ }
+
+ protected abstract ShortCut4JControlPane addItemShortCut();
+
+ protected abstract ShortCut4JControlPane removeItemShortCut();
+
+ protected abstract ShortCut4JControlPane copyItemShortCut();
+
+ protected abstract ShortCut4JControlPane moveUpItemShortCut();
+
+ protected abstract ShortCut4JControlPane moveDownItemShortCut();
+
+ protected abstract ShortCut4JControlPane sortItemShortCut();
+
+ public void setNameListEditable(boolean editable) {
+ }
+
+ public abstract Nameable[] update();
+
+
+ public void populate(Nameable[] nameableArray) {
+ }
+
+ public void update(DatasourceManagerProvider datasourceManager) {
+ }
+
+ public void populate(DatasourceManagerProvider datasourceManager) {
+ }
+
+ public void populate(TableDataSource tds) {
+ }
+
+ public void update(TableDataSource tds) {
+ }
+
+
+ /**
+ * 根据name,选中JNameEdList中的item
+ */
+ public void setSelectedName(String name) {
+ }
+
+ /**
+ * 获取选中的名字
+ */
+ public abstract String getSelectedName();
+
+ /**
+ * 名字是否重复
+ *
+ * @return 重复则返回true
+ */
+ public boolean isNameRepeated() {
+ return isNameRepeated;
+ }
+
+ /**
+ * 名字是否允许
+ *
+ * @return 是则返回true
+ */
+ public boolean isNamePermitted() {
+ return isNamePermitted;
+ }
+
+ /**
+ * 是否重命名
+ *
+ * @return 是则true
+ */
+ public abstract boolean isContainsRename();
+
+ /**
+ * 生成不重复的名字
+ *
+ * @param prefix 名字前缀
+ * @return 名字
+ */
+ public abstract String createUnrepeatedName(String prefix);
+
+
+ /**
+ * 检查按钮可用状态 Check button enabled.
+ */
+ public void checkButtonEnabled() {
+ }
+
+ protected void doBeforeRemove() {
+
+ }
+
+ protected void doAfterRemove() {
+
+ }
+
+ public NameableCreator[] creators() {
+ return creators == null ? new NameableCreator[0] : creators;
+ }
+
+ /**
+ * 检查是否符合规范
+ *
+ * @throws Exception
+ */
+ public void checkValid() throws Exception {
+ }
+
+ protected abstract boolean hasInvalid(boolean isAdd);
+
+ /**
+ * 设置选中项
+ *
+ * @param index 选中项的序列号
+ */
+ public void setSelectedIndex(int index) {
+ }
+
+
+ protected void rename(String oldName, String newName) {
+ dsNameChangedMap.put(oldName, newName);
+ }
+}
diff --git a/designer_base/src/com/fr/design/gui/controlpane/JListControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/JListControlPane.java
new file mode 100644
index 0000000000..debfc0a39f
--- /dev/null
+++ b/designer_base/src/com/fr/design/gui/controlpane/JListControlPane.java
@@ -0,0 +1,1028 @@
+package com.fr.design.gui.controlpane;
+
+import com.fr.base.BaseUtils;
+import com.fr.base.FRContext;
+import com.fr.design.actions.UpdateAction;
+import com.fr.design.beans.BasicBeanPane;
+import com.fr.design.data.tabledata.tabledatapane.GlobalMultiTDTableDataPane;
+import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane;
+import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane;
+import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane;
+import com.fr.design.file.HistoryTemplateListPane;
+import com.fr.design.gui.icontainer.UIScrollPane;
+import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.gui.ilist.JNameEdList;
+import com.fr.design.gui.ilist.ListModelElement;
+import com.fr.design.gui.ilist.ModNameActionListener;
+import com.fr.design.gui.itoolbar.UIToolbar;
+import com.fr.design.layout.FRGUIPaneFactory;
+import com.fr.design.mainframe.JTemplate;
+import com.fr.design.menu.LineSeparator;
+import com.fr.design.menu.MenuDef;
+import com.fr.design.menu.ShortCut;
+import com.fr.design.menu.ToolBarDef;
+import com.fr.design.utils.gui.GUICoreUtils;
+import com.fr.general.ComparatorUtils;
+import com.fr.general.Inter;
+import com.fr.stable.ArrayUtils;
+import com.fr.stable.Nameable;
+import com.fr.stable.core.PropertyChangeAdapter;
+
+import javax.swing.*;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.Comparator;
+
+public abstract class JListControlPane extends JControlPane {
+ public static final String LIST_NAME = "JControl_List";
+ private static final int SHORT_WIDTH = 30; //每加一个short Divider位置加30
+
+ private ShortCut4JControlPane[] shorts;
+ private NameableCreator[] creators;
+ protected JNameEdList nameableList;
+ protected JControlUpdatePane controlUpdatePane;
+
+ private ToolBarDef toolbarDef;
+ private UIToolbar toolBar;
+
+ // peter:这是整体的一个cardLayout Pane
+ private CardLayout cardLayout;
+ private JPanel cardPane;
+ protected int editingIndex;
+ protected String selectedName;
+ private boolean isNameRepeated = false;
+
+ public JListControlPane() {
+ this.initComponentPane();
+ }
+
+ /**
+ * 生成添加按钮的NameableCreator
+ * @return 按钮的NameableCreator
+ */
+ public abstract NameableCreator[] createNameableCreators();
+
+ protected void initComponentPane() {
+ this.setLayout(FRGUIPaneFactory.createBorderLayout());
+ this.creators = this.createNameableCreators();
+ this.controlUpdatePane = new JControlUpdatePane();
+
+ // p: edit card layout
+ this.cardLayout = new CardLayout();
+ cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
+ cardPane.setLayout(this.cardLayout);
+ // p:选择的Label
+ UILabel selectLabel = new UILabel();
+ cardPane.add(selectLabel, "SELECT");
+ cardPane.add(controlUpdatePane, "EDIT");
+ // SplitPane
+ JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane);
+ mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
+ mainSplitPane.setOneTouchExpandable(true);
+
+ this.add(mainSplitPane, BorderLayout.CENTER);
+ mainSplitPane.setDividerLocation(getLeftPreferredSize());
+ this.checkButtonEnabled();
+ }
+
+
+ protected JPanel getLeftPane(){
+ // LeftPane
+ JPanel leftPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
+
+ initNameList(leftPane);
+
+ shorts = this.createShortcuts();
+ if (ArrayUtils.isEmpty(shorts)) {
+ return leftPane;
+ }
+
+ toolbarDef = new ToolBarDef();
+ for (ShortCut4JControlPane sj : shorts) {
+ toolbarDef.addShortCut(sj.getShortCut());
+ }
+ toolBar = ToolBarDef.createJToolBar();
+ toolbarDef.updateToolBar(toolBar);
+ leftPane.add(toolBar, BorderLayout.NORTH);
+ return leftPane;
+ }
+
+
+ private void initNameList(JPanel leftPane) {
+ nameableList = createJNameList();
+ nameableList.setName(LIST_NAME);
+ leftPane.add(new UIScrollPane(nameableList), BorderLayout.CENTER);
+
+
+ nameableList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+ nameableList.addMouseListener(listMouseListener);
+ nameableList.addListSelectionListener(new ListSelectionListener() {
+ public void valueChanged(ListSelectionEvent evt) {
+ // richie:避免多次update和populate大大降低效率
+ if (!evt.getValueIsAdjusting()) {
+ // shoc 切换的时候加检验
+ if (hasInvalid(false)) {
+ return;
+ }
+ JListControlPane.this.controlUpdatePane.update();
+ JListControlPane.this.controlUpdatePane.populate();
+ JListControlPane.this.checkButtonEnabled();
+ }
+ }
+ });
+ }
+
+ public JNameEdList createJNameList() {
+ JNameEdList nameEdList = new JNameEdList(new DefaultListModel()) {
+ protected void doAfterLostFocus() {
+ JListControlPane.this.updateControlUpdatePane();
+ }
+ };
+ nameEdList.setCellRenderer(new NameableListCellRenderer());
+ return nameEdList;
+ }
+
+ public void updateControlUpdatePane() {
+ controlUpdatePane.update();
+ }
+
+ protected void doWhenPopulate(BasicBeanPane beanPane){
+
+ }
+
+ protected int getLeftPreferredSize() {
+ return shorts.length * SHORT_WIDTH;
+ }
+
+ protected ShortCut4JControlPane[] createShortcuts() {
+ return new ShortCut4JControlPane[]{
+ addItemShortCut(),
+ removeItemShortCut(),
+ copyItemShortCut(),
+ moveUpItemShortCut(),
+ moveDownItemShortCut(),
+ sortItemShortCut()
+ };
+ }
+
+ protected ShortCut4JControlPane addItemShortCut() {
+ ShortCut addItemShortCut;
+ if (creators.length == 1) {
+ addItemShortCut = new AddItemUpdateAction(creators);
+ } else {
+ addItemShortCut = new AddItemMenuDef(creators);
+ }
+ return new AbsoluteEnableShortCut(addItemShortCut);
+ }
+
+ protected ShortCut4JControlPane removeItemShortCut() {
+ return new NormalEnableShortCut(new RemoveItemAction());
+ }
+
+ protected ShortCut4JControlPane copyItemShortCut() {
+ return new NormalEnableShortCut(new CopyItemAction());
+ }
+
+ protected ShortCut4JControlPane moveUpItemShortCut() {
+ return new NormalEnableShortCut(new MoveUpItemAction());
+ }
+
+ protected ShortCut4JControlPane moveDownItemShortCut() {
+ return new NormalEnableShortCut(new MoveDownItemAction());
+ }
+
+ protected ShortCut4JControlPane sortItemShortCut() {
+ return new NormalEnableShortCut(new SortItemAction());
+ }
+
+ public void setNameListEditable(boolean editable) {
+ this.nameableList.setEditable(editable);
+ }
+
+ public Nameable[] update() {
+ java.util.List res = new java.util.ArrayList();
+ this.controlUpdatePane.update();
+ DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
+ for (int i = 0, len = listModel.getSize(); i < len; i++) {
+ res.add(((ListModelElement) listModel.getElementAt(i)).wrapper);
+ }
+
+ return res.toArray(new Nameable[res.size()]);
+ }
+
+ public void populate(Nameable[] nameableArray) {
+ DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
+ listModel.removeAllElements();
+ if (ArrayUtils.isEmpty(nameableArray)) {
+ return;
+ }
+
+ for (Nameable aNameableArray : nameableArray) {
+ listModel.addElement(new ListModelElement(aNameableArray));
+ }
+
+ if (listModel.size() > 0) {
+ this.nameableList.setSelectedIndex(0);
+ }
+ this.checkButtonEnabled();
+ }
+
+ /**
+ * 添加名字改变时的listener
+ *
+ * @param l 名字改变时的监听
+ */
+ public void addModNameActionListener(ModNameActionListener l) {
+ this.nameableList.addModNameActionListener(l);
+ }
+
+ /**
+ * 添加Editinglistener
+ *
+ * @param l 监听
+ */
+ public void addEditingListner(PropertyChangeAdapter l) {
+ this.nameableList.addEditingListner(l);
+ }
+
+ /*
+ * 刷新当前的选中的UpdatePane
+ */
+ protected void populateSelectedValue() {
+ JListControlPane.this.controlUpdatePane.populate();
+ }
+
+ /**
+ * 根据name,选中JNameEdList中的item
+ */
+ public void setSelectedName(String name) {
+ DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
+ for (int i = 0, len = listModel.getSize(); i < len; i++) {
+ Nameable item = ((ListModelElement) listModel.getElementAt(i)).wrapper;
+ if (ComparatorUtils.equals(name, item.getName())) {
+ this.nameableList.setSelectedIndex(i);
+ break;
+ }
+ }
+ }
+
+ public String getEditingName() {
+ return this.nameableList.getEditingName();
+ }
+
+ public Object getEditingType() {
+ return this.nameableList.getAllTypes()[editingIndex];
+ }
+
+ public void setWarnigText(int index) {
+ this.nameableList.setWarnigText(index);
+ }
+
+ /**
+ * 获取选中的名字
+ */
+ public String getSelectedName() {
+ ListModelElement el = (ListModelElement) this.nameableList.getSelectedValue();
+
+ return el == null ? null : el.wrapper.getName();
+ }
+
+ /**
+ * 刷新 NameableCreator
+ *
+ * @param creators 生成器
+ */
+ public void refreshNameableCreator(NameableCreator[] creators) {
+ this.creators = creators;
+ shorts = this.createShortcuts();
+ toolbarDef.clearShortCuts();
+ for (ShortCut4JControlPane sj : shorts) {
+ toolbarDef.addShortCut(sj.getShortCut());
+ }
+
+ toolbarDef.updateToolBar(toolBar);
+ toolBar.validate();
+ toolBar.repaint();
+ this.repaint();
+ }
+
+ protected boolean isNameRepeted(java.util.List[] list, String name) {
+ for (int i = 0; i < list.length; i++) {
+ if (list[i].contains(name)) {
+ isNameRepeated = true;
+ return true;
+ }
+ }
+ isNameRepeated = false;
+ return false;
+ }
+
+ /**
+ * 名字是否重复
+ * @return 重复则返回true
+ */
+ public boolean isNameRepeated() {
+ return isNameRepeated;
+ }
+
+ /**
+ * 添加 Nameable
+ *
+ * @param nameable 添加的Nameable
+ * @param index 序号
+ */
+ public void addNameable(Nameable nameable, int index) {
+ JNameEdList nameEdList = JListControlPane.this.nameableList;
+ DefaultListModel model = (DefaultListModel) nameEdList.getModel();
+
+ ListModelElement el = new ListModelElement(nameable);
+ model.add(index, el);
+ nameableList.setSelectedIndex(index);
+ nameableList.ensureIndexIsVisible(index);
+
+ nameEdList.repaint();
+ }
+
+ /**
+ * 是否重命名
+ * @return 是则true
+ */
+ public boolean isContainsRename() {
+ String rename = Inter.getLocText("FR-Please_Rename") + "!";
+ String[] names = this.nameableList.getAllNames();
+ for (int i = names.length - 1; i >= 0; i--) {
+ if (ComparatorUtils.equals(names[i], rename)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected DefaultListModel getModel() {
+ return (DefaultListModel) JListControlPane.this.nameableList.getModel();
+ }
+
+ private String createUnrepeatedCopyName(String suffix) {
+ DefaultListModel model = this.getModel();
+ String[] names = new String[model.getSize()];
+ for (int i = 0; i < model.size(); i++) {
+ names[i] = ((ListModelElement) model.get(i)).wrapper.getName();
+ }
+ String lastName = "CopyOf" + suffix;
+ while (ArrayUtils.contains(names, lastName)) {
+ lastName = "CopyOf" + lastName;
+ }
+ return lastName;
+ }
+
+
+ /**
+ * 生成不重复的名字
+ *
+ * @param prefix 名字前缀
+ * @return 名字
+ */
+ public String createUnrepeatedName(String prefix) {
+ DefaultListModel model = this.getModel();
+ Nameable[] all = new Nameable[model.getSize()];
+ for (int i = 0; i < model.size(); i++) {
+ all[i] = ((ListModelElement) model.get(i)).wrapper;
+ }
+ // richer:生成的名字从1开始. kunsnat: 添加属性从0开始.
+ int count = all.length + 1;
+ while (true) {
+ String name_test = prefix + count;
+ boolean repeated = false;
+ for (int i = 0, len = model.size(); i < len; i++) {
+ Nameable nameable = all[i];
+ if (ComparatorUtils.equals(nameable.getName(), name_test)) {
+ repeated = true;
+ break;
+ }
+ }
+
+ if (!repeated) {
+ return name_test;
+ }
+
+ count++;
+ }
+ }
+
+ /**
+ * 增加项的UpdateAction
+ */
+ protected class AddItemUpdateAction extends UpdateAction {
+ final NameableCreator creator;
+
+ public AddItemUpdateAction(NameableCreator[] creators) {
+ this.creator = creators[0];
+ this.setName(Inter.getLocText("FR-Action_Add"));
+ this.setMnemonic('A');
+ this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ Nameable nameable = creator.createNameable(JListControlPane.this);
+
+ JListControlPane.this.addNameable(nameable, getModel().getSize());
+ }
+ }
+
+ /*
+ * 增加项的MenuDef
+ */
+ protected class AddItemMenuDef extends MenuDef {
+ public AddItemMenuDef(NameableCreator[] creators) {
+ this.setName(Inter.getLocText("FR-Action_Add"));
+ this.setMnemonic('A');
+ this.setIconPath("/com/fr/design/images/control/addPopup.png");
+ wrapActionListener(creators);
+ }
+
+ private void wrapActionListener(NameableCreator[] creators) {
+ for (final NameableCreator creator : creators) {
+ if (!whetherAdd(creator.menuName())){
+ continue;
+ }
+ boolean isTrue = ComparatorUtils.equals(creator.menuName(), Inter.getLocText("Datasource-Stored_Procedure")) ||
+ ComparatorUtils.equals(creator.menuName(), Inter.getLocText("DS-Relation_TableData")) || ComparatorUtils.equals(creator.menuName(), Inter.getLocText("DS-Multi_Dimensional_Database"));
+ if (isTrue) {
+ this.addShortCut(new LineSeparator());
+ }
+ this.addShortCut(new UpdateAction() {
+ {
+ this.setName(creator.menuName());
+ Icon icon = creator.menuIcon();
+ if (icon != null) {
+ this.setSmallIcon(icon);
+ }
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (hasInvalid(true)) {
+ return;
+ }
+
+ Nameable nameable = creator.createNameable(JListControlPane.this);
+
+ JListControlPane.this.addNameable(nameable, getModel().getSize());
+ }
+ });
+ }
+ }
+
+ private boolean whetherAdd(String itemName){
+ JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
+ if (jTemplate == null) {
+ return false;
+ }
+ //先屏蔽掉这个,之后还有别的
+ String[] names = {Inter.getLocText("FR-Hyperlink_Chart_Float")};
+ for (String name : names){
+ if(!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, name)){
+ return false;
+ }
+ }
+ String formName = Inter.getLocText("Hyperlink-Form_link");
+ return !(jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, formName));
+ }
+ }
+
+ /*
+ * 移除item
+ */
+ private class RemoveItemAction extends UpdateAction {
+ public RemoveItemAction() {
+ this.setName(Inter.getLocText("FR-Action_Remove"));
+ this.setMnemonic('R');
+ this.setSmallIcon(BaseUtils
+ .readIcon("/com/fr/base/images/cell/control/remove.png"));
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ try {
+ JListControlPane.this.nameableList.getCellEditor()
+ .stopCellEditing();
+ } catch (Exception ignored) {
+ }
+ // bug:在选中一个NameObject并删除,会遗留下Name.
+ doBeforeRemove();
+ if (GUICoreUtils.removeJListSelectedNodes(SwingUtilities
+ .getWindowAncestor(JListControlPane.this), nameableList)) {
+ checkButtonEnabled();
+ doAfterRemove();
+ }
+ }
+ }
+
+ /*
+ * CopyItem
+ */
+ private class CopyItemAction extends UpdateAction {
+ public CopyItemAction() {
+ this.setName(Inter.getLocText("FR-Action_Copy"));
+ this.setMnemonic('C');
+ this.setSmallIcon(BaseUtils
+ .readIcon("/com/fr/base/images/cell/control/copy.png"));
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ // p:选中的值.
+ ListModelElement selectedValue = (ListModelElement) nameableList.getSelectedValue();
+ if (selectedValue == null) {
+ return;
+ }
+
+ controlUpdatePane.update();
+
+ Nameable selectedNameable = selectedValue.wrapper;
+
+ // p: 用反射机制实现
+ try {
+ Nameable newNameable = (Nameable) BaseUtils.cloneObject(selectedNameable);
+ newNameable.setName(createUnrepeatedCopyName(selectedNameable.getName()));
+
+ JListControlPane.this.addNameable(newNameable, nameableList.getSelectedIndex() + 1);
+ } catch (Exception e) {
+ FRContext.getLogger().error(e.getMessage(), e);
+ }
+ }
+ }
+
+ /*
+ * 上移Item
+ */
+ private class MoveUpItemAction extends UpdateAction {
+ public MoveUpItemAction() {
+ this.setName(Inter.getLocText("Utils-Move_Up"));
+ this.setMnemonic('U');
+ this.setSmallIcon(BaseUtils
+ .readIcon("/com/fr/design/images/control/up.png"));
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ int selectedIndex = nameableList.getSelectedIndex();
+ if (selectedIndex == -1) {
+ return;
+ }
+
+ // 上移
+ if (selectedIndex > 0) {
+ DefaultListModel listModel = (DefaultListModel) nameableList
+ .getModel();
+
+ Object selecteObj1 = listModel.get(selectedIndex - 1);
+ listModel.set(selectedIndex - 1, listModel.get(selectedIndex));
+ listModel.set(selectedIndex, selecteObj1);
+
+ nameableList.setSelectedIndex(selectedIndex - 1);
+ nameableList.ensureIndexIsVisible(selectedIndex - 1);
+ }
+ }
+ }
+
+ /*
+ * 下移Item
+ */
+ private class MoveDownItemAction extends UpdateAction {
+ public MoveDownItemAction() {
+ this.setName(Inter.getLocText("Utils-Move_Down"));
+ this.setMnemonic('D');
+ this.setSmallIcon(BaseUtils
+ .readIcon("/com/fr/design/images/control/down.png"));
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ int selectedIndex = nameableList.getSelectedIndex();
+ if (selectedIndex == -1) {
+ return;
+ }
+
+ if (selectedIndex < nameableList.getModel().getSize() - 1) {
+ DefaultListModel listModel = (DefaultListModel) nameableList
+ .getModel();
+
+ Object selecteObj1 = listModel.get(selectedIndex + 1);
+ listModel.set(selectedIndex + 1, listModel.get(selectedIndex));
+ listModel.set(selectedIndex, selecteObj1);
+
+ nameableList.setSelectedIndex(selectedIndex + 1);
+ nameableList.ensureIndexIsVisible(selectedIndex + 1);
+ }
+ }
+ }
+
+ private class SortItemAction extends UpdateAction {
+ private boolean isAtoZ = false;
+
+ public SortItemAction() {
+ this.setName(Inter.getLocText("FR-Action_Sort"));
+ this.setMnemonic('S');
+ this.setSmallIcon(BaseUtils
+ .readIcon("/com/fr/design/images/control/sortAsc.png"));
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ // p:选中的值.
+ Object selectedValue = nameableList.getSelectedValue();
+
+ DefaultListModel listModel = (DefaultListModel) nameableList
+ .getModel();
+ Nameable[] nameableArray = new Nameable[listModel.getSize()];
+ if (nameableArray.length <= 0) {
+ return;
+ }
+
+ for (int i = 0; i < listModel.getSize(); i++) {
+ nameableArray[i] = ((ListModelElement) listModel.getElementAt(i)).wrapper;
+ }
+
+ // p:排序.
+ if (isAtoZ) {
+ Comparator nameableComparator = new Comparator() {
+ public int compare(Nameable o1, Nameable o2) {
+ return -ComparatorUtils.compare(o1.getName(), o2
+ .getName());
+ }
+ };
+ isAtoZ = !isAtoZ;
+ Arrays.sort(nameableArray, nameableComparator);
+ } else {
+ Comparator nameableComparator = new Comparator() {
+ public int compare(Nameable o1, Nameable o2) {
+ return ComparatorUtils.compare(o1.getName(), o2
+ .getName());
+ }
+ };
+ isAtoZ = !isAtoZ;
+ Arrays.sort(nameableArray, nameableComparator);
+ }
+
+ for (int i = 0; i < nameableArray.length; i++) {
+ listModel.set(i, new ListModelElement(nameableArray[i]));
+ }
+
+ // p:需要选中以前的那个值.
+ if (selectedValue != null) {
+ nameableList.setSelectedValue(selectedValue, true);
+ }
+
+ checkButtonEnabled();
+ // p:需要repaint.
+ nameableList.repaint();
+ }
+ }
+
+ /*
+ * JNameEdList的鼠标事件
+ */
+ private MouseListener listMouseListener = new MouseAdapter() {
+ public void mouseReleased(MouseEvent evt) {
+ nameableList.stopEditing();
+ if (evt.getClickCount() >= 2
+ && SwingUtilities.isLeftMouseButton(evt)) {
+ editingIndex = nameableList.getSelectedIndex();
+ selectedName = nameableList.getNameAt(editingIndex);
+ nameableList.editItemAt(nameableList.getSelectedIndex());
+ }
+ // peter:处理右键的弹出菜单
+ if (!SwingUtilities.isRightMouseButton(evt)) {
+ return;
+ }
+
+ // peter: 注意,在checkButtonEnabled()方法里面,设置了所有的Action的Enabled.
+ checkButtonEnabled();
+
+ // p:右键菜单.
+ JPopupMenu popupMenu = new JPopupMenu();
+
+ for (ShortCut4JControlPane sj : shorts) {
+ sj.getShortCut().intoJPopupMenu(popupMenu);
+ }
+
+ // peter: 只有弹出菜单有子菜单的时候,才需要弹出来.
+ GUICoreUtils.showPopupMenu(popupMenu, nameableList, evt.getX() - 1,
+ evt.getY() - 1);
+ }
+
+ public void mouseMoved(MouseEvent e) {
+
+ }
+ };
+
+ /**
+ * 检查按钮可用状态 Check button enabled.
+ */
+ public void checkButtonEnabled() {
+ int selectedIndex = nameableList.getSelectedIndex();
+ if (selectedIndex == -1) {
+ this.cardLayout.show(cardPane, "SELECT");
+ } else {
+ this.cardLayout.show(cardPane, "EDIT");
+ }
+ for (ShortCut4JControlPane sj : this.shorts) {
+ sj.checkEnable();
+ }
+ }
+
+ protected void doBeforeRemove(){
+
+ }
+
+ protected void doAfterRemove(){
+
+ }
+
+ public NameableCreator[] creators() {
+ return creators == null ? new NameableCreator[0] : creators;
+ }
+
+ /*
+ * Nameable的ListCellRenerer
+ */
+ private class NameableListCellRenderer extends
+ DefaultListCellRenderer {
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus) {
+ super.getListCellRendererComponent(list, value, index, isSelected,
+ cellHasFocus);
+
+ if (value instanceof ListModelElement) {
+ Nameable wrappee = ((ListModelElement) value).wrapper;
+ this.setText(((ListModelElement) value).wrapper.getName());
+
+ boolean iconSet = false;
+ for (NameableCreator creator : JListControlPane.this.creators) {
+ if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) {
+ this.setIcon(creator.menuIcon());
+ this.setToolTipText(creator.createTooltip());
+ iconSet = true;
+ break;
+ }
+ }
+ if (!iconSet) {
+ this.setIcon(BaseUtils.readIcon("/com/fr/base/images/oem/cpt.png"));
+ }
+ }
+
+ return this;
+ }
+ }
+
+ public class AbsoluteEnableShortCut extends ShortCut4JControlPane {
+ public AbsoluteEnableShortCut(ShortCut shortCut) {
+ this.shortCut = shortCut;
+ }
+
+ /**
+ * 检查是否可用
+ */
+ public void checkEnable() {
+ this.shortCut.setEnabled(true);
+ }
+ }
+
+ public class NormalEnableShortCut extends ShortCut4JControlPane {
+ public NormalEnableShortCut(ShortCut shortCut) {
+ this.shortCut = shortCut;
+ }
+
+ /**
+ * 检查是否可用
+ */
+ public void checkEnable() {
+ this.shortCut.setEnabled(getModel()
+ .getSize() > 0
+ && JListControlPane.this.nameableList.getSelectedIndex() != -1);
+ }
+ }
+
+ public class SortEnableShortCut extends ShortCut4JControlPane {
+ public SortEnableShortCut(ShortCut shortCut) {
+ this.shortCut = shortCut;
+ }
+
+ /**
+ * 检查是否可用
+ */
+ @Override
+ public void checkEnable() {
+ this.shortCut.setEnabled(getModel().getSize() > 1);
+ }
+
+ }
+
+ public class MoveUpEnableShortCut extends ShortCut4JControlPane {
+ public MoveUpEnableShortCut(ShortCut shortCut) {
+ this.shortCut = shortCut;
+ }
+
+ /**
+ * 检查是否可用
+ */
+ @Override
+ public void checkEnable() {
+ this.shortCut.setEnabled(getModel().getSize() > 1
+ && JListControlPane.this.nameableList.getSelectedIndex() > 0);
+ }
+
+ }
+
+ public class MoveDownEnableShortCut extends ShortCut4JControlPane {
+ public MoveDownEnableShortCut(ShortCut shortCut) {
+ this.shortCut = shortCut;
+ }
+
+ /**
+ * 检查是否可用
+ */
+ @Override
+ public void checkEnable() {
+ this.shortCut.setEnabled(getModel().getSize() > 1
+ && JListControlPane.this.nameableList.getSelectedIndex() < JListControlPane.this.nameableList.getModel().getSize() - 1);
+ }
+
+ }
+
+ private class JControlUpdatePane extends JPanel {
+ private CardLayout card;
+ private JPanel cardPane;
+ private BasicBeanPane[] updatePanes;
+
+ private ListModelElement elEditing;
+
+ public JControlUpdatePane() {
+ initUpdatePane();
+ }
+
+ private void initUpdatePane() {
+ if (creators == null) {
+ return;
+ }
+ card = new CardLayout();
+ cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
+ cardPane.setLayout(card);
+ this.setLayout(FRGUIPaneFactory.createBorderLayout());
+ this.add(cardPane);
+ int len = creators.length;
+ updatePanes = new BasicBeanPane[len];
+ }
+
+ public void populate() {
+ ListModelElement el = (ListModelElement) JListControlPane.this.nameableList.getSelectedValue();
+ if (el == null) {
+ return;
+ }
+
+ elEditing = el;
+
+ for (int i = 0, len = updatePanes.length; i < len; i++) {
+ Object ob2Populate = creators[i].acceptObject2Populate(el.wrapper);
+ if (ob2Populate != null) {
+ if (updatePanes[i] == null) {
+ if (isMulti(creators[i].getUpdatePane()) || isTree(creators[i].getUpdatePane())) {
+ updatePanes[i] = createPaneByCreators(creators[i], el.wrapper.getName());
+ } else {
+ updatePanes[i] = createPaneByCreators(creators[i]);
+ }
+ cardPane.add(updatePanes[i], String.valueOf(i));
+ }
+ card.show(cardPane, String.valueOf(i));
+ updatePanes[i].populateBean(ob2Populate);
+ doWhenPopulate(updatePanes[i]);
+ break;
+ }
+ }
+ }
+
+ public boolean isMulti(Class _class){
+ return ComparatorUtils.equals(_class, GlobalMultiTDTableDataPane.class) || ComparatorUtils.equals(_class, MultiTDTableDataPane.class);
+ }
+
+ public boolean isTree(Class _class){
+ return ComparatorUtils.equals(_class, GlobalTreeTableDataPane.class) || ComparatorUtils.equals(_class, TreeTableDataPane.class);
+ }
+
+ public void update() {
+ for (int i = 0; i < updatePanes.length; i++) {
+ BasicBeanPane pane = updatePanes[i];
+
+ if (pane != null && pane.isVisible()) {
+ Object bean = pane.updateBean();
+ if (i < JListControlPane.this.creators.length) {
+ JListControlPane.this.creators[i].saveUpdatedBean(elEditing, bean);
+ }
+ }
+ }
+ }
+
+ public void checkValid() throws Exception {
+ if (updatePanes != null) {
+ for (int i = 0; i < updatePanes.length; i++) {
+ if (updatePanes[i] != null) {
+ updatePanes[i].checkValid();
+ }
+ }
+ }
+ }
+ }
+
+ protected BasicBeanPane createPaneByCreators(NameableCreator creator) {
+ try {
+ return creator.getUpdatePane().newInstance();
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected BasicBeanPane createPaneByCreators(NameableCreator creator, String string) {
+ Constructor constructor = null;
+ try {
+ constructor = creator.getUpdatePane().getDeclaredConstructor(new Class[]{String.class});
+ constructor.setAccessible(true);
+ return (BasicBeanPane) constructor.newInstance(string);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ // 选项添加个数有限制等情况下 要求能控制快捷按钮的状态
+ protected void setToolbarDefEnable(int shortCutIndex, int itemIndex, boolean enabled) {
+ if (this.toolbarDef.getShortCutCount() > shortCutIndex) {
+ ShortCut sc = this.toolbarDef.getShortCut(shortCutIndex);
+ if (sc instanceof AddItemMenuDef) {
+ AddItemMenuDef am = (AddItemMenuDef) sc;
+ if (am.getShortCutCount() > itemIndex) {
+ am.getShortCut(itemIndex).setEnabled(enabled);
+ }
+ }
+ }
+ }
+
+ /**
+ * 检查是否符合规范
+ *
+ * @throws Exception
+ */
+ public void checkValid() throws Exception {
+ this.controlUpdatePane.checkValid();
+ }
+
+ private int getInValidIndex() {
+ BasicBeanPane[] p = controlUpdatePane.updatePanes;
+ if (p != null) {
+ for (int i = 0; i < p.length; i++) {
+ if (p[i] != null) {
+ try {
+ p[i].checkValid();
+ } catch (Exception e) {
+ return i;
+ }
+ }
+ }
+ }
+ return -1;
+ }
+
+ protected boolean hasInvalid(boolean isAdd) {
+ int idx = JListControlPane.this.getInValidIndex();
+ if (isAdd || nameableList.getSelectedIndex() != idx) {
+ try {
+ checkValid();
+ } catch (Exception exp) {
+ JOptionPane.showMessageDialog(JListControlPane.this, exp.getMessage());
+ nameableList.setSelectedIndex(idx);
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * 设置选中项
+ *
+ * @param index 选中项的序列号
+ */
+ public void setSelectedIndex(int index) {
+ nameableList.setSelectedIndex(index);
+ }
+}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/gui/controlpane/ObjectJControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/ObjectJControlPane.java
index fb944b93b5..69fe1d642b 100644
--- a/designer_base/src/com/fr/design/gui/controlpane/ObjectJControlPane.java
+++ b/designer_base/src/com/fr/design/gui/controlpane/ObjectJControlPane.java
@@ -11,7 +11,7 @@ import com.fr.design.beans.BasicBeanPane;
* @author zhou
* @since 2012-4-5上午9:29:20
*/
-public abstract class ObjectJControlPane extends JControlPane {
+public abstract class ObjectJControlPane extends JListControlPane {
private Object object;
public ObjectJControlPane() {
diff --git a/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java b/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
index fe14127725..b7992e60e7 100644
--- a/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
+++ b/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
@@ -4,7 +4,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.HyperlinkPluginAction;
import com.fr.design.actions.UpdateAction;
import com.fr.design.fun.HyperlinkProvider;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.Inter;
@@ -25,7 +25,7 @@ import java.util.List;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间:2013-6-25 上午11:17:57
*/
-public class HyperlinkGroupPane extends JControlPane {
+public class HyperlinkGroupPane extends JListControlPane {
/**
* 生成添加按钮的NameableCreator
diff --git a/designer_base/src/com/fr/design/parameter/ParameterArrayPane.java b/designer_base/src/com/fr/design/parameter/ParameterArrayPane.java
index 5a36ece136..223c930788 100644
--- a/designer_base/src/com/fr/design/parameter/ParameterArrayPane.java
+++ b/designer_base/src/com/fr/design/parameter/ParameterArrayPane.java
@@ -2,7 +2,7 @@ package com.fr.design.parameter;
import com.fr.base.ConfigManager;
import com.fr.base.Parameter;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.NameableSelfCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
@@ -18,7 +18,7 @@ import javax.swing.*;
import java.util.Arrays;
import java.util.List;
-public class ParameterArrayPane extends JControlPane {
+public class ParameterArrayPane extends JListControlPane {
/**
* Constructor.
*/
diff --git a/designer_base/src/com/fr/env/EnvListPane.java b/designer_base/src/com/fr/env/EnvListPane.java
index a59d6ba915..0f81215825 100644
--- a/designer_base/src/com/fr/env/EnvListPane.java
+++ b/designer_base/src/com/fr/env/EnvListPane.java
@@ -41,7 +41,7 @@ import com.fr.dav.LocalEnv;
import com.fr.design.DesignerEnvManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.InformationWarnPane;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ipasswordfield.UIPassWordField;
@@ -63,7 +63,7 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
-public class EnvListPane extends JControlPane {
+public class EnvListPane extends JListControlPane {
public EnvListPane() {
super();
addEditingListner(new PropertyChangeAdapter() {
diff --git a/designer_chart/src/com/fr/design/chart/ChartControlPane.java b/designer_chart/src/com/fr/design/chart/ChartControlPane.java
index 390d780fb1..1ac74dbeab 100644
--- a/designer_chart/src/com/fr/design/chart/ChartControlPane.java
+++ b/designer_chart/src/com/fr/design/chart/ChartControlPane.java
@@ -3,7 +3,7 @@ package com.fr.design.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.beans.BasicBeanPane;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.layout.FRGUIPaneFactory;
@@ -18,7 +18,7 @@ import java.util.HashMap;
* 管理图表类型Pane
* @author kunsnat: ChartComponent移出.
*/
-public class ChartControlPane extends JControlPane {
+public class ChartControlPane extends JListControlPane {
private static final long serialVersionUID = 7336270815128413184L;
public ChartControlPane() {
diff --git a/designer_chart/src/com/fr/design/chart/axis/ChartAlertLinePane.java b/designer_chart/src/com/fr/design/chart/axis/ChartAlertLinePane.java
index 28a06e22a2..e6bde825ab 100644
--- a/designer_chart/src/com/fr/design/chart/axis/ChartAlertLinePane.java
+++ b/designer_chart/src/com/fr/design/chart/axis/ChartAlertLinePane.java
@@ -4,14 +4,14 @@ import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.stable.Nameable;
import com.fr.chart.chartattr.ChartAlertValue;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import java.util.ArrayList;
import java.util.List;
-public class ChartAlertLinePane extends JControlPane {
+public class ChartAlertLinePane extends JListControlPane {
public NameableCreator[] createNameableCreators() {
return new NameableCreator[]{
diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrPane.java
index 7fb006c849..a5f8b6d0a0 100644
--- a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrPane.java
+++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrPane.java
@@ -7,7 +7,7 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.design.chart.series.SeriesCondition.impl.DataSeriesConditionPaneFactory;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
@@ -20,7 +20,7 @@ import java.util.List;
*
* @see DataSeriesConditionPane
*/
-public class DataSeriesAttrPane extends JControlPane {
+public class DataSeriesAttrPane extends JListControlPane {
private static final long serialVersionUID = -7265389532959632525L;
private Plot plot;
diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TrendLineControlPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TrendLineControlPane.java
index 583d2c3bd2..b59c5df6b6 100644
--- a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TrendLineControlPane.java
+++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TrendLineControlPane.java
@@ -5,14 +5,14 @@ import com.fr.general.NameObject;
import com.fr.stable.Nameable;
import com.fr.chart.base.AttrTrendLine;
import com.fr.chart.base.ConditionTrendLine;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import java.util.ArrayList;
import java.util.List;
-public class TrendLineControlPane extends JControlPane {
+public class TrendLineControlPane extends JListControlPane {
public NameableCreator[] createNameableCreators() {
return new NameableCreator[] {
diff --git a/designer_chart/src/com/fr/design/mainframe/MapArrayPane.java b/designer_chart/src/com/fr/design/mainframe/MapArrayPane.java
index 14926e71cf..3dd189d30a 100644
--- a/designer_chart/src/com/fr/design/mainframe/MapArrayPane.java
+++ b/designer_chart/src/com/fr/design/mainframe/MapArrayPane.java
@@ -32,7 +32,7 @@ import java.util.List;
* Date: 14/12/3
* Time: 上午10:00
*/
-public class MapArrayPane extends JControlPane {
+public class MapArrayPane extends JListControlPane {
private static final int LEFT_WIDTH = 180;
private static final Color LINE_COLOR = new Color(176, 176, 176);
private static final int TOP_GAP = 5;
diff --git a/designer_chart/src/com/fr/design/module/ChartPreStyleManagerPane.java b/designer_chart/src/com/fr/design/module/ChartPreStyleManagerPane.java
index 5d1b246d49..87d9577bd4 100644
--- a/designer_chart/src/com/fr/design/module/ChartPreStyleManagerPane.java
+++ b/designer_chart/src/com/fr/design/module/ChartPreStyleManagerPane.java
@@ -4,7 +4,7 @@ import com.fr.base.ChartPreStyleManagerProvider;
import com.fr.base.ChartPreStyleServerManager;
import com.fr.base.Utils;
import com.fr.chart.base.ChartPreStyle;
-import com.fr.design.gui.controlpane.JControlPane;
+import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.mainframe.DesignerContext;
@@ -22,7 +22,7 @@ import java.util.Iterator;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间:2013-8-21 下午02:33:48
*/
-public class ChartPreStyleManagerPane extends JControlPane {
+public class ChartPreStyleManagerPane extends JListControlPane {
@Override
/**