|
|
@ -3,39 +3,37 @@ package com.fr.design.gui.controlpane; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.FRContext; |
|
|
|
import com.fr.base.FRContext; |
|
|
|
import com.fr.base.chart.BasePlot; |
|
|
|
import com.fr.base.chart.BasePlot; |
|
|
|
import com.fr.design.actions.UpdateAction; |
|
|
|
|
|
|
|
import com.fr.design.actions.core.ActionFactory; |
|
|
|
|
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
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.gui.HyperlinkFilterHelper; |
|
|
|
|
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
|
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
|
import com.fr.design.gui.ilist.ListModelElement; |
|
|
|
import com.fr.design.gui.ilist.ListModelElement; |
|
|
|
import com.fr.design.gui.ilist.UINameEdList; |
|
|
|
import com.fr.design.gui.ilist.UINameEdList; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
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.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.stable.Nameable; |
|
|
|
import com.fr.stable.Nameable; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.DefaultListModel; |
|
|
|
|
|
|
|
import javax.swing.JList; |
|
|
|
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
import javax.swing.JPopupMenu; |
|
|
|
|
|
|
|
import javax.swing.ListSelectionModel; |
|
|
|
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import javax.swing.event.ListDataEvent; |
|
|
|
import javax.swing.event.ListDataEvent; |
|
|
|
import javax.swing.event.ListDataListener; |
|
|
|
import javax.swing.event.ListDataListener; |
|
|
|
import javax.swing.event.ListSelectionEvent; |
|
|
|
import javax.swing.event.ListSelectionEvent; |
|
|
|
import javax.swing.event.ListSelectionListener; |
|
|
|
import javax.swing.event.ListSelectionListener; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.event.*; |
|
|
|
import java.awt.Point; |
|
|
|
|
|
|
|
import java.awt.Rectangle; |
|
|
|
|
|
|
|
import java.awt.Toolkit; |
|
|
|
|
|
|
|
import java.awt.Window; |
|
|
|
|
|
|
|
import java.awt.event.InputEvent; |
|
|
|
|
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
|
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
|
|
|
import java.awt.event.MouseListener; |
|
|
|
import java.lang.reflect.Constructor; |
|
|
|
import java.lang.reflect.Constructor; |
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
@ -45,7 +43,7 @@ import java.util.Comparator; |
|
|
|
* Created by plough on 2017/7/19. |
|
|
|
* Created by plough on 2017/7/19. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
public abstract class UIListControlPane extends UIControlPane { |
|
|
|
public abstract class UIListControlPane extends UIControlPane implements ListControlPaneProvider { |
|
|
|
public static final String LIST_NAME = "UIControl_List"; |
|
|
|
public static final String LIST_NAME = "UIControl_List"; |
|
|
|
private static final int EDIT_RANGE = 25; // 编辑按钮的x坐标范围
|
|
|
|
private static final int EDIT_RANGE = 25; // 编辑按钮的x坐标范围
|
|
|
|
|
|
|
|
|
|
|
@ -66,7 +64,7 @@ public abstract class UIListControlPane extends UIControlPane { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected JPanel createControlUpdatePane() { |
|
|
|
protected JPanel createControlUpdatePane() { |
|
|
|
return new JControlUpdatePane(); |
|
|
|
return JControlUpdatePane.newInstance(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -141,55 +139,6 @@ public abstract class UIListControlPane extends UIControlPane { |
|
|
|
((JControlUpdatePane) controlUpdatePane).update(); |
|
|
|
((JControlUpdatePane) controlUpdatePane).update(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void doWhenPopulate(BasicBeanPane beanPane) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void doBeforePopulate(ListModelElement el, Object obj) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected ShortCut4JControlPane addItemShortCut() { |
|
|
|
|
|
|
|
ShortCut addItemShortCut; |
|
|
|
|
|
|
|
NameableCreator[] creators = creators(); |
|
|
|
|
|
|
|
if (creators.length == 1) { |
|
|
|
|
|
|
|
addItemShortCut = new AddItemUpdateAction(creators); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
addItemShortCut = getAddItemMenuDef(creators); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return new AbsoluteEnableShortCut(addItemShortCut); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected AddItemMenuDef getAddItemMenuDef (NameableCreator[] creators) { |
|
|
|
|
|
|
|
return new AddItemMenuDef(creators); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected ShortCut4JControlPane removeItemShortCut() { |
|
|
|
|
|
|
|
return new NormalEnableShortCut(new RemoveItemAction()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected ShortCut4JControlPane copyItemShortCut() { |
|
|
|
|
|
|
|
return new NormalEnableShortCut(new CopyItemAction()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected ShortCut4JControlPane moveUpItemShortCut() { |
|
|
|
|
|
|
|
return new NormalEnableShortCut(new MoveUpItemAction()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected ShortCut4JControlPane moveDownItemShortCut() { |
|
|
|
|
|
|
|
return new NormalEnableShortCut(new MoveDownItemAction()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected ShortCut4JControlPane sortItemShortCut() { |
|
|
|
|
|
|
|
return new NormalEnableShortCut(new SortItemAction()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setNameListEditable(boolean editable) { |
|
|
|
public void setNameListEditable(boolean editable) { |
|
|
|
this.nameableList.setEditable(editable); |
|
|
|
this.nameableList.setEditable(editable); |
|
|
|
} |
|
|
|
} |
|
|
@ -259,22 +208,6 @@ public abstract class UIListControlPane extends UIControlPane { |
|
|
|
popupEditDialog(); |
|
|
|
popupEditDialog(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 是否重命名 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return 是则true |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean isContainsRename() { |
|
|
|
|
|
|
|
String rename = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_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() { |
|
|
|
protected DefaultListModel getModel() { |
|
|
|
return (DefaultListModel) UIListControlPane.this.nameableList.getModel(); |
|
|
|
return (DefaultListModel) UIListControlPane.this.nameableList.getModel(); |
|
|
|
} |
|
|
|
} |
|
|
@ -377,320 +310,148 @@ public abstract class UIListControlPane extends UIControlPane { |
|
|
|
return resultPos; |
|
|
|
return resultPos; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@Override |
|
|
|
* 增加项的UpdateAction |
|
|
|
public void onAddItem(NameableCreator creator) { |
|
|
|
*/ |
|
|
|
Nameable nameable = creator.createNameable(this); |
|
|
|
protected class AddItemUpdateAction extends UpdateAction { |
|
|
|
this.addNameable(nameable, getModel().getSize()); |
|
|
|
final NameableCreator creator; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AddItemUpdateAction(NameableCreator[] creators) { |
|
|
|
|
|
|
|
this.creator = creators[0]; |
|
|
|
|
|
|
|
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Add")); |
|
|
|
|
|
|
|
this.setMnemonic('A'); |
|
|
|
|
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Gets component on toolbar. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return the created components on toolbar. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public JComponent createToolBarComponent() { |
|
|
|
|
|
|
|
Object object = this.getValue(UIButton.class.getName()); |
|
|
|
|
|
|
|
if (!(object instanceof AbstractButton)) { |
|
|
|
|
|
|
|
// 直接使用默认UI
|
|
|
|
|
|
|
|
UIButton button = new UIButton(); |
|
|
|
|
|
|
|
// 添加一个名字作为自动化测试用
|
|
|
|
|
|
|
|
button.setName(getName()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设置属性.
|
|
|
|
|
|
|
|
Integer mnemonicInteger = (Integer) this.getValue(Action.MNEMONIC_KEY); |
|
|
|
|
|
|
|
if (mnemonicInteger != null) { |
|
|
|
|
|
|
|
button.setMnemonic((char) mnemonicInteger.intValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); |
|
|
|
|
|
|
|
button.addActionListener(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.putValue(UIButton.class.getName(), button); |
|
|
|
|
|
|
|
button.setText(StringUtils.EMPTY); |
|
|
|
|
|
|
|
button.setEnabled(this.isEnabled()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//peter:产生tooltip
|
|
|
|
|
|
|
|
button.setToolTipText(ActionFactory.createButtonToolTipText(this)); |
|
|
|
|
|
|
|
object = button; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (JComponent) object; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
Nameable nameable = creator.createNameable(UIListControlPane.this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIListControlPane.this.addNameable(nameable, getModel().getSize()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
@Override |
|
|
|
* 增加项的MenuDef |
|
|
|
public void onRemoveItem() { |
|
|
|
*/ |
|
|
|
try { |
|
|
|
protected class AddItemMenuDef extends MenuDef { |
|
|
|
this.nameableList.getCellEditor().stopCellEditing(); |
|
|
|
public AddItemMenuDef(NameableCreator[] creators) { |
|
|
|
} catch (Exception ignored) { |
|
|
|
super(true); |
|
|
|
// do nothing
|
|
|
|
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Add")); |
|
|
|
} |
|
|
|
this.setMnemonic('A'); |
|
|
|
// bug:在选中一个NameObject并删除,会遗留下Name.
|
|
|
|
this.setIconPath("/com/fr/design/images/control/addPopup.png"); |
|
|
|
doBeforeRemove(); |
|
|
|
wrapActionListener(creators); |
|
|
|
if (GUICoreUtils.removeJListSelectedNodes(SwingUtilities |
|
|
|
|
|
|
|
.getWindowAncestor(this), nameableList)) { |
|
|
|
|
|
|
|
checkButtonEnabled(); |
|
|
|
|
|
|
|
doAfterRemove(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@Override |
|
|
|
* 生成UIButton |
|
|
|
public void onCopyItem() { |
|
|
|
* @return 菜单按钮 |
|
|
|
// p:选中的值.
|
|
|
|
*/ |
|
|
|
ListModelElement selectedValue = (ListModelElement) nameableList.getSelectedValue(); |
|
|
|
public UIButton createUIButton() { |
|
|
|
if (selectedValue == null) { |
|
|
|
createdButton = super.createUIButton(); |
|
|
|
return; |
|
|
|
// 此按钮单独抽出,不应使用工具栏外观
|
|
|
|
|
|
|
|
if (!createdButton.isOpaque()) { |
|
|
|
|
|
|
|
createdButton.setOpaque(true); |
|
|
|
|
|
|
|
createdButton.setNormalPainted(true); |
|
|
|
|
|
|
|
createdButton.setBorderPaintedOnlyWhenPressed(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return createdButton; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void wrapActionListener(NameableCreator[] creators) { |
|
|
|
((JControlUpdatePane) controlUpdatePane).update(); |
|
|
|
for (final NameableCreator creator : creators) { |
|
|
|
|
|
|
|
if (!whetherAdd(creator.menuName())) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
boolean isTrue = ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Datasource-Stored_Procedure")) || |
|
|
|
|
|
|
|
ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Relation_TableData")) || ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
if (hasInvalid(true)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Nameable nameable = creator.createNameable(UIListControlPane.this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIListControlPane.this.addNameable(nameable, getModel().getSize()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected boolean whetherAdd(String itemName){ |
|
|
|
Nameable selectedNameable = selectedValue.wrapper; |
|
|
|
return HyperlinkFilterHelper.whetherAddHyperlink4cell(itemName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
// p: 用反射机制实现
|
|
|
|
* 移除item |
|
|
|
try { |
|
|
|
*/ |
|
|
|
Nameable newNameable = (Nameable) BaseUtils.cloneObject(selectedNameable); |
|
|
|
private class RemoveItemAction extends UpdateAction { |
|
|
|
newNameable.setName(createUnrepeatedCopyName(selectedNameable.getName())); |
|
|
|
public RemoveItemAction() { |
|
|
|
|
|
|
|
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Remove")); |
|
|
|
|
|
|
|
this.setMnemonic('R'); |
|
|
|
|
|
|
|
this.setSmallIcon(BaseUtils |
|
|
|
|
|
|
|
.readIcon("/com/fr/base/images/cell/control/remove.png")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
UIListControlPane.this.addNameable(newNameable, nameableList.getSelectedIndex() + 1); |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
} catch (Exception e) { |
|
|
|
try { |
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
UIListControlPane.this.nameableList.getCellEditor() |
|
|
|
|
|
|
|
.stopCellEditing(); |
|
|
|
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
|
|
|
// do nothing
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// bug:在选中一个NameObject并删除,会遗留下Name.
|
|
|
|
|
|
|
|
doBeforeRemove(); |
|
|
|
|
|
|
|
if (GUICoreUtils.removeJListSelectedNodes(SwingUtilities |
|
|
|
|
|
|
|
.getWindowAncestor(UIListControlPane.this), nameableList)) { |
|
|
|
|
|
|
|
checkButtonEnabled(); |
|
|
|
|
|
|
|
doAfterRemove(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
@Override |
|
|
|
* CopyItem |
|
|
|
public void onMoveUpItem() { |
|
|
|
*/ |
|
|
|
int selectedIndex = nameableList.getSelectedIndex(); |
|
|
|
private class CopyItemAction extends UpdateAction { |
|
|
|
if (selectedIndex == -1) { |
|
|
|
public CopyItemAction() { |
|
|
|
return; |
|
|
|
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Copy")); |
|
|
|
|
|
|
|
this.setMnemonic('C'); |
|
|
|
|
|
|
|
this.setSmallIcon(BaseUtils |
|
|
|
|
|
|
|
.readIcon("/com/fr/design/images/m_edit/copy.png")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
// 上移
|
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
if (selectedIndex > 0) { |
|
|
|
// p:选中的值.
|
|
|
|
DefaultListModel listModel = (DefaultListModel) nameableList |
|
|
|
ListModelElement selectedValue = (ListModelElement) nameableList.getSelectedValue(); |
|
|
|
.getModel(); |
|
|
|
if (selectedValue == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
((JControlUpdatePane) controlUpdatePane).update(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Nameable selectedNameable = selectedValue.wrapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// p: 用反射机制实现
|
|
|
|
Object selecteObj1 = listModel.get(selectedIndex - 1); |
|
|
|
try { |
|
|
|
listModel.set(selectedIndex - 1, listModel.get(selectedIndex)); |
|
|
|
Nameable newNameable = (Nameable) BaseUtils.cloneObject(selectedNameable); |
|
|
|
listModel.set(selectedIndex, selecteObj1); |
|
|
|
newNameable.setName(createUnrepeatedCopyName(selectedNameable.getName())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIListControlPane.this.addNameable(newNameable, nameableList.getSelectedIndex() + 1); |
|
|
|
nameableList.setSelectedIndex(selectedIndex - 1); |
|
|
|
} catch (Exception e) { |
|
|
|
nameableList.ensureIndexIsVisible(selectedIndex - 1); |
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
@Override |
|
|
|
* 上移Item |
|
|
|
public void onMoveDownItem() { |
|
|
|
*/ |
|
|
|
int selectedIndex = nameableList.getSelectedIndex(); |
|
|
|
private class MoveUpItemAction extends UpdateAction { |
|
|
|
if (selectedIndex == -1) { |
|
|
|
public MoveUpItemAction() { |
|
|
|
return; |
|
|
|
this.setName(com.fr.design.i18n.Toolkit.i18nText("Utils-Move_Up")); |
|
|
|
|
|
|
|
this.setMnemonic('U'); |
|
|
|
|
|
|
|
this.setSmallIcon(BaseUtils |
|
|
|
|
|
|
|
.readIcon("/com/fr/design/images/control/up.png")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
if (selectedIndex < nameableList.getModel().getSize() - 1) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
DefaultListModel listModel = (DefaultListModel) nameableList |
|
|
|
int selectedIndex = nameableList.getSelectedIndex(); |
|
|
|
.getModel(); |
|
|
|
if (selectedIndex == -1) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 上移
|
|
|
|
|
|
|
|
if (selectedIndex > 0) { |
|
|
|
|
|
|
|
DefaultListModel listModel = (DefaultListModel) nameableList |
|
|
|
|
|
|
|
.getModel(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object selecteObj1 = listModel.get(selectedIndex - 1); |
|
|
|
Object selecteObj1 = listModel.get(selectedIndex + 1); |
|
|
|
listModel.set(selectedIndex - 1, listModel.get(selectedIndex)); |
|
|
|
listModel.set(selectedIndex + 1, listModel.get(selectedIndex)); |
|
|
|
listModel.set(selectedIndex, selecteObj1); |
|
|
|
listModel.set(selectedIndex, selecteObj1); |
|
|
|
|
|
|
|
|
|
|
|
nameableList.setSelectedIndex(selectedIndex - 1); |
|
|
|
nameableList.setSelectedIndex(selectedIndex + 1); |
|
|
|
nameableList.ensureIndexIsVisible(selectedIndex - 1); |
|
|
|
nameableList.ensureIndexIsVisible(selectedIndex + 1); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
@Override |
|
|
|
* 下移Item |
|
|
|
public void onSortItem(boolean isAtoZ) { |
|
|
|
*/ |
|
|
|
// p:选中的值.
|
|
|
|
private class MoveDownItemAction extends UpdateAction { |
|
|
|
Object selectedValue = nameableList.getSelectedValue(); |
|
|
|
public MoveDownItemAction() { |
|
|
|
|
|
|
|
this.setName(com.fr.design.i18n.Toolkit.i18nText("Utils-Move_Down")); |
|
|
|
DefaultListModel listModel = (DefaultListModel) nameableList |
|
|
|
this.setMnemonic('D'); |
|
|
|
.getModel(); |
|
|
|
this.setSmallIcon(BaseUtils |
|
|
|
Nameable[] nameableArray = new Nameable[listModel.getSize()]; |
|
|
|
.readIcon("/com/fr/design/images/control/down.png")); |
|
|
|
if (nameableArray.length <= 0) { |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
for (int i = 0; i < listModel.getSize(); i++) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
nameableArray[i] = ((ListModelElement) listModel.getElementAt(i)).wrapper; |
|
|
|
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() { |
|
|
|
// p:排序.
|
|
|
|
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Sort")); |
|
|
|
if (isAtoZ) { |
|
|
|
this.setMnemonic('S'); |
|
|
|
Comparator<Nameable> nameableComparator = new Comparator<Nameable>() { |
|
|
|
this.setSmallIcon(BaseUtils |
|
|
|
@Override |
|
|
|
.readIcon("/com/fr/design/images/control/sortAsc.png")); |
|
|
|
public int compare(Nameable o1, Nameable o2) { |
|
|
|
|
|
|
|
return -ComparatorUtils.compare(o1.getName(), o2 |
|
|
|
|
|
|
|
.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
isAtoZ = !isAtoZ; |
|
|
|
|
|
|
|
Arrays.sort(nameableArray, nameableComparator); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Comparator<Nameable> nameableComparator = new Comparator<Nameable>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int compare(Nameable o1, Nameable o2) { |
|
|
|
|
|
|
|
return ComparatorUtils.compare(o1.getName(), o2 |
|
|
|
|
|
|
|
.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
isAtoZ = !isAtoZ; |
|
|
|
|
|
|
|
Arrays.sort(nameableArray, nameableComparator); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
for (int i = 0; i < nameableArray.length; i++) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
listModel.set(i, new ListModelElement(nameableArray[i])); |
|
|
|
// 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<Nameable> nameableComparator = new Comparator<Nameable>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int compare(Nameable o1, Nameable o2) { |
|
|
|
|
|
|
|
return -ComparatorUtils.compare(o1.getName(), o2 |
|
|
|
|
|
|
|
.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
isAtoZ = !isAtoZ; |
|
|
|
|
|
|
|
Arrays.sort(nameableArray, nameableComparator); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Comparator<Nameable> nameableComparator = new Comparator<Nameable>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
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++) { |
|
|
|
// p:需要选中以前的那个值.
|
|
|
|
listModel.set(i, new ListModelElement(nameableArray[i])); |
|
|
|
if (selectedValue != null) { |
|
|
|
} |
|
|
|
nameableList.setSelectedValue(selectedValue, true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// p:需要选中以前的那个值.
|
|
|
|
checkButtonEnabled(); |
|
|
|
if (selectedValue != null) { |
|
|
|
// p:需要repaint.
|
|
|
|
nameableList.setSelectedValue(selectedValue, true); |
|
|
|
nameableList.repaint(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
checkButtonEnabled(); |
|
|
|
@Override |
|
|
|
// p:需要repaint.
|
|
|
|
public boolean isItemSelected() { |
|
|
|
nameableList.repaint(); |
|
|
|
return getModel().getSize() > 0 && nameableList.getSelectedIndex() != -1; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
@ -768,179 +529,7 @@ public abstract class UIListControlPane extends UIControlPane { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BasicBeanPane createPaneByCreators(NameableCreator creator) { |
|
|
|
public class AbsoluteEnableShortCut extends ShortCut4JControlPane { |
|
|
|
|
|
|
|
public AbsoluteEnableShortCut(ShortCut shortCut) { |
|
|
|
|
|
|
|
this.shortCut = shortCut; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 检查是否可用 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void checkEnable() { |
|
|
|
|
|
|
|
this.shortCut.setEnabled(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class NormalEnableShortCut extends ShortCut4JControlPane { |
|
|
|
|
|
|
|
public NormalEnableShortCut(ShortCut shortCut) { |
|
|
|
|
|
|
|
this.shortCut = shortCut; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 检查是否可用 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void checkEnable() { |
|
|
|
|
|
|
|
this.shortCut.setEnabled(getModel() |
|
|
|
|
|
|
|
.getSize() > 0 |
|
|
|
|
|
|
|
&& UIListControlPane.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 |
|
|
|
|
|
|
|
&& UIListControlPane.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 |
|
|
|
|
|
|
|
&& UIListControlPane.this.nameableList.getSelectedIndex() < UIListControlPane.this.nameableList.getModel().getSize() - 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected Object getob2Populate (Object ob2Populate) { |
|
|
|
|
|
|
|
return ob2Populate; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class JControlUpdatePane extends JPanel { |
|
|
|
|
|
|
|
private CardLayout card; |
|
|
|
|
|
|
|
private JPanel cardPane; |
|
|
|
|
|
|
|
private BasicBeanPane[] updatePanes; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ListModelElement elEditing; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JControlUpdatePane() { |
|
|
|
|
|
|
|
initUpdatePane(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initUpdatePane() { |
|
|
|
|
|
|
|
NameableCreator[] creators = creators(); |
|
|
|
|
|
|
|
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) UIListControlPane.this.nameableList.getSelectedValue(); |
|
|
|
|
|
|
|
if (el == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elEditing = el; |
|
|
|
|
|
|
|
NameableCreator[] creators = creators(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0, len = updatePanes.length; i < len; i++) { |
|
|
|
|
|
|
|
Object ob2Populate = creators[i].acceptObject2Populate(el.wrapper); |
|
|
|
|
|
|
|
ob2Populate = getob2Populate(ob2Populate); |
|
|
|
|
|
|
|
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)); |
|
|
|
|
|
|
|
doBeforePopulate(el, ob2Populate); |
|
|
|
|
|
|
|
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() { |
|
|
|
|
|
|
|
NameableCreator[] creators = creators(); |
|
|
|
|
|
|
|
for (int i = 0; i < updatePanes.length; i++) { |
|
|
|
|
|
|
|
BasicBeanPane pane = updatePanes[i]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pane != null && pane.isVisible()) { |
|
|
|
|
|
|
|
Object bean = pane.updateBean(); |
|
|
|
|
|
|
|
if (i < creators.length) { |
|
|
|
|
|
|
|
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 { |
|
|
|
try { |
|
|
|
return creator.getUpdatePane().newInstance(); |
|
|
|
return creator.getUpdatePane().newInstance(); |
|
|
|
} catch (InstantiationException e) { |
|
|
|
} catch (InstantiationException e) { |
|
|
@ -950,7 +539,7 @@ public abstract class UIListControlPane extends UIControlPane { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected BasicBeanPane createPaneByCreators(NameableCreator creator, String string) { |
|
|
|
public BasicBeanPane createPaneByCreators(NameableCreator creator, String string) { |
|
|
|
Constructor constructor = null; |
|
|
|
Constructor constructor = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
constructor = creator.getUpdatePane().getDeclaredConstructor(new Class[]{String.class}); |
|
|
|
constructor = creator.getUpdatePane().getDeclaredConstructor(new Class[]{String.class}); |
|
|
@ -965,21 +554,6 @@ public abstract class UIListControlPane extends UIControlPane { |
|
|
|
} catch (InvocationTargetException e) { |
|
|
|
} catch (InvocationTargetException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 选项添加个数有限制等情况下 要求能控制快捷按钮的状态
|
|
|
|
|
|
|
|
protected void setToolbarDefEnable(int shortCutIndex, int itemIndex, boolean enabled) { |
|
|
|
|
|
|
|
ToolBarDef toolbarDef = getToolbarDef(); |
|
|
|
|
|
|
|
if (toolbarDef.getShortCutCount() > shortCutIndex) { |
|
|
|
|
|
|
|
ShortCut sc = toolbarDef.getShortCut(shortCutIndex); |
|
|
|
|
|
|
|
if (sc instanceof AddItemMenuDef) { |
|
|
|
|
|
|
|
AddItemMenuDef am = (AddItemMenuDef) sc; |
|
|
|
|
|
|
|
if (am.getShortCutCount() > itemIndex) { |
|
|
|
|
|
|
|
am.getShortCut(itemIndex).setEnabled(enabled); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -993,7 +567,7 @@ public abstract class UIListControlPane extends UIControlPane { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private int getInValidIndex() { |
|
|
|
private int getInValidIndex() { |
|
|
|
BasicBeanPane[] p = ((JControlUpdatePane) controlUpdatePane).updatePanes; |
|
|
|
BasicBeanPane[] p = ((JControlUpdatePane) controlUpdatePane).getUpdatePanes(); |
|
|
|
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) { |
|
|
@ -1031,4 +605,8 @@ public abstract class UIListControlPane extends UIControlPane { |
|
|
|
nameableList.setSelectedIndex(index); |
|
|
|
nameableList.setSelectedIndex(index); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public ListModelElement getSelectedElement() { |
|
|
|
|
|
|
|
return (ListModelElement) this.nameableList.getSelectedValue(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|