public class Link extends AbstractComponent
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Sizeable.Unit
Modifier and Type | Field and Description |
---|---|
static BorderStyle |
TARGET_BORDER_DEFAULT
Deprecated.
As of 7.0, use
BorderStyle.DEFAULT instead |
static BorderStyle |
TARGET_BORDER_MINIMAL
Deprecated.
As of 7.0, use
BorderStyle.MINIMAL instead |
static BorderStyle |
TARGET_BORDER_NONE
Deprecated.
As of 7.0, use
BorderStyle.NONE instead |
DESIGN_ATTR_PLAIN_TEXT
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
Constructor and Description |
---|
Link()
Creates a new link.
|
Link(String caption,
Resource resource)
Creates a new instance of Link.
|
Link(String caption,
Resource resource,
String targetName,
int width,
int height,
BorderStyle border)
Creates a new instance of Link that opens a new window.
|
Modifier and Type | Method and Description |
---|---|
protected Collection<String> |
getCustomAttributes()
Returns a collection of attributes that should not be handled by the
basic implementation of the
readDesign and writeDesign
methods. |
Resource |
getResource()
Returns the resource this link opens.
|
protected LinkState |
getState()
Returns the shared state bean with information to be sent from the server
to the client.
|
protected LinkState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
BorderStyle |
getTargetBorder()
Returns the target window border.
|
int |
getTargetHeight()
Returns the target window height or -1 if not set.
|
String |
getTargetName()
Returns the target window name.
|
int |
getTargetWidth()
Returns the target window width or -1 if not set.
|
void |
readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Reads the component state from the given design.
|
void |
setResource(Resource resource)
Sets the resource this link opens.
|
void |
setTargetBorder(BorderStyle targetBorder)
Sets the border of the target window.
|
void |
setTargetHeight(int targetHeight)
Sets the target window height.
|
void |
setTargetName(String targetName)
Sets the target window name.
|
void |
setTargetWidth(int targetWidth)
Sets the target window width.
|
void |
writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Writes the component state to the given design.
|
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isImmediate, isOrHasAncestor, isReadOnly, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setLocale, setParent, setPrimaryStyleName, setReadOnly, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidth, setWidthUndefined
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addAttachListener, addDetachListener, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
getConnectorId
@Deprecated public static final BorderStyle TARGET_BORDER_NONE
BorderStyle.NONE
instead@Deprecated public static final BorderStyle TARGET_BORDER_MINIMAL
BorderStyle.MINIMAL
instead@Deprecated public static final BorderStyle TARGET_BORDER_DEFAULT
BorderStyle.DEFAULT
insteadpublic Link()
public Link(String caption, Resource resource)
caption
- resource
- public Link(String caption, Resource resource, String targetName, int width, int height, BorderStyle border)
caption
- the Link text.targetName
- the name of the target window where the link opens to. Empty
name of null implies that the target is opened to the window
containing the link.width
- the Width of the target window.height
- the Height of the target window.border
- the Border style of the target window.protected LinkState getState()
AbstractComponent
getState
in class AbstractComponent
protected LinkState getState(boolean markAsDirty)
AbstractClientConnector
getState
in class AbstractComponent
markAsDirty
- true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()
public BorderStyle getTargetBorder()
public int getTargetHeight()
public String getTargetName()
public int getTargetWidth()
public void setTargetBorder(BorderStyle targetBorder)
targetBorder
- the targetBorder to set.public void setTargetHeight(int targetHeight)
targetHeight
- the targetHeight to set.public void setTargetName(String targetName)
targetName
- the targetName to set.public void setTargetWidth(int targetWidth)
targetWidth
- the targetWidth to set.public Resource getResource()
public void setResource(Resource resource)
resource
- the resource to set.public void readDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Component
The component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
readDesign
in interface Component
readDesign
in class AbstractComponent
design
- The element to obtain the state fromdesignContext
- The DesignContext instance used for parsing the designpublic void writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Component
The component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
writeDesign
in interface Component
writeDesign
in class AbstractComponent
design
- The element to write the component state to. Any previous
attributes or child nodes are not cleared.designContext
- The DesignContext instance used for writing the designprotected Collection<String> getCustomAttributes()
AbstractComponent
readDesign
and writeDesign
methods. Typically these are handled in a custom way in the overridden
versions of the above methodsgetCustomAttributes
in class AbstractComponent
Copyright © 2022 Vaadin Ltd. All rights reserved.