Package org.boco.seamwebappgen.annotations

Examples of org.boco.seamwebappgen.annotations.ShowAttributeInList


        attr.setKey(isKey(cBean, fields[j]));

        // Recupera l'implementation type        
        attr.setImplementationType(this.getBeanAttribute(beanName, attr.getName()).getImplementationType());

        ShowAttributeInList annotation = (ShowAttributeInList) getFieldAnnotation(fields[j], ShowAttributeInList.class);

        if (annotation.isDefaultOrderingAttribute() && annotation.ascending())
        {
          attr.setDefaultOrderingAttribute("Asc");
        }

        if (annotation.isDefaultOrderingAttribute() && !annotation.ascending())
        {
          attr.setDefaultOrderingAttribute("Desc");
        }

        ShowAttribute showAttr = new ShowAttribute(null, attr);
        showAttr.setListFormatOff(annotation.formatOff());

        for (int i = 0; i < annotation.iconValues().length; i++)
        {
          showAttr.addIconValue(annotation.iconValues()[i]);
        }

        for (int i = 0; i < annotation.icons().length; i++)
        {
          showAttr.addIcon(annotation.icons()[i]);
        }

        if (isAlternateOrderingAttribute(fields[j]))
        {
          // Il campo ha una annotazione @AlternateOrderingAttribute

          AlternateOrderingAttribute ann = fields[j].getAnnotation(AlternateOrderingAttribute.class);

          showAttr.setAlternateOrderingAttribute(ann.attribute());
        }

        showAttr.setWidth(annotation.width());
       
        if (order(fields[j]) != 1000)
        {
          if (tmp.size() <= order(fields[j]))
            tmp.setSize(order(fields[j]) + 1);

          if (tmp.get(order(fields[j])) != null)
            throw new ShowAttributeWrongOrderException(fields[j].getName(), beanName);

          tmp.set(order(fields[j]), showAttr);
        }
        else
          tmp.add(showAttr);
      }
    }

    // Inserisce i campi di tipo @Transient
    // escludendo getSerialVersionUID

    Method methods[] = cBean.getDeclaredMethods();

    /** Ordinamento degli attributi per nome **/

    java.util.Arrays.sort(methods, new JavaMethodComparator());

    for (int i = 0; i < methods.length; i++)
    {
      if (methods[i].getName().startsWith("get") && !methods[i].getName().equals("getSerialVersionUID") && methods[i].getAnnotation(javax.persistence.Transient.class) != null && methods[i].getAnnotation(ShowTransientAttributeInList.class) != null)
      {
        Attribute attr = new Attribute();

        //attr.setName(methods[i].getName());

        attr.setName(Utils.makeMethod2Field(methods[i].getName()));

        attr.setType(methods[i].getReturnType().getName());
        attr.setKey(false);
        attr.setTrans(true);

        ShowAttribute showAttr = new ShowAttribute(null, attr);

        ShowTransientAttributeInList annotation = methods[i].getAnnotation(ShowTransientAttributeInList.class);

        showAttr.setTransientParameters(annotation.parameters());
        showAttr.setWidth(annotation.width());

        if (annotation.order() != 1000)
        {
          if (tmp.size() <= annotation.order())
            tmp.setSize(annotation.order() + 1);

          //          if (tmp.get(order(methods[i])) != null)
          //            throw new ShowAttributeWrongOrderException(methods[i].getName(), beanName);

          tmp.set(annotation.order(), showAttr);
        }
        else
          tmp.add(showAttr);

        //        if (order(methods[i]) != 1000)
        //        {
        //          if (tmp.size() <= order(methods[i]))
        //            tmp.setSize(order(methods[i]) + 1);
        //
        //          if (tmp.get(order(methods[i])) != null)
        //            throw new ShowAttributeWrongOrderException(methods[i].getName(), beanName);
        //
        //          tmp.set(order(methods[i]), showAttr);
        //        }
        //        else
        //          tmp.add(showAttr);
      }
    }

    // Attributi delle relazioni collegate al bean

    for (int j = 0; j < methods.length; j++)
    {
      Annotation annotations[] = methods[j].getAnnotations();

      // System.out.println("Metodo "+methods[j].getName());

      for (int k = 0; k < annotations.length; k++)
      {
        Annotation annotation = annotations[k];

        if (annotation.annotationType().equals(ShowRelationshipAttributesInList.class))
        {
          String attributesName[] = ((ShowRelationshipAttributesInList) annotation).names();
          int    attributesOrder[] = ((ShowRelationshipAttributesInList) annotation).orders();
          String widths[] = ((ShowRelationshipAttributesInList) annotation).widths();
         
View Full Code Here

TOP

Related Classes of org.boco.seamwebappgen.annotations.ShowAttributeInList

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.