/** * @see com.alkacon.acacia.client.I_EntityRenderer#renderInline(com.alkacon.vie.shared.I_Entity, * com.google.gwt.dom.client.Element) */ public void renderInline(I_Entity entity, Element context) { I_Type entityType = m_vie.getType(entity.getTypeName()); List<String> attributeNames = entityType.getAttributeNames(); for (String attributeName : attributeNames) { I_Type attributeType = entityType.getAttributeType(attributeName); I_EntityRenderer renderer = m_widgetService.getRendererForAttribute(attributeName, attributeType); renderer.renderInline( entity, attributeName, context, entityType.getAttributeMinOccurrence(attributeName), entityType.getAttributeMaxOccurrence(attributeName)); } }
/** * @see com.alkacon.acacia.client.I_EntityRenderer#renderForm(com.alkacon.vie.shared.I_Entity, * com.google.gwt.user.client.ui.Panel) */ public void renderForm(final I_Entity entity, Panel context) { context.addStyleName(ENTITY_CLASS); context.getElement().setAttribute("typeof", entity.getTypeName()); context.getElement().setAttribute("about", entity.getId()); I_Type entityType = m_vie.getType(entity.getTypeName()); List<String> attributeNames = entityType.getAttributeNames(); for (final String attributeName : attributeNames) { AttributeHandler handler = new AttributeHandler(m_vie, entity, attributeName, m_widgetService); I_Type attributeType = entityType.getAttributeType(attributeName); I_EntityRenderer renderer = m_widgetService.getRendererForAttribute(attributeName, attributeType); int minOccurrence = entityType.getAttributeMinOccurrence(attributeName); String label = m_widgetService.getAttributeLabel(attributeName); String help = m_widgetService.getAttributeHelp(attributeName); ValuePanel attributeElement = new ValuePanel(); context.add(attributeElement); I_EntityAttribute attribute = entity.getAttribute(attributeName); if ((attribute == null) && (minOccurrence > 0)) { attribute = createEmptyAttribute(entity, attributeName, minOccurrence); } if (attribute != null) { for (int i = 0; i < attribute.getValueCount(); i++) { AttributeValueView valueWidget = new AttributeValueView(handler, label, help); attributeElement.add(valueWidget); if (attribute.isSimpleValue()) { valueWidget.setValueWidget( m_widgetService.getAttributeWidget(attributeName), attribute.getSimpleValues().get(i)); } else { valueWidget.setValueEntity(renderer, attribute.getComplexValues().get(i)); } } } else { AttributeValueView valueWidget = new AttributeValueView(handler, label, help); attributeElement.add(valueWidget); } handler.updateButtonVisisbility(); } }