/** * Creates a set of components to be rendered from the supplied descriptors. * * @param object the parent object * @param properties the properties * @param context the layout context * @return the components */ @Override protected ComponentSet createComponentSet( IMObject object, List<Property> properties, LayoutContext context) { ComponentSet set = super.createComponentSet(object, properties, context); Lookup lookup = AlertHelper.getAlertType((Act) object); ComponentState alertType = set.get("alertType"); if (lookup != null && alertType != null) { initAlertType(lookup, alertType.getComponent()); } ComponentState priority = getPriority(lookup); int index = set.indexOf("alertType"); if (index >= 0) { set.add(index + 1, priority); } else { set.add(priority); } return set; }
/** * Lay out out the object in the specified container. * * @param object the object to lay out * @param properties the object's properties * @param parent the parent object. May be {@code null} * @param container the container to use * @param context the layout context */ @Override protected void doLayout( IMObject object, PropertySet properties, IMObject parent, Component container, LayoutContext context) { ArchetypeDescriptor archetype = context.getArchetypeDescriptor(object); ArchetypeNodes nodes = getArchetypeNodes(); NodeFilter filter = getNodeFilter(object, context); List<Property> simple = nodes.getSimpleNodes(properties, archetype, object, filter); List<Property> complex = nodes.getComplexNodes(properties, archetype, object, filter); if (simple.size() == 1 && complex.isEmpty()) { ComponentSet set = createComponentSet(object, simple, context); ComponentState state = set.getComponents().get(0); setFocusTraversal(state); container.add(state.getComponent()); } else { doSimpleLayout(object, parent, simple, container, context); doComplexLayout(object, parent, complex, container, context); } }