|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.itmill.toolkit.ui.AbstractComponent
com.itmill.toolkit.ui.AbstractComponentContainer
com.itmill.toolkit.ui.AbstractLayout
com.itmill.toolkit.ui.CustomLayout
public class CustomLayout
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 responsible 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 web site 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 as in OrderedLayout.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.itmill.toolkit.ui.AbstractComponent |
|---|
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler |
| Nested classes/interfaces inherited from interface com.itmill.toolkit.ui.Layout |
|---|
Layout.AlignmentHandler, Layout.SpacingHandler |
| 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.AbstractLayout |
|---|
margins |
| Fields inherited from interface com.itmill.toolkit.terminal.Sizeable |
|---|
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS, UNITS_ROWS |
| Constructor Summary | |
|---|---|
CustomLayout(InputStream templateStream)
Constructs a custom layout with the template given in the stream. |
|
CustomLayout(String template)
Constructor for custom layout with given template name. |
|
| Method Summary | |
|---|---|
void |
addComponent(Component c)
Adds the component into this container. |
void |
addComponent(Component c,
String location)
Adds the component into this container to given location. |
Component |
getComponent(String location)
Gets the child-component by its location. |
Iterator |
getComponentIterator()
Gets the component container iterator for going trough all the components in the container. |
String |
getTag()
Gets the component UIDL tag. |
String |
getTemplateName()
Get the name of the template |
void |
paintContent(PaintTarget target)
Paints the content of this component. |
void |
removeComponent(Component c)
Removes the component from this container. |
void |
removeComponent(String location)
Removes the component from this container from given location. |
void |
replaceComponent(Component oldComponent,
Component newComponent)
Replaces the component in the container with another one without changing position. |
void |
setMargin(boolean enabled)
Although most layouts support margins, CustomLayout does not. |
void |
setMargin(boolean topEnabled,
boolean rightEnabled,
boolean bottomEnabled,
boolean leftEnabled)
Although most layouts support margins, CustomLayout does not. |
void |
setStyle(String name)
CustomLayout's template selecting was previously implemented with setStyle. |
void |
setTemplateName(String templateName)
Set the name of the template used to draw custom layout. |
| Methods inherited from class com.itmill.toolkit.ui.AbstractComponentContainer |
|---|
addListener, addListener, attach, detach, fireComponentAttachEvent, fireComponentDetachEvent, moveComponentsFrom, removeAllComponents, removeListener, removeListener, requestRepaintAll, setEnabled |
| 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, requestRepaintAll |
| Methods inherited from interface com.itmill.toolkit.ui.Component |
|---|
addListener, addStyleName, attach, childRequestedRepaint, detach, getApplication, getCaption, getIcon, getLocale, getParent, getStyleName, getWindow, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setParent, setReadOnly, setStyleName, setVisible |
| Methods inherited from interface com.itmill.toolkit.terminal.Paintable |
|---|
addListener, getDebugId, paint, removeListener, requestRepaint, requestRepaintRequests, setDebugId |
| Methods inherited from interface com.itmill.toolkit.terminal.VariableOwner |
|---|
changeVariables, isImmediate |
| Methods inherited from interface com.itmill.toolkit.terminal.Sizeable |
|---|
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUnits, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUnits |
| Constructor Detail |
|---|
public CustomLayout(InputStream templateStream)
throws IOException
templateStream - Stream containing template data. Must be using UTF-8 encoding.
To use a String as a template use for instance new
ByteArrayInputStream("".getBytes()).streamLength - Length of the templateStream
IOExceptionpublic CustomLayout(String template)
| Method Detail |
|---|
public String getTag()
getTag in class AbstractLayout
public void addComponent(Component c,
String location)
c - the component to be added.location - the location of the component.public void addComponent(Component c)
addComponent in interface ComponentContaineraddComponent in class AbstractComponentContainerc - the component to be added.ComponentContainer.addComponent(Component)public void removeComponent(Component c)
removeComponent in interface ComponentContainerremoveComponent in class AbstractComponentContainerc - the component to be removed.ComponentContainer.removeComponent(Component)public void removeComponent(String location)
location - the Location identifier of the component.public Iterator getComponentIterator()
public Component getComponent(String location)
location - the name of the location where the requested component
resides.
public void paintContent(PaintTarget target)
throws PaintException
paintContent in class AbstractLayouttarget -
PaintException - if the paint operation failed.
public void replaceComponent(Component oldComponent,
Component newComponent)
ComponentContainerThis 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.
oldComponent - the old component that will be replaced.newComponent - the new component to be replaced.public void setStyle(String name)
setStyle in class AbstractComponentname - template namepublic String getTemplateName()
public void setTemplateName(String templateName)
templateName - public void setMargin(boolean enabled)
setMargin in interface LayoutsetMargin in class AbstractLayoutUnsupportedOperationException
public void setMargin(boolean topEnabled,
boolean rightEnabled,
boolean bottomEnabled,
boolean leftEnabled)
setMargin in interface LayoutsetMargin in class AbstractLayoutUnsupportedOperationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||