示例#1
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;
 }
示例#2
0
 public void addMetaProperty(MetaProperty metaProperty) {
   if (metaPropertiesTab == null) {
     metaPropertiesTab = new HashMap();
   }
   metaPropertiesTab.put(metaProperty.getName(), metaProperty);
 }