public class Link extends AbstractField
AbstractField
.Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
HREF_VOID
The default href to assign when
null is supplied on
one of the constructors or the setHref() method. |
protected static java.lang.String |
LINK
The pattern used to create the html for a link or anchor.
|
private static long |
serialVersionUID
The class' serialization version id.
|
static java.lang.String |
TARGET_BLANK
A constant for the _blank target value.
|
static java.lang.String |
TARGET_PARENT
A constant for the _parent target value.
|
static java.lang.String |
TARGET_SELF
A constant for the _self target value.
|
static java.lang.String |
TARGET_TOP
A constant for the _top target value.
|
PARAM
ivHashCode, ivHashFlds, ivObjAttrs
Constructor and Description |
---|
Link(java.lang.String href)
Constructs a new instance of
Link using the supplied
parameters. |
Link(java.lang.String href,
java.lang.String text)
Constructs a new instance of
Link using the supplied
parameters. |
Link(java.lang.String href,
java.lang.String text,
java.lang.String target)
Constructs a new instance of
Link using the supplied
parameters. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares the given object to this object and determines if the two are
equal.
|
protected java.lang.String |
formatAttr(java.lang.String attr)
Returns a formatted html string for the requested attribute value.
|
java.lang.String |
getHRef()
Returns the link's href attribute.
|
java.lang.String |
getTarget()
Returns the link's target attribute.
|
java.lang.String |
getText()
Returns the link's text attribute.
|
void |
setHRef(java.lang.String href)
Sets the link's href attribute.
|
void |
setTarget(java.lang.String target)
Sets the link's target attribute.
|
void |
setText(java.lang.String text)
Sets the link's text attribute.
|
void |
setTextHS(java.lang.String text)
Sets the link's text attribute.
|
java.lang.String |
toHTML()
Returns a formatted html string for the link's current attribute values.
|
getDisabled, getId, getName, getOnBlur, getOnClick, getOnDblClick, getOnFocus, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseOut, getOnMouseOver, getStyleCls, getStyleStr, setDisabled, setId, setName, setOnBlur, setOnClick, setOnDblClick, setOnFocus, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseOut, setOnMouseOver, setStyleCls, setStyleStr
cloneMapAttributes, formatValue, formatValue, getHashFields, getMapArrayList, getMapAttributes, getMapBigDecimal, getMapBoolean, getMapDate, getMapDouble, getMapInteger, getMapLong, getMapMapped, getMapObject, getMapShort, getMapString, getMapString, getMapStringBuffer, getMapStringBuilder, getMapTime, getMapTimestamp, getMapVector, hashCode, setHashFields, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMapAttributes, setMapObject, setMapTime, setMapTimestamp, toStringArray
private static final long serialVersionUID
protected static final java.lang.String LINK
public static final java.lang.String TARGET_BLANK
public static final java.lang.String TARGET_PARENT
public static final java.lang.String TARGET_SELF
public static final java.lang.String TARGET_TOP
protected static final java.lang.String HREF_VOID
null
is supplied on
one of the constructors or the setHref() method.public Link(java.lang.String href)
Link
using the supplied
parameters. Defaults the text value and the target to an empty string.
Note: HTML links have an href and no name. HTML anchors have a name and may or may not have an href. To create an anchor, use setName() to set the anchor name.
href
- (String) The href for the link. If null
is
supplied, the default "javascript:void(0)" will be assigned.public Link(java.lang.String href, java.lang.String text)
Link
using the supplied
parameters. Defaults the target to an empty string.
Note: HTML links have an href and no name. HTML anchors have a name and may or may not have an href. To create an anchor, use setName() to set the anchor name.
href
- (String) The href for the link. If null
is
supplied, the default "javascript:void(0)" will be assigned.text
- (String) The text value to display. The supplied value
is auto-encoded for html safe characters. To construct a link
with text that is already html safe, set this value to an empty
string and then use the setTextHS() method to set the html safe
text value.public Link(java.lang.String href, java.lang.String text, java.lang.String target)
Link
using the supplied
parameters.
Note: HTML links have an href and no name. HTML anchors have a name and may or may not have an href. To create an anchor, use setName() to set the anchor name.
href
- (String) The href for the link. If null
is
supplied, the default "javascript:void(0)" will be assigned.text
- (String) The text value to display. The supplied value
is auto-encoded for html safe characters. To construct a link
with text that is already html safe, set this value to an empty
string and then use the setTextHS() method to set the html safe
text value.target
- (String) The target for the link.public boolean equals(java.lang.Object obj)
equals
in class MappedAttributesObject
obj
- (Object) The object to compare with this object.true
if the specified object is equal to
this object, otherwise false
.protected java.lang.String formatAttr(java.lang.String attr)
formatAttr
in AbstractField
.formatAttr
in class AbstractField
AbstractField.formatAttr(java.lang.String)
public java.lang.String toHTML()
toHTML
in AbstractField
. If the href
is the default (javascript:void(0)) and no onclick event handler has been
specified, then only the text value is returned (no link).toHTML
in class AbstractField
AbstractField.toHTML()
public java.lang.String getHRef()
public void setHRef(java.lang.String href)
href
- (String) The link's href. If null
is supplied,
the default "javascript:void(0)" will be assigned.public java.lang.String getTarget()
public void setTarget(java.lang.String target)
target
- (String) The link's target.public java.lang.String getText()
public void setText(java.lang.String text)
text
- (String) The link's text. The supplied value is encoded
for html safe characters.public void setTextHS(java.lang.String text)
text
- (String) The link's text. The supplied value is assumed
to contain html safe characters. No additional encoding is done.