Package de.iritgo.aktera.model

Examples of de.iritgo.aktera.model.Input


   */
  public Input createInput(String name)
  {
    assert StringTools.isNotTrimEmpty(name);

    Input input = new DefaultInput();

    input.setName(name);

    return input;
  }
View Full Code Here


   * @see de.iritgo.aktera.ui.UIResponse#addInput(java.lang.String,
   *      java.lang.String)
   */
  public Input addInput(String name, String label)
  {
    Input newInput = createInput(name);
    assert label != null;
    newInput.setLabel(label);
    add(newInput);

    return newInput;
  }
View Full Code Here

      }
    }

    if (re instanceof Input)
    {
      Input i = (Input) re;

      i.setLabel(translateString(i.getLabel(), messages));

      Map validValues = i.getValidValues();

      if (validValues != null)
      {
        TreeMap newMap = new TreeMap();
        String oneKey = null;
        Object oneValue = null;

        for (Iterator iv = validValues.keySet().iterator(); iv.hasNext();)
        {
          oneKey = iv.next().toString();
          oneValue = validValues.get(oneKey);

          if (oneValue instanceof String)
          {
            newMap.put(oneKey, translateString(oneValue.toString(), messages));
          }
          else
          {
            newMap.put(oneKey, oneValue);
          }
        }

        i.setValidValues(newMap);
      }
    }
    else if (re instanceof Output)
    {
      Output o = (Output) re;
View Full Code Here

      }
    }

    if (re instanceof Input)
    {
      Input i = (Input) re;

      i.setLabel(translateString(i.getLabel(), messages));

      Map validValues = i.getValidValues();

      if (validValues != null)
      {
        TreeMap newMap = new TreeMap();
        String oneKey = null;
        Object oneValue = null;

        for (Iterator iv = validValues.keySet().iterator(); iv.hasNext();)
        {
          oneKey = iv.next().toString();
          oneValue = validValues.get(oneKey);

          if (oneValue instanceof String)
          {
            newMap.put(oneKey, translateString(oneValue.toString(), messages));
          }
          else
          {
            newMap.put(oneKey, oneValue);
          }
        }

        i.setValidValues(newMap);
      }
    }
    else if (re instanceof Output)
    {
      Output o = (Output) re;
View Full Code Here

        // System.out.println (listObject.dump ());
        results.add(listObject);
      }
    }

    Input attribute = (Input) result.get("listSearchCategory");

    if (attribute != null)
    {
      StringBuffer validValues = new StringBuffer(StringTools.trim(attribute.getDefaultValue()) + "|");

      for (Iterator k = attribute.getValidValues().entrySet().iterator(); k.hasNext();)
      {
        Map.Entry value = (Map.Entry) k.next();

        validValues.append(value.getKey() + "|" + value.getValue());
View Full Code Here

    {
      ResponseElement group = (ResponseElement) i.next();

      for (Iterator j = group.getAll().iterator(); j.hasNext();)
      {
        Input attribute = (Input) j.next();

        String attributeName = attribute.getName();
        String attributeContent = (String) attribute.getDefaultValue().toString();

        dataObject.setAttribute(attributeName, attributeContent);

        if ("combo".equals(attribute.getAttribute("editor")))
        {
          StringBuffer validValues = new StringBuffer();

          for (Iterator k = attribute.getValidValues().entrySet().iterator(); k.hasNext();)
          {
            Map.Entry value = (Map.Entry) k.next();

            validValues.append(value.getKey() + "|" + value.getValue());
View Full Code Here

        wdGroup.addWidgetDescription(createWidget(controller.getUniqueId(), fieldLabel, attributeName,
                attributeName, false, hide));
      }

      Input attribute = (Input) result.get("listSearchCategory");

      if (attribute != null)
      {
        controller.addWidgetDescription(createWidget(controller.getUniqueId(), "listSearchCategory",
                "listSearchCategory", "listSearchCategory", false, false));
      }

      // Wird noch ben�tigt um zu �perpr�fen ob �berhaupt die Neuanlage
      // erlaubt ist.
      // Command cmdNew = (Command) resultList.getAttribute ("cmdNew");
      Command cmdEdit = (Command) resultList.getAttribute("cmdEdit");

      if (cmdEdit != null)
      {
        controller.addCommandDescription(createCommand(controller.getUniqueId(), "NewAkteraObjectCommand",
                cmdEdit.getModel(), "new", "new", "des", true, true));

        controller.addCommandDescription(createCommand(controller.getUniqueId(), "EditAkteraObjectCommand",
                cmdEdit.getModel(), "edit", "edit", "des", true, true));
      }

      ResponseElement itemCommands = (ResponseElement) resultList.getAttribute("itemCommands");

      if (itemCommands != null)
      {
        for (Iterator i = itemCommands.getAll().iterator(); i.hasNext();)
        {
          Command command = (Command) i.next();

          if (command.getName().equals("delete"))
          {
            controller.addCommandDescription(createCommand(controller.getUniqueId(),
                    "DeleteAkteraObjectCommand", command.getModel(), "delete", "delete", "des",
                    true, true));
          }
        }
      }

      controller.addCommandDescription(createCommand(controller.getUniqueId(), "CancelAkteraObjectCommand",
              "cancel", "cancel", "cancel", "des", true, true));

      guiManager.addController(controllerTypeId, controller);
    }

    if (displayType == GUIControllerRequest.DATAOBJECT)
    {
      KeelResponse keelForm = getKeelObject(controllerTypeId, "0", userUniqueId);

      Controller controller = createController(controllerTypeId);

      ResponseElement groups = keelForm.get("groups");

      for (Iterator i = groups.getAll().iterator(); i.hasNext();)
      {
        ResponseElement group = (ResponseElement) i.next();

        WidgetDescription wdGroup = createWidget(controller.getUniqueId(), (String) ((Output) group)
                .getContent(), "group", "group", false, true);

        controller.addWidgetDescription(wdGroup);

        for (Iterator j = group.getAll().iterator(); j.hasNext();)
        {
          Input field = (Input) j.next();
          String fieldName = field.getName();
          String fieldLabel = field.getLabel();
          boolean duty = field.getAttribute("duty") == null ? false : true;

          WidgetDescription fieldWidget = createWidget(controller.getUniqueId(), fieldLabel, fieldName,
                  (String) ((Input) field).getAttribute("editor"), duty, true);

          wdGroup.addWidgetDescription(fieldWidget);
View Full Code Here

          fixedDomain = oneDomain.getAttribute("name");
        }

        if (domainCount > 1)
        {
          Input domainInput = res.createInput("domain");

          domainInput.setLabel("Domain");
          domainInput.setDefaultValue(defaultDomain);
          domainInput.setValidValues(valids);
          res.add(domainInput);
          fixedDomain = defaultDomain;
        }
      }
      catch (ConfigurationException x)
      {
        throw new ModelException(x);
      }
    }

    Input loginName = res.createInput("loginName");

    loginName.setDefaultValue(defaultLoginName);
    loginName.setLabel("Login");
    res.add(loginName);

    Input password = res.createInput("password");

    password.setDefaultValue(defaultPassword);
    password.setLabel("Password");

    password.setAttribute("type", "password");
    res.add(password);

    String loginModel = Constants.LOGIN;

    if (req.getParameter("loginmodel") != null)
    {
      loginModel = (String) req.getParameter("loginmodel");
    }

    Command login = res.createCommand(loginModel);

    login.setName("login");
    login.setLabel("$login");

    if (fixedDomain != null)
    {
      login.setParameter("domain", fixedDomain);
    }

    if (rememberConfig.equals("prompt") || rememberConfig.equals("last"))
    {
      Input remember = res.createInput("remember");

      remember.setLabel("Remember Login");
      remember.setAttribute("checkbox", "Y");

      String rememberChecked = configuration.getAttribute("remember-checked", "false");

      if (rememberConfig.equals("last"))
      {
        remember.setDefaultValue((defaultLoginName != null && ! defaultLoginName.equals("")) ? "on" : "off");
      }
      else if (rememberChecked.equals("true"))
      {
        remember.setDefaultValue("on");
      }

      res.add(remember);
    }
    else if (rememberConfig.equals("always"))
View Full Code Here

      if (re instanceof Input)
      {
        totalPropCount = totalPropCount + 3;

        Input i = (Input) re;
        Map valids = i.getValidValues();

        if (valids.size() == 0)
        {
          totalPropCount = totalPropCount - 1;
        }
      }

      if (re instanceof Output)
      {
        totalPropCount = totalPropCount + 1;
      }

      if (re instanceof Command)
      {
        totalPropCount = totalPropCount + 4;
      }

      DynaProperty[] props = new DynaProperty[totalPropCount];
      DynaProperty nameProp = new DynaProperty("name", Class.forName("java.lang.String"));

      props[propCount++] = nameProp;

      DynaProperty typeProp = new DynaProperty("type", Class.forName("java.lang.String"));

      props[propCount++] = typeProp;

      DynaProperty nested = new DynaProperty("nested", allNested.getClass());

      props[propCount++] = nested;

      /*if (allNested.size() > 0) {
          ResponseElement nestedElement = null;
          for (Iterator in = allNested.iterator(); in.hasNext();) {
              nestedElement = (ResponseElement) in.next();
              DynaProperty nestedProp =
                  new DynaProperty(
                      nestedElement.getName(),
                      Class.forName(
                          "de.iritgo.aktera.clients.ResponseElementDynaBean"));
              props[propCount++] = nestedProp;
          }
      } */
      DynaProperty attribProp = new DynaProperty("attributes", Class
              .forName("org.apache.commons.beanutils.BasicDynaBean"));

      props[propCount++] = attribProp;

      /*   if (attributes.size() > 0) {
             Object attribVal = null;
             String oneKey = null;
             for (Iterator in = attributes.keySet().iterator();
                 in.hasNext();
                 ) {
                 oneKey = (String) in.next();
                 attribVal = attributes.get(oneKey);
                 DynaProperty nestedProp =
                     new DynaProperty(oneKey, attribVal.getClass());
                 props[propCount++] = nestedProp;
             }
         } */

      /**
       * If the element is an Input, create properties appropriate to an Input
       */
      if (re instanceof Input)
      {
        Input i = (Input) re;
        Object defValue = i.getDefaultValue();
        DynaProperty defProp = null;

        if (defValue != null)
        {
          defProp = new DynaProperty("defaultValue", i.getDefaultValue().getClass());
        }
        else
        {
          defProp = new DynaProperty("defaultValue", Class.forName("java.lang.String"));
        }

        props[propCount++] = defProp;

        /**
         * We only have an attribute of "validValues" if the set of valid values
         * for this input is not empty. The actual validValues property gets
         * populated by a HashSet of dynabeans, where each bean has attributes
         * name and label
         */
        Map valids = i.getValidValues();

        if (valids.size() > 0)
        {
          DynaProperty validsProp = new DynaProperty("validValues", Class.forName("java.util.TreeSet"));

View Full Code Here

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

TOP

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

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.