Package org.boco.seamwebappgen.info

Examples of org.boco.seamwebappgen.info.Attribute


    /** Predispone la lista di tutti gli attributi da inserire nel form **/
    /** I campi Transient sono gestiti in questa sezione **/
    for (int i = 0; i < bean.getAttributes().size(); i++)
    {
      Attribute attribute = bean.getAttributes().get(i);

      if (!attribute.isKey() && (attribute.getImplementationType() != AttributeImplementationType.HIDEINFORM))
      {
        CodeChunk codeChunk = new CodeChunk(attribute.getOrderInForm());

        codeChunk.addHtmlCode("\t<p:cell grayFill=\".7\" horizontalAlignment=\"left\"  verticalAlignment=\"middle\" ");

        if (!attribute.getOnDisplayIf().equals(""))
        {
          codeChunk.addHtmlCode("rendered=\"#{" + attribute.getOnDisplayIf() + "}\"");
        }

        codeChunk.addHtmlCode(">");
        codeChunk.addHtmlCode("#{msgs.form_" + bean.getName() + "_" + attribute.getName() + "}</p:cell>\r\n");

        if (attribute.getImplementationType() == AttributeImplementationType.TEXTAREA)
        {
          if (attribute.getType().equals("java.lang.String"))
          {
            codeChunk.addHtmlCode("\t<p:cell               horizontalAlignment=\"justify\" verticalAlignment=\"middle\" ");

            if (!attribute.getOnDisplayIf().equals(""))
            {
              codeChunk.addHtmlCode("rendered=\"#{" + attribute.getOnDisplayIf() + "}\"");
            }

            codeChunk.addHtmlCode(">#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + attribute.getName() + "}</p:cell>\r\n");
          }
        }

        if (attribute.getImplementationType() == AttributeImplementationType.FORMATTEDTEXTAREA)
        {
          if (attribute.getType().equals("java.lang.String"))
          {
            codeChunk.addHtmlCode("\t<p:cell               horizontalAlignment=\"justify\" verticalAlignment=\"middle\" ");
            if (!attribute.getOnDisplayIf().equals(""))
            {
              codeChunk.addHtmlCode("rendered=\"#{" + attribute.getOnDisplayIf() + "}\"");
            }
            codeChunk.addHtmlCode(">\r\n");
            codeChunk.addHtmlCode("\t\t<p:text value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + attribute.getName() + "}\" >\r\n");
            codeChunk.addHtmlCode("\t\t\t<f:converter converterId=\"Html2PdfConverter\" />\r\n");
            codeChunk.addHtmlCode("\t\t</p:text>\r\n");
            codeChunk.addHtmlCode("\t</p:cell>\r\n");
          }
        }

        if (attribute.getImplementationType() == AttributeImplementationType.LISTBOX)
        {
          codeChunk.addHtmlCode("\t<p:cell grayFill=\".7\" horizontalAlignment=\"left\"  verticalAlignment=\"middle\">LIST BOX</p:cell>\r\n");
        }

        if (attribute.getImplementationType() == AttributeImplementationType.TEXT || attribute.getImplementationType() == AttributeImplementationType.READONLY)
        {
          if (attribute.getType().equals("java.lang.Boolean"))
          {
            codeChunk.addHtmlCode("\t<p:cell               horizontalAlignment=\"justify\" verticalAlignment=\"middle\" ");

            if (!attribute.getOnDisplayIf().equals(""))
            {
              codeChunk.addHtmlCode("rendered=\"#{" + attribute.getOnDisplayIf() + "}\"");
            }

            codeChunk.addHtmlCode(">#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + attribute.getName() + "}</p:cell>\r\n");
          }
          if (attribute.getType().equals("java.lang.String"))
          {
            codeChunk.addHtmlCode("\t<p:cell               horizontalAlignment=\"justify\" verticalAlignment=\"middle\" ");

            if (!attribute.getOnDisplayIf().equals(""))
            {
              codeChunk.addHtmlCode("rendered=\"#{" + attribute.getOnDisplayIf() + "}\"");
            }

            codeChunk.addHtmlCode(">#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + attribute.getName() + "}</p:cell>\r\n");
          }
          if (attribute.getType().equals("java.util.Date"))
          {
            codeChunk.addHtmlCode("\t<p:cell               horizontalAlignment=\"justify\" verticalAlignment=\"middle\" ");

            if (!attribute.getOnDisplayIf().equals(""))
            {
              codeChunk.addHtmlCode("rendered=\"#{" + attribute.getOnDisplayIf() + "}\"");
            }

            codeChunk.addHtmlCode(">\r\n");

            codeChunk.addHtmlCode("\t\t<p:text value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + attribute.getName() + "}\" >\r\n");
            codeChunk.addHtmlCode("\t\t\t<f:convertDateTime type=\"date\" pattern=\"#{msgs.Application_DateFormat}\" />\r\n");
            codeChunk.addHtmlCode("\t\t</p:text>\r\n");

            codeChunk.addHtmlCode("\t</p:cell>\r\n");
          }
          if (attribute.getType().equals("java.lang.Double"))
          {
            codeChunk.addHtmlCode("\t<p:cell               horizontalAlignment=\"justify\" verticalAlignment=\"middle\" ");

            if (!attribute.getOnDisplayIf().equals(""))
            {
              codeChunk.addHtmlCode("rendered=\"#{" + attribute.getOnDisplayIf() + "}\"");
            }

            codeChunk.addHtmlCode(">\r\n");

            codeChunk.addHtmlCode("\t\t<p:text value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + attribute.getName() + "}\" >\r\n");
            codeChunk.addHtmlCode("\t\t\t<f:converter converterId=\"DoubleConverter\" />\r\n");
            codeChunk.addHtmlCode("\t\t</p:text>\r\n");

            codeChunk.addHtmlCode("\t</p:cell>\r\n");
          }
          if (attribute.getType().equals("java.lang.Long"))
          {
            codeChunk.addHtmlCode("\t<p:cell               horizontalAlignment=\"justify\" verticalAlignment=\"middle\" ");

            if (!attribute.getOnDisplayIf().equals(""))
            {
              codeChunk.addHtmlCode("rendered=\"#{" + attribute.getOnDisplayIf() + "}\"");
            }

            codeChunk.addHtmlCode(">\r\n");

            codeChunk.addHtmlCode("\t\t<p:text value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + attribute.getName() + "}\" >\r\n");
            codeChunk.addHtmlCode("\t\t\t<f:converter converterId=\"LongConverter\"/>\r\n");
            codeChunk.addHtmlCode("\t\t</p:text>\r\n");

            codeChunk.addHtmlCode("\t</p:cell>\r\n");
          }
          if (attribute.getType().equals("java.lang.Integer"))
          {
            codeChunk.addHtmlCode("\t<p:cell               horizontalAlignment=\"justify\" verticalAlignment=\"middle\" ");

            if (!attribute.getOnDisplayIf().equals(""))
            {
              codeChunk.addHtmlCode("rendered=\"#{" + attribute.getOnDisplayIf() + "}\"");
            }

            codeChunk.addHtmlCode(">\r\n");

            codeChunk.addHtmlCode("\t\t<p:text value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + attribute.getName() + "}\" >\r\n");
            codeChunk.addHtmlCode("\t\t\t<f:converter converterId=\"IntegerConverter\" />\r\n");
            codeChunk.addHtmlCode("\t\t</p:text>\r\n");

            codeChunk.addHtmlCode("\t</p:cell>\r\n");
          }

        }

        codeChunks.add(codeChunk);
      }
    }

    // Inserisce gli attributi provenienti da relazioni che debbono essere
    // solo visualizzati
    for (int i = 0; i < bean.getShowInFormAttributes().size(); i++)
    {
      ShowAttribute attribute = bean.getShowInFormAttributes().get(i);

      CodeChunk codeChunk = new CodeChunk(attribute.getOrderInForm());

      codeChunk.addHtmlCode("\t<p:cell grayFill=\".7\" horizontalAlignment=\"left\"  verticalAlignment=\"middle\">#{msgs.form_" + bean.getName() + "_" + attribute.getQualifiedName().replace(".", "_") + "}</p:cell>\r\n");
      codeChunk.addHtmlCode("\t<p:cell               horizontalAlignment=\"justify\" verticalAlignment=\"middle\">#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + attribute.getQualifiedName() + "}</p:cell>\r\n");

      codeChunks.add(codeChunk);
    }

    // Inserisce gli attributi provenienti da relazioni
