aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/ui/AbstractComponentContainer.java
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2007-11-19 14:03:05 +0000
committerMarc Englund <marc.englund@itmill.com>2007-11-19 14:03:05 +0000
commitf2e3722df9676436680afc0f1991e91e1696fb99 (patch)
tree6f255ff78abaf96f1e71a1f2c9ecd3b66647f4a2 /src/com/itmill/toolkit/ui/AbstractComponentContainer.java
parent93291f532db9d545cf2a8dd98e2671f27cd197b0 (diff)
downloadvaadin-framework-f2e3722df9676436680afc0f1991e91e1696fb99.tar.gz
vaadin-framework-f2e3722df9676436680afc0f1991e91e1696fb99.zip
MASS REFORMAT.
According to http://toolkit.intra.itmill.com/trac/itmilltoolkit/wiki/CodingConventions svn changeset:2864/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/ui/AbstractComponentContainer.java')
-rw-r--r--src/com/itmill/toolkit/ui/AbstractComponentContainer.java327
1 files changed, 166 insertions, 161 deletions
diff --git a/src/com/itmill/toolkit/ui/AbstractComponentContainer.java b/src/com/itmill/toolkit/ui/AbstractComponentContainer.java
index 6c2e45d562..9f4fcb45a1 100644
--- a/src/com/itmill/toolkit/ui/AbstractComponentContainer.java
+++ b/src/com/itmill/toolkit/ui/AbstractComponentContainer.java
@@ -44,166 +44,171 @@ import java.util.LinkedList;
* @since 3.0
*/
public abstract class AbstractComponentContainer extends AbstractComponent
- implements ComponentContainer {
-
- /**
- * Constructs a new component container.
- */
- public AbstractComponentContainer() {
- super();
- }
-
- /**
- * Removes all components from the container. This should probably be
- * reimplemented in extending classes for a more powerfull implementation.
- */
- public void removeAllComponents() {
- LinkedList l = new LinkedList();
-
- // Adds all components
- for (Iterator i = getComponentIterator(); i.hasNext();)
- l.add(i.next());
-
- // Removes all component
- for (Iterator i = l.iterator(); i.hasNext();)
- removeComponent((Component) i.next());
- }
-
- /*
- * Moves all components from an another container into this container. Don't
- * add a JavaDoc comment here, we use the default documentation from
- * implemented interface.
- */
- public void moveComponentsFrom(ComponentContainer source) {
- LinkedList components = new LinkedList();
- for (Iterator i = source.getComponentIterator(); i.hasNext();)
- components.add(i.next());
-
- for (Iterator i = components.iterator(); i.hasNext();) {
- Component c = (Component) i.next();
- source.removeComponent(c);
- addComponent(c);
- }
- }
-
- /**
- * Notifies all contained components that the container is attached to a
- * window.
- *
- * @see com.itmill.toolkit.ui.Component#attach()
- */
- public void attach() {
- super.attach();
-
- for (Iterator i = getComponentIterator(); i.hasNext();)
- ((Component) i.next()).attach();
- }
-
- /**
- * Notifies all contained components that the container is detached from a
- * window.
- *
- * @see com.itmill.toolkit.ui.Component#detach()
- */
- public void detach() {
- super.detach();
-
- for (Iterator i = getComponentIterator(); i.hasNext();)
- ((Component) i.next()).detach();
- }
-
- /* Events ************************************************************ */
-
- private static final Method COMPONENT_ATTACHED_METHOD;
-
- private static final Method COMPONENT_DETACHED_METHOD;
-
- static {
- try {
- COMPONENT_ATTACHED_METHOD = ComponentAttachListener.class
- .getDeclaredMethod("componentAttachedToContainer",
- new Class[] { ComponentAttachEvent.class });
- COMPONENT_DETACHED_METHOD = ComponentDetachListener.class
- .getDeclaredMethod("componentDetachedFromContainer",
- new Class[] { ComponentDetachEvent.class });
- } catch (java.lang.NoSuchMethodException e) {
- // This should never happen
- throw new java.lang.RuntimeException();
- }
- }
-
- /* documented in interface */
- public void addListener(ComponentAttachListener listener) {
- addListener(ComponentContainer.ComponentAttachEvent.class, listener,
- COMPONENT_ATTACHED_METHOD);
- }
-
- /* documented in interface */
- public void addListener(ComponentDetachListener listener) {
- addListener(ComponentContainer.ComponentDetachEvent.class, listener,
- COMPONENT_DETACHED_METHOD);
- }
-
- /* documented in interface */
- public void removeListener(ComponentAttachListener listener) {
- removeListener(ComponentContainer.ComponentAttachEvent.class, listener,
- COMPONENT_ATTACHED_METHOD);
- }
-
- /* documented in interface */
- public void removeListener(ComponentDetachListener listener) {
- removeListener(ComponentContainer.ComponentDetachEvent.class, listener,
- COMPONENT_DETACHED_METHOD);
- }
-
- /**
- * Fires the component attached event. This should be called by the
- * addComponent methods after the component have been added to this
- * container.
- *
- * @param component
- * the component that has been added to this container.
- */
- protected void fireComponentAttachEvent(Component component) {
- fireEvent(new ComponentAttachEvent(this, component));
- }
-
- /**
- * Fires the component detached event. This should be called by the
- * removeComponent methods after the component have been removed from this
- * container.
- *
- * @param component
- * the component that has been removed from this container.
- */
- protected void fireComponentDetachEvent(Component component) {
- fireEvent(new ComponentDetachEvent(this, component));
- }
-
- /**
- * This only implements the events and component parent calls. The extending
- * classes must implement component list maintenance and call this method
- * after component list maintenance.
- *
- * @see com.itmill.toolkit.ui.ComponentContainer#addComponent(Component)
- */
- public void addComponent(Component c) {
- c.setParent(this);
- fireComponentAttachEvent(c);
- }
-
- /**
- * This only implements the events and component parent calls. The extending
- * classes must implement component list maintenance and call this method
- * before component list maintenance.
- *
- * @see com.itmill.toolkit.ui.ComponentContainer#removeComponent(Component)
- */
- public void removeComponent(Component c) {
- if (c.getParent() == this) {
- c.setParent(null);
- fireComponentDetachEvent(c);
- }
- }
+ implements ComponentContainer {
+
+ /**
+ * Constructs a new component container.
+ */
+ public AbstractComponentContainer() {
+ super();
+ }
+
+ /**
+ * Removes all components from the container. This should probably be
+ * reimplemented in extending classes for a more powerfull implementation.
+ */
+ public void removeAllComponents() {
+ LinkedList l = new LinkedList();
+
+ // Adds all components
+ for (Iterator i = getComponentIterator(); i.hasNext();) {
+ l.add(i.next());
+ }
+
+ // Removes all component
+ for (Iterator i = l.iterator(); i.hasNext();) {
+ removeComponent((Component) i.next());
+ }
+ }
+
+ /*
+ * Moves all components from an another container into this container. Don't
+ * add a JavaDoc comment here, we use the default documentation from
+ * implemented interface.
+ */
+ public void moveComponentsFrom(ComponentContainer source) {
+ LinkedList components = new LinkedList();
+ for (Iterator i = source.getComponentIterator(); i.hasNext();) {
+ components.add(i.next());
+ }
+
+ for (Iterator i = components.iterator(); i.hasNext();) {
+ Component c = (Component) i.next();
+ source.removeComponent(c);
+ addComponent(c);
+ }
+ }
+
+ /**
+ * Notifies all contained components that the container is attached to a
+ * window.
+ *
+ * @see com.itmill.toolkit.ui.Component#attach()
+ */
+ public void attach() {
+ super.attach();
+
+ for (Iterator i = getComponentIterator(); i.hasNext();) {
+ ((Component) i.next()).attach();
+ }
+ }
+
+ /**
+ * Notifies all contained components that the container is detached from a
+ * window.
+ *
+ * @see com.itmill.toolkit.ui.Component#detach()
+ */
+ public void detach() {
+ super.detach();
+
+ for (Iterator i = getComponentIterator(); i.hasNext();) {
+ ((Component) i.next()).detach();
+ }
+ }
+
+ /* Events ************************************************************ */
+
+ private static final Method COMPONENT_ATTACHED_METHOD;
+
+ private static final Method COMPONENT_DETACHED_METHOD;
+
+ static {
+ try {
+ COMPONENT_ATTACHED_METHOD = ComponentAttachListener.class
+ .getDeclaredMethod("componentAttachedToContainer",
+ new Class[] { ComponentAttachEvent.class });
+ COMPONENT_DETACHED_METHOD = ComponentDetachListener.class
+ .getDeclaredMethod("componentDetachedFromContainer",
+ new Class[] { ComponentDetachEvent.class });
+ } catch (java.lang.NoSuchMethodException e) {
+ // This should never happen
+ throw new java.lang.RuntimeException();
+ }
+ }
+
+ /* documented in interface */
+ public void addListener(ComponentAttachListener listener) {
+ addListener(ComponentContainer.ComponentAttachEvent.class, listener,
+ COMPONENT_ATTACHED_METHOD);
+ }
+
+ /* documented in interface */
+ public void addListener(ComponentDetachListener listener) {
+ addListener(ComponentContainer.ComponentDetachEvent.class, listener,
+ COMPONENT_DETACHED_METHOD);
+ }
+
+ /* documented in interface */
+ public void removeListener(ComponentAttachListener listener) {
+ removeListener(ComponentContainer.ComponentAttachEvent.class, listener,
+ COMPONENT_ATTACHED_METHOD);
+ }
+
+ /* documented in interface */
+ public void removeListener(ComponentDetachListener listener) {
+ removeListener(ComponentContainer.ComponentDetachEvent.class, listener,
+ COMPONENT_DETACHED_METHOD);
+ }
+
+ /**
+ * Fires the component attached event. This should be called by the
+ * addComponent methods after the component have been added to this
+ * container.
+ *
+ * @param component
+ * the component that has been added to this container.
+ */
+ protected void fireComponentAttachEvent(Component component) {
+ fireEvent(new ComponentAttachEvent(this, component));
+ }
+
+ /**
+ * Fires the component detached event. This should be called by the
+ * removeComponent methods after the component have been removed from this
+ * container.
+ *
+ * @param component
+ * the component that has been removed from this container.
+ */
+ protected void fireComponentDetachEvent(Component component) {
+ fireEvent(new ComponentDetachEvent(this, component));
+ }
+
+ /**
+ * This only implements the events and component parent calls. The extending
+ * classes must implement component list maintenance and call this method
+ * after component list maintenance.
+ *
+ * @see com.itmill.toolkit.ui.ComponentContainer#addComponent(Component)
+ */
+ public void addComponent(Component c) {
+ c.setParent(this);
+ fireComponentAttachEvent(c);
+ }
+
+ /**
+ * This only implements the events and component parent calls. The extending
+ * classes must implement component list maintenance and call this method
+ * before component list maintenance.
+ *
+ * @see com.itmill.toolkit.ui.ComponentContainer#removeComponent(Component)
+ */
+ public void removeComponent(Component c) {
+ if (c.getParent() == this) {
+ c.setParent(null);
+ fireComponentDetachEvent(c);
+ }
+ }
}