|
|||||||||||
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.Page
The top-level container for all Bebop components and containers.
ActionListeners
.
A typical Page
may be created as follows:
Page p = new Page("Hello World"); p.add(new Label("Hello World"); p.lock();
Field Summary | |
protected BitSet |
m_invisible
The default (initial) visibility of components. |
protected Container |
m_panel
Container that renders this Page . |
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 | |
Page()
Creates an empty page with default title and implicit BoxPanel container. |
|
Page(Label title)
Creates an empty page with the specified title and implicit BoxPanel container. |
|
Page(Label title,
Container panel)
Creates an empty page with the specified title and panel. |
|
Page(String title)
Creates an empty page with the specified title and implicit BoxPanel container. |
|
Page(String title,
Container panel)
Creates an empty page with the specified title and panel. |
Method Summary | |
void |
add(Component c)
Adds a component to this container. |
void |
add(Component c,
int constraints)
Adds a component with the specified layout constraints to this container. |
void |
addActionListener(ActionListener l)
Registers a listener that is notified whenever a request to this page is made, after the selected component has had a chance to respond. |
void |
addClientStylesheet(String styleSheetURI,
String mimeType)
Adds a client-side stylesheet that should be used in HTML output. |
void |
addComponent(Component c)
Deprecated. This method will become private in ACS 5.0. |
void |
addComponentStateParam(Component c,
ParameterModel p)
Registers a state parameter for a component. |
void |
addGlobalStateParam(ParameterModel p)
Adds a global state parameter to this page. |
void |
addRequestListener(RequestListener l)
Registers a listener that is notified whenever a request to this page is made, before the selected component has had a chance to respond. |
Document |
buildDocument(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Builds a DOM Document from the current request state by doing a depth-first tree walk on the current set of components in this Page, calling generateXML on each. |
Iterator |
children()
Returns an iterator over the children of this component. |
boolean |
contains(Object o)
Returns true if this list contains the specified element. |
protected void |
fireActionEvent(PageState state)
Broadcasts an ActionEvent to all registered listeners. |
protected void |
fireRequestEvent(PageState state)
Broadcasts a RequestEvent to all registered listeners. |
void |
generateXML(PageState state,
Document parent)
Constructs a DOM or JDOM tree with all components on the page. |
void |
generateXML(PageState state,
Element elt)
Do nothing. |
protected Element |
generateXMLHelper(PageState ps,
Document parent)
Constructs the top nodes of the DOM or JDOM tree. |
Component |
get(int index)
Returns the component at the specified position. |
Component |
getComponent(int i)
Gets a page component by index. |
Collection |
getComponentParameters(Component c)
Get the parameters registered for a given component. |
Component |
getErrorDisplay()
Gets the Component that will display the validation errors
in the current PageState . |
Container |
getPanel()
Returns the panel that the Page uses for rendering its
components. |
Iterator |
getParameters()
Gets the ParameterModels held in this Page. |
FormModel |
getStateModel()
Gets the form model that contains the parameters for the page's state. |
Label |
getTitle()
Retrieves the title of this page. |
Label |
getTitle(PageState state)
Retrieves the title of this page as a Bebop label component. |
int |
indexOf(Component c)
Gets the index of a component. |
boolean |
isEmpty()
Returns true if the container contains no components. |
boolean |
isUsingHttpSession()
Returns true if this page should export state through
the HttpSession instead of the URL query string. |
boolean |
isVisibleDefault(Component c)
Checks whether the specified component is visible by default on the page. |
void |
lock()
Locks the page and all its components against further modifications. |
String |
parameterName(Component c,
String name)
The global name of the parameter name in the component
c . |
String |
parameterName(String name)
The global name of the parameter name . |
protected PageState |
prepare(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Deprecated. Use process(HttpServletRequest,HttpServletResponse) instead. |
PageState |
process(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Creates a PageState object and processes it by calling the respond method on the selected component. |
void |
process(PageState state)
Processes the supplied PageState object according to this PageModel. |
void |
removeActionListener(ActionListener l)
Remove a previously registered action listener. |
void |
removeRequestListener(RequestListener l)
Removes a previously registered request listener. |
void |
respond(PageState state)
Responds to the request. |
void |
setErrorDisplay(Component c)
Sets the Component that will display the validation errors
in the current PageState . |
void |
setPanel(Container c)
Set the Container used for rendering components on this page. |
void |
setStyleSheet(String styleSheetURI,
String styleSheetType)
Deprecated. Use addClientStylesheet
instead. Will be removed on 2001-05-31. |
void |
setTitle(Label title)
Set the title for this page from the passed in label. |
void |
setTitle(String title)
Sets the title for this page from the passed in string. |
void |
setUsingHttpSession(boolean b)
Indicates to this page whether it should export its entire state to subsequent requests through the URL query string, or if it should use the HttpSession instead and only use the URL query string for the control event. |
void |
setVisibleDefault(Component c,
boolean v)
Sets whether the specified component is visible by default. |
int |
size()
Returns the number of elements in this container. |
boolean |
stateContains(Component c)
Checks whether this component is already in the page model. |
int |
stateIndex(Component c)
Gets the state index of a component. |
int |
stateSize()
The number of components in the page model. |
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, register, 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, register, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible |
Methods inherited from interface com.arsdigita.util.Lockable |
isLocked |
Field Detail |
public static final String versionId
protected Container m_panel
Container
that renders this Page
.
protected BitSet m_invisible
Constructor Detail |
public Page(String title, Container panel)
title
- title for this pagepanel
- container for this pagepublic Page(Label title, Container panel)
title
- title for this pagepanel
- container for this pagepublic Page()
public Page(Label title)
title
- title for this pagepublic Page(String title)
title
- title for this pageMethod Detail |
public boolean isUsingHttpSession()
true
if this page should export state through
the HttpSession instead of the URL query string.
If this returns true
, then PageState.stateAsURL()
will only export the control event as
a URL query string. If this returns false
,
then stateAsURL() will export the entire page state.
true
if this page should export state through
the HttpSession; false
if it should export using
the URL query string.PageState.stateAsURL()
public void setUsingHttpSession(boolean b)
b
- true
if PageState.stateAsURL()
will export only the control event as a URL query string.
false
if stateAsURL() will export the entire page state.PageState.stateAsURL()
public void add(Component c)
add
in interface Container
c
- component to add to this containerpublic void add(Component c, int constraints)
add
in interface Container
c
- component to add to this containerconstraints
- layout constraints (a
bitwise OR of static ints in the particular layout)public boolean contains(Object o)
true
if this list contains the specified element.
More formally, returns true
if and only if this list
contains at least
one element e such that (o==null ? e==null : o.equals(e)).
This method returns true
only if the component has been
directly added to this container. If this container contains another
container that contains this component, this method returns
false
.
contains
in interface Container
o
- element whose presence in this container is to be tested
true
if this Container contains the specified
component directly; false
otherwise.public Component get(int index)
get
in interface Container
index
- the index of the item to be retrieved from this
Container
public int indexOf(Component c)
indexOf
in interface Container
c
- component to search for
public boolean isEmpty()
true
if the container contains no components.
isEmpty
in interface Container
true
if this container contains no
components; false
otherwise.public int size()
size
in interface Container
public Iterator children()
Component
null
) iterator.
children
in interface Component
children
in class SimpleComponent
public final Container getPanel()
Page
uses for rendering its
components.
public void setPanel(Container c)
public final Label getTitle()
Retrieves the title of this page.
public final Label getTitle(PageState state)
state
- the state of the current request
public void setTitle(String title)
title
- title for this pagepublic void setTitle(Label title)
title
- title for this pagepublic final void setErrorDisplay(Component c)
Component
that will display the validation errors
in the current PageState
. Any validation error in the
PageState
will cause the Page
to completely
ignore all other components and render only the error display component.
By default, a PageErrorDisplay
component is used to display the
validation errors.
c
- the component that will display the validation errors
in the current PageState
public final Component getErrorDisplay()
Component
that will display the validation errors
in the current PageState
. Any validation error in the
PageState
will cause the Page
to completely
ignore all other components and render only the error display component.
By default, a PageErrorDisplay
component is used to display the
validation errors.
PageState
.public void setStyleSheet(String styleSheetURI, String styleSheetType)
addClientStylesheet
instead. Will be removed on 2001-05-31.
setStyleSheet("style.css", "text/css")
.
These values will ultimately wind up in a <link> tag in the head of the HTML page.
Note that the stylesheet set with this call has nothing to do with the XSLT stylesheet (transformer) that is applied to the XML generated from this page.
styleSheetURI
- the location of the stylesheetstyleSheetType
- the MIME type of the stylesheet, usually
text/csspublic void addClientStylesheet(String styleSheetURI, String mimeType)
setStyleSheet("style.css", "text/css")
.
These values will ultimately wind up in a <link> tag in the head of the HTML page.
Note that the stylesheet set with this call has nothing to do with the XSLT stylesheet (transformer) that is applied to the XML generated from this page.
styleSheetURI
- the location of the stylesheetmimeType
- the MIME type of the stylesheet, usually
text/csspublic void addGlobalStateParam(ParameterModel p)
If the parameter was previously added as a component state parameter, its name is unmangled and stays unmangled.
p
- the global parameter to addaddComponentStateParam(com.arsdigita.bebop.Component, com.arsdigita.bebop.parameters.ParameterModel)
protected Element generateXMLHelper(PageState ps, Document parent)
Generates DOM fragment:
<bebop:page> <bebop:title> ... value set with setTitle ... </bebop:title> <bebop:stylesheet href='styleSheetURI' type='mimeType'> ... page content gnerated by children ... </bebop:page>The content of the <title> element can be set by calling
setTitle
. The <stylesheet>
element will only be present if a stylesheet has been set with setStyleSheet
.
ps
- the page state for the current pageparent
- the DOM node for the whole Documentpublic void generateXML(PageState state, Document parent)
HttpServletRequest
kept in
the state
.
state
- the page state produced by process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
parent
- the DOM node for the whole Documentprocess
public void generateXML(PageState state, Element elt)
generateXML
in interface Component
generateXML
in class SimpleComponent
public PageState process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException
broadcasts
an ActionEvent
to all the listeners that
registered with addActionListener
.
javax.servlet.ServletException
generateXML
public void process(PageState state) throws javax.servlet.ServletException
javax.servlet.ServletException
protected PageState prepare(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException
process(HttpServletRequest,HttpServletResponse)
instead.
javax.servlet.ServletException
public Document buildDocument(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException
javax.servlet.ServletException
public void lock()
Locking a page helps in finding mistakes that result from modifying a page's structure.
lock
in interface Lockable
lock
in class SimpleComponent
public void respond(PageState state) throws javax.servlet.ServletException
Component
Responds to the request. This method is only called if the request
was made from a link or form that the component put on the page in the
PageState.stateAsURL()
previous request.
No output should be generated on the HTTP response. The component
can store intermediate results in the state
by calling
setAttribute
.
This method is called before any output is printed to the HTTP response so that the component can forward to a different page and thereby commit the response.
respond
in interface Component
respond
in class SimpleComponent
state
- the current page state
javax.servlet.ServletException
public void addActionListener(ActionListener l)
public void removeActionListener(ActionListener l)
public void addRequestListener(RequestListener l)
public void removeRequestListener(RequestListener l)
protected void fireActionEvent(PageState state)
ActionEvent
to all registered listeners. The
source of the event is this page, and the state recorded in the event
is the one resulting from processing the current request.
protected void fireRequestEvent(PageState state)
RequestEvent
to all registered listeners. The
source of the event is this page, and the state recorded in the event
is the one resulting from processing the current request.
public void addComponent(Component c)
public void addComponentStateParam(Component c, ParameterModel p)
c
- the component to register the parameter forp
- the state parameter to registeraddGlobalStateParam(com.arsdigita.bebop.parameters.ParameterModel)
public Collection getComponentParameters(Component c)
Get the parameters registered for a given component.
public int stateIndex(Component c)
c
- the component to search for
public int stateSize()
public boolean stateContains(Component c)
public Component getComponent(int i)
public final FormModel getStateModel()
public Iterator getParameters()
public boolean isVisibleDefault(Component c)
c
- a component contained in the page
true
if the component is visible by default;
false
otherwise.setVisibleDefault
,
Component.setVisible
public void setVisibleDefault(Component c, boolean v)
Component.setVisible
.
When a component is first added to a page, it is visible.
c
- a component whose visibility is to be setv
- true
if the component is visible;
false
otherwise.Component.setVisible
,
Component.register
public String parameterName(Component c, String name)
name
in the component
c
.
public String parameterName(String name)
name
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |