Examples of ActionDef


Examples of bm.ui.def.view.ActionDef

    {
        final Vector actions = def.getActions();
        final int count = actions.size();
        for( int i = 0; i < count; i++ )
        {
            final ActionDef actionDef = (ActionDef) actions.elementAt( i );
            boolean active;
            if( actionDef.getOnlyIf() != null )
            {
                active = flags.contains( actionDef.getOnlyIf() );
            }
            else if( actionDef.getUnless() != null )
            {
                active = !flags.contains( actionDef.getUnless() );
            }
            else
            {
                active = actionDef.isActive();
            }
            final String actionName = actionDef.getName();
            final boolean forItem = actionDef.getFor() != null;
            final int code = actionDef.getCode();
            Command command = Application.getCommandFactory().getCommand( code );
            if( command == null )
            {
                command = new Command(
                        ResourceManager.getResource( actionDef.getLabel() ),
                        forItem ?
                            Command.ITEM :
                            actionDef.getType() != null ?
                                actionDef.getType().intValue() :
                                Command.SCREEN,
                        actionDef.getOrder() != -1 ?
                            actionDef.getOrder() :
                            i + 1
                );
            }
            if( view instanceof DataFormView && forItem )
            {
                final Item item = ((DataFormView) view).getItem(
                        actionDef.getFor()
                );
                final Action action = new Action(
                        actionName,
                        command,
                        code,
                        item,
                        actionDef.getDefault() != null &&
                            actionDef.getDefault().booleanValue()
                );
                view.addAction( action, active );
            }
            else
            {
                view.addAction( new Action(
                        actionName,
                        command,
                        code,
                        null,
                        actionDef.getDefault() != null &&
                            actionDef.getDefault().booleanValue()
                ), active );
            }
        }
    }
View Full Code Here

Examples of jodd.madvoc.ActionDef

    if (resultBasePath != null) {
      resultBasePath = replaceActionNameMacros(resultBasePath, actionNames);
    }

    return new ActionDef(path, httpMethod, resultBasePath);
  }
View Full Code Here

Examples of jodd.madvoc.ActionDef

    Object action = new Object();
    ActionConfig actionConfig = new ActionConfig(
        Action.class,
        ReflectUtil.findMethod(Action.class, "view"),
        null, null,
        new ActionDef(actionPath, "GET"),
        null, false, null, null);

    return new ActionRequest(madvocController, actionConfig.getActionPath(), actionConfig, action, servletRequest, servletResponse);
  }
View Full Code Here

Examples of jodd.madvoc.ActionDef

  public void testActionPathMacros1() {
    WebApplication webapp = new WebApplication(true);
    webapp.registerMadvocComponents();
    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);

    actionsManager.register(FooAction.class, "one", new ActionDef("/${one}"));

    ActionConfig actionConfig = actionsManager.lookup("/foo", null);
    assertNotNull(actionConfig);

    actionConfig = actionsManager.lookup("/foo/boo", null);
View Full Code Here

Examples of jodd.madvoc.ActionDef

  public void testActionPathMacros2() {
    WebApplication webapp = new WebApplication(true);
    webapp.registerMadvocComponents();
    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);

    actionsManager.register(FooAction.class, "one", new ActionDef("/${one}"));
    actionsManager.register(FooAction.class, "two", new ActionDef("/xxx-${two}"));

    ActionConfig actionConfig = actionsManager.lookup("/foo", null);
    assertEquals("one", actionConfig.actionClassMethod.getName());

    actionConfig = actionsManager.lookup("/foo/boo", null);
View Full Code Here

Examples of jodd.madvoc.ActionDef

  public void testActionPathMacros3() {
    WebApplication webapp = new WebApplication(true);
    webapp.registerMadvocComponents();
    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);

    actionsManager.register(FooAction.class, "one", new ActionDef("/yyy-${one}"));
    actionsManager.register(FooAction.class, "two", new ActionDef("/xxx-${two}"));

    assertEquals(2, actionsManager.getActionsCount());

    ActionConfig actionConfig = actionsManager.lookup("/foo", null);
    assertNull(actionConfig);

    actionConfig = actionsManager.lookup("/yyy-111", null);
    assertEquals("one", actionConfig.actionClassMethod.getName());

    actionConfig = actionsManager.lookup("/xxx-222", null);
    assertEquals("two", actionConfig.actionClassMethod.getName());

    try {
      actionsManager.register(FooAction.class, "two", new ActionDef("/xxx-${two}"));
      Assert.fail();
    } catch (Exception ex) {
      // ignore
    }
  }
View Full Code Here

Examples of jodd.madvoc.ActionDef

  public void testActionPathMacros4() {
    WebApplication webapp = new WebApplication(true);
    webapp.registerMadvocComponents();
    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);

    actionsManager.register(FooAction.class, "one", new ActionDef("/${one}"));
    actionsManager.register(FooAction.class, "one", new ActionDef("/dummy"));    // no macro
    actionsManager.register(FooAction.class, "two", new ActionDef("/${two}/${three}"));
    actionsManager.register(FooAction.class, "three", new ActionDef("/life/${three}"));

    ActionConfig actionConfig = actionsManager.lookup("/foo", null);
    assertEquals("one", actionConfig.actionClassMethod.getName());

     actionConfig = actionsManager.lookup("/scott/ramonna", null);
View Full Code Here

Examples of jodd.madvoc.ActionDef

    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);

    MadvocConfig madvocConfig = webapp.getComponent(MadvocConfig.class);
    madvocConfig.setPathMacroClass(RegExpPathMacros.class);

    actionsManager.register(FooAction.class, "one", new ActionDef("/${one:[ab]+}"));

    ActionConfig actionConfig = actionsManager.lookup("/a", null);
    assertNotNull(actionConfig);

    actionConfig = actionsManager.lookup("/ac", null);
View Full Code Here

Examples of jodd.madvoc.ActionDef

    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);

    MadvocConfig madvocConfig = webapp.getComponent(MadvocConfig.class);
    madvocConfig.setPathMacroClass(WildcardPathMacros.class);

    actionsManager.register(FooAction.class, "one", new ActionDef("/${one:a?a}"));

    ActionConfig actionConfig = actionsManager.lookup("/aaa", null);
    assertNotNull(actionConfig);

    actionConfig = actionsManager.lookup("/aab", null);
View Full Code Here

Examples of jodd.madvoc.ActionDef

      ActionFilter[] actionFilterInstances = filtersManager.resolveAll(actionFilters);

      ActionInterceptor[] actionInterceptorInstances = interceptorsManager.resolveAll(actionInterceptors);

      ActionDef actionDef;
      if (resultBasePath != null) {
        actionDef = new ActionDef(actionPath, method, resultBasePath);
      }
      else {
        actionDef = new ActionDef(actionPath, method);
      }

      ActionConfig actionConfig =
          actionMethodParser.createActionConfig(
              actionClass, actionClassMethod,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.