/** * returns the component at the given position * * @param i position * @return component at given pos */ public SComponent getComponent(int i) { return (SComponent) getComponentList().get(i); }
/** * returns the number of components in this container * * @return number of components */ public int getComponentCount() { return getComponentList().size(); }
/** * Adds a component to the container with the given constraint at the end * of the internal list. * * @param c the component to add * @param constraint the constraint for this component * @return the added component */ public SComponent addComponent(SComponent c, Object constraint) { return addComponent(c, constraint, getComponentList().size()); }
public SComponent[] getComponents() { // vorsichtig mit Threads ( eigentlich TreeLock!!!) return (SComponent[]) getComponentList().toArray(new SComponent[getComponentCount()]); }
/** * Calls the visitor on each SComponent this container has. You might * want to call this in your visitor in visit(SContainer). * * @param visitor an implementation of the {@link ComponentVisitor} * interface. */ public void inviteEachComponent(ComponentVisitor visitor) throws Exception { for (Object o : getComponentList()) { ((SComponent) o).invite(visitor); } }
@Override public void addNotify() { for (Object o : getComponentList()) { ((SComponent) o).addNotify(); } super.addNotify(); }
@Override public void removeNotify() { for (Object o : getComponentList()) { ((SComponent) o).removeNotify(); } super.removeNotify(); }
/** * Removes the given component from the container. * * @param c the component to remove * @see #remove(org.wings.SComponent) */ public void remove(SComponent c) { if (c == null) return; if (layout != null) layout.removeComponent(c); int index = getComponentList().indexOf(c); if (getComponentList().remove(c)) { getConstraintList().remove(index); c.removeNotify(); fireContainerEvent(SContainerEvent.COMPONENT_REMOVED, c); c.setParent(null); reload(); } }
/** * CAVEAT this did not work yet... We need to clone the layout manager as * well, so SLayoutManager must be Cloneable */ @Override public Object clone() { try { SContainer erg = (SContainer) super.clone(); // uiuiui, layout manager must be cloned as well,... // componentList and constraintList contain references to the // original components / constraints erg.getComponentList().clear(); erg.getConstraintList().clear(); for (int i = 0; i < getComponentCount(); i++) { erg.addComponent((SComponent) getComponent(i).clone()); } return erg; } catch (Exception e) { log.error("Unable to clone container", e); return null; } }
index = getComponentList().size(); getComponentList().add(index, c); getConstraintList().add(index, constraint); c.setParent(this);
rows = 0; for (Object o1 : getContainer().getComponentList()) { SComponent comp = (SComponent) o1; if (!comp.isVisible()) { colweight = new double[rows]; for (Object o : getContainer().getComponentList()) { SComponent comp = (SComponent) o; if (!comp.isVisible()) {
public void removeWindow(SWindow window) { if (!windowsPane.getComponentList().contains(window)) { return; } getSession().getReloadManager().setSuppressMode(true); windowsPane.remove(window); getSession().getReloadManager().setSuppressMode(false); if (isUpdatePossible() && SRootContainer.class.isAssignableFrom(getClass())) { update(((RootContainerCG) getCG()).getRemoveWindowUpdate(windowsPane, window)); } else { windowsPane.reload(); } }