|
|||||||||||
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.BaseLink
com.arsdigita.bebop.Link
A URL on a page. May contain a label, an image, or any other component. A Link is a BaseLink that manages URL variables.
Example: The common usage for a Link component is illustrated in the code fragment below:
Page p = new Page("Link Example"); Link link = new Link("Click Here","path/to/target/"); link.setVar("foo","1"); p.add(link);
The target of the link above will be rendered in HTML as:
href="path/to/target/?foo=1"
If either the link text or the URL needs to be changed for a link
within a locked page, a PrintListener
should be used.
Field Summary | |
static String |
NEW_FRAME
Passing this value to setTargetFrame
will create a link that opens a new browser window whenever it
is clicked. |
protected String |
TYPE_LINK
The value for the XML type attribute for a plain link. |
static String |
versionId
|
Fields inherited from class com.arsdigita.bebop.BaseLink |
m_child, m_noJavascriptURL, m_url |
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 | |
Link(Component child,
PrintListener l)
Constructors with PrintListener parameters allow for a PrintListener to be set for
the Link, without the need to make a separate call to
the addPrintListener method. |
|
Link(Component child,
String url)
The Component parameter in this constructor is usually a Label or Image . |
|
Link(PrintListener l)
|
|
Link(String label,
PrintListener l)
|
|
Link(String label,
String url)
This constructor is a common one for a Link component, as it allows for the Link text and the target URL to be set at the same time during construction. |
|
Link(String label,
URL url)
Constructs a Link using a URL . |
Method Summary | |
void |
addURLVars(String name,
String value)
Deprecated. use setVar |
Object |
clone()
Clones a component. |
protected void |
generateURL(PageState state,
Element parent)
|
String |
getTargetFrame()
Get the "target" attribute of the link, which determines which browser frame will load the new page when this link is clicked. |
String |
getURLVarString()
|
protected String |
prepareURL(PageState state,
String location)
Processes the URL for this link after the print listener runs. |
void |
setTargetFrame(String frameName)
Set the "target" attribute of the link, which determines which browser frame will load the new page when this link is clicked. |
void |
setVar(String name,
String value)
Sets a query variable and its value. |
Methods inherited from class com.arsdigita.bebop.BaseLink |
addPrintListener, firePrintEvent, generateExtraXMLAttributes, generateXML, getChild, getNoJavascriptTarget, getTarget, removePrintListener, setChild, setConfirmation, setNoJavascriptTarget, setOnClick, setTarget, setTypeAttr, setupNoJavascriptURL |
Methods inherited from class com.arsdigita.bebop.TextStylable |
setBackgroundColor, setColor |
Methods inherited from class com.arsdigita.bebop.SimpleComponent |
children, 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 |
Field Detail |
public static final String versionId
protected final String TYPE_LINK
public static final String NEW_FRAME
Passing this value to setTargetFrame
will create a link that opens a new browser window whenever it
is clicked.
setTargetFrame(java.lang.String)
,
Constant Field ValuesConstructor Detail |
public Link(Component child, String url)
The Component parameter in this constructor is
usually a Label
or Image
.
Starting with release 5.2, this method prefixes the
passed-in url
with the path to the CCM dispatcher.
Code using this constructor should not prefix url
with the webapp context path or the dispatcher servlet
path.
The vast majority of CCM UI code expects to link through the
dispatcher. Code that does not should use the
Link
constructor taking a URL
.
Link(String,URL)
public Link(Component child, PrintListener l)
PrintListener
to be set for
the Link, without the need to make a separate call to
the addPrintListener method. PrintListeners
are a convenient way to alter underlying Link attributes
such as Link text or target URL within a locked page
on a per request basis.
public Link(String label, PrintListener l)
public Link(PrintListener l)
public Link(String label, String url)
This constructor is a common one for a Link component, as it allows for the Link text and the target URL to be set at the same time during construction.
Starting with release 5.2, this method prefixes the
passed-in url
with the path to the CCM dispatcher.
Code using this constructor should not prefix url
with the webapp context path or the dispatcher servlet
path.
The vast majority of CCM UI code expects to link through the
dispatcher. Code that does not should use the
Link
constructor taking a URL
.
Link(String,URL)
public Link(String label, URL url)
Constructs a Link using a URL
. When this
constructor is used, the method setVar(String,String)
and its deprecated equivalent have no effect on the resulting
hyperlink. Instead, use the ParameterMap
argument
to URL
.
label
- a String
of label texturl
- a URL
for the link's targetURL
,
ParameterMap
Method Detail |
public Object clone() throws CloneNotSupportedException
SimpleComponent
clone
in class BaseLink
CloneNotSupportedException
public void setVar(String name, String value)
All the variables set with this method are appended to the
query string in the URL that is output for this Link
.
name
- the name of the queryvalue
- the value for the querypublic void addURLVars(String name, String value)
setVar
public String getURLVarString()
public String getTargetFrame()
Get the "target" attribute of the link, which determines which browser frame will load the new page when this link is clicked.
public void setTargetFrame(String frameName)
Set the "target" attribute of the link, which determines which browser frame will load the new page when this link is clicked.
protected void generateURL(PageState state, Element parent)
generateURL
in class BaseLink
protected String prepareURL(PageState state, String location)
location
- the original URL
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |