Package com.vaadin.ui
Class Link
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.ui.AbstractComponent
-
- com.vaadin.ui.Link
-
- All Implemented Interfaces:
ContextClickEvent.ContextClickNotifier,MethodEventSource,ClientConnector,Sizeable,Connector,Component,Serializable
public class Link extends AbstractComponent
Link is used to create external or internal URL links.- Since:
- 3.0
- Author:
- Vaadin Ltd.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
-
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
-
-
Field Summary
Fields Modifier and Type Field Description static BorderStyleTARGET_BORDER_DEFAULTDeprecated.As of 7.0, useBorderStyle.DEFAULTinsteadstatic BorderStyleTARGET_BORDER_MINIMALDeprecated.As of 7.0, useBorderStyle.MINIMALinsteadstatic BorderStyleTARGET_BORDER_NONEDeprecated.As of 7.0, useBorderStyle.NONEinstead-
Fields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXT
-
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Collection<String>getCustomAttributes()Returns a collection of attributes that should not be handled by the basic implementation of theAbstractComponent.readDesign(Element, DesignContext)andAbstractComponent.writeDesign(Element, DesignContext)methods.ResourcegetResource()Returns the resource this link opens.protected LinkStategetState()Returns the shared state bean with information to be sent from the server to the client.protected LinkStategetState(boolean markAsDirty)Returns the shared state for this connector.BorderStylegetTargetBorder()Returns the target window border.intgetTargetHeight()Returns the target window height or -1 if not set.StringgetTargetName()Returns the target window name.intgetTargetWidth()Returns the target window width or -1 if not set.voidreadDesign(org.jsoup.nodes.Element design, DesignContext designContext)Reads the component state from the given design.voidsetResource(Resource resource)Sets the resource this link opens.voidsetTargetBorder(BorderStyle targetBorder)Sets the border of the target window.voidsetTargetHeight(int targetHeight)Sets the target window height.voidsetTargetName(String targetName)Sets the target window name.voidsetTargetWidth(int targetWidth)Sets the target window width.voidwriteDesign(org.jsoup.nodes.Element design, DesignContext designContext)Writes the component state to the given design.-
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidth, setWidthFull, setWidthUndefined
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, 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, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.ui.Component
addStyleNames, getUI, removeStyleNames, setStyleName
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
-
-
-
Field Detail
-
TARGET_BORDER_NONE
@Deprecated public static final BorderStyle TARGET_BORDER_NONE
Deprecated.As of 7.0, useBorderStyle.NONEinstead
-
TARGET_BORDER_MINIMAL
@Deprecated public static final BorderStyle TARGET_BORDER_MINIMAL
Deprecated.As of 7.0, useBorderStyle.MINIMALinstead
-
TARGET_BORDER_DEFAULT
@Deprecated public static final BorderStyle TARGET_BORDER_DEFAULT
Deprecated.As of 7.0, useBorderStyle.DEFAULTinstead
-
-
Constructor Detail
-
Link
public Link()
Creates a new link.
-
Link
public Link(String caption, Resource resource)
Creates a new instance of Link.- Parameters:
caption-resource-
-
Link
public Link(String caption, Resource resource, String targetName, int width, int height, BorderStyle border)
Creates a new instance of Link that opens a new window.- Parameters:
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.
-
-
Method Detail
-
getState
protected LinkState getState()
Description copied from class:AbstractComponentReturns the shared state bean with information to be sent from the server to the client. Subclasses should override this method and set any relevant fields of the state returned by super.getState().- Overrides:
getStatein classAbstractComponent- Returns:
- updated component shared state
-
getState
protected LinkState getState(boolean markAsDirty)
Description copied from class:AbstractClientConnectorReturns the shared state for this connector.- Overrides:
getStatein classAbstractComponent- Parameters:
markAsDirty- true if the connector should automatically be marked dirty, false otherwise- Returns:
- The shared state for this connector. Never null.
- See Also:
AbstractClientConnector.getState()
-
getTargetBorder
public BorderStyle getTargetBorder()
Returns the target window border.- Returns:
- the target window border.
-
getTargetHeight
public int getTargetHeight()
Returns the target window height or -1 if not set.- Returns:
- the target window height.
-
getTargetName
public String getTargetName()
Returns the target window name. Empty name of null implies that the target is opened to the window containing the link.- Returns:
- the target window name.
-
getTargetWidth
public int getTargetWidth()
Returns the target window width or -1 if not set.- Returns:
- the target window width.
-
setTargetBorder
public void setTargetBorder(BorderStyle targetBorder)
Sets the border of the target window.- Parameters:
targetBorder- the targetBorder to set.
-
setTargetHeight
public void setTargetHeight(int targetHeight)
Sets the target window height.- Parameters:
targetHeight- the targetHeight to set.
-
setTargetName
public void setTargetName(String targetName)
Sets the target window name.- Parameters:
targetName- the targetName to set.
-
setTargetWidth
public void setTargetWidth(int targetWidth)
Sets the target window width.- Parameters:
targetWidth- the targetWidth to set.
-
getResource
public Resource getResource()
Returns the resource this link opens.- Returns:
- the Resource.
-
setResource
public void setResource(Resource resource)
Sets the resource this link opens.- Parameters:
resource- the resource to set.
-
readDesign
public void readDesign(org.jsoup.nodes.Element design, DesignContext designContext)Description copied from interface:ComponentReads the component state from the given design.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.
- Specified by:
readDesignin interfaceComponent- Overrides:
readDesignin classAbstractComponent- Parameters:
design- The element to obtain the state fromdesignContext- The DesignContext instance used for parsing the design
-
writeDesign
public void writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)Description copied from interface:ComponentWrites the component state to the given design.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.
- Specified by:
writeDesignin interfaceComponent- Overrides:
writeDesignin classAbstractComponent- Parameters:
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 design
-
getCustomAttributes
protected Collection<String> getCustomAttributes()
Description copied from class:AbstractComponentReturns a collection of attributes that should not be handled by the basic implementation of theAbstractComponent.readDesign(Element, DesignContext)andAbstractComponent.writeDesign(Element, DesignContext)methods. Typically these are handled in a custom way in the overridden versions of the above methods- Overrides:
getCustomAttributesin classAbstractComponent- Returns:
- the collection of attributes that are not handled by the basic implementation
-
-