View Full Code Here


          Vector<Attribute> attributes1 = bean.getAttributes();
          Vector<ShowAttribute> callingAttributes = new Vector<ShowAttribute>();

          for (int l = 0; l < attributes1.size(); l++)
          {
            Attribute attr = attributes1.get(l);

            if (attr.getImplementationType() != AttributeImplementationType.HIDEINFORM)
              callingAttributes.add(new ShowAttribute(attributes1.get(l)));
          }

          /**
           * Nei calling attributes ci vanno
           *
           * 1) Gli attributi visualizzati del bean origine
           *
           * 2) Gli attributi visualizzati nel bean, ereditati dal
           * superbean origine (se esiste)
           *
           * 3) Gli attributi derivanti da relazioni implementate come
           * LISTBOX
           *
           * 4) Gli attributi derivanti da relazioni implementate come
           * LISTBOX ereditate dal superbean origine (se esiste)
           *
           */

          Vector<Relationship> re = bean.getRelationships();

          for (int j = 0; j < re.size(); j++)
          {
            if (re.get(j).isListBox())
            {
              Attribute a = new Attribute();
              a.setKey(false);
              a.setName(Utils.makeFirstLetterLowerCase(re.get(j).getToBeanName()));

              ShowAttribute attr = new ShowAttribute(re.get(j), a);

              callingAttributes.add(attr);
            }
          }

          Bean targetBean = infoReader.getBean(rel.getToBeanName());

          /**
           * generateSelectionPage2One(String sourceDir, String targetDir,
           * Relationship rel, Vector<ShowAttribute>
           * callingBeanAttributes, String bean, Vector<SearchAttribute>
           * localSearchAttributes, Vector<ShowAttribute>
           * targetBeanAttributes)
           */

          HTMLGenerator.generatePopUpSingleSelection(sourceDir, targetDir, bean, rel, callingAttributes, targetBean.getLocalSearchAttributes(), beanAttr);
        }

        if ((!rel.isMasterDetail() || (rel.isMasterDetail() && rel.getOrderInForm() != 0)) && rel.isToMany())
        {
          // Relazione a n implementata come popup

          // Attributi nella pagina di origine

          Vector<ShowAttribute> attributes = rel.getRelatedAttributes();

          Bean targetBean = infoReader.getBean(rel.getToBeanName());

          Vector<Attribute> tmp = new Vector<Attribute>(bean.getAttributes());
          Vector<ShowAttribute> beanAttr = new Vector<ShowAttribute>();

          for (int l = 0; l < tmp.size(); l++)
          {
            beanAttr.add(new ShowAttribute(tmp.get(l)));
          }

          // Sono aggiunti gli attributi derivanti dalle relazioni
          // implementate come ListBox

          Vector<Relationship> re = bean.getRelationships();

          for (int j = 0; j < re.size(); j++)
          {
            if (re.get(j).isListBox())
            {
              Attribute a = new Attribute();
              a.setKey(false);
              a.setName(Utils.makeFirstLetterLowerCase(re.get(j).getToBeanName()));

              ShowAttribute attr = new ShowAttribute(re.get(j), a);

              beanAttr.add(attr);
            }
View Full Code Here

    /** Inserimento campi nascosti * */

    for (int i = 0; i < bean.getAttributes().size(); i++)
    {
      Attribute attr = bean.getAttributes().get(i);

      if (!attr.isKey() && (attr.getImplementationType() != AttributeImplementationType.HIDEINFORM) && (attr.getImplementationType() != AttributeImplementationType.READONLY))
      {
        hiddenAttributes += insertAttribute2Form(attr, bean.getName(), false) + "\r\n";
      }
    }

View Full Code Here

    rows = listColumns(rel.getToBeanName(), rel.getRelatedAttributes()); // Colonne della tabella

    /** Inserimento campi nascosti * */
    for (int i = 0; i < bean.getAttributes().size(); i++)
    {
      Attribute attr = bean.getAttributes().get(i);

      if (!attr.isKey() && (attr.getImplementationType() != AttributeImplementationType.HIDEINFORM) && (attr.getImplementationType() != AttributeImplementationType.READONLY))
      {
        hiddenAttributes += insertAttribute2Form(attr, bean.getName(), false) + "\r\n";
      }
    }

View Full Code Here

  {
    String template = "." + File.separator + "templates" + File.separator + "Seam_Help.html";

    for (int i = 0; i < bean.getAttributes().size(); i++)
    {
      Attribute attribute = bean.getAttributes().get(i);

      if (attribute.isHelp())
      {
        String sourceFile = sourceDir + ".." + File.separator + "html" + File.separator + "help" + File.separator + "form_" + bean.getName() + "_" + attribute.getName() + ".html";
        String targetFile = targetDir + "html" + File.separator + "help" + File.separator + "form_" + bean.getName() + "_" + attribute.getName() + ".html";

        // Recupera il codice custom nella pagina
        LinkedList<String> yourJavaScriptCode = Utils.getYourCode(sourceFile, CustomCodeType.JAVA);
        LinkedList<String> yourCode = Utils.getYourCode(sourceFile, CustomCodeType.JSP);
View Full Code Here

    javaScript += "\tfunction startup()\r\n";
    javaScript += "\t{\r\n";

    for (int i = 0; i < bean.getAttributes().size(); i++)
    {
      Attribute attr = bean.getAttributes().get(i);

      if (!attr.isKey() && (attr.getImplementationType() != AttributeImplementationType.HIDEINFORM) && (attr.getImplementationType() != AttributeImplementationType.READONLY))
      {
        if (attr.getType().equals("java.lang.Boolean"))
        {
          javaScript += "\t\t\tif (window.opener.document.forms[\"form\"].elements[\"form:" + attr.getName() + "\"] != null)\r\n";
          javaScript += "\t\t\tdocument.forms[\"form\"].elements[\"form:" + attr.getName() + "\"].checked = window.opener.document.forms[\"form\"].elements[\"form:" + attr.getName() + "\"].checked;\r\n";
        }
        else
        {
          javaScript += "\t\tif (window.opener.document.forms[\"form\"].elements[\"form:" + attr.getName() + "\"] != null)\r\n";
          javaScript += "\t\t\tdocument.forms[\"form\"].elements[\"form:" + attr.getName() + "\"].value = window.opener.document.forms[\"form\"].elements[\"form:" + attr.getName() + "\"].value;\r\n";
        }

      }
    }
View Full Code Here

    /** Predispone la lista di tutti gli attributi da inserire nel form **/
    /** I campi Transient sono gestiti in questa sezione **/
    for (int i = 0; i < bean.getAttributes().size(); i++)
    {
      Attribute attribute = bean.getAttributes().get(i);

      if (!attribute.isKey() && (attribute.getImplementationType() != AttributeImplementationType.HIDEINFORM))
      {
        CodeChunk codeChunk = new CodeChunk(attribute.getOrderInForm());

        codeChunk.addHtmlCode("\t<tr><td width=\"100%\">\r\n");

        codeChunk.addHtmlCode("\t\t<rich:panel rendered=\"#{");

        codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='CREATE'");
        if (!attribute.getOnCreateIf().equals(""))
          codeChunk.addHtmlCode(" and " + attribute.getOnCreateIf());
        codeChunk.addHtmlCode(")");

        codeChunk.addHtmlCode(" or ");

        codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT'");
        if (!attribute.getOnEditIf().equals(""))
          codeChunk.addHtmlCode(" and " + attribute.getOnEditIf());
        codeChunk.addHtmlCode(")");

        codeChunk.addHtmlCode(" or ");

        codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY'");
        if (!attribute.getOnDisplayIf().equals(""))
          codeChunk.addHtmlCode(" and " + attribute.getOnDisplayIf());
        codeChunk.addHtmlCode(")");

        codeChunk.addHtmlCode(" or ");

        codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'");
        if (!attribute.getOnDeleteIf().equals(""))
          codeChunk.addHtmlCode(" and " + attribute.getOnDeleteIf());
        codeChunk.addHtmlCode(")");

        codeChunk.addHtmlCode("}\" >\r\n");

        codeChunk.addHtmlCode("\t\t\t<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\r\n");
        codeChunk.addHtmlCode("\t\t\t<tr>\r\n");
        codeChunk.addHtmlCode("\t\t\t<td class=\"formFieldLabel\" >\r\n");
        codeChunk.addHtmlCode("\t\t\t\t<h:outputLabel for=\"" + attribute.getName() + "\"  value=\"#{msgs.form_" + bean.getName() + attribute.SeamLabel() + "}\" />\r\n");
        codeChunk.addHtmlCode("\t\t\t</td>\r\n");

        codeChunk.addHtmlCode("\t\t\t<td width=\"1%\">\r\n");
        if (attribute.isRequired())
          codeChunk.addHtmlCode("\t\t\t\t<h:outputText value=\"*\"  rendered=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='CREATE' or " + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT'}\" style=\"color: red; font-weight: bold;\" />\r\n");
        codeChunk.addHtmlCode("\t\t\t</td>\r\n");

        if (attribute.getImplementationType() == AttributeImplementationType.TEXTAREA || attribute.getImplementationType() == AttributeImplementationType.FORMATTEDTEXTAREA)
        {
          if (attribute.getType().equals("java.lang.String"))
          {
            codeChunk.addHtmlCode("\t\t\t<td>\r\n");
            codeChunk.addHtmlCode("\t\t\t\t" + insertAttribute2Form(attribute, bean.getName(), true));
            codeChunk.addHtmlCode("\t\t\t\t<h:outputText id=\"" + attribute.getName() + "Display\"   value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + attribute.SeamField() + "}\" rendered=\"#{");

            codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY'");
            if (!attribute.getOnDisplayIf().equals(""))
              codeChunk.addHtmlCode(" and " + attribute.getOnDisplayIf());
            codeChunk.addHtmlCode(")");

            codeChunk.addHtmlCode(" or ");

            codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'");
            if (!attribute.getOnDeleteIf().equals(""))
              codeChunk.addHtmlCode(" and " + attribute.getOnDeleteIf());
            codeChunk.addHtmlCode(")");

            codeChunk.addHtmlCode("}\" ");

            if (attribute.getImplementationType() == AttributeImplementationType.FORMATTEDTEXTAREA)
            {
              if (!textAreaIds.equals(""))
                textAreaIds += ",";
              textAreaIds += "form:" + attribute.getName() + "";

              codeChunk.addHtmlCode(" escape=\"false\" ");
            }

            codeChunk.addHtmlCode("/>\r\n");

            codeChunk.addHtmlCode("\t\t\t\t<br />\r\n");
            codeChunk.addHtmlCode("\t\t\t\t<h:message for=\"" + attribute.getName() + "\" errorClass=\"rich-messages-label\" />\r\n");

            codeChunk.addHtmlCode("\t\t\t</td>\r\n");
          }
        }

        if (attribute.getImplementationType() == AttributeImplementationType.LISTBOX)
        {
          codeChunk.addHtmlCode("\t\t\t<td>\r\n");

          codeChunk.addHtmlCode("\t\t\t\t" + insertAttribute2Form(attribute, bean.getName(), true));
          /**         
                    codeChunk.addHtmlCode("\t\t\t\t<h:selectOneMenu id=\"" + attribute.getName() + "\" value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + attribute.getName() + "}\" styleClass=\"formField\" ");

                    codeChunk.addHtmlCode(" required=\"#{" + attribute.isRequired() + " and " + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation!=\'DELETE\'}\"");

                    codeChunk.addHtmlCode(" rendered=\"#{");

                    codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='CREATE'");
                    if (!attribute.getOnCreateIf().equals(""))
                      codeChunk.addHtmlCode(" and " + attribute.getOnCreateIf());
                    codeChunk.addHtmlCode(")");

                    codeChunk.addHtmlCode(" or ");

                    codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT'");
                    if (!attribute.getOnEditIf().equals(""))
                      codeChunk.addHtmlCode(" and " + attribute.getOnEditIf());
                    codeChunk.addHtmlCode(")");

                    codeChunk.addHtmlCode("}\" >\r\n");

                    codeChunk.addHtmlCode("\t\t\t\t\t<f:selectItem itemValue=\"\"  itemLabel=\"#{msgs.Application_noSelectionLabel}\" />\r\n");

                    for (String option : attribute.getLabels())
                    {
                      codeChunk.addHtmlCode("\t\t\t\t\t<f:selectItem itemValue=\"" + option + "\"  itemLabel=\"" + option + "\"/>\r\n");
                    }

                   
                    if (!attribute.getAjaxEvent().equals(""))
                    {
                      codeChunk.addHtmlCode("\t\t\t\t\t"+addAjaxSupport(attribute.getAjaxEvent(), attribute.getIdsToRerenderOnAjaxEvent())+"\r\n");
                    }
                   
                    codeChunk.addHtmlCode("\t\t\t\t</h:selectOneMenu>\r\n");
          **/
          codeChunk.addHtmlCode("\t\t\t\t<h:outputText id=\"" + attribute.getName() + "Display\"  value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + attribute.SeamField() + "}\" rendered=\"#{");

          codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY'");
          if (!attribute.getOnDisplayIf().equals(""))
            codeChunk.addHtmlCode(" and " + attribute.getOnDisplayIf());
          codeChunk.addHtmlCode(")");

          codeChunk.addHtmlCode(" or ");

          codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'");
          if (!attribute.getOnDeleteIf().equals(""))
            codeChunk.addHtmlCode(" and " + attribute.getOnDeleteIf());
          codeChunk.addHtmlCode(")");

          codeChunk.addHtmlCode("}\" ");

          codeChunk.addHtmlCode("/>\r\n");

          codeChunk.addHtmlCode("\t\t\t\t<br />\r\n");
          codeChunk.addHtmlCode("\t\t\t\t<h:message for=\"" + attribute.getName() + "\" errorClass=\"rich-messages-label\" />\r\n");

          codeChunk.addHtmlCode("\t\t\t</td>\r\n");
        }

        if (attribute.getImplementationType() == AttributeImplementationType.TEXT)
        {
          if (attribute.getType().equals("java.lang.Boolean"))
          {
            codeChunk.addHtmlCode("\t\t\t<td>\r\n");
            codeChunk.addHtmlCode("\t\t\t\t" + insertAttribute2Form(attribute, bean.getName(), true) + "\r\n");

            codeChunk.addHtmlCode("\t\t\t\t<br />\r\n");
            codeChunk.addHtmlCode("\t\t\t\t<h:message for=\"" + attribute.getName() + "\" errorClass=\"rich-messages-label\" />\r\n");

            codeChunk.addHtmlCode("\t\t\t</td>\r\n");
          }

          if (attribute.getType().equals("java.lang.String"))
          {
            codeChunk.addHtmlCode("\t\t\t<td>\r\n");
            codeChunk.addHtmlCode("\t\t\t\t" + insertAttribute2Form(attribute, bean.getName(), true) + "\r\n");
            codeChunk.addHtmlCode("\t\t\t\t<h:outputText id=\"" + attribute.getName() + "Display\"  value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + attribute.SeamField() + "}\" rendered=\"#{");

            codeChunk.addHtmlCode(Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY'");

            codeChunk.addHtmlCode(" or ");

            codeChunk.addHtmlCode(Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'");

            codeChunk.addHtmlCode("}\" ");

            codeChunk.addHtmlCode("/>\r\n");

            codeChunk.addHtmlCode("\t\t\t\t<br />\r\n");
            codeChunk.addHtmlCode("\t\t\t\t<h:message for=\"" + attribute.getName() + "\" errorClass=\"rich-messages-label\" />\r\n");

            codeChunk.addHtmlCode("\t\t\t</td>\r\n");
          }

          if (attribute.getType().equals("java.util.Date"))
          {
            codeChunk.addHtmlCode("\t\t\t<td>\r\n");

            codeChunk.addHtmlCode("\t\t" + insertAttribute2Form(attribute, bean.getName(), true) + "\r\n");

            codeChunk.addHtmlCode("\t\t\t\t<h:outputText id=\"" + attribute.getName() + "Display\"   value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + attribute.SeamField() + "}\" rendered=\"#{");

            codeChunk.addHtmlCode(Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY'");

            codeChunk.addHtmlCode(" or ");

            codeChunk.addHtmlCode(Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'");

            codeChunk.addHtmlCode("}\" ");

            codeChunk.addHtmlCode(">\r\n");

            if (!attribute.isFormFormatOff())
              codeChunk.addHtmlCode("\t\t\t\t\t<s:convertDateTime pattern=\"#{msgs.Application_DateFormat}\"/>\r\n");

            codeChunk.addHtmlCode("\t\t\t\t</h:outputText>\r\n");

            codeChunk.addHtmlCode("\t\t\t\t<br />\r\n");
            codeChunk.addHtmlCode("\t\t\t\t<h:message for=\"" + attribute.getName() + "\" errorClass=\"rich-messages-label\" />\r\n");

            codeChunk.addHtmlCode("\t\t\t</td>\r\n");
          }

          if (attribute.getType().equals("java.lang.Double"))
          {
            codeChunk.addHtmlCode("\t\t\t<td>\r\n");
            codeChunk.addHtmlCode("\t\t\t\t" + insertAttribute2Form(attribute, bean.getName(), true) + "\r\n");
            codeChunk.addHtmlCode("\t\t\t\t<h:outputText id=\"" + attribute.getName() + "Display\"  value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + attribute.SeamField() + "}\" rendered=\"#{");

            codeChunk.addHtmlCode(Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY'");

            codeChunk.addHtmlCode(" or ");

            codeChunk.addHtmlCode(Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'");

            codeChunk.addHtmlCode("}\" ");

            codeChunk.addHtmlCode(">\r\n");

            codeChunk.addHtmlCode("\t\t\t\t\t<f:converter converterId=\"DoubleConverter\" />\r\n");

            codeChunk.addHtmlCode("\t\t\t\t</h:outputText>\r\n");

            codeChunk.addHtmlCode("\t\t\t\t<br />\r\n");
            codeChunk.addHtmlCode("\t\t\t\t<h:message for=\"" + attribute.getName() + "\" errorClass=\"rich-messages-label\" />\r\n");

            codeChunk.addHtmlCode("\t\t\t</td>\r\n");
          }

          if (attribute.getType().equals("java.lang.Long"))
          {
            codeChunk.addHtmlCode("\t\t\t<td>\r\n");
            codeChunk.addHtmlCode("\t\t\t\t" + insertAttribute2Form(attribute, bean.getName(), true) + "\r\n");
            codeChunk.addHtmlCode("\t\t\t\t<h:outputText id=\"" + attribute.getName() + "Display\"  value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + attribute.SeamField() + "}\" rendered=\"#{");

            codeChunk.addHtmlCode(Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY'");

            codeChunk.addHtmlCode(" or ");

            codeChunk.addHtmlCode(Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'");

            codeChunk.addHtmlCode("}\" ");

            codeChunk.addHtmlCode(">\r\n");

            if (!attribute.isFormFormatOff())
              codeChunk.addHtmlCode("\t\t\t\t<f:converter converterId=\"LongConverter\"/>\r\n");

            codeChunk.addHtmlCode("\t\t\t\t\t</h:outputText>\r\n");

            codeChunk.addHtmlCode("\t\t\t\t<br />\r\n");
            codeChunk.addHtmlCode("\t\t\t\t<h:message for=\"" + attribute.getName() + "\" errorClass=\"rich-messages-label\" />\r\n");

            codeChunk.addHtmlCode("\t\t\t</td>\r\n");
          }

          if (attribute.getType().equals("java.lang.Integer"))
          {
            codeChunk.addHtmlCode("\t\t\t<td>\r\n");
            codeChunk.addHtmlCode("\t\t\t\t" + insertAttribute2Form(attribute, bean.getName(), true) + "\r\n");
            codeChunk.addHtmlCode("\t\t\t\t<h:outputText id=\"" + attribute.getName() + "Display\"  value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + attribute.SeamField() + "}\" rendered=\"#{");

            codeChunk.addHtmlCode(Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY'");

            codeChunk.addHtmlCode(" or ");

            codeChunk.addHtmlCode(Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'");

            codeChunk.addHtmlCode("}\" ");

            codeChunk.addHtmlCode(">\r\n");

            if (!attribute.isFormFormatOff())
              codeChunk.addHtmlCode("\t\t\t\t\t<f:converter converterId=\"IntegerConverter\" />\r\n");

            codeChunk.addHtmlCode("\t\t\t\t</h:outputText>\r\n");

            codeChunk.addHtmlCode("\t\t\t\t<br />\r\n");
            codeChunk.addHtmlCode("\t\t\t\t<h:message for=\"" + attribute.getName() + "\" errorClass=\"rich-messages-label\" />\r\n");

            codeChunk.addHtmlCode("\t\t\t</td>\r\n");
          }

          if (attribute.getType().contains("UploadedFile") || attribute.getType().contains("org.boco.seamUtility.upload.UploadedFile"))
          {
            /**
             * Gestione degli upload / download dal form
             */
            usesUpload = "enctype=\"multipart/form-data\"";

            if (bean.getRelationship(Utils.makeGet(bean.getName() + "Upload")) == null)
            {
              // Piu' allegati

              codeChunk.addHtmlCode("\t\t\t<td>\r\n");

              codeChunk.addHtmlCode("\t\t\t\t" + insertAttribute2Form(attribute, bean.getName(), true) + "\r\n");

              codeChunk.addHtmlCode("\t\t\t\t<h:dataTable var=\"" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload\"  value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeFirstLetterLowerCase(bean.getName()) + "Uploads}\" >\r\n");

              codeChunk.addHtmlCode("\t\t\t\t<h:column>\r\n");

              codeChunk.addHtmlCode("\t\t\t\t\t<h:commandButton action=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload." + Utils.makeFirstLetterLowerCase(attribute.getName()) + "Fm.downloadFile(facesContext)}\" image=\"img/download.png\" rendered=\"#{(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload!=null) and (" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload." + Utils.makeFirstLetterLowerCase(attribute.getName()) + "Fm!=null) and ((" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY') or (" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'))}\" />\r\n");
              codeChunk.addHtmlCode("\t\t\t\t\t<h:outputText value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload." + Utils.makeFirstLetterLowerCase(attribute.getName()) + "Fm.fileName}\" rendered=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload." + Utils.makeFirstLetterLowerCase(attribute.getName()) + "Fm!=null}\" />\r\n");
              codeChunk.addHtmlCode("\t\t\t\t\t<h:outputLabel for=\"delete" + Utils.makeFirstLetterLowerCase(attribute.getName()) + "\" value=\"Rimuovi\" rendered=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload!=null and " + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT'}\" />\r\n");
              codeChunk.addHtmlCode("\t\t\t\t\t<h:selectBooleanCheckbox for=\"delete" + Utils.makeFirstLetterLowerCase(attribute.getName()) + "\" value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload." + Utils.makeFirstLetterLowerCase(attribute.getName()) + "Fm.checkDelete}\" rendered=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload!=null and " + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT'}\" />\r\n");
              codeChunk.addHtmlCode("\t\t\t\t\t<h:outputLabel for=\"update" + Utils.makeFirstLetterLowerCase(attribute.getName()) + "\" value=\"Sostituisci\" rendered=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload!=null and " + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT'}\" />\r\n");
              codeChunk.addHtmlCode("\t\t\t\t\t<h:selectBooleanCheckbox for=\"update" + Utils.makeFirstLetterLowerCase(attribute.getName()) + "\" value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload." + Utils.makeFirstLetterLowerCase(attribute.getName()) + "Fm.checkUpdate}\" rendered=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload!=null and " + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT'}\" />\r\n");

              codeChunk.addHtmlCode("\t\t\t\t</h:column>\r\n");

              codeChunk.addHtmlCode("\t\t\t\t</h:dataTable>\r\n");

              codeChunk.addHtmlCode("\t\t\t</td>\r\n");
            }
            else
            {
              // Un solo allegato

              codeChunk.addHtmlCode("\t\t\t<td>\r\n");

              codeChunk.addHtmlCode("\t\t\t\t" + insertAttribute2Form(attribute, bean.getName(), true) + "\r\n");

              codeChunk.addHtmlCode("\t\t\t\t<h:commandButton action=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload." + attribute.getName() + "Fm.downloadFile(facesContext)}\" image=\"img/download.png\" rendered=\"#{");

              codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload!=null) and (" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload." + attribute.getName() + "Fm!=null) and ((" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY'");
              if (!attribute.getOnDisplayIf().equals(""))
                codeChunk.addHtmlCode(" and " + attribute.getOnDisplayIf());
              codeChunk.addHtmlCode(")");

              codeChunk.addHtmlCode(" or ");

              codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'");
              if (!attribute.getOnDeleteIf().equals(""))
                codeChunk.addHtmlCode(" and " + attribute.getOnDeleteIf());
              codeChunk.addHtmlCode("))");

              codeChunk.addHtmlCode("}\" ");

              codeChunk.addHtmlCode("/>\r\n");

              codeChunk.addHtmlCode("\t\t\t\t<h:outputText value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload." + attribute.getName() + "Fm.fileName}\" rendered=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload." + attribute.getName() + "Fm!=null}\" />\r\n");

              codeChunk.addHtmlCode("\t\t\t\t<h:outputLabel for=\"delete" + attribute.getName() + "\" value=\"Rimuovere\" rendered=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload!=null and " + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT'}\" />\r\n");
              codeChunk.addHtmlCode("\t\t\t\t<h:selectBooleanCheckbox for=\"delete" + attribute.getName() + "\" value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload." + attribute.getName() + "Fm.checkDelete}\" rendered=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeFirstLetterLowerCase(bean.getName()) + "Upload!=null and " + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT'}\" />\r\n");

              codeChunk.addHtmlCode("\t\t\t</td>\r\n");
            }
          }
        }

        /** Campi di sola visualizzazione * */

        if (attribute.getImplementationType() == AttributeImplementationType.READONLY)
        {
          if (attribute.getType().equals("java.lang.String"))
          {
            codeChunk.addHtmlCode("\t<td>\r\n");
            codeChunk.addHtmlCode("\t\t<tr:outputText id=\"" + attribute.getName() + "\"   value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + attribute.SeamField() + "}\" />\r\n");
            codeChunk.addHtmlCode("\t</td>\r\n");
          }

          if (attribute.getType().equals("java.util.Date"))
          {
            codeChunk.addHtmlCode("\t<trh:cellFormat >\r\n");

            codeChunk.addHtmlCode("\t\t<tr:outputText id=\"" + attribute.getName() + "\"   value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + attribute.SeamField() + "}\" >\r\n");

            codeChunk.addHtmlCode("\t\t\t<f:convertDateTime pattern=\"#{msgs.Application_DateFormat}\" />\r\n");

            codeChunk.addHtmlCode("\t\t</tr:outputText>\r\n");

            codeChunk.addHtmlCode("\t</trh:cellFormat>\r\n");
          }
          if (attribute.getType().equals("java.lang.Integer"))
          {
            codeChunk.addHtmlCode("\t<trh:cellFormat >\r\n");

            codeChunk.addHtmlCode("\t\t<tr:outputText id=\"" + attribute.getName() + "\"   value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + attribute.SeamField() + "}\" >\r\n");

            codeChunk.addHtmlCode("\t\t\t<f:converter converterId=\"IntegerConverter\" />\r\n");

            codeChunk.addHtmlCode("\t\t</tr:outputText>\r\n");

            codeChunk.addHtmlCode("\t</trh:cellFormat>\r\n");
          }
          if (attribute.getType().equals("java.lang.Long"))
          {
            codeChunk.addHtmlCode("\t<trh:cellFormat >\r\n");

            codeChunk.addHtmlCode("\t\t<tr:outputText id=\"" + attribute.getName() + "\"   value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + attribute.SeamField() + "}\" >\r\n");

            codeChunk.addHtmlCode("\t\t\t<f:converter converterId=\"LongConverter\" />\r\n");

            codeChunk.addHtmlCode("\t\t</tr:outputText>\r\n");

            codeChunk.addHtmlCode("\t</trh:cellFormat>\r\n");
          }
          if (attribute.getType().equals("java.lang.Double"))
          {
            codeChunk.addHtmlCode("\t<trh:cellFormat >\r\n");

            codeChunk.addHtmlCode("\t\t<tr:outputText id=\"" + attribute.getName() + "\"   value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + attribute.SeamField() + "}\" >\r\n");

            codeChunk.addHtmlCode("\t\t\t<f:converter converterId=\"DoubleConverter\" />\r\n");

            codeChunk.addHtmlCode("\t\t</tr:outputText>\r\n");

            codeChunk.addHtmlCode("\t</trh:cellFormat>\r\n");
          }
        }

        if (attribute.isHelp())
        {
          codeChunk.addHtmlCode("\t\t\t<td width=\"1%\"><h:graphicImage styleClass=\"imageLink\" url=\"img/info.gif\" onclick=\"help('help/form_" + bean.getName() + "_" + attribute.getName() + ".html');\" /></td>\r\n");
        }
        else
        {
          codeChunk.addHtmlCode("\t\t\t<td width=\"1%\"></td>\r\n");
        }

        codeChunk.addHtmlCode("\t\t\t</tr>\r\n");
        codeChunk.addHtmlCode("\t\t\t</table>\r\n");
        codeChunk.addHtmlCode("\t\t</rich:panel>\r\n");
        codeChunk.addHtmlCode("\t</td></tr>\r\n");

        codeChunks.add(codeChunk);
      }
    }

    // Inserisce gli attributi provenienti da relazioni che debbono essere
    // solo visualizzati
    for (int i = 0; i < bean.getShowInFormAttributes().size(); i++)
    {
      ShowAttribute attribute = bean.getShowInFormAttributes().get(i);

      CodeChunk codeChunk = new CodeChunk(attribute.getOrderInForm());

      if (attribute.getRelationship() != null && attribute.getRelationship().isToMany())
      {
        codeChunk.addHtmlCode("\r\n@ShowRelationshipAttributesInForm - Relazione :N non supportata - " + attribute.getRelationship().getName() + "\r\n");
      }
      else
      {
        codeChunk.addHtmlCode("\r\n\t<tr><td width=\"100%\">\r\n");

        if (!attribute.getOnCreateIf().equals("") || !attribute.getOnEditIf().equals("") || !attribute.getOnDisplayIf().equals("") || !attribute.getOnDeleteIf().equals(""))
        {
          codeChunk.addHtmlCode("\t\t<rich:panel width=\"100%\" rendered=\"#{");
          codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='CREATE'");
          if (!attribute.getOnCreateIf().equals(""))
            codeChunk.addHtmlCode(" and " + attribute.getOnCreateIf());
          codeChunk.addHtmlCode(")");

          codeChunk.addHtmlCode(" or ");

          codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT'");
          if (!attribute.getOnEditIf().equals(""))
            codeChunk.addHtmlCode(" and " + attribute.getOnEditIf());
          codeChunk.addHtmlCode(")");

          codeChunk.addHtmlCode(" or ");

          codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY'");
          if (!attribute.getOnDisplayIf().equals(""))
            codeChunk.addHtmlCode(" and " + attribute.getOnDisplayIf());
          codeChunk.addHtmlCode(")");

          codeChunk.addHtmlCode(" or ");

          codeChunk.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'");
          if (!attribute.getOnDeleteIf().equals(""))
            codeChunk.addHtmlCode(" and " + attribute.getOnDeleteIf());
          codeChunk.addHtmlCode(")");
          codeChunk.addHtmlCode("}\" >\r\n");
        }
        else
        {
          codeChunk.addHtmlCode("\t<rich:panel>\r\n");
        }

        codeChunk.addHtmlCode("\t\t<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\r\n");

        codeChunk.addHtmlCode("\t\t<tr>\r\n");

        codeChunk.addHtmlCode("\t\t<td class=\"formFieldLabel\" >\r\n");
        codeChunk.addHtmlCode("\t\t\t<h:outputLabel value=\"#{msgs.form_" + bean.getName() + "_" + attribute.getQualifiedName().replace(".", "_") + "}\" />\r\n");
        codeChunk.addHtmlCode("\t\t</td>\r\n");

        codeChunk.addHtmlCode("\t\t<td width=\"1%\"></td>\r\n");

        codeChunk.addHtmlCode("\t\t<td>\r\n");
        codeChunk.addHtmlCode("\t\t\t<h:outputText value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + attribute.getQualifiedName() + "}\" />\r\n");
        codeChunk.addHtmlCode("\t\t</td>\r\n");

        codeChunk.addHtmlCode("\t\t</tr>\r\n");

        codeChunk.addHtmlCode("\t\t</table>\r\n");

        codeChunk.addHtmlCode("\t\t</rich:panel>\r\n");
        codeChunk.addHtmlCode("\t</td></tr>\r\n");
      }

      codeChunks.add(codeChunk);
    }

    // Inserisce gli attributi provenienti da relazioni
    for (int i = 0; i < bean.getRelationships().size(); i++)
    {
      Relationship rel = bean.getRelationships().get(i);

      if (rel.isUsed() && !rel.isMasterDetail())
      {
        CodeChunk codeChunk = null;

        //if ( infoReader.BeanCrudInPopUp(rel.getToBeanName()) )
        if (!rel.isListBox() && rel.isCRUD())
        {
          dynamicMenus += "<a4j:region>\r\n";
          dynamicMenus += "<rich:contextMenu attached=\"false\" id=\"menu" + rel.getName() + "\" submitMode=\"ajax\" >\r\n";

          dynamicMenus += "\t<rich:menuItem ajaxSingle=\"true\" value=\"#{msgs.list_" + rel.getToBeanName() + "_display}\" actionListener=\"#{" + rel.getToBeanName() + "Manager.popupMenuSelectItem}\" requestDelay=\"0\" oncomplete=\"openCrudPopUp_" + rel.getName() + "('Display');\">\r\n";
          dynamicMenus += "\t\t<a4j:actionparam name=\"selectedId\" value=\"{selectedBean}\" />\r\n";
          dynamicMenus += "\t</rich:menuItem>\r\n\r\n";

          if (rel.getPopUpEdit())
          {
            dynamicMenus += "\t<rich:menuItem ajaxSingle=\"true\" value=\"#{msgs.list_" + rel.getToBeanName() + "_edit}\" actionListener=\"#{" + rel.getToBeanName() + "Manager.popupMenuSelectItem}\" requestDelay=\"0\" oncomplete=\"openCrudPopUp_" + rel.getName() + "('Edit');\" rendered=\"#{(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='CREATE') or (" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT')}\" >\r\n";
            dynamicMenus += "\t\t<a4j:actionparam name=\"selectedId\" value=\"{selectedBean}\" />\r\n";
            dynamicMenus += "\t</rich:menuItem>\r\n\r\n";
          }

          if (rel.getPopUpDelete())
          {
            dynamicMenus += "\t<rich:menuItem ajaxSingle=\"true\" value=\"#{msgs.list_" + rel.getToBeanName() + "_delete}\" actionListener=\"#{" + rel.getToBeanName() + "Manager.popupMenuSelectItem}\" requestDelay=\"0\" oncomplete=\"openCrudPopUp_" + rel.getName() + "('Delete');\" rendered=\"#{(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='CREATE') or (" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT')}\" >\r\n";
            dynamicMenus += "\t\t<a4j:actionparam name=\"selectedId\" value=\"{selectedBean}\" />\r\n";
            dynamicMenus += "\t</rich:menuItem>\r\n\r\n";
          }

          dynamicMenus += "</rich:contextMenu>\r\n";
          dynamicMenus += "</a4j:region>\r\n";
        }

        if (!rel.isToMany())
        {
          // Relazione :1
          if (rel.isListBox())
          {
            // Relazione :1 implementata come ListBox
            codeChunk = insertSingleSelectionListBox2Form(sourceDir, bean, rel, true, false);
          }
          else
          {
            // Relazione :1 implementata come PopUp
            codeChunk = insertSingleSelectionPopUp2Form(sourceDir, bean, rel, inPopUp);
            if (rel.isRequired())
              updatePopUpRelationships += "\tupdatePopUpRelationships(\"" + Utils.makeFirstLetterLowerCase(bean.getName()) + "_" + rel.getName() + "\");\r\n";
            else
              updatePopUpRelationships += "";
          }
        }
        else
        {
          // Relazione :N
          if (rel.isListBox())
          {
            // Relazione :N implementata come ListBox
            codeChunk = insertMultipleSelectionListBox2Form(bean, rel, true, false);
          }
          else
          {
            // Relazione :N implementata come PopUp
            codeChunk = insertMultipleSelectionPopUp2Form(sourceDir, bean, rel, inPopUp);
            if (rel.isRequired())
              updatePopUpRelationships += "\tupdatePopUpRelationships(\"" + Utils.makeFirstLetterLowerCase(bean.getName()) + "_" + rel.getName() + "\");\r\n";
            else
              updatePopUpRelationships += "";
          }
        }

        codeChunk.setOrder(rel.getOrderInForm());
        codeChunks.add(codeChunk);
      }

      /** Relazioni master-detail in cui nel detail viene inserito anche una popup per la gestione del master **/
      if (rel.isUsed() && rel.isMasterDetail() && rel.getOrderInForm() != 0)
      {
        CodeChunk codeChunk = null;

        if (!rel.isToMany())
        {
          // Relazione :1 implementata come PopUp
          codeChunk = insertSingleSelectionPopUp2Form(sourceDir, bean, rel, inPopUp);
          if (rel.isRequired())
            updatePopUpRelationships += "\tupdatePopUpRelationships(\"" + Utils.makeFirstLetterLowerCase(bean.getName()) + "_" + rel.getName() + "\");\r\n";
          else
            updatePopUpRelationships += "";
        }
        else
        {
          // Relazione :N implementata come PopUp
          codeChunk = insertMultipleSelectionPopUp2Form(sourceDir, bean, rel, inPopUp);
          if (rel.isRequired())
            updatePopUpRelationships += "\tupdatePopUpRelationships(\"" + Utils.makeFirstLetterLowerCase(bean.getName()) + "_" + rel.getName() + "\");\r\n";
          else
            updatePopUpRelationships += "";
        }

        codeChunk.setOrder(rel.getOrderInForm());
        codeChunks.add(codeChunk);
      }

    }

    /** Predispone i Manager necessari per le chiamate remoting * */
    relatedManagers += bean.getName() + "Manager";

    for (int i = 0; i < bean.getRelationships().size(); i++)
    {
      Relationship rel = bean.getRelationships().get(i);

      if (rel.isUsed())
      {
        relatedManagers += "&" + rel.getToBeanName() + "Manager";
      }
    }

    /** Ordinamento dei chunck  **/

    CodeChunk chunks[] = codeChunks.toArray(new CodeChunk[0]);

    Arrays.sort(chunks, new CodeChunkComparator());

    //    for (int i = 0; i < chunks.length; i++)
    //    {
    //      javaScript += chunks[i].getJavascriptCode();
    //      rows += chunks[i].getHtmlCode();
    //    }

    Vector<CodeChunk> chunkVector = new Vector<CodeChunk>(java.util.Arrays.asList(chunks));

    /** Generazione dei grouppi di attributi **/
    for (int i = 0; i < bean.getFormFieldsGroups().size(); i++)
    {
      FormFieldsGroup group = bean.getFormFieldsGroups().get(i);

      CodeChunk start = new CodeChunk(group.getFromFieldOrder());
      start.addHtmlCode("\r\n\r\n<!-- START GROUP: " + group.getTitle() + "  -->\r\n");
      start.addHtmlCode("<rich:panel header=\"" + group.getTitle() + "\" rendered=\"#{");

      start.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='CREATE'");
      if (!group.getShowOnCreateIf().equals(""))
        start.addHtmlCode(" and " + group.getShowOnCreateIf());
      start.addHtmlCode(")");

      start.addHtmlCode(" or ");

      start.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT'");
      if (!group.getShowOnEditIf().equals(""))
        start.addHtmlCode(" and " + group.getShowOnEditIf());
      start.addHtmlCode(")");

      start.addHtmlCode(" or ");

      start.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY'");
      if (!group.getShowOnDisplayIf().equals(""))
        start.addHtmlCode(" and " + group.getShowOnDisplayIf());
      start.addHtmlCode(")");

      start.addHtmlCode(" or ");

      start.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'");
      if (!group.getShowOnDeleteIf().equals(""))
        start.addHtmlCode(" and " + group.getShowOnDeleteIf());
      start.addHtmlCode(")");

      start.addHtmlCode("}\" >\r\n\r\n");
      start.addHtmlCode("<table width=\"100%\">\r\n");

      int idx = getChunkIndex(chunkVector, start);

      chunkVector.add(idx, start);

      CodeChunk end = new CodeChunk(group.getToFieldOrder());

      end.addHtmlCode("</table>\r\n");
      end.addHtmlCode("\r\n\r\n</rich:panel>\r\n");
      //end.addHtmlCode("<tr:spacer height=\"25\" />\r\n");
      end.addHtmlCode("<!-- END GROUP: " + group.getTitle() + "  -->\r\n\r\n");

      idx = getChunkIndex(chunkVector, end);

      chunkVector.add(idx + 1, end);
    }

    /** Finalmente scrive i chunk nel tag che viene sostituito nel template **/

    for (int i = 0; i < chunkVector.size(); i++)
    {
      javaScript += chunkVector.get(i).getJavascriptCode();
      rows += chunkVector.get(i).getHtmlCode();
    }

    /** Gestione dei campi FORMATTEDTEXTAREA **/

    if (!textAreaIds.equals(""))
    {
      String HtmlEditorJavascriptTemplate = "." + File.separator + "templates" + File.separator + "HtmlEditorJavascript.js";

      HashMap<String, String> tags = new HashMap<String, String>();

      tags.put("@TextAreaIds", textAreaIds);

      javascriptHtmlEditor = Utils.SeamReplaceTag2String(tags, null, null, HtmlEditorJavascriptTemplate);
    }

    if (bean.getPrintMenuConditionInForm().equals(""))
      printButton = "\t\t<h:commandLink immediate=\"true\" value=\"#{msgs.Application_print}\" action=\"/" + bean.getName() + "Print.seam\" rendered=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation!='CREATE'}\" style=\"text-decoration: none; color: black\" />";
    else
      printButton = "\t\t<h:commandLink immediate=\"true\" value=\"#{msgs.Application_print}\" action=\"/" + bean.getName() + "Print.seam\" rendered=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation!='CREATE' and " + bean.getPrintMenuConditionInForm() + "}\" style=\"text-decoration: none; color: black\" />";

    /** Gestione campi nascosti per CRUDInSeparatePopup **/
    if (inPopUp)
    {
      Vector<Relationship> relationships2ThisBean = infoReader.getAllRelationship2ThisBean(bean.getName());

      for (int r = 0; r < relationships2ThisBean.size(); r++)
      {
        Relationship rel = relationships2ThisBean.get(r);

        Bean fromBean = infoReader.getBean(rel.getFromBeanName());

        String tmp = generatePopUpJavascriptFunctionsInPopup(fromBean).replace("startup", "loadHiddenFields").replace("\tdocument.forms[\"form\"].elements[\"form:", "\tdocument.forms[\"form\"].elements[\"form:" + rel.getFromBeanName());
        //        tmp += "\r\n"+generatePopUpJavascriptFunctionsInPopup(fromBean).replace("startup", "loadHiddenFields");

        if (javaScript.contains("loadHiddenFields"))
        {
          tmp = tmp.replace("function loadHiddenFields()", "");
          tmp = tmp.replace("{", "");

          javaScript = javaScript.replace("}", "\r\n" + tmp);
        }
        else
        {
          javaScript += tmp;
        }

        for (int i = 0; i < fromBean.getAttributes().size(); i++)
        {
          Attribute attr = fromBean.getAttributes().get(i);

          if (!attr.isKey() && (attr.getImplementationType() != AttributeImplementationType.HIDEINFORM) && (attr.getImplementationType() != AttributeImplementationType.READONLY))
          {
            String tmp1 = insertAttribute2Form(attr, fromBean.getName(), false).replace("id=\"", "id=\"" + rel.getFromBeanName()) + "\r\n";

            if (!hiddenAttributes.contains(tmp1))
              hiddenAttributes += tmp1;
View Full Code Here

    }

    // Attributi del bean nel form
    for (int i = 0; i < bean.getAttributes().size(); i++)
    {
      Attribute attr = bean.getAttributes().get(i);

      key = "form_" + bean.getName() + "_" + attr.getName();
      if (!prop.containsKey(key))
      {
        prop.put(key, Utils.makeFirstLetterUpperCase(attr.getName()));
      }
    }

    // Relazioni nel form
    for (int i = 0; i < bean.getRelationships().size(); i++)
    {
      Relationship rel = bean.getRelationships().get(i);

      key = "form_" + bean.getName() + "_" + rel.getName();
      if (!prop.containsKey(key))
      {
        prop.put(key, rel.getName().substring(3));
      }

      if (rel.isListBox())
      {
        ;
      }
      else
      {
        for (int j = 0; j < rel.getRelatedAttributes().size(); j++)
        {
          Attribute attr = rel.getRelatedAttributes().get(j);

          key = "form_" + bean.getName() + "_" + rel.getName();

          for (int k = 0; k < attr.getRelationships().size(); k++)
          {
            key += "_";
            key += attr.getRelationships().get(k).getName();
          }

          key += "_" + attr.getName();

          if (!prop.containsKey(key))
          {
            prop.put(key, Utils.makeFirstLetterUpperCase(attr.getName()));
          }
        }
      }
    }

    // Attributi delle relazioni da visualizzare nel form del bean
    for (int i = 0; i < bean.getShowInFormAttributes().size(); i++)
    {
      ShowAttribute attribute = bean.getShowInFormAttributes().get(i);

      key = "form_" + bean.getName() + "_" + attribute.getQualifiedName().replace(".", "_");

      if (!prop.containsKey(key))
      {
        prop.put(key, key);
      }
    }

    // Attributi del bean nella lista
    for (int i = 0; i < bean.getShowAttributes().size(); i++)
    {
      ShowAttribute attr = bean.getShowAttributes().get(i);

      if (!attr.belongsToRelationship())
      {
        key = "list_" + bean.getName() + "_" + attr.getName();
        if (!prop.containsKey(key))
        {
          prop.put(key, Utils.makeFirstLetterUpperCase(attr.getName()));
        }
      }
      else
      {
        // key = "list_" + bean.getName() + "_" + attr.getRelationship().getName() + "_" + attr.getName();

        key = "list_" + bean.getName();

        for (int k = 0; k < attr.getRelationships().size(); k++)
          key += "_" + attr.getRelationships().get(k).getName();

        key += "_" + attr.getName();

        if (!prop.containsKey(key))
        {
          prop.put(key, key);
        }
      }
    }

    // Pulsante di riferimento al master nella lista detail

    for (int i = 0; i < bean.getRelationships().size(); i++)
    {
      Relationship rel = bean.getRelationships().get(i);

      if (rel.isMasterDetail())
      {
        if (!rel.isFromMany() && !rel.isToMany() && !rel.isFromMaster())
        {
          // Relazione 1:1 Master-Detail in cui il bean e' il Detail

          key = "list_" + rel.getFromBeanName() + "_" + rel.getName() + "_OnlyOne" + rel.getFromBeanName() + "Allowed";

          if (!prop.containsKey(key))
          {
            prop.put(key, "Only one " + rel.getFromBeanName()+" allowed");
          }
        }

        // Inserisce il bottone di selezione del master o del detail a seconda del verso della relazione

        if (!rel.isFromMaster())
        {
          // Questo bean e' il Detail
          key = "list_" + rel.getFromBeanName() + "_" + rel.getToBeanName();

          if (!prop.containsKey(key))
          {
            prop.put(key, rel.getToBeanName());
          }
        }
        else
        {
          // Questo bean e' il master

          Vector<ShowList> lists = infoReader.getLists(rel.getToBeanName());

          for (ShowList list : lists)
          {
            key = "list_" + rel.getFromBeanName() + "_" + list.getName();

            if (!prop.containsKey(key))
            {
              prop.put(key, list.getName());
            }
          }
        }
      }
    }

    /** Etichette per i campi della ricerca locale **/
    for (int i = 0; i < bean.getLocalSearchAttributes().size(); i++)
    {
      ShowAttribute attr = bean.getLocalSearchAttributes().get(i);

      if (attr.getRelationship() == null)
      {
        key = "localSearch_" + bean.getName() + "_" + attr.getName();
        if (!prop.containsKey(key))
        {
          prop.put(key, Utils.makeFirstLetterUpperCase(attr.getName()));
        }
      }
      else
      {
        key = "localSearch_" + bean.getName() + "_" + attr.getRelationship().getName() + "_" + attr.getName();
        if (!prop.containsKey(key))
        {
          prop.put(key, attr.getRelationship().getName() + "_" + Utils.makeFirstLetterUpperCase(attr.getName()));
        }
      }

    }

View Full Code Here

TOP

Related Classes of org.boco.seamwebappgen.info.Attribute

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.