Package de.iritgo.aktera.model

Examples of de.iritgo.aktera.model.Command


        props[propCount++] = contentProp;
      }

      if (re instanceof Command)
      {
        Command c = (Command) re;

        DynaProperty modelProp = new DynaProperty("model", Class.forName("java.lang.String"));

        props[propCount++] = modelProp;

        DynaProperty beanProp = new DynaProperty("bean", Class.forName("java.lang.String"));

        props[propCount++] = beanProp;

        DynaProperty labelProp = new DynaProperty("label", Class.forName("java.lang.String"));

        props[propCount++] = labelProp;

        Map params = c.getParameters();
        DynaProperty paramsProp = new DynaProperty("parameters", params.getClass());

        props[propCount++] = paramsProp;
      }
View Full Code Here


  {
    ModelResponse res = req.createResponse();

    try
    {
      Command c = res.createCommand(getConfiguration().getChild("model").getValue());

      res.addErrors(req.getErrors());

      return c.execute(req, res, true, true);
    }
    catch (ConfigurationException ce)
    {
      throw new ModelException(ce);
    }
View Full Code Here

      CommandInfo viewCommand = listing.getCommand(ListingDescriptor.COMMAND_VIEW);

      if (viewCommand != null)
      {
        Command cmd = viewCommand.createCommand(request, response, context);

        cmd.setName("command");
        cmd.setParameter(listing.getKeyName(), id);
        cmd.setParameter("link", "Y");
        outItem.setAttribute("command", cmd);
      }
    }

    while (rowNum <= context.getResultsPerPage())
View Full Code Here

        CommandInfo viewCommand = listing.getCommand(ListingDescriptor.COMMAND_VIEW);

        if (viewCommand != null)
        {
          Command cmd = viewCommand.createCommand(request, response, context);

          cmd.setName("command");
          cmd.setParameter("id", filler.getId());
          cmd.setParameter("link", "Y");
          outItem.setAttribute("command", cmd);
        }

        ++num;
View Full Code Here

    CommandInfo viewCommand = listing.getCommand(ListingDescriptor.COMMAND_VIEW);

    if (viewCommand != null)
    {
      Command cmd = viewCommand.createCommand(request, response, context);

      cmd.setName("command");
      cmd.setParameter(listing.getKeyName(), persistent.getFieldString(listing.getIdColumn()));
      cmd.setParameter("link", "Y");
      outItem.setAttribute("command", cmd);
    }
  }
View Full Code Here

    CommandInfo viewCommand = listing.getCommand(ListingDescriptor.COMMAND_VIEW);

    if (viewCommand != null)
    {
      Command cmd = viewCommand.createCommand(request, response, context);

      cmd.setName("command");
      cmd.setParameter(listing.getKeyName(), ids);
      cmd.setParameter("link", "Y");
      outItem.setAttribute("command", cmd);
    }
  }
