@Override protected void actionPropertyChanged(Action action, String propertyName) { super.actionPropertyChanged(action, propertyName); if (ACTION_PROPERTY_SPLIT_BUTTON_ENABLED.equals(propertyName) || "enabled".equals(propertyName)) { setButtonEnabled(isSplitButtonEnabled(action)); } else if (Action.SMALL_ICON.equals(propertyName)) { setIconFromAction(action); } else if (SystemInfo.isJdk6Above() && Action.LARGE_ICON_KEY.equals(propertyName)) { setIconFromAction(action); } }
@Override protected void configurePropertiesFromAction(Action action) { super.configurePropertiesFromAction(action); setButtonEnabled(isSplitButtonEnabled(action)); setIconFromAction(action); }
/** * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent) */ public void valueChanged(ListSelectionEvent e) { if (e != null && e.getValueIsAdjusting()) return; TokenInitiative ti = (TokenInitiative) displayList.getSelectedValue(); boolean enabled = (ti != null && hasOwnerPermission(ti.getToken())) ? true : false; CLEAR_INIT_STATE_VALUE.setEnabled(enabled); SET_INIT_STATE_VALUE.setEnabled(enabled); if (menuButton.getAction() == TOGGLE_HOLD_ACTION) { menuButton.setButtonEnabled(enabled); } else { TOGGLE_HOLD_ACTION.setEnabled(enabled); } // endif MAKE_CURRENT_ACTION.setEnabled(enabled && ti != list.getTokenInitiative(list.getCurrent())); REMOVE_TOKEN_ACTION.setEnabled(enabled); ti = (list.getCurrent() >= 0) ? list.getTokenInitiative(list.getCurrent()) : null; if (hasGMPermission() || (ti != null && hasOwnerPermission(ti.getToken()))) { menuButton.setButtonEnabled(true); } else { if (menuButton.getAction() == NEXT_ACTION) menuButton.setButtonEnabled(false); } }
/** * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(InitiativeList.ROUND_PROP)) { String text = list.getRound() < 0 ? "" : Integer.toString(list.getRound()); round.setText(text); } else if (evt.getPropertyName().equals(InitiativeList.CURRENT_PROP)) { if (list.getCurrent() < 0) return; Token t = list.getTokenInitiative(list.getCurrent()).getToken(); if (t == null) return; String s = I18N.getText("initPanel.displayMessage", t.getName()); if (InitiativeListModel.isTokenVisible(t, list.isHideNPC()) && t.getType() != Type.NPC && AppPreferences.isShowInitGainMessage()) MapTool.addMessage(TextMessage.say(null, s)); displayList.ensureIndexIsVisible(model.getDisplayIndex(list.getCurrent())); if (menuButton.getAction() == NEXT_ACTION) menuButton.setButtonEnabled(list.getCurrent() >= 0 && hasOwnerPermission(list.getToken(list.getCurrent()))); } else if (evt.getPropertyName().equals(InitiativeList.TOKENS_PROP)) { if ((evt.getOldValue() == null && evt.getNewValue() instanceof TokenInitiative) || (evt.getNewValue() == null & evt.getOldValue() instanceof TokenInitiative)) displayList.getSelectionModel().clearSelection(); } else if (evt.getPropertyName().equals(InitiativeList.HIDE_NPCS_PROP)) { displayList.getSelectionModel().clearSelection(); } else if (evt.getPropertyName().equals(InitiativeList.OWNER_PERMISSIONS_PROP)) { updateView(); } // endif }
public void run() { model.setList(list); if (menuButton != null && menuButton.getAction() == NEXT_ACTION) menuButton.setButtonEnabled(hasGMPermission() || list.getCurrent() >= 0 && hasOwnerPermission(list.getToken(list.getCurrent()))); if (list.getCurrent() >= 0) { int index = model.getDisplayIndex(list.getCurrent()); if (index >= 0) displayList.ensureIndexIsVisible(index); } } });