Class SplitterTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
-
- net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag
-
- net.sf.jguiraffe.gui.builder.components.tags.SimpleComponentTag
-
- net.sf.jguiraffe.gui.builder.components.tags.ContainerTag
-
- net.sf.jguiraffe.gui.builder.components.tags.SplitterTag
-
- All Implemented Interfaces:
Composite,ConditionalTag,org.apache.commons.jelly.Tag
public class SplitterTag extends ContainerTag
A tag for implementing a splitter component.
A splitter is an element, which separates two arbitrary elements, either vertically or horizontally. The user can drag the splitter and thus change the size of the associated elements.
This tag expects exactly two other component tags in its body (which itself can be container tags holding arbitrary other components). These are the components whose size is controlled by the splitter. The following attributes are supported:
Attribute Description Optional size Defines the size of the slider component in pixels. This is either the width or the height of the slider bar (depending on the slider's orientation). Yes orientation This attribute defines the slider's orientation (i.e. vertical or horizontal). Allowed values are specified by the Orientationenumeration class. Case does not matter. If this attribute is not provided, the slider will be vertical.Yes pos With this attribute an initial position of the slider can be specified in pixels. Yes resizeWeight Determines the behavior of the slider when the available space changes. This attribute can take a value between 0 and 1. A value of 0 means that only the right/bottom component is affected by the change, a value of 1 would only modify the left/top component. 0.5 means that both components are equally affected, and so on. Yes - Version:
- $Id: SplitterTag.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description SplitterTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddComponents(ComponentManager manager, Object container, Collection<Object[]> comps)Adds the components to this container.protected ObjectcreateContainer(ComponentManager manager, boolean create, Collection<Object[]> components)Creates the container component.ObjectgetFirstComponent()Returns the first component of the splitter.StringgetOrientation()Returns the orientation of the splitter as a string value.intgetPos()Returns the initial position of the splitter.floatgetResizeWeight()Returns the splitter' resize weight.ObjectgetSecondComponent()Returns the second component of the splitter.intgetSize()Returns the splitter's size.OrientationgetSplitterOrientation()Returns the final orientation of the splitter.protected voidprocessBeforeBody()Performs processing before the evaluation of this tag's body.voidsetOrientation(String orientation)Set method for theorientationattribute.voidsetPos(int pos)Setter method for the pos attribute.voidsetResizeWeight(float resizeWeight)Setter method for the resizeWeight attribute.voidsetSize(int size)Setter method of the size attribute.-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.ContainerTag
addComponent, createComponent, getComposite, getContainer, getLayout, setComposite, setLayout
-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.SimpleComponentTag
getComponent, process
-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag
getBackColor, getBackgroundColor, getConstraints, getFont, getFontRef, getForeColor, getForegroundColor, getName, getToolTipData, insertComponent, setBackColor, setConstraints, setFont, setFontRef, setForeColor, setName, setTooltip, setTooltipres, setTooltipresgrp
-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
canProcess, canProcess, convertToClass, convertToNumberWithUnit, convertToNumberWithUnit, doTag, findContainer, getBuilderData, getBuilderData, getIfName, getResourceText, getResourceText, getUnlessName, setIfName, setUnlessName
-
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
-
-
-
-
Method Detail
-
getOrientation
public String getOrientation()
Returns the orientation of the splitter as a string value. This is the value passed to theorientationattribute. It may not be a valid instance of theOrientationenumeration class.- Returns:
- the orientation as string
-
setOrientation
public void setOrientation(String orientation)
Set method for theorientationattribute.- Parameters:
orientation- the attribute's value
-
getSplitterOrientation
public Orientation getSplitterOrientation()
Returns the final orientation of the splitter. This value is determined based on the value of theorientationattribute when the tag is processed. If the orientation cannot be resolved, processing of the tag throws an exception.- Returns:
- the
Orientationvalue of the splitter
-
getPos
public int getPos()
Returns the initial position of the splitter.- Returns:
- the initial position
-
setPos
public void setPos(int pos)
Setter method for the pos attribute.- Parameters:
pos- the attribute's value
-
getResizeWeight
public float getResizeWeight()
Returns the splitter' resize weight. This factor determines how the associated components are affected by a change of the size.- Returns:
- the resize weight factor
-
setResizeWeight
public void setResizeWeight(float resizeWeight)
Setter method for the resizeWeight attribute.- Parameters:
resizeWeight- the attribute's value
-
getSize
public int getSize()
Returns the splitter's size. This is the width or height (depending on the orientation) of the drawn bar.- Returns:
- the size of the splitter
-
setSize
public void setSize(int size)
Setter method of the size attribute.- Parameters:
size- the attribute's value
-
getFirstComponent
public Object getFirstComponent()
Returns the first component of the splitter.- Returns:
- the first component
-
getSecondComponent
public Object getSecondComponent()
Returns the second component of the splitter.- Returns:
- the second component
-
processBeforeBody
protected void processBeforeBody() throws org.apache.commons.jelly.JellyTagException, FormBuilderExceptionPerforms processing before the evaluation of this tag's body. This implementation tries to resolve the value passed to theorientationattribute.- Overrides:
processBeforeBodyin classContainerTag- Throws:
org.apache.commons.jelly.JellyTagException- if the tag is used incorrectlyFormBuilderException- if an error occurs
-
createContainer
protected Object createContainer(ComponentManager manager, boolean create, Collection<Object[]> components) throws FormBuilderException, org.apache.commons.jelly.JellyTagException
Creates the container component. This implementation will delegate to the component manager to create and initialize the splitter component.- Specified by:
createContainerin classContainerTag- Parameters:
manager- the component managercreate- the create flagcomponents- a collection with the container's children- Returns:
- the newly created component
- Throws:
FormBuilderException- if the tag is incorrectly usedorg.apache.commons.jelly.JellyTagException- if the tag is incorrectly used
-
addComponents
protected void addComponents(ComponentManager manager, Object container, Collection<Object[]> comps)
Adds the components to this container. This implementation is left empty because the splitter's components are handled in a different way.- Overrides:
addComponentsin classContainerTag- Parameters:
manager- the component managercontainer- the container objectcomps- a collection with the child components
-
-