|
|||||||||||
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.TabbedPane
A tabbed pane that lets the user switch between components by clicking on a given title in the tab strip.
Tabs (components) are added using the addTab
method. Each
entry consists of a label (which is a string) and the Component
that is displayed if the user clicks on the label.
There is always exactly one component that is currently visible, the component
that is returned by getCurrentPane(com.arsdigita.bebop.PageState)
. Without user interaction,
this is the default pane -- that was set by setDefaultPane(com.arsdigita.bebop.Component)
-- or, if
none has been set, the first component that was added to the TabbedPane
.
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 | |
TabbedPane()
Constructs an empty TabbedPane. |
Method Summary | |
void |
add(Component pc)
Adds a new pane to the dialog. |
void |
add(Component pc,
int constraints)
Adds a new pane with layout constraints to the dialog. |
void |
addActionListener(ActionListener l)
Adds an ActionListener , which is run whenever respond is called. |
void |
addTab(Component label,
Component c)
Adds a tab and its associated component. |
void |
addTab(String label,
Component c)
Adds a tab and its associated component. |
protected int |
findPane(Component c)
Find the pane whose body is the specified component |
protected void |
fireActionEvent(PageState state)
Fires an ActionEvent . |
protected void |
generateTabs(PageState data,
Element parent)
Builds a DOM representing the header for the tab strip. |
void |
generateXML(PageState state,
Element parent)
Services the request by building a DOM tree with the tabs themselves and then the included page. |
Component |
getCurrentPane(PageState data)
Gets the currently visible pane. |
Component |
getDefaultPane()
Gets the default pane. |
Component |
getPane(Component label)
Gets the pane with the specified label. |
Component |
getPane(String label)
Gets the pane with the specified key in its label. |
int |
getSelectedIndex(PageState state)
|
boolean |
isTabVisible(PageState s,
Component c)
Determine if a particular tab is visible |
boolean |
isTabVisible(PageState s,
int i)
Determine if a particular tab is visible |
void |
register(Page p)
Registers with the specified root container. |
void |
removeActionListener(ActionListener l)
Removes a previously added ActionListener . |
void |
respond(PageState state)
Notifies the TabbedPane that one of the tabs has been
selected. |
void |
setDefaultPane(Component pane)
Sets the default pane, which is visible until the user clicks on another label in the tab strip. |
protected void |
setDefaultPaneIndex(int i)
Sets the index of the default pane, which is visible until the user clicks on another label in the tab strip. |
void |
setSelectedIndex(PageState state,
int index)
|
void |
setTabVisible(PageState s,
Component c,
boolean v)
Show or hide a particular tab |
void |
setTabVisible(PageState s,
int i,
boolean v)
Show or hide a particular tab |
Methods inherited from class com.arsdigita.bebop.SimpleContainer |
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, 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, 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 TabbedPane()
Method Detail |
public void register(Page p)
register
in interface Component
register
in class SimpleComponent
p
- the root container to register withpublic void add(Component pc)
addTab
instead.
add
in interface Container
add
in class SimpleContainer
pc
- the component to be addedpublic void add(Component pc, int constraints)
addTab
instead.
add
in interface Container
add
in class SimpleContainer
constraints
- this parameter is ignored. Child classes should
override the add method if they wish to provide special handling
of constraints.public void addTab(Component label, Component c)
label
- the text to display in the tab stripc
- the component to display when the user clicks on the
label
in the tab strippublic void addTab(String label, Component c)
label
- the text to display in the tab stripc
- the component to display when the user clicks on the
label
in the tab strippublic void addActionListener(ActionListener l)
ActionListener
, which is run whenever respond
is called.
respond
public void removeActionListener(ActionListener l)
ActionListener
.
addActionListener
protected void fireActionEvent(PageState state)
ActionEvent
. All registered
ActionListener
s are run. The source of the event is the
TabbedPane
.
state
- the current page staterespond
protected void setDefaultPaneIndex(int i)
i
- the index of the default panepublic void setDefaultPane(Component pane) throws IllegalArgumentException
pane
- the component to display as the default pane
IllegalArgumentException
public void setTabVisible(PageState s, int i, boolean v)
s
- the page statei
- the index of the tabv
- if true, shows the tab. Otherwise, hides the tabpublic void setTabVisible(PageState s, Component c, boolean v)
s
- the page statec
- the body of the tabv
- if true, shows the tab. Otherwise, hides the tabpublic boolean isTabVisible(PageState s, int i)
s
- the page statei
- the index of the tabpublic boolean isTabVisible(PageState s, Component c)
s
- the page statec
- the body of the tabprotected int findPane(Component c)
c
- the component
public Component getDefaultPane()
null
if there are no
panes.public Component getPane(Component label)
null
if a pane with that label does not exist.public Component getPane(String label)
null
if a pane with that label does not exist.public Component getCurrentPane(PageState data)
public void setSelectedIndex(PageState state, int index)
public int getSelectedIndex(PageState state)
protected void generateTabs(PageState data, Element parent)
public void generateXML(PageState state, Element parent)
Generates a DOM fragment:
<bebop:tabbedPane>
<bebop:tabStrip>
<bebop:tab [href="..."] [current="t|f"]> .. label .. </bebop:tab>
<bebop:tab [href="..."] [current="t|f"]> .. label .. </bebop:tab>
<bebop:tab [href="..."] [current="t|f"]> .. label .. </bebop:tab>
</bebop:tabStrip>
<bebop:currentPane>
... contentes ..
</bebop:currentPane>
</bebop:tabbedPane>
generateXML
in interface Component
generateXML
in class SimpleContainer
state
- represents the current requestparent
- the parent XML elementSimpleContainer.setTag(String)
,
SimpleContainer.setNamespace(String)
public void respond(PageState state) throws javax.servlet.ServletException
TabbedPane
that one of the tabs has been
selected. Changes the currently visible pane and runs all the ActionListeners
.
The respond
method on the now-visible component is
not called.
respond
in interface Component
respond
in class SimpleComponent
state
- the current page state
javax.servlet.ServletException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |