Package org.springframework.richclient.command

Examples of org.springframework.richclient.command.ActionCommand


  private final ActionCommand createRevertCommand() {
    String commandId = getRevertCommandFaceDescriptorId();
    if (!StringUtils.hasText(commandId)) {
      return null;
    }
    ActionCommand revertCmd = new ActionCommand(commandId) {
      protected void doExecuteCommand() {
        revert();
      }
    };
    attachFormGuard(revertCmd, FormGuard.LIKE_REVERTCOMMAND);
View Full Code Here


    protected ActionCommand getSelectNoneCommand()
    {
      if (selectNoneCommand == null)
      {
        selectNoneCommand = new ActionCommand(getSelectNoneCommandId()) {
          public void doExecuteCommand() {
            onSelectNone();
          }
        };
        selectNoneCommand.setSecurityControllerId(getFinishSecurityControllerId());
View Full Code Here

     * Test that the authorized state overrides the enabled state
     */
    public void testAuthorizedOverridesEnabled() {
        ApplicationSecurityManager securityManager = (ApplicationSecurityManager)ApplicationServicesLocator.services().getService(ApplicationSecurityManager.class);
        CommandManager cmgr = Application.instance().getActiveWindow().getCommandManager();
        ActionCommand cmdWrite = cmgr.getActionCommand( "cmdWrite" );

        // We start with no authentication, so nothing should be authorized
        assertFalse( "Object should not be authorized", cmdWrite.isAuthorized() );
        assertFalse( "Object should not be enabled", cmdWrite.isEnabled() );

        // Try to enable them, should not happen
        cmdWrite.setEnabled( true );
        assertFalse( "Object should not be enabled", cmdWrite.isEnabled() );

        // Now authorize it
        Authentication auth = TestAuthenticationManager.makeAuthentication( "test", "test", "ROLE_WRITE" );
        securityManager.doLogin( auth );

        assertTrue( "Object should be authorized", cmdWrite.isAuthorized() );
        assertTrue( "Object should be enabled", cmdWrite.isEnabled() );

        // Now we should be able to disable and re-enabled it
        cmdWrite.setEnabled( false );
        assertFalse( "Object should not be enabled", cmdWrite.isEnabled() );
        cmdWrite.setEnabled( true );
        assertTrue( "Object should be enabled", cmdWrite.isEnabled() );

        // Now leave it disabled, remove the authorization, re-authorize and it
        // should still be disabled
        cmdWrite.setEnabled( false );
        assertFalse( "Object should not be enabled", cmdWrite.isEnabled() );
        securityManager.doLogout();

        assertFalse( "Object should not be authorized", cmdWrite.isAuthorized() );
        assertFalse( "Object should not be enabled", cmdWrite.isEnabled() );

        securityManager.doLogin( auth );

        assertTrue( "Object should be authorized", cmdWrite.isAuthorized() );
        assertFalse( "Object should not be enabled", cmdWrite.isEnabled() );
    }
View Full Code Here

        buttonBar.setOpaque(false);
        return buttonBar;
    }

    protected Object[] getIntroPageCommandGroupMembers() {
        nextCommand = new ActionCommand("nextCommand") {
            public void doExecuteCommand() {
                onNext();
            }
        };
View Full Code Here

    //configurer.setShowToolBar(false);
    configurer.setInitialSize(new Dimension(640, 480));
  }

  public void onCommandsCreated(ApplicationWindow window) {
    ActionCommand command = window.getCommandManager().getActionCommand("loginCommand");
    command.execute();
  }
View Full Code Here

    if ( condition != null && !condition.isValid() ) {
      return null;
    }

    if ( provider != null ) {
      ActionCommand command = provider.getCommand( object );

      if ( configurer != null ) {
        configurer.configure( command );
      }
View Full Code Here

  public EditableAspect( @NotNull final Editor<T> editor ) {
    this( new CommandProvider<ObjectTablePanel<T>>() {
      @NotNull
      @Override
      public ActionCommand getCommand( @NotNull final ObjectTablePanel<T> object ) {
        return new ActionCommand( CommandIds.EDIT ) {
          @Override
          protected void doExecuteCommand() {
            ObjectTable<T> objectTable = object.getObjectTable();

            T element = objectTable.getSelectedObject();
View Full Code Here

    getEditCommandBuilder().setProvider( editCommandProvider );
  }

  @Override
  public void apply( @NotNull final ObjectTablePanel<T> panel ) {
    final ActionCommand editCommand = getEditCommandBuilder().getCommand( panel );
    if ( editCommand == null ) {
      return;
    }

    //add the edit command as double click command
View Full Code Here

    //new command
    getNewCommandBuilder().setProvider( new CommandProvider<ObjectTablePanel<T>>() {
      @Override
      @NotNull
      public ActionCommand getCommand( @NotNull ObjectTablePanel<T> object ) {
        return new ActionCommand( NEW_COMMAND_ID ) {
          @Override
          protected void doExecuteCommand() {
            callback.createNewEntry();
          }
        };
View Full Code Here

    } );
  }

  @Override
  public void apply( @NotNull ObjectTablePanel<T> panel ) {
    final ActionCommand theNewCommand = getNewCommand( panel );
    final ActionCommand theDeleteCommand = getDeleteCommand( panel );

    panel.addConfigurer( new PopupConfigurer<T>() {
      @Override
      @NotNull
      protected List<? extends ActionCommand> getCommands( @NotNull ObjectTable<T> objectTable ) {
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.