I_Entity parentEntity,
AttributeHandler attributeHandler,
int attributeIndex,
Panel context) {
I_Type entityType = m_vie.getType(parentEntity.getTypeName());
I_Type attributeType = attributeHandler.getAttributeType();
String attributeName = attributeHandler.getAttributeName();
int minOccurrence = entityType.getAttributeMinOccurrence(attributeName);
I_EntityAttribute attribute = parentEntity.getAttribute(attributeName);
if ((attribute == null) && (minOccurrence > 0)) {
attribute = createEmptyAttribute(parentEntity, attributeName, minOccurrence);
}
ValuePanel attributeElement = new ValuePanel();
context.add(attributeElement);
context.addStyleName(ENTITY_CLASS);
RootHandler parentHandler = new RootHandler();
parentHandler.ensureHandlers(attributeIndex);
parentHandler.setHandler(attributeIndex, attributeName, attributeHandler);
attributeHandler.setSingleValueIndex(attributeIndex);
String label = m_widgetService.getAttributeLabel(attributeName);
String help = m_widgetService.getAttributeHelp(attributeName);
if (attribute != null) {
I_EntityRenderer renderer = m_widgetService.getRendererForAttribute(attributeName, attributeType);
AttributeValueView valueWidget = new AttributeValueView(attributeHandler, label, help);
if (attributeType.isChoice() && (entityType.getAttributeMaxOccurrence(attributeName) == 1)) {
valueWidget.setCollapsed(true);
}
attributeElement.add(valueWidget);
if (attribute.isSimpleValue()) {
valueWidget.setValueWidget(