Package de.iritgo.aktera.ui.form

Examples of de.iritgo.aktera.ui.form.CommandDescriptor


    if (oldFormular != null)
    {
      formular.setPersistents(oldFormular.getPersistents());
    }

    CommandDescriptor commands = formular.getCommands();

    if (! readOnly && cmdSave != null && cmdSave.getModel() != null)
    {
      commands.add((CommandInfo) cmdSave.clone());
    }
    else
    {
      if (cmdEdit != null && cmdEdit.getModel() != null)
      {
        CommandInfo cmd = (CommandInfo) cmdEdit.clone();

        cmd.addParameter("id", id);
        commands.add(cmd);
      }
    }

    if (commandConfig.size() > 0)
    {
      for (Iterator i = commandConfig.iterator(); i.hasNext();)
      {
        Configuration aCommandConfig = (Configuration) i.next();

        CommandInfo cmdInfo = new CommandInfo(aCommandConfig.getAttribute("model"), aCommandConfig
                .getAttribute("id"), aCommandConfig.getAttribute("label"), aCommandConfig.getAttribute(
                "icon", null));

        cmdInfo.setBundle(aCommandConfig.getAttribute("bundle", "Aktera"));

        commands.add(cmdInfo);
      }
    }

    if (cmdCancel != null && cmdCancel.getModel() != null)
    {
      commands.add((CommandInfo) cmdCancel.clone());
    }

    commands.sortCommands();

    UserTools.setContextObject(request, persistentsId, formular);

    return formular;
  }
View Full Code Here


        cmd.setBean(true);
      }

      cmd.setIcon(commandConfig.getAttribute("icon", null));

      CommandDescriptor command = field.getCommands().add(cmd);

      command.setBundle(commandConfig.getAttribute("bundle", field.getBundle() != null ? field.getBundle()
              : formular.getBundle()));

      Configuration[] parameterChildren = commandConfig.getChildren("parameter");

      for (Configuration parameterConfig : parameterChildren)
      {
        command.withParameter(parameterConfig.getAttribute("name"), parameterConfig.getAttribute("value"));
      }

      parameterChildren = commandConfig.getChildren("param");

      for (Configuration parameterConfig : parameterChildren)
      {
        command.withParameter(parameterConfig.getAttribute("name"), parameterConfig.getAttribute("value"));
      }

      Configuration[] attributeChildren = commandConfig.getChildren("attribute");

      for (Configuration attributeConfig : attributeChildren)
      {
        command.withParameter(attributeConfig.getAttribute("name"), attributeConfig.getAttribute("value"));
      }
    }
  }
View Full Code Here

    listing.setCommand(ListingDescriptor.COMMAND_BACK, cmdBack);
    listing.setCommand(ListingDescriptor.COMMAND_EXECUTE, cmdExecute);

    if (commandConfig.size() > 0)
    {
      CommandDescriptor cmdDescriptor = new CommandDescriptor();

      for (Iterator i = commandConfig.iterator(); i.hasNext();)
      {
        Configuration aCommandConfig = (Configuration) i.next();

        String permission = aCommandConfig.getAttribute("permission", null);

        if (permission != null && ! UserTools.currentUserHasPermission(request, permission))
        {
          continue;
        }

        String role = aCommandConfig.getAttribute("role", null);

        if (role != null && ! UserTools.currentUserIsInGroup(request, role))
        {
          continue;
        }

        CommandInfo cmdInfo = new CommandInfo(aCommandConfig.getAttribute("model"), aCommandConfig
                .getAttribute("id"), aCommandConfig.getAttribute("label"), aCommandConfig.getAttribute(
                "icon", null));

        cmdInfo.setBundle(aCommandConfig.getAttribute("bundle", "Aktera"));

        Configuration[] params = aCommandConfig.getChildren("param");

        setParameters(cmdInfo, params);

        cmdDescriptor.add(cmdInfo);
      }

      listing.setListCommands(cmdDescriptor);
    }

    if (! overview && itemCommandConfig.size() > 0)
    {
      CommandDescriptor cmdDescriptor = new CommandDescriptor("selectedItems");

      for (Iterator i = itemCommandConfig.iterator(); i.hasNext();)
      {
        Configuration aItemCommandConfig = (Configuration) i.next();

        if (! NumberTools.toBool(aItemCommandConfig.getAttribute("visible", "true"), true))
        {
          continue;
        }

        if (cmdDescriptor.hasCommand(aItemCommandConfig.getAttribute("id")))
        {
          continue;
        }

        CommandInfo cmdInfo = new CommandInfo(aItemCommandConfig.getAttribute("model", aItemCommandConfig
                .getAttribute("bean", null)), aItemCommandConfig.getAttribute("id"), aItemCommandConfig
                .getAttribute("label"), aItemCommandConfig.getAttribute("icon", null));

        cmdInfo.setStyle(aItemCommandConfig.getAttribute("style", null));
        cmdInfo.setBundle(aItemCommandConfig.getAttribute("bundle", "Aktera"));

        if (aItemCommandConfig.getAttribute("bean", null) != null)
        {
          cmdInfo.setBean(true);
        }

        Configuration[] params = aItemCommandConfig.getChildren("param");

        setParameters(cmdInfo, params);

        cmdDescriptor.add(cmdInfo);
      }

      listing.setItemCommands(cmdDescriptor);
    }
View Full Code Here

TOP

Related Classes of de.iritgo.aktera.ui.form.CommandDescriptor

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.