View Full Code Here

    outList.setAttribute("commandStyle", listing.getCommandStyle());

    CommandInfo viewCommand = listing.getCommand(ListingDescriptor.COMMAND_VIEW);
    if (viewCommand != null && viewCommand.checkPermission(request))
    {
      Command cmd = viewCommand.createCommand(request, response, context);

      cmd.setName(outList.getName() + "CmdEdit");
      cmd.setLabel(viewCommand.getLabel() != null ? viewCommand.getLabel() : "edit");
      outList.setAttribute("cmdEdit", cmd);
    }

    CommandInfo cmdNew = listing.getCommand(ListingDescriptor.COMMAND_NEW);
    if (cmdNew != null && cmdNew.isVisible() && cmdNew.checkPermission(request))
    {
      Command cmd = cmdNew.createCommand(request, response, context);

      cmd.setName(outList.getName() + "CmdNew");
      outList.setAttribute("cmdNew", cmd);
    }

    String outListName = outList.getName();
    if (currentPage > 1)
    {
      Command cmdPageStart = createPageCommand(request, response, listing, "cmdPageStart", new String[]
      {
        "~listSort"
      });
      cmdPageStart.setParameter(outListName + "Page", String.valueOf(minPage));
      cmdPageStart.setLabel("$start");
      outList.setAttribute("cmdPageStart", cmdPageStart);

      Command cmdPageBack = createPageCommand(request, response, listing, "cmdPageBack", new String[]
      {
        "~listSort"
      });
      cmdPageBack.setParameter(outListName + "Page", String.valueOf(currentPage - 1));
      cmdPageBack.setLabel("$back");
      outList.setAttribute("cmdPageBack", cmdPageBack);

      Output outPrevPages = response.createOutput("prevPages");
      outList.setAttribute("prevPages", outPrevPages);
      int firstPrevPage = Math.max(minPage, currentPage - context.getNumPrevPages());
      for (int i = currentPage - 1; i >= firstPrevPage; --i)
      {
        Command cmdPage = createPageCommand(request, response, listing, "cmdPage", new String[]
        {
          "~listSort"
        });
        cmdPage.setParameter(outListName + "Page", String.valueOf(currentPage - i - 1 + firstPrevPage));
        cmdPage.setLabel(String.valueOf(currentPage - i - 1 + firstPrevPage));
        outPrevPages.add(cmdPage);
      }
    }

    if (currentPage < maxPage)
    {
      Command cmdPageEnd = createPageCommand(request, response, listing, "cmdPageEnd", new String[]
      {
        "~listSort"
      });
      cmdPageEnd.setParameter(outListName + "Page", String.valueOf(maxPage));
      cmdPageEnd.setLabel("$end");
      outList.setAttribute("cmdPageEnd", cmdPageEnd);

      Command cmdPageNext = createPageCommand(request, response, listing, "cmdPageNext", new String[]
      {
        "~listSort"
      });
      cmdPageNext.setParameter(outListName + "Page", String.valueOf(currentPage + 1));
      cmdPageNext.setLabel("$next");
      outList.setAttribute("cmdPageNext", cmdPageNext);

      Output outNextPages = response.createOutput("nextPages");
      outList.setAttribute("nextPages", outNextPages);
      int lastNextPage = Math.min(maxPage, currentPage + context.getNumNextPages());
      for (int i = currentPage + 1; i <= lastNextPage; ++i)
      {
        Command cmdPage = createPageCommand(request, response, listing, "page", new String[]
        {
          "~listSort"
        });
        cmdPage.setParameter(outListName + "Page", String.valueOf(i));
        cmdPage.setLabel(String.valueOf(i));
        outNextPages.add(cmdPage);
      }
    }

    if (listing.getListCommands() != null)
    {
      Output outCommands = response.createOutput("commands");
      outList.setAttribute("commands", outCommands);
      for (Iterator i = listing.getListCommands().iterator(); i.hasNext();)
      {
        CommandInfo descriptor = (CommandInfo) i.next();
        Command command = descriptor.createCommand(request, response, context);
        outCommands.add(command);
      }
    }

    if (listing.getItemCommands() != null)
    {
      Output outItemCommands = response.createOutput("itemCommands");
      CommandInfo viewCmd = listing.getCommand(ListingDescriptor.COMMAND_VIEW);
      if (viewCmd != null && viewCmd.checkPermission(request))
      {
        Command cmd = viewCmd.createCommand(request, response, context);
        outItemCommands.add(cmd);
      }
      outItemCommands.setAttribute("label", listing.getItemCommands().getLabel());
      outList.setAttribute("itemCommands", outItemCommands);
      for (Iterator i = listing.getItemCommands().iterator(); i.hasNext();)
      {
        CommandInfo descriptor = (CommandInfo) i.next();
        if (viewCmd == null || ! descriptor.getName().equals(viewCmd.getName()))
        {
          Command command = descriptor.createCommand(request, response, context);
          outItemCommands.add(command);
        }
      }

      Command cmdExecute;
      if (listing.getCommand(ListingDescriptor.COMMAND_EXECUTE) == null)
      {
        if (listing.isNg())
        {
          cmdExecute = response.createCommand(null);
          cmdExecute.setBean("de.iritgo.aktera.ui.ExecuteListItemCommand");
        }
        else
        {
          cmdExecute = response.createCommand("aktera.tools.execute-listitem-command");
        }
        cmdExecute.setName(outListName + "CmdExecute");
        cmdExecute.setLabel("execute");
      }
      else
      {
        cmdExecute = listing.getCommand(ListingDescriptor.COMMAND_EXECUTE).createCommand(request, response,
                "_lep", context);
      }

      outList.setAttribute("cmdExecute", cmdExecute);
      cmdExecute.setParameter("_lm", listing.getListModel() != null ? listing.getListModel() : ModelTools
              .getPreviousModel(request));
      for (Iterator i = request.getParameters().keySet().iterator(); i.hasNext();)
      {
        String key = (String) i.next();
        if ("model".equals(key) || "orig-model".equals(key) || key.startsWith("_lp"))
        {
          continue;
        }
        cmdExecute.setParameter("_lp" + key, request.getParameter(key));
      }

      for (Iterator i = listing.getItemCommands().iterator(); i.hasNext();)
      {
        CommandInfo descriptor = (CommandInfo) i.next();
        descriptor.setParameters(request, cmdExecute, "_lp", context);
      }
    }

    CommandInfo cmdSearch = listing.getCommand(ListingDescriptor.COMMAND_SEARCH);
    if (cmdSearch != null)
    {
      String searchInputName = outListName + "Search";
      Input input = response.createInput(searchInputName);
      input.setLabel("search");
      input.setDefaultValue(request.getParameterAsString(searchInputName));
      response.add(input);
      if (listing.getCategories() != null)
      {
        input = response.createInput(searchInputName + "Category");
        input.setDefaultValue(listing.getCategory());
        input.setValidValues(listing.getCategories());
        response.add(input);
      }
      Command cmd = cmdSearch.createCommand(request, response, context);
      cmd.setName(outListName + "CmdSearch");
      outList.setAttribute("cmdSearch", cmd);
    }

    CommandInfo cmdBack = listing.getCommand(ListingDescriptor.COMMAND_BACK);
    if (cmdBack != null)
    {
      Command cmd = cmdBack.createCommand(request, response, context);
      outList.setAttribute("cmdBack", cmd);
    }
  }
