org.openswing.swing.client
Class LinkButton

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.openswing.swing.client.LinkButton
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class LinkButton
extends javax.swing.JPanel

Title: OpenSwing Framework

Description: button having a "link like" look 'n feel, whose text is translated according to internalization settings. An ActionListener can be added to this button to listener click events.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 java.lang.String labelAttributeName
          attribute name linked to the text of this link (optional), used to bind this link to a Form's value object
 java.lang.String tooltipAttributeName
          attribute name linked to the tooltip text of this link (optional), used to bind this link to a Form's value object
 java.lang.String uriAttributeName
          attribute name linked to the uri of this link (optional), used to bind this link to a Form's value object; if binded, this is the URI to automatically open when clicking on link
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LinkButton()
           
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
          Add an ActionListener to the link button.
 java.awt.event.ActionListener[] getActionListeners()
           
 java.awt.Font getFont()
           
 java.awt.Color getForegroundColorWhenEntered()
           
 java.lang.String getLabel()
           
 java.lang.String getLabelAttributeName()
           
 javax.swing.JLabel getLinkButton()
           
 boolean getOldValue()
           
 int getTextAlignment()
           
 java.lang.String getTooltipAttributeName()
           
 java.lang.String getToolTipText()
           
 java.lang.String getUri()
           
 java.lang.String getUriAttributeName()
           
 boolean isEnabled()
           
 boolean isShowUnderline()
           
 void linkClicked()
           
 void removeActionListener(java.awt.event.ActionListener listener)
          Remove an ActionListener currently applied to the link button.
 void setEnabled(boolean enabled)
          Set abilitation state for this link button.
 void setFont(java.awt.Font font)
          Set the specified font.
 void setForegroundColorWhenEntered(java.awt.Color foregroundColorWhenEntered)
          Set the label color to use when the mouse is over the link.
 void setLabel(java.lang.String label)
           
 void setLabelAttributeName(java.lang.String labelAttributeName)
          Bind the link text to the form which contains it and with the specified the attribute.
 void setShowUnderline(boolean showUnderline)
          Define if show an underline.
 void setText(java.lang.String label)
          Set label text.
 void setTextAlignment(int alignment)
          Set column text horizontal alignement.
 void setTooltipAttributeName(java.lang.String tooltipAttributeName)
          Bind the link tooltip to the form which contains it and with the specified the attribute.
 void setToolTipText(java.lang.String toolTipText)
          Set a tooltip text.
 void setUri(java.lang.String uri)
          Set the URI to automatically open when clicking on the link (optional).
 void setUriAttributeName(java.lang.String uriAttributeName)
          Set the attribute name linked to the uri of this link (optional), used to bind this link to a Form's value object.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

labelAttributeName

public java.lang.String labelAttributeName
attribute name linked to the text of this link (optional), used to bind this link to a Form's value object


tooltipAttributeName

public java.lang.String tooltipAttributeName
attribute name linked to the tooltip text of this link (optional), used to bind this link to a Form's value object


uriAttributeName

public java.lang.String uriAttributeName
attribute name linked to the uri of this link (optional), used to bind this link to a Form's value object; if binded, this is the URI to automatically open when clicking on link

Constructor Detail

LinkButton

public LinkButton()
Method Detail

linkClicked

public final void linkClicked()

setText

public final void setText(java.lang.String label)
Set label text.

Parameters:
label - text for the label, translated according to internalization settings

getLabel

public final java.lang.String getLabel()
Returns:
label not yet translated

setLabel

public final void setLabel(java.lang.String label)
Returns:
label not yet translated

getFont

public final java.awt.Font getFont()
Returns:
current Font setting

setFont

public final void setFont(java.awt.Font font)
Set the specified font.

Parameters:
font - Font to set

setToolTipText

public final void setToolTipText(java.lang.String toolTipText)
Set a tooltip text. This text will be translated according to the internationalization settings.

Parameters:
toolTipText - tool tip text entry in the dictionary

getToolTipText

public final java.lang.String getToolTipText()
Returns:
tool tip text entry in the dictionary

getTextAlignment

public final int getTextAlignment()
Returns:
column text horizontal alignment

setTextAlignment

public final void setTextAlignment(int alignment)
Set column text horizontal alignement.

Parameters:
alignment - column text horizontal alignement; possible values: "SwingConstants.LEFT", "SwingConstants.RIGHT", "SwingConstants.CENTER".

getForegroundColorWhenEntered

public final java.awt.Color getForegroundColorWhenEntered()
Returns:
label color to use when the mouse is over the link

setForegroundColorWhenEntered

public final void setForegroundColorWhenEntered(java.awt.Color foregroundColorWhenEntered)
Set the label color to use when the mouse is over the link.


getActionListeners

public final java.awt.event.ActionListener[] getActionListeners()

addActionListener

public final void addActionListener(java.awt.event.ActionListener listener)
Add an ActionListener to the link button.

Parameters:
listener - ActionListener to add to the link button

removeActionListener

public final void removeActionListener(java.awt.event.ActionListener listener)
Remove an ActionListener currently applied to the link button.

Parameters:
listener - ActionListener to remove

isShowUnderline

public final boolean isShowUnderline()
Returns:
boolean define if show an underline

setShowUnderline

public final void setShowUnderline(boolean showUnderline)
Define if show an underline.

Parameters:
showUnderline - define if show an underline

setLabelAttributeName

public final void setLabelAttributeName(java.lang.String labelAttributeName)
Bind the link text to the form which contains it and with the specified the attribute.

Parameters:
labelAttributeName - attribute name binded to text of this link

getLabelAttributeName

public final java.lang.String getLabelAttributeName()
Returns:
attribute name binded to the text of this link

setTooltipAttributeName

public final void setTooltipAttributeName(java.lang.String tooltipAttributeName)
Bind the link tooltip to the form which contains it and with the specified the attribute.

Parameters:
tooltipAttributeName - attribute name binded to tooltip of this link

getTooltipAttributeName

public final java.lang.String getTooltipAttributeName()
Returns:
attribute name binded to the tooltip of this link

getUri

public final java.lang.String getUri()
Returns:
URI to automatically open when clicking on the link (optional)

setUri

public final void setUri(java.lang.String uri)
Set the URI to automatically open when clicking on the link (optional).

Parameters:
uri - URI to automatically open when clicking on the link (optional)

getUriAttributeName

public final java.lang.String getUriAttributeName()
Returns:
attribute name linked to the uri of this link (optional); if binded, this is the URI to automatically open when clicking on link

setUriAttributeName

public final void setUriAttributeName(java.lang.String uriAttributeName)
Set the attribute name linked to the uri of this link (optional), used to bind this link to a Form's value object. If binded, this is the URI to automatically open when clicking on link.

Parameters:
uriAttributeName - attribute name linked to the uri of this link (optional); if binded, this is the URI to automatically open when clicking on link

getOldValue

public final boolean getOldValue()
Returns:
old enabled value

isEnabled

public final boolean isEnabled()
Returns:
link button current abilitation state

setEnabled

public final void setEnabled(boolean enabled)
Set abilitation state for this link button.

Parameters:
enabled - abilitation state

getLinkButton

public javax.swing.JLabel getLinkButton()