예제 #1
0
 /** {@inheritDoc} */
 @Override
 public void performInitialization(Object model) {
   List<Component> items = new ArrayList<Component>();
   List<Object> modelCollection =
       ObjectPropertyUtils.getPropertyValue(model, tabCollectionPropertyName);
   int index = 0;
   for (Object tabObj : modelCollection) {
     String idSuffix;
     if (idSuffixPropertyName != null) {
       idSuffix = ObjectPropertyUtils.getPropertyValueAsText(tabObj, idSuffixPropertyName);
     } else {
       idSuffix = Integer.toString(index);
     }
     Group newGroup = ComponentUtils.copy(groupPrototype, "_" + idSuffix);
     if (expressionProperties != null && !expressionProperties.isEmpty()) {
       Map<String, Object> tabContext = new HashMap<String, Object>();
       for (Map.Entry<String, String> entry : expressionProperties.entrySet()) {
         tabContext.put(
             entry.getKey(), ObjectPropertyUtils.getPropertyValueAsText(tabObj, entry.getValue()));
       }
       ContextUtils.pushAllToContextDeep(newGroup, tabContext);
     }
     if (setFieldBindingObjectPath && newGroup instanceof CollectionGroup) {
       ((CollectionGroup) newGroup)
           .getBindingInfo()
           .setBindingObjectPath(tabCollectionPropertyName + "[" + index + "]");
     } else if (setFieldBindingObjectPath) {
       newGroup.setFieldBindingObjectPath(tabCollectionPropertyName + "[" + index + "]");
     }
     items.add(newGroup);
     index++;
   }
   setItems(items);
   super.performInitialization(model);
 }