Package de.iritgo.aktera.ui.form

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


          }

          outItem.add(outColumn);
        }

        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);
View Full Code Here


      }

      outItem.add(outColumn);
    }

    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

      }

      outItem.add(outColumn);
    }

    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("embedded", "Y");
    }
    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

TOP

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

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.