com.itmill.toolkit.ui
Class ExpandLayout

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
                  extended by com.itmill.toolkit.ui.ExpandLayout
All Implemented Interfaces:
MethodEventSource, Paintable, Sizeable, VariableOwner, Component, ComponentContainer, Layout, EventListener

public class ExpandLayout
extends OrderedLayout
implements Sizeable

Our layouts (except custom layout of course) don't currently work at all with relative widths. This layout tries to cope this issue. basically this is ordered layout which has sizeable interface 100 % height & width by default all contained components may also have sizeable interfaces sizes can be used to build flexible layout where some component gets all the space other components don't use : SizeableLayout l = new SizeableLayout(); l.addComponent(menu); l.addComponent(main); l.setComponentSize(main, new Size(100, 100)); l.addComponent(footer);


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
 
Fields inherited from class com.itmill.toolkit.ui.OrderedLayout
ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL
 
Fields inherited from interface com.itmill.toolkit.terminal.Sizeable
UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS, UNITS_ROWS
 
Constructor Summary
ExpandLayout()
           
 
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.
 void expand(Component c)
           
 int getHeight()
          Gets the height of the object.
 int getHeightUnits()
          Gets the height property units.
 String getTag()
          Gets the component UIDL tag.
 int getWidth()
          Gets the width of the object.
 int getWidthUnits()
          Gets the width property units.
 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 setHeight(int height)
          Sets the height of the object.
 void setHeightUnits(int units)
          Sets the height property units.
 void setWidth(int width)
          Sets the width of the object.
 void setWidthUnits(int units)
          Sets the width property units.
 
Methods inherited from class com.itmill.toolkit.ui.OrderedLayout
getComponentIterator, getOrientation, setOrientation
 
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
 

Constructor Detail

ExpandLayout

public ExpandLayout()
Method Detail

expand

public void expand(Component c)
Parameters:
c - Component which container will be maximized

getTag

public String getTag()
Description copied from class: OrderedLayout
Gets the component UIDL tag.

Overrides:
getTag in class OrderedLayout
Returns:
the Component UIDL tag as string.

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Description copied from class: OrderedLayout
Paints the content of this component.

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

addComponent

public void addComponent(Component c,
                         int index)
Description copied from class: OrderedLayout
Adds a component into indexed position in this container.

Overrides:
addComponent in class OrderedLayout
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.

addComponent

public void addComponent(Component c)
Description copied from class: OrderedLayout
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 OrderedLayout
Parameters:
c - the component to be added.
See Also:
ComponentContainer.addComponent(Component)

addComponentAsFirst

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

Overrides:
addComponentAsFirst in class OrderedLayout
Parameters:
c - the component to be added.

removeComponent

public void removeComponent(Component c)
Description copied from class: OrderedLayout
Removes the component from this container.

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

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
Overrides:
replaceComponent in class OrderedLayout
Parameters:
oldComponent - the old component that will be replaced.
newComponent - the new component to be replaced.

getHeight

public int getHeight()
Description copied from interface: Sizeable
Gets the height of the object. Negative number implies unspecified size (terminal is free to set the size).

Specified by:
getHeight in interface Sizeable
Returns:
height of the object in units specified by heightUnits property.

getHeightUnits

public int getHeightUnits()
Description copied from interface: Sizeable
Gets the height property units.

Specified by:
getHeightUnits in interface Sizeable
Returns:
units used in height property.

getWidth

public int getWidth()
Description copied from interface: Sizeable
Gets the width of the object. Negative number implies unspecified size (terminal is free to set the size).

Specified by:
getWidth in interface Sizeable
Returns:
width of the object in units specified by widthUnits property.

getWidthUnits

public int getWidthUnits()
Description copied from interface: Sizeable
Gets the width property units.

Specified by:
getWidthUnits in interface Sizeable
Returns:
units used in width property.

setHeight

public void setHeight(int height)
Description copied from interface: Sizeable
Sets the height of the object. Negative number implies unspecified size (terminal is free to set the size).

Specified by:
setHeight in interface Sizeable
Parameters:
height - the height of the object in units specified by heightUnits property.

setHeightUnits

public void setHeightUnits(int units)
Description copied from interface: Sizeable
Sets the height property units.

Specified by:
setHeightUnits in interface Sizeable
Parameters:
units - the units used in height property.

setWidth

public void setWidth(int width)
Description copied from interface: Sizeable
Sets the width of the object. Negative number implies unspecified size (terminal is free to set the size).

Specified by:
setWidth in interface Sizeable
Parameters:
width - the width of the object in units specified by widthUnits property.

setWidthUnits

public void setWidthUnits(int units)
Description copied from interface: Sizeable
Sets the width property units.

Specified by:
setWidthUnits in interface Sizeable
Parameters:
units - the units used in width property.


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