Beispiel #1
0
 public void movePropertyToLeft(int index) {
   if (propertiesNames == null) return;
   if (index <= 0) return;
   Object aux = propertiesNames.get(index);
   propertiesNames.set(index, propertiesNames.get(index - 1));
   propertiesNames.set(index - 1, aux);
   resetAfterAddRemoveProperty();
 }
Beispiel #2
0
 public void movePropertyToRight(int index) {
   if (propertiesNames == null) return;
   if (index >= propertiesNames.size() - 1) return;
   Object aux = propertiesNames.get(index);
   propertiesNames.set(index, propertiesNames.get(index + 1));
   propertiesNames.set(index + 1, aux);
   resetAfterAddRemoveProperty();
 }
Beispiel #3
0
 public List<String> getPropertiesNamesWithKeyAndHidden() throws XavaException {
   if (propertiesNamesWithKeyAndHidden == null) {
     propertiesNamesWithKeyAndHidden = new ArrayList<String>();
     propertiesNamesWithKeyAndHidden.addAll(getMetaModel().getAllKeyPropertiesNames());
     propertiesNamesWithKeyAndHidden.addAll(getPropertiesNames());
     propertiesNamesWithKeyAndHidden.addAll(getHiddenPropertiesNames());
   }
   return propertiesNamesWithKeyAndHidden;
 }
Beispiel #4
0
 // assert(!areAllProperties());
 private List createPropertiesNames() {
   StringTokenizer st = new StringTokenizer(removeTotalProperties(properties), ",;");
   List result = new ArrayList();
   while (st.hasMoreTokens()) {
     String name = st.nextToken().trim();
     if (name.endsWith("+")) {
       name = name.substring(0, name.length() - 1);
       if (sumPropertiesNames == null) sumPropertiesNames = new HashSet();
       sumPropertiesNames.add(name);
     }
     result.add(name);
   }
   return result;
 }
Beispiel #5
0
 public List namesToMetaProperties(Collection names) throws XavaException {
   List metaProperties = new ArrayList();
   Iterator it = names.iterator();
   int i = -1;
   while (it.hasNext()) {
     i++;
     String name = (String) it.next();
     MetaProperty metaPropertyTab = null;
     try {
       MetaProperty metaProperty = getMetaModel().getMetaProperty(name).cloneMetaProperty();
       metaProperty.setQualifiedName(name);
       String labelId = null;
       if (representCollection()) {
         labelId = getId() + "." + name;
         // If there is no specific translation for the collection,
         // we take the translation from the default tab.
         if (!Labels.existsExact(labelId)) {
           labelId = getIdForDefaultTab() + ".properties." + name;
         }
       } else {
         labelId = getId() + ".properties." + name;
       }
       if (Labels.exists(labelId)) {
         metaProperty.setLabelId(labelId);
       } else if (metaPropertiesTab != null) {
         // By now only the label overwritten from the property of tab
         metaPropertyTab = (MetaProperty) metaPropertiesTab.get(name);
         if (metaPropertyTab != null) {
           metaProperty = metaProperty.cloneMetaProperty();
           metaProperty.setLabel(metaPropertyTab.getLabel());
         }
       }
       metaProperties.add(metaProperty);
     } catch (ElementNotFoundException ex) {
       MetaProperty notInEntity = new MetaProperty();
       notInEntity.setName(name);
       notInEntity.setTypeName("java.lang.Object");
       if (metaPropertyTab != null) {
         notInEntity.setLabel(metaPropertyTab.getLabel());
       }
       metaProperties.add(notInEntity);
     }
   }
   return metaProperties;
 }
Beispiel #6
0
 private List createAllPropertiesNames() throws XavaException {
   List result = new ArrayList();
   // First the properties from a possible @EmbeddedId
   for (Iterator itRef = getMetaModel().getMetaReferencesKey().iterator(); itRef.hasNext(); ) {
     MetaReference ref = (MetaReference) itRef.next();
     if (ref.isAggregate()) {
       for (Iterator itKey =
               ref.getMetaModelReferenced()
                   .getPropertiesNamesWithoutHiddenNorTransient()
                   .iterator();
           itKey.hasNext(); ) {
         result.add(ref.getName() + "." + itKey.next());
       }
     }
   }
   // Now the plain properties
   result.addAll(getMetaModel().getPropertiesNamesWithoutHiddenNorTransient());
   return result;
 }
Beispiel #7
0
 /**
  * Hidden ones are not included
  *
  * @return Not null, read only and of type <tt>MetaProperty</tt>.
  */
 public Collection getMetaPropertiesCalculated() throws XavaException {
   if (metaPropertiesCalculated == null) {
     metaPropertiesCalculated = new ArrayList();
     Iterator it = getMetaProperties().iterator();
     while (it.hasNext()) {
       MetaProperty metaProperty = (MetaProperty) it.next();
       if (metaProperty.isCalculated()) {
         metaPropertiesCalculated.add(metaProperty);
       }
     }
   }
   return metaPropertiesCalculated;
 }
Beispiel #8
0
 public List getRemainingPropertiesNames() throws XavaException {
   List result = new ArrayList(getMetaModel().getRecursiveQualifiedPropertiesNames());
   result.removeAll(getPropertiesNames());
   return result;
 }
Beispiel #9
0
 /** For dynamically remove all properties to this tab */
 public void clearProperties() {
   if (propertiesNames == null) return;
   propertiesNames.clear();
   resetAfterAddRemoveProperty();
 }
Beispiel #10
0
 /** For dynamically remove properties to this tab */
 public void removeProperty(int index) {
   if (propertiesNames == null) return;
   propertiesNames.remove(index);
   resetAfterAddRemoveProperty();
 }
Beispiel #11
0
 /** For dynamically remove properties to this tab */
 public void removeProperty(String propertyName) {
   if (propertiesNames == null) return;
   propertiesNames.remove(propertyName);
   resetAfterAddRemoveProperty();
 }
Beispiel #12
0
 /** For dynamically add properties to this tab */
 public void addProperty(int index, String propertyName) {
   if (propertiesNames == null) return;
   propertiesNames.add(index, propertyName);
   resetAfterAddRemoveProperty();
 }