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; }
/** * 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; }
// 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; }
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; }
/** For dynamically add properties to this tab */ public void addProperty(int index, String propertyName) { if (propertiesNames == null) return; propertiesNames.add(index, propertyName); resetAfterAddRemoveProperty(); }