|
|
@ -78,6 +78,16 @@ public abstract class UpdateAction extends ShortCut implements Action { |
|
|
|
|
|
|
|
|
|
|
|
private String searchText = StringUtils.EMPTY; |
|
|
|
private String searchText = StringUtils.EMPTY; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 按钮在按压状态的图标key |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static final String PRESSED_ICON = "pressedIcon"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 按钮在灰化状态的图标key |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static final String DISABLED_ICON = "disabledIcon"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -251,6 +261,14 @@ public abstract class UpdateAction extends ShortCut implements Action { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setPressedIcon(Icon pressedIcon) { |
|
|
|
|
|
|
|
this.putValue(UpdateAction.PRESSED_ICON, pressedIcon); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setDisabledIcon(Icon disabledIcon) { |
|
|
|
|
|
|
|
this.putValue(UpdateAction.DISABLED_ICON, disabledIcon); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { |
|
|
|
public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { |
|
|
|
|
|
|
|
|
|
|
@ -271,6 +289,8 @@ public abstract class UpdateAction extends ShortCut implements Action { |
|
|
|
UIMenuItem menuItem = new UIMenuItem(this); |
|
|
|
UIMenuItem menuItem = new UIMenuItem(this); |
|
|
|
// 设置名字用作单元测
|
|
|
|
// 设置名字用作单元测
|
|
|
|
menuItem.setName(getName()); |
|
|
|
menuItem.setName(getName()); |
|
|
|
|
|
|
|
setPressedIcon4Button(menuItem); |
|
|
|
|
|
|
|
setDisabledIcon4Button(menuItem); |
|
|
|
object = menuItem; |
|
|
|
object = menuItem; |
|
|
|
|
|
|
|
|
|
|
|
this.putValue(UIMenuItem.class.getName(), object); |
|
|
|
this.putValue(UIMenuItem.class.getName(), object); |
|
|
@ -282,6 +302,8 @@ public abstract class UpdateAction extends ShortCut implements Action { |
|
|
|
UIMenuEastAttrItem menuItem = new UIMenuEastAttrItem(this); |
|
|
|
UIMenuEastAttrItem menuItem = new UIMenuEastAttrItem(this); |
|
|
|
// 设置名字用作单元测
|
|
|
|
// 设置名字用作单元测
|
|
|
|
menuItem.setName(getName()); |
|
|
|
menuItem.setName(getName()); |
|
|
|
|
|
|
|
setPressedIcon4Button(menuItem); |
|
|
|
|
|
|
|
setDisabledIcon4Button(menuItem); |
|
|
|
this.putValue(UIMenuItem.class.getName(), menuItem); |
|
|
|
this.putValue(UIMenuItem.class.getName(), menuItem); |
|
|
|
return menuItem; |
|
|
|
return menuItem; |
|
|
|
} |
|
|
|
} |
|
|
@ -307,6 +329,8 @@ public abstract class UpdateAction extends ShortCut implements Action { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); |
|
|
|
button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); |
|
|
|
|
|
|
|
setPressedIcon4Button(button); |
|
|
|
|
|
|
|
setDisabledIcon4Button(button); |
|
|
|
button.addActionListener(this); |
|
|
|
button.addActionListener(this); |
|
|
|
|
|
|
|
|
|
|
|
button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); |
|
|
|
button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); |
|
|
@ -454,6 +478,8 @@ public abstract class UpdateAction extends ShortCut implements Action { |
|
|
|
object = new UseMenuItem(this); |
|
|
|
object = new UseMenuItem(this); |
|
|
|
this.putValue(UseMenuItem.class.getName(), object); |
|
|
|
this.putValue(UseMenuItem.class.getName(), object); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
setPressedIcon4Button((UseMenuItem) object); |
|
|
|
|
|
|
|
setDisabledIcon4Button((UseMenuItem) object); |
|
|
|
return (UseMenuItem) object; |
|
|
|
return (UseMenuItem) object; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -594,4 +620,17 @@ public abstract class UpdateAction extends ShortCut implements Action { |
|
|
|
shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator); |
|
|
|
shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
private void setPressedIcon4Button(AbstractButton button) { |
|
|
|
|
|
|
|
Icon pressedIcon = (Icon) this.getValue(UpdateAction.PRESSED_ICON); |
|
|
|
|
|
|
|
if (pressedIcon != null) { |
|
|
|
|
|
|
|
button.setPressedIcon(pressedIcon); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setDisabledIcon4Button(AbstractButton button) { |
|
|
|
|
|
|
|
Icon disabledIcon = (Icon) this.getValue(UpdateAction.DISABLED_ICON); |
|
|
|
|
|
|
|
if (disabledIcon != null) { |
|
|
|
|
|
|
|
button.setDisabledIcon(disabledIcon); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|