|
|
@ -51,6 +51,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
this.initComponentPane(); |
|
|
|
this.initComponentPane(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
protected JPanel createControlUpdatePane() { |
|
|
|
protected JPanel createControlUpdatePane() { |
|
|
|
return new JControlUpdatePane(); |
|
|
|
return new JControlUpdatePane(); |
|
|
|
} |
|
|
|
} |
|
|
@ -60,32 +61,12 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
* |
|
|
|
* |
|
|
|
* @return 按钮的NameableCreator |
|
|
|
* @return 按钮的NameableCreator |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public abstract NameableCreator[] createNameableCreators(); |
|
|
|
public abstract NameableCreator[] createNameableCreators(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected JPanel getLeftPane() { |
|
|
|
@Override |
|
|
|
// LeftPane
|
|
|
|
protected void initLeftPane(JPanel 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 = createJNameList(); |
|
|
|
nameableList.setName(LIST_NAME); |
|
|
|
nameableList.setName(LIST_NAME); |
|
|
|
leftPane.add(new UIScrollPane(nameableList), BorderLayout.CENTER); |
|
|
|
leftPane.add(new UIScrollPane(nameableList), BorderLayout.CENTER); |
|
|
@ -111,6 +92,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
|
|
|
|
|
|
|
|
public JNameEdList createJNameList() { |
|
|
|
public JNameEdList createJNameList() { |
|
|
|
JNameEdList nameEdList = new JNameEdList(new DefaultListModel()) { |
|
|
|
JNameEdList nameEdList = new JNameEdList(new DefaultListModel()) { |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void doAfterLostFocus() { |
|
|
|
protected void doAfterLostFocus() { |
|
|
|
JListControlPane.this.updateControlUpdatePane(); |
|
|
|
JListControlPane.this.updateControlUpdatePane(); |
|
|
|
} |
|
|
|
} |
|
|
@ -127,23 +109,10 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected int getLeftPreferredSize() { |
|
|
|
@Override |
|
|
|
return shorts.length * JControlPane.SHORT_WIDTH; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected ShortCut4JControlPane[] createShortcuts() { |
|
|
|
|
|
|
|
return new ShortCut4JControlPane[]{ |
|
|
|
|
|
|
|
addItemShortCut(), |
|
|
|
|
|
|
|
removeItemShortCut(), |
|
|
|
|
|
|
|
copyItemShortCut(), |
|
|
|
|
|
|
|
moveUpItemShortCut(), |
|
|
|
|
|
|
|
moveDownItemShortCut(), |
|
|
|
|
|
|
|
sortItemShortCut() |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected ShortCut4JControlPane addItemShortCut() { |
|
|
|
protected ShortCut4JControlPane addItemShortCut() { |
|
|
|
ShortCut addItemShortCut; |
|
|
|
ShortCut addItemShortCut; |
|
|
|
|
|
|
|
NameableCreator[] creators = creators(); |
|
|
|
if (creators.length == 1) { |
|
|
|
if (creators.length == 1) { |
|
|
|
addItemShortCut = new AddItemUpdateAction(creators); |
|
|
|
addItemShortCut = new AddItemUpdateAction(creators); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -152,22 +121,27 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
return new AbsoluteEnableShortCut(addItemShortCut); |
|
|
|
return new AbsoluteEnableShortCut(addItemShortCut); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
protected ShortCut4JControlPane removeItemShortCut() { |
|
|
|
protected ShortCut4JControlPane removeItemShortCut() { |
|
|
|
return new NormalEnableShortCut(new RemoveItemAction()); |
|
|
|
return new NormalEnableShortCut(new RemoveItemAction()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
protected ShortCut4JControlPane copyItemShortCut() { |
|
|
|
protected ShortCut4JControlPane copyItemShortCut() { |
|
|
|
return new NormalEnableShortCut(new CopyItemAction()); |
|
|
|
return new NormalEnableShortCut(new CopyItemAction()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
protected ShortCut4JControlPane moveUpItemShortCut() { |
|
|
|
protected ShortCut4JControlPane moveUpItemShortCut() { |
|
|
|
return new NormalEnableShortCut(new MoveUpItemAction()); |
|
|
|
return new NormalEnableShortCut(new MoveUpItemAction()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
protected ShortCut4JControlPane moveDownItemShortCut() { |
|
|
|
protected ShortCut4JControlPane moveDownItemShortCut() { |
|
|
|
return new NormalEnableShortCut(new MoveDownItemAction()); |
|
|
|
return new NormalEnableShortCut(new MoveDownItemAction()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
protected ShortCut4JControlPane sortItemShortCut() { |
|
|
|
protected ShortCut4JControlPane sortItemShortCut() { |
|
|
|
return new NormalEnableShortCut(new SortItemAction()); |
|
|
|
return new NormalEnableShortCut(new SortItemAction()); |
|
|
|
} |
|
|
|
} |
|
|
@ -176,6 +150,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
this.nameableList.setEditable(editable); |
|
|
|
this.nameableList.setEditable(editable); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
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>(); |
|
|
|
((JControlUpdatePane) this.controlUpdatePane).update(); |
|
|
|
((JControlUpdatePane) this.controlUpdatePane).update(); |
|
|
@ -187,6 +162,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
return res.toArray(new Nameable[res.size()]); |
|
|
|
return res.toArray(new Nameable[res.size()]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void populate(Nameable[] nameableArray) { |
|
|
|
public void populate(Nameable[] nameableArray) { |
|
|
|
DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel(); |
|
|
|
DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel(); |
|
|
|
listModel.removeAllElements(); |
|
|
|
listModel.removeAllElements(); |
|
|
@ -264,25 +240,6 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
return el == null ? null : el.wrapper.getName(); |
|
|
|
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) { |
|
|
|
protected boolean isNameRepeted(java.util.List[] list, String name) { |
|
|
|
for (int i = 0; i < list.length; i++) { |
|
|
|
for (int i = 0; i < list.length; i++) { |
|
|
|
if (list[i].contains(name)) { |
|
|
|
if (list[i].contains(name)) { |
|
|
@ -361,6 +318,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
* @param prefix 名字前缀 |
|
|
|
* @param prefix 名字前缀 |
|
|
|
* @return 名字 |
|
|
|
* @return 名字 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public String createUnrepeatedName(String prefix) { |
|
|
|
public String createUnrepeatedName(String prefix) { |
|
|
|
DefaultListModel model = this.getModel(); |
|
|
|
DefaultListModel model = this.getModel(); |
|
|
|
Nameable[] all = new Nameable[model.getSize()]; |
|
|
|
Nameable[] all = new Nameable[model.getSize()]; |
|
|
@ -401,6 +359,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); |
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
Nameable nameable = creator.createNameable(JListControlPane.this); |
|
|
|
Nameable nameable = creator.createNameable(JListControlPane.this); |
|
|
|
|
|
|
|
|
|
|
@ -438,6 +397,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
if (hasInvalid(true)) { |
|
|
|
if (hasInvalid(true)) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -479,6 +439,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
.readIcon("/com/fr/base/images/cell/control/remove.png")); |
|
|
|
.readIcon("/com/fr/base/images/cell/control/remove.png")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
JListControlPane.this.nameableList.getCellEditor() |
|
|
|
JListControlPane.this.nameableList.getCellEditor() |
|
|
@ -506,6 +467,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
.readIcon("/com/fr/base/images/cell/control/copy.png")); |
|
|
|
.readIcon("/com/fr/base/images/cell/control/copy.png")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
// p:选中的值.
|
|
|
|
// p:选中的值.
|
|
|
|
ListModelElement selectedValue = (ListModelElement) nameableList.getSelectedValue(); |
|
|
|
ListModelElement selectedValue = (ListModelElement) nameableList.getSelectedValue(); |
|
|
@ -540,6 +502,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
.readIcon("/com/fr/design/images/control/up.png")); |
|
|
|
.readIcon("/com/fr/design/images/control/up.png")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
int selectedIndex = nameableList.getSelectedIndex(); |
|
|
|
int selectedIndex = nameableList.getSelectedIndex(); |
|
|
|
if (selectedIndex == -1) { |
|
|
|
if (selectedIndex == -1) { |
|
|
@ -572,6 +535,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
.readIcon("/com/fr/design/images/control/down.png")); |
|
|
|
.readIcon("/com/fr/design/images/control/down.png")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
int selectedIndex = nameableList.getSelectedIndex(); |
|
|
|
int selectedIndex = nameableList.getSelectedIndex(); |
|
|
|
if (selectedIndex == -1) { |
|
|
|
if (selectedIndex == -1) { |
|
|
@ -602,6 +566,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
.readIcon("/com/fr/design/images/control/sortAsc.png")); |
|
|
|
.readIcon("/com/fr/design/images/control/sortAsc.png")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
// p:选中的值.
|
|
|
|
// p:选中的值.
|
|
|
|
Object selectedValue = nameableList.getSelectedValue(); |
|
|
|
Object selectedValue = nameableList.getSelectedValue(); |
|
|
@ -620,6 +585,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
// p:排序.
|
|
|
|
// p:排序.
|
|
|
|
if (isAtoZ) { |
|
|
|
if (isAtoZ) { |
|
|
|
Comparator<Nameable> nameableComparator = new Comparator<Nameable>() { |
|
|
|
Comparator<Nameable> nameableComparator = new Comparator<Nameable>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
public int compare(Nameable o1, Nameable o2) { |
|
|
|
public int compare(Nameable o1, Nameable o2) { |
|
|
|
return -ComparatorUtils.compare(o1.getName(), o2 |
|
|
|
return -ComparatorUtils.compare(o1.getName(), o2 |
|
|
|
.getName()); |
|
|
|
.getName()); |
|
|
@ -629,6 +595,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
Arrays.sort(nameableArray, nameableComparator); |
|
|
|
Arrays.sort(nameableArray, nameableComparator); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Comparator<Nameable> nameableComparator = new Comparator<Nameable>() { |
|
|
|
Comparator<Nameable> nameableComparator = new Comparator<Nameable>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
public int compare(Nameable o1, Nameable o2) { |
|
|
|
public int compare(Nameable o1, Nameable o2) { |
|
|
|
return ComparatorUtils.compare(o1.getName(), o2 |
|
|
|
return ComparatorUtils.compare(o1.getName(), o2 |
|
|
|
.getName()); |
|
|
|
.getName()); |
|
|
@ -657,6 +624,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
* JNameEdList的鼠标事件 |
|
|
|
* JNameEdList的鼠标事件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private MouseListener listMouseListener = new MouseAdapter() { |
|
|
|
private MouseListener listMouseListener = new MouseAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void mouseReleased(MouseEvent evt) { |
|
|
|
public void mouseReleased(MouseEvent evt) { |
|
|
|
nameableList.stopEditing(); |
|
|
|
nameableList.stopEditing(); |
|
|
|
if (evt.getClickCount() >= 2 |
|
|
|
if (evt.getClickCount() >= 2 |
|
|
@ -676,7 +644,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
// p:右键菜单.
|
|
|
|
// p:右键菜单.
|
|
|
|
JPopupMenu popupMenu = new JPopupMenu(); |
|
|
|
JPopupMenu popupMenu = new JPopupMenu(); |
|
|
|
|
|
|
|
|
|
|
|
for (ShortCut4JControlPane sj : shorts) { |
|
|
|
for (ShortCut4JControlPane sj : getShorts()) { |
|
|
|
sj.getShortCut().intoJPopupMenu(popupMenu); |
|
|
|
sj.getShortCut().intoJPopupMenu(popupMenu); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -685,6 +653,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
evt.getY() - 1); |
|
|
|
evt.getY() - 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void mouseMoved(MouseEvent e) { |
|
|
|
public void mouseMoved(MouseEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -693,35 +662,26 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 检查按钮可用状态 Check button enabled. |
|
|
|
* 检查按钮可用状态 Check button enabled. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public void checkButtonEnabled() { |
|
|
|
public void checkButtonEnabled() { |
|
|
|
|
|
|
|
|
|
|
|
int selectedIndex = nameableList.getSelectedIndex(); |
|
|
|
int selectedIndex = nameableList.getSelectedIndex(); |
|
|
|
if (selectedIndex == -1) { |
|
|
|
if (selectedIndex == -1) { |
|
|
|
this.cardLayout.show(cardPane, "SELECT"); |
|
|
|
this.cardLayout.show(cardPane, "SELECT"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.cardLayout.show(cardPane, "EDIT"); |
|
|
|
this.cardLayout.show(cardPane, "EDIT"); |
|
|
|
} |
|
|
|
} |
|
|
|
for (ShortCut4JControlPane sj : this.shorts) { |
|
|
|
for (ShortCut4JControlPane sj : getShorts()) { |
|
|
|
sj.checkEnable(); |
|
|
|
sj.checkEnable(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void doBeforeRemove() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void doAfterRemove() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public NameableCreator[] creators() { |
|
|
|
|
|
|
|
return creators == null ? new NameableCreator[0] : creators; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Nameable的ListCellRenerer |
|
|
|
* Nameable的ListCellRenerer |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private class NameableListCellRenderer extends |
|
|
|
private class NameableListCellRenderer extends |
|
|
|
DefaultListCellRenderer { |
|
|
|
DefaultListCellRenderer { |
|
|
|
|
|
|
|
@Override |
|
|
|
public Component getListCellRendererComponent(JList list, Object value, |
|
|
|
public Component getListCellRendererComponent(JList list, Object value, |
|
|
|
int index, boolean isSelected, boolean cellHasFocus) { |
|
|
|
int index, boolean isSelected, boolean cellHasFocus) { |
|
|
|
super.getListCellRendererComponent(list, value, index, isSelected, |
|
|
|
super.getListCellRendererComponent(list, value, index, isSelected, |
|
|
@ -732,7 +692,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
this.setText(((ListModelElement) value).wrapper.getName()); |
|
|
|
this.setText(((ListModelElement) value).wrapper.getName()); |
|
|
|
|
|
|
|
|
|
|
|
boolean iconSet = false; |
|
|
|
boolean iconSet = false; |
|
|
|
for (NameableCreator creator : JListControlPane.this.creators) { |
|
|
|
for (NameableCreator creator : JListControlPane.this.creators()) { |
|
|
|
if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) { |
|
|
|
if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) { |
|
|
|
this.setIcon(creator.menuIcon()); |
|
|
|
this.setIcon(creator.menuIcon()); |
|
|
|
this.setToolTipText(creator.createTooltip()); |
|
|
|
this.setToolTipText(creator.createTooltip()); |
|
|
@ -757,6 +717,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 检查是否可用 |
|
|
|
* 检查是否可用 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public void checkEnable() { |
|
|
|
public void checkEnable() { |
|
|
|
this.shortCut.setEnabled(true); |
|
|
|
this.shortCut.setEnabled(true); |
|
|
|
} |
|
|
|
} |
|
|
@ -770,6 +731,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 检查是否可用 |
|
|
|
* 检查是否可用 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public void checkEnable() { |
|
|
|
public void checkEnable() { |
|
|
|
this.shortCut.setEnabled(getModel() |
|
|
|
this.shortCut.setEnabled(getModel() |
|
|
|
.getSize() > 0 |
|
|
|
.getSize() > 0 |
|
|
@ -836,6 +798,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initUpdatePane() { |
|
|
|
private void initUpdatePane() { |
|
|
|
|
|
|
|
NameableCreator[] creators = creators(); |
|
|
|
if (creators == null) { |
|
|
|
if (creators == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -855,6 +818,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
elEditing = el; |
|
|
|
elEditing = el; |
|
|
|
|
|
|
|
NameableCreator[] creators = creators(); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0, len = updatePanes.length; i < len; i++) { |
|
|
|
for (int i = 0, len = updatePanes.length; i < len; i++) { |
|
|
|
Object ob2Populate = creators[i].acceptObject2Populate(el.wrapper); |
|
|
|
Object ob2Populate = creators[i].acceptObject2Populate(el.wrapper); |
|
|
@ -884,13 +848,14 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void update() { |
|
|
|
public void update() { |
|
|
|
|
|
|
|
NameableCreator[] creators = creators(); |
|
|
|
for (int i = 0; i < updatePanes.length; i++) { |
|
|
|
for (int i = 0; i < updatePanes.length; i++) { |
|
|
|
BasicBeanPane pane = updatePanes[i]; |
|
|
|
BasicBeanPane pane = updatePanes[i]; |
|
|
|
|
|
|
|
|
|
|
|
if (pane != null && pane.isVisible()) { |
|
|
|
if (pane != null && pane.isVisible()) { |
|
|
|
Object bean = pane.updateBean(); |
|
|
|
Object bean = pane.updateBean(); |
|
|
|
if (i < JListControlPane.this.creators.length) { |
|
|
|
if (i < creators.length) { |
|
|
|
JListControlPane.this.creators[i].saveUpdatedBean(elEditing, bean); |
|
|
|
creators[i].saveUpdatedBean(elEditing, bean); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -937,8 +902,9 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
|
|
|
|
|
|
|
|
// 选项添加个数有限制等情况下 要求能控制快捷按钮的状态
|
|
|
|
// 选项添加个数有限制等情况下 要求能控制快捷按钮的状态
|
|
|
|
protected void setToolbarDefEnable(int shortCutIndex, int itemIndex, boolean enabled) { |
|
|
|
protected void setToolbarDefEnable(int shortCutIndex, int itemIndex, boolean enabled) { |
|
|
|
if (this.toolbarDef.getShortCutCount() > shortCutIndex) { |
|
|
|
ToolBarDef toolbarDef = getToolbarDef(); |
|
|
|
ShortCut sc = this.toolbarDef.getShortCut(shortCutIndex); |
|
|
|
if (toolbarDef.getShortCutCount() > shortCutIndex) { |
|
|
|
|
|
|
|
ShortCut sc = toolbarDef.getShortCut(shortCutIndex); |
|
|
|
if (sc instanceof AddItemMenuDef) { |
|
|
|
if (sc instanceof AddItemMenuDef) { |
|
|
|
AddItemMenuDef am = (AddItemMenuDef) sc; |
|
|
|
AddItemMenuDef am = (AddItemMenuDef) sc; |
|
|
|
if (am.getShortCutCount() > itemIndex) { |
|
|
|
if (am.getShortCutCount() > itemIndex) { |
|
|
@ -953,6 +919,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
* |
|
|
|
* |
|
|
|
* @throws Exception |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public void checkValid() throws Exception { |
|
|
|
public void checkValid() throws Exception { |
|
|
|
((JControlUpdatePane) this.controlUpdatePane).checkValid(); |
|
|
|
((JControlUpdatePane) this.controlUpdatePane).checkValid(); |
|
|
|
} |
|
|
|
} |
|
|
@ -973,6 +940,7 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
protected boolean hasInvalid(boolean isAdd) { |
|
|
|
protected boolean hasInvalid(boolean isAdd) { |
|
|
|
int idx = JListControlPane.this.getInValidIndex(); |
|
|
|
int idx = JListControlPane.this.getInValidIndex(); |
|
|
|
if (isAdd || nameableList.getSelectedIndex() != idx) { |
|
|
|
if (isAdd || nameableList.getSelectedIndex() != idx) { |
|
|
@ -987,13 +955,4 @@ public abstract class JListControlPane extends JControlPane { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 设置选中项 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param index 选中项的序列号 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setSelectedIndex(int index) { |
|
|
|
|
|
|
|
nameableList.setSelectedIndex(index); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |