private Action getAction(Component component) { if(component instanceof AbstractButton) { return ((AbstractButton) component).getAction(); } // Action cannot be retrieved from this container return null; }
private Action getAction(Component component) { if(component instanceof AbstractButton) { return ((AbstractButton) component).getAction(); } // Action cannot be retrieved from this container return null; }
public void runAction(AbstractButton button) { button.getAction().actionPerformed(null); }
@Override public void actionPerformed(final ActionEvent event) { for (final Action action : this.actions) { action.setEnabled(true); } final Object source = event.getSource(); if (source instanceof AbstractButton) { ((AbstractButton) source).getAction().setEnabled(false); } } }
private String getGroupName(Component component) { Action action = null; if (component instanceof AbstractButton) { action = ((AbstractButton) component).getAction(); } else if (component instanceof Action) { action = (Action) component; } if (action != null) { Object parent = action.getValue("parent"); if (parent != null) { return parent.toString(); } } return ""; } }
public boolean haveSelectorAction() { for (Component comp : extraTools.getComponents()) { if (comp instanceof AbstractButton) { AbstractButton ab = (AbstractButton) comp; if (ab.getAction() instanceof ModelComponentDecorator.ValueSelectorAction) { return true; } } } return false; }
public boolean haveNullerAction() { for (Component comp : extraTools.getComponents()) { if (comp instanceof AbstractButton) { AbstractButton ab = (AbstractButton) comp; if (ab.getAction() instanceof ModelComponentDecorator.NullerAction) { return true; } } } return false; }
public <A extends AbstractApplicationAction> A getLogicAction(AbstractButton b) { Action action = b.getAction(); Preconditions.checkNotNull(action); Preconditions.checkState(action instanceof ApplicationUIAction); return ((ApplicationUIAction<A>) action).getLogicAction(); } }
@Override public final void mouseExited(MouseEvent evt) { if (evt.getSource() instanceof AbstractButton) { AbstractButton button = (AbstractButton) evt.getSource(); Action action = button.getAction(); if (action != null) { setStatusBarMessage(_oldMessage != null ? _oldMessage : " "); } } } }
/** * Returns the action for the radio button. * * @return the {@link Action} or {@code null}. */ public Action getAction() { return getComponent().getAction(); }
Action[] getImageContextActions(){ return new Action[]{ zoomToFitAction , scaleToggleButton.getAction(), rotateLeftModeAction, rotateRightModeAction, getToggleHighlightAction()}; }
public static void install(final AbstractButton button) { Action action = button.getAction(); install(button, action); }
public AbstractButton findButtonWithAction( String actionId ) { int numKids = getComponentCount(); for( int i = 0; i < numKids; i++ ) { Component kid = getComponent( i ); if( kid instanceof AbstractButton && ((AbstractButton)kid).getAction() != null && actionId.equals( ((AbstractButton)kid).getAction().getValue( Action.ACTION_COMMAND_KEY ) ) ) { return (AbstractButton)kid; } } return null; } }
public static void uninstall(final AbstractButton button) { Action action = button.getAction(); uninstall(button, action); }
public AbstractButton findButtonWithAction( String actionId ) { int numKids = getComponentCount(); for( int i = 0; i < numKids; i++ ) { Component kid = getComponent( i ); if( kid instanceof AbstractButton && ((AbstractButton)kid).getAction() != null && actionId.equals( ((AbstractButton)kid).getAction().getValue( Action.ACTION_COMMAND_KEY ) ) ) { return (AbstractButton)kid; } } return null; } }
@Override public final void mouseEntered(MouseEvent evt) { if (evt.getSource() instanceof AbstractButton) { AbstractButton button = (AbstractButton) evt.getSource(); Action action = button.getAction(); if (action != null) { String message = (String) action.getValue(Action.SHORT_DESCRIPTION); if (message != null && message.length() > 0) { _oldMessage = getStatusBarMessage(); setStatusBarMessage(message); } } } }
public Action[] getActions() { ArrayList actions = new ArrayList<Action>(); for (Component c : initEditMenu(true).getMenuComponents()) { Action act = null; if (c instanceof JMenuItem) { JMenuItem mi = (JMenuItem) c; act = mi.getAction(); } else if (c instanceof AbstractButton) { AbstractButton mi = (AbstractButton) c; act = mi.getAction(); } if (act != null) actions.add(act); } return (Action[]) actions.toArray(new Action[actions.size()]); }
private ButtonGroup addActions(List<Action> actions, JMenu menu, boolean selectFirst) { ButtonGroup buttonGroup = addActions(actions, menu); if (selectFirst) { Enumeration<AbstractButton> en = buttonGroup.getElements(); if (en.hasMoreElements()) { StandardAction action = (StandardAction) en.nextElement().getAction(); action.select(true); } } return buttonGroup; }
@Override public void updateUserLocation (Rectangle rect) { for (Component comp : getMenuComponents()) { if (comp instanceof AbstractButton) { Action action = ((AbstractButton) comp).getAction(); if (action instanceof LocationDependent) { ((LocationDependent) action).updateUserLocation(rect); } } } } }
protected void initButton(AbstractButton abstractButton) { Class actionName = (Class) abstractButton.getClientProperty("applicationAction"); if (actionName != null) { Action action = getContext().getActionFactory().createUIAction(this, abstractButton, actionName); abstractButton.setAction(action); } if (abstractButton.getAction() != null) { // get the _applicationActionKey property String key = (String) abstractButton.getClientProperty("applicationActionKey"); if (key != null) { affectKeyStroke(abstractButton, key); } } }