|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.bebop.Completable
com.arsdigita.bebop.SimpleComponent
com.arsdigita.bebop.TextStylable
com.arsdigita.bebop.BlockStylable
com.arsdigita.bebop.SimpleContainer
com.arsdigita.bebop.ColumnPanel
A container that prints its components in a table. Each child is printed
in its own table cell. The number of columns can be specified in the
constructor. The components are put into the table in the order in which
they were added to the ColumnPanel
by filling the table one row
at a time (filling each row from left to right), from the top of the table
to the bottom.
The position of the component within the cell can be influenced with the following constraints.
Horizontal alignment | Use LEFT , CENTER , or
RIGHT . |
Vertical alignment | Use TOP , MIDDLE , or
BOTTOM . |
Full width | Use FULL_WIDTH to instruct the panel to put
the component in a row by itself, spanning the full width of the
table. |
Inserting children | Use INSERT to instruct the panel to
insert the corresponding component, assuming that it will also be
laid out by a ColumnPanel with the same number of
columns. |
Constraints can be combined by
ORing them together. For example, to print a component in a row of its
own, left-aligned, at the bottom of its cell, use the constraint
FULL_WIDTH | LEFT | BOTTOM
.
Using the INSERT
constraint fuses the current
ColumnPanel
with the panel of the child to which the
constraint is applied. For example, consider a Form
that is to
have a 2-column format with labels in the left column and widgets
in the right column. If a FormSection
is added to the form, it
should be included seamlessly into the parent form. To do this,
set the INSERT
constraint when the FormSection
is added to the ColumnPanel
of the Form
. At
the same time, tell the ColumnPanel
used to lay out the FormSection
that it is to be inserted into another
panel.
The following pseudo-code illustrates the example. (It assumes that Form and FormSection are decorators of the ColumnPanel.)
Form form = new Form(new ColumnPanel(2)); FormSection sec = new FormSection(new ColumnPanel(2, true)); sec.add(new Label("Basic Item Metadata"), ColumnPanel.FULL_WIDTH); sec.add(new Label("Title:"), ColumnPanel.RIGHT); sec.add(new Text("title")); form.add(sec, ColumnPanel.INSERT);
Field Summary | |
static String |
versionId
|
Fields inherited from class com.arsdigita.bebop.BlockStylable |
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CENTER, FULL_WIDTH, INSERT, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP |
Fields inherited from class com.arsdigita.bebop.SimpleComponent |
m_attr |
Fields inherited from interface com.arsdigita.bebop.Component |
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE |
Constructor Summary | |
ColumnPanel(int nCols)
Creates a table panel with the specified number of columns. |
|
ColumnPanel(int nCols,
boolean inserted)
Creates a table panel with the specified number of columns that will be printed as a direct child of a ColumnPanel
with the same number of columns. |
Method Summary | |
void |
add(Component c,
int constraints)
Adds a component, specifying its constraints. |
void |
generateXML(PageState state,
Element parent)
Adds child components as a subtree under table-style nodes. |
int |
getNumCols()
Returns the number of columns for this ColumnPanel |
boolean |
isInserted()
Determines whether this panel is to be inserted into another panel. |
void |
setBorder(boolean b)
|
void |
setBorderColor(String c)
|
void |
setBorderWidth(String w)
|
void |
setColumnWidth(int col,
String width)
|
void |
setConstraint(Component c,
int constraints)
Sets the constraint for one child component. |
void |
setInserted(boolean inserted)
Sets whether this panel will be printed inside a ColumnPanel with the same number of columns. |
void |
setPadBorder(boolean border)
|
void |
setPadCellPadding(String padding)
|
void |
setPadColor(String c)
|
void |
setPadFrameWidth(String w)
|
void |
setWidth(String w)
|
Methods inherited from class com.arsdigita.bebop.SimpleContainer |
add, children, contains, generateChildrenXML, generateParent, get, getNamespace, getTag, indexOf, isEmpty, setNamespace, setTag, size |
Methods inherited from class com.arsdigita.bebop.BlockStylable |
setBorder, setBorder, setBorderColor, setHorizontalAlignment, setMargin, setMargin, setPadding, setPadding, setVerticalAlignment |
Methods inherited from class com.arsdigita.bebop.TextStylable |
setBackgroundColor, setColor |
Methods inherited from class com.arsdigita.bebop.SimpleComponent |
clone, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, lock, register, register, respond, setAttribute, setClassAttr, setIdAttr, setKey, setMetaDataAttribute, setStyleAttr, setVisible |
Methods inherited from class com.arsdigita.bebop.Completable |
addCompletionListener, fireCompletionEvent |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.arsdigita.bebop.Component |
getClassAttr, getIdAttr, getKey, getStyleAttr, isVisible, register, register, respond, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible |
Methods inherited from interface com.arsdigita.util.Lockable |
isLocked, lock |
Field Detail |
public static final String versionId
Constructor Detail |
public ColumnPanel(int nCols)
nCols
- number of columns in the panelpublic ColumnPanel(int nCols, boolean inserted)
ColumnPanel
with the same number of columns.
nCols
- number of columns in the panelinserted
- true
if this panel
is to be printed as a direct child of a
ColumnPanel
with the same number of
columnssetInserted(boolean)
Method Detail |
public void add(Component c, int constraints)
add
in interface Container
add
in class SimpleContainer
c
- the component to addconstraints
- the constraints for this componentpublic void setInserted(boolean inserted)
ColumnPanel
with the same number of columns. If
inserted
is true, no <table> tags will be produced
to enclose the child components.
inserted
- true
if this panel is to be printed
inside a ColumnPanel
with the same number of columnspublic final boolean isInserted()
true
if this panel is to be inserted
into another panel; false
otherwise.setInserted(boolean)
public final int getNumCols()
public void generateXML(PageState state, Element parent)
parent
rather than included in any of the
cell
elements of the panel.
Generates a DOM fragment:
<bebop:pad>
[<bebop:padFrame>]
[<bebop:border>]
<bebop:panelRow>
<bebop:cell> ... cell contents </bebop:cell>
<bebop:cell> ... cell contents </bebop:cell>
...
</bebop:panelRow>
<bebop:panelRow>
<bebop:cell> ... cell contents </bebop:cell>
<bebop:cell> ... cell contents </bebop:cell>
...
</bebop:panelRow>
[</bebop:border>]
[</bebop:padFrame>]
</bebop:boxPanel>
generateXML
in interface Component
generateXML
in class SimpleContainer
state
- the current page stateparent
- the parent element for these child componentsSimpleContainer.setTag(String)
,
SimpleContainer.setNamespace(String)
public void setBorderColor(String c)
public void setBorderWidth(String w)
public void setColumnWidth(int col, String width)
public void setBorder(boolean b)
public void setPadColor(String c)
public void setWidth(String w)
public void setPadFrameWidth(String w)
public void setPadBorder(boolean border)
public void setPadCellPadding(String padding)
public void setConstraint(Component c, int constraints)
c
- the child componentconstraints
- the constraints to add
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |