public SComponent[] getComponents() { return layout.getContainer().getComponents(); } }
/** * Retrieves the first contained component of a certain type. * * @param component * the component to start from. * @param childSComponentType * the type of the component to look for. * @return the first contained component of the looked for type or null if * none. */ public static SComponent getFirstChildSComponentOfType(SComponent component, Class<? extends SComponent> childSComponentType) { if (childSComponentType.isAssignableFrom(component.getClass())) { return component; } else if (component instanceof SContainer) { SComponent[] children = ((SContainer) component).getComponents(); for (SComponent child : children) { SComponent childResult = getFirstChildSComponentOfType(child, childSComponentType); if (childResult != null) { return childResult; } } } return null; }
/** * Search in the given SContainer for the SComponent with the given name. * @param container The SContainer where you want to search for the SComponent with the given name. * @param name The Name of the SComponent * @return the SComponent with the given name */ public static SComponent getComponentByName(SContainer container, String name) { SComponent component = null; SComponent[] components = container.getComponents(); for (SComponent component_x : components) { if (component_x.getName().equals(name)) { component = component_x; break; } else if (component_x instanceof SContainer) { component = getComponentByName((SContainer) component_x, name); if (component != null) { break; } } } return component; }
private void updateComponentTreeCG(SComponent c) { c.updateCG(); if (c instanceof SContainer) { SComponent[] children = ((SContainer) c).getComponents(); for (SComponent aChildren : children) { updateComponentTreeCG(aChildren); } } updateCG(); }
private static void rebuildPanel(SContainer oldPanel, SContainer newPanel) { SLayoutManager layoutManager = oldPanel.getLayout(); SComponent[] components = oldPanel.getComponents(); ArrayList constraints = oldPanel.getConstraintList(); oldPanel.removeAll(); oldPanel.setLayout(null); newPanel.setLayout(layoutManager); for (int i = 0; i < components.length; i++) { SComponent component = components[i]; Object constraint = constraints.get(i); newPanel.add(component, constraint); } }
componentSet.names = names; componentSet.componentProperties = org.wings.plaf.css.TemplateIntegrationLayoutCG.getComponentProperties(this); for (SComponent component : container.getComponents()) { if (names.contains(component.getName())) componentSet.contained.add(component);