org.millstone.base.ui
Class CustomLayout

java.lang.Object
  |
  +--org.millstone.base.ui.AbstractComponent
        |
        +--org.millstone.base.ui.AbstractComponentContainer
              |
              +--org.millstone.base.ui.CustomLayout
All Implemented Interfaces:
Component, ComponentContainer, java.util.EventListener, Layout, MethodEventSource, Paintable, VariableOwner

public class CustomLayout
extends AbstractComponentContainer
implements Layout

A container component with freely designed layout and style. The container consists of items with textually represented locations. Each item contains one sub-component. The adapter and theme are resposible for rendering the layout with given style by placing the items on the screen in defined locations.

The definition of locations is not fixed - the each style can define its locations in a way that is suitable for it. One typical example would be to create visual design for a website as a custom layout: the visual design could define locations for "menu", "body" and "title" for example. The layout would then be implemented as XLS-template with for given style.

The default theme handles the styles that are not defined by just drawing the subcomponents with flowlayout.

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

Nested Class Summary
 
Nested classes inherited from class org.millstone.base.ui.ComponentContainer
ComponentContainer.ComponentAttachEvent, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachEvent, ComponentContainer.ComponentDetachListener
 
Nested classes inherited from class org.millstone.base.ui.Component
Component.Event, Component.Listener
 
Nested classes inherited from class org.millstone.base.terminal.Paintable
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener
 
Constructor Summary
CustomLayout(java.lang.String style)
          Constructor for custom layout with given style
 
Method Summary
 void addComponent(Component c)
          Add a component into this container.
 void addComponent(Component c, java.lang.String location)
          Add a component into this container to given location.
 java.util.Iterator getComponentIterator()
          Get component container iterator for going trough all the components in the container.
 java.lang.String getTag()
          Get component UIDL tag.
 void paintContent(PaintTarget target)
          Paint the content of this component.
 void removeComponent(Component c)
          Remove a component from this container.
 void removeComponent(java.lang.String location)
          Remove a component from this container from given location.
 void replaceComponent(Component oldComponent, Component newComponent)
          Replace a component in the container with another one without changing position.
 
Methods inherited from class org.millstone.base.ui.AbstractComponentContainer
addListener, addListener, attach, detach, fireComponentAttachEvent, fireComponentDetachEvent, moveComponentsFrom, removeAllComponents, removeListener, removeListener
 
Methods inherited from class org.millstone.base.ui.AbstractComponent
addListener, addListener, addListener, addListener, changeVariables, childRequestedRepaint, dependsOn, fireComponentEvent, fireEvent, getApplication, getCaption, getComponentError, getDescription, getDirectDependencies, getErrorMessage, getIcon, getLocale, getParent, getStyle, getWindow, isEnabled, isImmediate, isReadOnly, isVisible, paint, removeDirectDependency, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setDescription, setEnabled, setIcon, setImmediate, setLocale, setParent, setReadOnly, setStyle, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.millstone.base.ui.ComponentContainer
addListener, addListener, moveComponentsFrom, removeAllComponents, removeListener, removeListener
 
Methods inherited from interface org.millstone.base.ui.Component
addListener, attach, childRequestedRepaint, detach, getApplication, getCaption, getIcon, getLocale, getParent, getStyle, getWindow, isEnabled, isImmediate, isReadOnly, isVisible, removeListener, setEnabled, setParent, setReadOnly, setStyle, setVisible
 
Methods inherited from interface org.millstone.base.terminal.Paintable
addListener, paint, removeListener, requestRepaint, requestRepaintRequests
 
Methods inherited from interface org.millstone.base.terminal.VariableOwner
changeVariables, dependsOn, getDirectDependencies, removeDirectDependency
 

Constructor Detail

CustomLayout

public CustomLayout(java.lang.String style)
Constructor for custom layout with given style

Method Detail

getTag

public java.lang.String getTag()
Get component UIDL tag.

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

addComponent

public void addComponent(Component c,
                         java.lang.String location)
Add a component into this container to given location.

Parameters:
c - The component to be added.
location - The location of the component

addComponent

public void addComponent(Component c)
Add a component into this container. The component is added without specifying the location (empty string is then used as location). Only one component can be added to the default "" location and adding more components into that location overwrites the old components.

Specified by:
addComponent in interface ComponentContainer
Overrides:
addComponent in class AbstractComponentContainer
Parameters:
c - The component to be added.

removeComponent

public void removeComponent(Component c)
Remove a component from this container.

Specified by:
removeComponent in interface ComponentContainer
Overrides:
removeComponent in class AbstractComponentContainer
Parameters:
c - The component to be removed.

removeComponent

public void removeComponent(java.lang.String location)
Remove a component from this container from given location.

Parameters:
location - Location identifier of the component

getComponentIterator

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

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

paintContent

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

Overrides:
paintContent in class AbstractComponent
Parameters:
target - target UIDL stream where the component should paint itself to
Throws:
PaintException - The paint operation failed.

replaceComponent

public void replaceComponent(Component oldComponent,
                             Component newComponent)
Description copied from interface: ComponentContainer
Replace a 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,2001,2002 IT Mill Ltd. All Rights Reserved.