Package org.springframework.richclient.command

Examples of org.springframework.richclient.command.ActionCommand


        if (!StringUtils.hasText(commandId)) {
            return null;
        }

        ActionCommand newDetailObjectCommand = new ActionCommand(commandId) {

            protected void doExecuteCommand() {
                maybeCloneObject(); // Avoid losing user edits
            }
        };
        String scid = constructSecurityControllerId(commandId);
        newDetailObjectCommand.setSecurityControllerId(scid);
        return (ActionCommand) getCommandConfigurer().configure(newDetailObjectCommand);
    }
View Full Code Here


        if (!StringUtils.hasText(commandId)) {
            return null;
        }

        ActionCommand printObjectCommand = new ActionCommand(commandId) {

            @Override
            protected void doExecuteCommand() {
                Iterator<T> iter = new Iterator<T>() {

                    private ListSelectionModel sm = getSelectionModel();
                    private int max = sm.getMaxSelectionIndex();
                    private int index = sm.getMinSelectionIndex();

                    @Override
                    public boolean hasNext() {
                        if (sm.isSelectionEmpty())
                            return false;
                        for (; index <= max; index++) {
                            if (sm.isSelectedIndex(index))
                                return true;
                        }
                        return false;
                    }

                    @Override
                    public T next() {
                        if (hasNext())
                            return (T) getMasterEventList().get(index++);

                        throw new NoSuchElementException("No further elements were selected! Check this via hasNext before!");
                    }

                    @Override
                    public void remove() {
                        throw new UnsupportedOperationException("Not supported yet.");
                    }
                };

                printAction(iter);
            }
        };
        String scid = constructSecurityControllerId(commandId);

        printObjectCommand.setSecurityControllerId(scid);
        return (ActionCommand) getCommandConfigurer().configure(printObjectCommand);
    }
View Full Code Here

    private ListUtils() {

    }

    public static ActionCommand createRemoveRowCommand(final List list, final ValueModel selectionIndexHolder) {
        ActionCommand removeCommand = new ActionCommand("removeCommand") {
            protected void doExecuteCommand() {
                int selectedRowIndex = ((Integer) selectionIndexHolder.getValue()).intValue();
                list.remove(selectedRowIndex);
            }
        };
View Full Code Here

  public void registerAccelerators() {
    CommandManager commandManager = getCommandManager();
    Keymap keymap = new DefaultKeymap(getClass().getName(), textComponent.getKeymap());
    for (int i = 0; i < COMMANDS.length; i++) {
      ActionCommand command = commandManager.getActionCommand(COMMANDS[i]);
      keymap.addActionForKeyStroke(command.getAccelerator(), command.getActionAdapter());
    }
    if (COMMANDS.length > 0) {
      textComponent.setKeymap(keymap);
    }
  }
View Full Code Here

                null, options, options[initialValue]);
    }

    public static ActionCommand createDummyCommand(final String id, final String msg)
    {
        ActionCommand newCommand = new ActionCommand(id)
        {

            protected void doExecuteCommand()
            {
                System.out.println(msg);
View Full Code Here

  /**
   * Initialize the standard commands needed on a Dialog: Ok/Cancel.
   */
  private void initStandardCommands() {
    finishCommand = new ActionCommand(getFinishCommandId()) {
      public void doExecuteCommand() {
        boolean result = onFinish();
        if (result) {
          if (getDisplayFinishSuccessMessage()) {
            showFinishSuccessMessageDialog();
          }
          executeCloseAction();
        }
      }
    };
    finishCommand.setSecurityControllerId(getFinishSecurityControllerId());
    finishCommand.setEnabled(defaultEnabled);

    cancelCommand = new ActionCommand(getCancelCommandId()) {

      public void doExecuteCommand() {
        onCancel();
      }
    };
View Full Code Here

  /**
   * Returns the message to use upon succesful finish.
   */
  protected String getFinishSuccessMessage() {
    ActionCommand callingCommand = getCallingCommand();
    if (callingCommand != null) {
      String[] successMessageKeys = new String[] { callingCommand.getId() + "." + SUCCESS_FINISH_MESSAGE_KEY,
          DEFAULT_FINISH_SUCCESS_MESSAGE_KEY };
      return getMessage(successMessageKeys, getFinishSuccessMessageArguments());
    }
    return getMessage(DEFAULT_FINISH_SUCCESS_MESSAGE_KEY);
  }
View Full Code Here

  /**
   * Returns the title to use upon succesful finish.
   */
  protected String getFinishSuccessTitle() {
    ActionCommand callingCommand = getCallingCommand();
    if (callingCommand != null) {
      String[] successTitleKeys = new String[] { callingCommand.getId() + "." + SUCCESS_FINISH_TITLE_KEY,
          DEFAULT_FINISH_SUCCESS_TITLE_KEY };
      return getMessage(successTitleKeys, getFinishSuccessTitleArguments());
    }
    return getMessage(DEFAULT_FINISH_SUCCESS_TITLE_KEY);
  }
View Full Code Here

    /**
     * When commands are created, lookup the login command and execute it.
     */
    public void onCommandsCreated(ApplicationWindow window)
    {
        ActionCommand command = (ActionCommand) window.getCommandManager().getCommand("loginCommand", ActionCommand.class);
        command.execute();
    }
View Full Code Here

    return builder;
  }

  public ActionCommand getPrintFormObjectCommand() {
    if (printFormObjectCommand == null) {
      printFormObjectCommand = new ActionCommand(getPrintFormObjectCommandFaceDescriptorId()) {

        protected void doExecuteCommand() {
          getMessageArea().append(getFormObjectDetails(new StringBuilder(), getFormModel()).toString());
        }
      };
View Full Code Here

TOP

Related Classes of org.springframework.richclient.command.ActionCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.