Browse Source

Merge pull request #89 in BA/design from ~ZACK/design:dev to dev

* commit '34b1582c04bf6ddb076e65c7f3beda726e0fcc7e':
  属性这边单独整理下
master
superman 9 years ago
parent
commit
03713c3b53
  1. 1
      designer_base/src/com/fr/design/data/datapane/TableDataListPane.java
  2. 115
      designer_base/src/com/fr/design/gui/controlpane/JControlPane.java
  3. 61
      designer_base/src/com/fr/design/gui/controlpane/JListControlPane.java

1
designer_base/src/com/fr/design/data/datapane/TableDataListPane.java

@ -22,6 +22,7 @@ import java.util.*;
* TableDataList Pane. * TableDataList Pane.
*/ */
public class TableDataListPane extends JListControlPane { public class TableDataListPane extends JListControlPane {
private boolean isNamePermitted = true;
public TableDataListPane() { public TableDataListPane() {
super(); super();

115
designer_base/src/com/fr/design/gui/controlpane/JControlPane.java

@ -22,22 +22,18 @@ import java.util.Map;
* Time: 15:07 * Time: 15:07
*/ */
public abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper { public abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper {
private static final int SHORT_WIDTH = 30; //每加一个short Divider位置加30 protected static final int SHORT_WIDTH = 30; //每加一个short Divider位置加30
private ShortCut4JControlPane[] shorts;
private NameableCreator[] creators;
protected JPanel controlUpdatePane; protected JPanel controlUpdatePane;
protected Map<String, String> dsNameChangedMap = new HashMap<String, String>();
protected ShortCut4JControlPane[] shorts;
protected NameableCreator[] creators;
protected ToolBarDef toolbarDef;
private ToolBarDef toolbarDef; protected UIToolbar toolBar;
private UIToolbar toolBar;
// peter:这是整体的一个cardLayout Pane // peter:这是整体的一个cardLayout Pane
private CardLayout cardLayout; protected CardLayout cardLayout;
private JPanel cardPane;
protected String selectedName; protected JPanel cardPane;
protected boolean isNamePermitted = true;
protected Map<String, String> dsNameChangedMap = new HashMap<String, String>();
private boolean isNameRepeated = false;
public JControlPane() { public JControlPane() {
this.initComponentPane(); this.initComponentPane();
@ -53,7 +49,7 @@ public abstract class JControlPane extends BasicPane implements UnrepeatedNameHe
protected void initComponentPane() { protected void initComponentPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.creators = this.createNameableCreators(); this.creators = this.createNameableCreators();
this.controlUpdatePane = new JPanel(); this.controlUpdatePane = createControlUpdatePane();
// p: edit card layout // p: edit card layout
this.cardLayout = new CardLayout(); this.cardLayout = new CardLayout();
@ -73,6 +69,7 @@ public abstract class JControlPane extends BasicPane implements UnrepeatedNameHe
this.checkButtonEnabled(); this.checkButtonEnabled();
} }
protected abstract JPanel createControlUpdatePane();
protected JPanel getLeftPane() { protected JPanel getLeftPane() {
// LeftPane // LeftPane
@ -95,6 +92,55 @@ public abstract class JControlPane extends BasicPane implements UnrepeatedNameHe
return leftPane; return leftPane;
} }
public ShortCut4JControlPane[] getShorts() {
return shorts;
}
public void setShorts(ShortCut4JControlPane[] shorts) {
this.shorts = shorts;
}
public NameableCreator[] getCreators() {
return creators;
}
public void setCreators(NameableCreator[] creators) {
this.creators = creators;
}
public ToolBarDef getToolbarDef() {
return toolbarDef;
}
public void setToolbarDef(ToolBarDef toolbarDef) {
this.toolbarDef = toolbarDef;
}
public UIToolbar getToolBar() {
return toolBar;
}
public void setToolBar(UIToolbar toolBar) {
this.toolBar = toolBar;
}
public CardLayout getCardLayout() {
return cardLayout;
}
public void setCardLayout(CardLayout cardLayout) {
this.cardLayout = cardLayout;
}
public JPanel getCardPane() {
return cardPane;
}
public void setCardPane(JPanel cardPane) {
this.cardPane = cardPane;
}
/** /**
* 初始化 * 初始化
*/ */
@ -158,52 +204,15 @@ public abstract class JControlPane extends BasicPane implements UnrepeatedNameHe
public void update(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 * @return 默认返回true
*/ */
public boolean isNamePermitted() { public boolean isNamePermitted() {
return isNamePermitted; return true;
} }
/**
* 是否重命名
*
* @return 是则true
*/
public abstract boolean isContainsRename();
/**
* 生成不重复的名字
*
* @param prefix 名字前缀
* @return 名字
*/
public abstract String createUnrepeatedName(String prefix);
/** /**
* 检查按钮可用状态 Check button enabled. * 检查按钮可用状态 Check button enabled.
*/ */

61
designer_base/src/com/fr/design/gui/controlpane/JListControlPane.java

@ -10,11 +10,9 @@ import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane; import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.icontainer.UIScrollPane; 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.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.ModNameActionListener; import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.LineSeparator; import com.fr.design.menu.LineSeparator;
@ -43,19 +41,8 @@ import java.util.Comparator;
public abstract class JListControlPane extends JControlPane { public abstract class JListControlPane extends JControlPane {
public static final String LIST_NAME = "JControl_List"; 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 JNameEdList nameableList;
protected JControlUpdatePane controlUpdatePane;
private ToolBarDef toolbarDef;
private UIToolbar toolBar;
// peter:这是整体的一个cardLayout Pane
private CardLayout cardLayout;
private JPanel cardPane;
protected int editingIndex; protected int editingIndex;
protected String selectedName; protected String selectedName;
private boolean isNameRepeated = false; private boolean isNameRepeated = false;
@ -64,35 +51,17 @@ public abstract class JListControlPane extends JControlPane {
this.initComponentPane(); this.initComponentPane();
} }
protected JPanel createControlUpdatePane() {
return new JControlUpdatePane();
}
/** /**
* 生成添加按钮的NameableCreator * 生成添加按钮的NameableCreator
*
* @return 按钮的NameableCreator * @return 按钮的NameableCreator
*/ */
public abstract NameableCreator[] createNameableCreators(); 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() { protected JPanel getLeftPane() {
// LeftPane // LeftPane
@ -132,8 +101,8 @@ public abstract class JListControlPane extends JControlPane {
if (hasInvalid(false)) { if (hasInvalid(false)) {
return; return;
} }
JListControlPane.this.controlUpdatePane.update(); ((JControlUpdatePane) JListControlPane.this.controlUpdatePane).update();
JListControlPane.this.controlUpdatePane.populate(); ((JControlUpdatePane) JListControlPane.this.controlUpdatePane).populate();
JListControlPane.this.checkButtonEnabled(); JListControlPane.this.checkButtonEnabled();
} }
} }
@ -151,7 +120,7 @@ public abstract class JListControlPane extends JControlPane {
} }
public void updateControlUpdatePane() { public void updateControlUpdatePane() {
controlUpdatePane.update(); ((JControlUpdatePane) controlUpdatePane).update();
} }
protected void doWhenPopulate(BasicBeanPane beanPane) { protected void doWhenPopulate(BasicBeanPane beanPane) {
@ -159,7 +128,7 @@ public abstract class JListControlPane extends JControlPane {
} }
protected int getLeftPreferredSize() { protected int getLeftPreferredSize() {
return shorts.length * SHORT_WIDTH; return shorts.length * JControlPane.SHORT_WIDTH;
} }
protected ShortCut4JControlPane[] createShortcuts() { protected ShortCut4JControlPane[] createShortcuts() {
@ -209,7 +178,7 @@ public abstract class JListControlPane extends JControlPane {
public Nameable[] update() { public Nameable[] update() {
java.util.List<Nameable> res = new java.util.ArrayList<Nameable>(); java.util.List<Nameable> res = new java.util.ArrayList<Nameable>();
this.controlUpdatePane.update(); ((JControlUpdatePane) this.controlUpdatePane).update();
DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel(); DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
for (int i = 0, len = listModel.getSize(); i < len; i++) { for (int i = 0, len = listModel.getSize(); i < len; i++) {
res.add(((ListModelElement) listModel.getElementAt(i)).wrapper); res.add(((ListModelElement) listModel.getElementAt(i)).wrapper);
@ -257,7 +226,7 @@ public abstract class JListControlPane extends JControlPane {
* 刷新当前的选中的UpdatePane * 刷新当前的选中的UpdatePane
*/ */
protected void populateSelectedValue() { protected void populateSelectedValue() {
JListControlPane.this.controlUpdatePane.populate(); ((JControlUpdatePane) JListControlPane.this.controlUpdatePane).populate();
} }
/** /**
@ -327,6 +296,7 @@ public abstract class JListControlPane extends JControlPane {
/** /**
* 名字是否重复 * 名字是否重复
*
* @return 重复则返回true * @return 重复则返回true
*/ */
public boolean isNameRepeated() { public boolean isNameRepeated() {
@ -353,6 +323,7 @@ public abstract class JListControlPane extends JControlPane {
/** /**
* 是否重命名 * 是否重命名
*
* @return 是则true * @return 是则true
*/ */
public boolean isContainsRename() { public boolean isContainsRename() {
@ -542,7 +513,7 @@ public abstract class JListControlPane extends JControlPane {
return; return;
} }
controlUpdatePane.update(); ((JControlUpdatePane) controlUpdatePane).update();
Nameable selectedNameable = selectedValue.wrapper; Nameable selectedNameable = selectedValue.wrapper;
@ -983,11 +954,11 @@ public abstract class JListControlPane extends JControlPane {
* @throws Exception * @throws Exception
*/ */
public void checkValid() throws Exception { public void checkValid() throws Exception {
this.controlUpdatePane.checkValid(); ((JControlUpdatePane) this.controlUpdatePane).checkValid();
} }
private int getInValidIndex() { private int getInValidIndex() {
BasicBeanPane[] p = controlUpdatePane.updatePanes; BasicBeanPane[] p = ((JControlUpdatePane) controlUpdatePane).updatePanes;
if (p != null) { if (p != null) {
for (int i = 0; i < p.length; i++) { for (int i = 0; i < p.length; i++) {
if (p[i] != null) { if (p[i] != null) {

Loading…
Cancel
Save