com.itmill.toolkit.ui
Class OrderedLayout

java.lang.Object
  extended by com.itmill.toolkit.terminal.Identifiable
      extended by com.itmill.toolkit.ui.AbstractComponent
          extended by com.itmill.toolkit.ui.AbstractComponentContainer
              extended by com.itmill.toolkit.ui.OrderedLayout
All Implemented Interfaces:
MethodEventSource, Paintable, VariableOwner, Component, ComponentContainer, Layout, EventListener
Direct Known Subclasses:
ExpandLayout

public class OrderedLayout
extends AbstractComponentContainer
implements Layout

Ordered layout. OrderedLayout is a component container, which shows the subcomponents in the order of their addition in specified orientation.

Since:
3.0
Version:
4.1.4
Author:
IT Mill Ltd.

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.itmill.toolkit.ui.ComponentContainer
ComponentContainer.ComponentAttachEvent, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachEvent, ComponentContainer.ComponentDetachListener
 
Nested classes/interfaces inherited from interface com.itmill.toolkit.ui.Component
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener
 
Nested classes/interfaces inherited from interface com.itmill.toolkit.terminal.Paintable
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener
 
Field Summary
static int ORIENTATION_HORIZONTAL
          Components are to be layed out horizontally.
static int ORIENTATION_VERTICAL
          Components are to be layed out vertically.
 
Constructor Summary
OrderedLayout()
          Creates a new ordered layout.
OrderedLayout(int orientation)
          Create a new ordered layout.
 
Method Summary
 void addComponent(Component c)
          Add a component into this container.
 void addComponent(Component c, int index)
          Adds a component into indexed position in this container.
 void addComponentAsFirst(Component c)
          Adds a component into this container.
 Iterator getComponentIterator()
          Gets the component container iterator for going trough all the components in the container.
 int getOrientation()
          Gets the orientation of the container.
 String getTag()
          Gets the component UIDL tag.
 void paintContent(PaintTarget target)
          Paints the content of this component.
 void removeComponent(Component c)
          Removes the component from this container.
 void replaceComponent(Component oldComponent, Component newComponent)
          Replaces the component in the container with another one without changing position.
 void setOrientation(int orientation)
          Set the orientation of the container.
 
Methods inherited from class com.itmill.toolkit.ui.AbstractComponentContainer
addListener, addListener, attach, detach, fireComponentAttachEvent, fireComponentDetachEvent, moveComponentsFrom, removeAllComponents, removeListener, removeListener
 
Methods inherited from class com.itmill.toolkit.ui.AbstractComponent
addListener, addListener, addListener, addListener, changeVariables, childRequestedRepaint, dependsOn, fireComponentErrorEvent, fireComponentEvent, fireEvent, getApplication, getCaption, getComponentError, getData, getDescription, getDirectDependencies, getErrorMessage, getIcon, getLocale, getParent, getStyle, getWindow, isEnabled, isImmediate, isReadOnly, isVisible, paint, removeDirectDependency, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDescription, setEnabled, setIcon, setImmediate, setLocale, setParent, setReadOnly, setStyle, setVisible
 
Methods inherited from class com.itmill.toolkit.terminal.Identifiable
getDebugId, getUIID, setDebugId, setUIID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.itmill.toolkit.ui.ComponentContainer
addListener, addListener, moveComponentsFrom, removeAllComponents, removeListener, removeListener
 
Methods inherited from interface com.itmill.toolkit.ui.Component
addListener, attach, childRequestedRepaint, detach, getApplication, getCaption, getIcon, getLocale, getParent, getStyle, getWindow, isEnabled, isReadOnly, isVisible, removeListener, setEnabled, setParent, setReadOnly, setStyle, setVisible
 
Methods inherited from interface com.itmill.toolkit.terminal.Paintable
addListener, paint, removeListener, requestRepaint, requestRepaintRequests
 
Methods inherited from interface com.itmill.toolkit.terminal.VariableOwner
changeVariables, dependsOn, getDirectDependencies, isImmediate, removeDirectDependency
 

Field Detail

ORIENTATION_VERTICAL

public static int ORIENTATION_VERTICAL
Components are to be layed out vertically.


ORIENTATION_HORIZONTAL

public static int ORIENTATION_HORIZONTAL
Components are to be layed out horizontally.

Constructor Detail

OrderedLayout

public OrderedLayout()
Creates a new ordered layout. The order of the layout is ORIENTATION_VERTICAL.


OrderedLayout

public OrderedLayout(int orientation)
Create a new ordered layout. The orientation of the layout is given as parameters.

Parameters:
orientation - the Orientation of the layout.
Method Detail

getTag

public String getTag()
Gets the component UIDL tag.

Specified by:
getTag in class AbstractComponent
Returns:
the Component UIDL tag as string.

addComponent

public void addComponent(Component c)
Add a component into this container. The component is added to the right or under the previous component.

Specified by:
addComponent in interface ComponentContainer
Overrides:
addComponent in class AbstractComponentContainer
Parameters:
c - the component to be added.
See Also:
ComponentContainer.addComponent(Component)

addComponentAsFirst

public void addComponentAsFirst(Component c)
Adds a component into this container. The component is added to the left or on top of the other components.

Parameters:
c - the component to be added.

addComponent

public void addComponent(Component c,
                         int index)
Adds a component into indexed position in this container.

Parameters:
c - the component to be added.
index - the Index of the component position. The components currently in and after the position are shifted forwards.

removeComponent

public void removeComponent(Component c)
Removes the component from this container.

Specified by:
removeComponent in interface ComponentContainer
Overrides:
removeComponent in class AbstractComponentContainer
Parameters:
c - the component to be removed.
See Also:
ComponentContainer.removeComponent(Component)

getComponentIterator

public Iterator getComponentIterator()
Gets the component container iterator for going trough all the components in the container.

Specified by:
getComponentIterator in interface ComponentContainer
Returns:
the Iterator of the components inside the container.

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Paints the content of this component.

Overrides:
paintContent in class AbstractComponent
Parameters:
target - the Paint Event.
Throws:
PaintException - if the paint operation failed.

getOrientation

public int getOrientation()
Gets the orientation of the container.

Returns:
the Value of property orientation.

setOrientation

public void setOrientation(int orientation)
Set the orientation of the container.

Parameters:
orientation - the New value of property orientation.

replaceComponent

public void replaceComponent(Component oldComponent,
                             Component newComponent)
Description copied from interface: ComponentContainer
Replaces the component in the container with another one without changing position.

This method replaces component with another one is such way that the new component overtakes the position of the old component. If the old component is not in the container, the new component is added to the container. If the both component are already in the container, their positions are swapped. Component attach and detach events should be taken care as with add and remove.

Specified by:
replaceComponent in interface ComponentContainer
Parameters:
oldComponent - the old component that will be replaced.
newComponent - the new component to be replaced.


Copyright © 2000-2008 IT Mill Ltd. All Rights Reserved.