View Full Code Here

   * @throws ModelException.
   */
  private static Command createPageCommand(ModelRequest request, ModelResponse response, ListingDescriptor listing,
          String name, String[] ommitPrevParameters) throws ModelException
  {
    Command cmd = ModelTools.createPreviousModelCommand(request, response, listing.getListModel(),
            ommitPrevParameters);
    cmd.setName(name);
    cmd.getParameters().remove(listing.getId() + "Sort");
    return cmd;
  }
View Full Code Here

        outColumn.setAttribute("hide", "Y");
      }

      if (column.isSortable() && ! "custom".equals(column.getViewer()) && ! column.getViewer().startsWith("js:"))
      {
        Command sortCommand = createPageCommand(req, res, listing, "sort" + colNum);

        sortCommand.setParameter(context.getListName() + "Sort", column.getName());
        outColumn.setAttribute("sortCommand", sortCommand);
      }

      outHeader.add(outColumn);
    }
View Full Code Here

      if (re instanceof Command)
      {
        set("type", "command");

        Command c = (Command) re;

        if (c.getModel() != null)
        {
          set("model", c.getModel());
        }

        if (c.getBean() != null)
        {
          set("bean", c.getBean());
        }

        set("label", c.getLabel());

        Map params = c.getParameters();

        set("parameters", params);
      }
    }
    catch (Exception e)
View Full Code Here

TOP

Related Classes of de.iritgo.aktera.model.Command

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.