AttributeHandler.setResizeHandler(tabSizeHandler);
tabbedPanel.getElement().getStyle().setBorderWidth(0, Unit.PX);
Iterator<TabInfo> tabIt = tabInfos.iterator();
TabInfo currentTab = tabIt.next();
TabInfo nextTab = tabIt.next();
FlowPanel tabPanel = new FlowPanel();
tabPanel.addStyleName(ENTITY_CLASS);
tabPanel.addStyleName(I_LayoutBundle.INSTANCE.form().formParent());
tabPanel.getElement().getStyle().setMargin(0, Unit.PX);
tabbedPanel.addNamed(tabPanel, currentTab.getTabName(), currentTab.getTabId());
I_Type entityType = m_vie.getType(entity.getTypeName());
List<String> attributeNames = entityType.getAttributeNames();
for (final String attributeName : attributeNames) {
boolean collapsed = false;
if ((nextTab != null) && attributeName.endsWith("/" + nextTab.getStartName())) {
currentTab = nextTab;
nextTab = tabIt.hasNext() ? tabIt.next() : null;
tabPanel = new FlowPanel();
tabPanel.addStyleName(ENTITY_CLASS);
tabPanel.addStyleName(I_LayoutBundle.INSTANCE.form().formParent());
tabPanel.getElement().getStyle().setMargin(0, Unit.PX);
tabbedPanel.addNamed(tabPanel, currentTab.getTabName(), currentTab.getTabId());
// check if the tab content may be collapsed
if (currentTab.isCollapsed()) {
int currentIndex = attributeNames.indexOf(attributeName);
collapsed = ((currentIndex + 1) == attributeNames.size())
|| ((nextTab != null) && attributeNames.get(currentIndex + 1).endsWith(
"/" + nextTab.getStartName()));
}
}
AttributeHandler handler = new AttributeHandler(m_vie, entity, attributeName, m_widgetService);
parentHandler.setHandler(attributeIndex, attributeName, handler);
I_Type attributeType = entityType.getAttributeType(attributeName);
I_EntityRenderer renderer = m_widgetService.getRendererForAttribute(attributeName, attributeType);
int minOccurrence = entityType.getAttributeMinOccurrence(attributeName);
I_EntityAttribute attribute = entity.getAttribute(attributeName);
// only single complex values may be collapsed
if (collapsed
&& (attribute != null)
&& !attributeType.isSimpleType()
&& (minOccurrence == 1)
&& (entityType.getAttributeMaxOccurrence(attributeName) == 1)) {
renderer.renderForm(attribute.getComplexValue(), tabPanel, handler, 0);
} else {
String label = m_widgetService.getAttributeLabel(attributeName);
String help = m_widgetService.getAttributeHelp(attributeName);
ValuePanel attributeElement = new ValuePanel();
tabPanel.add(attributeElement);
if ((attribute == null) && (minOccurrence > 0)) {
attribute = createEmptyAttribute(entity, attributeName, minOccurrence);
}
if (attribute != null) {
for (int i = 0; i < attribute.getValueCount(); i++) {