com.alee.extended.label
Class WebStyledLabelUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.LabelUI
          extended by javax.swing.plaf.basic.BasicLabelUI
              extended by com.alee.extended.label.WebStyledLabelUI
All Implemented Interfaces:
Styleable, BorderMethods, SwingMethods, java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.SwingConstants

public class WebStyledLabelUI
extends javax.swing.plaf.basic.BasicLabelUI
implements Styleable, BorderMethods, javax.swing.SwingConstants


Field Summary
protected  boolean ignoreColorSettings
           
protected  WebStyledLabel label
           
protected  java.awt.Insets margin
          Style settings.
protected  StyledLabelPainter painter
          Component painter.
protected  int preferredRowCount
           
protected  java.beans.PropertyChangeListener propertyChangeListener
          Label listeners.
protected  float scriptFontRatio
           
protected  java.lang.String styleId
          Runtime variables.
protected  java.lang.String truncatedTextSuffix
           
 
Fields inherited from class javax.swing.plaf.basic.BasicLabelUI
labelUI
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
WebStyledLabelUI()
           
 
Method Summary
protected  void applyPainterSettings(StyledLabelPainter painter)
          Applies UI settings to this specific painter.
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
          Returns an instance of the WebStyledLabelUI for the specified component.
 java.awt.Insets getMargin()
          Returns component margin.
 Painter getPainter()
          Returns label painter.
 int getPreferredRowCount()
          Returns preferred row count.
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
          
 float getScriptFontRatio()
          Returns subscript and superscript font ratio.
 java.lang.String getStyleId()
          Returns component style ID.
 java.lang.String getTruncatedTextSuffix()
          Returns truncated text suffix.
 void installUI(javax.swing.JComponent c)
          Installs UI in the specified component.
 boolean isIgnoreColorSettings()
          Returns whether color settings should be ignored or not.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Paints label.
 void propertyChange(java.beans.PropertyChangeEvent e)
          
 void setIgnoreColorSettings(boolean ignore)
          Sets whether color settings should be ignored or not.
 void setMargin(java.awt.Insets margin)
          Sets component margin.
 void setPainter(Painter painter)
          Sets label painter.
 void setPreferredRowCount(int rows)
          Sets preferred row count.
 void setScriptFontRatio(float ratio)
          Sets subscript and superscript font ratio.
 void setStyleId(java.lang.String id)
          Sets custom component style ID.
 void setTruncatedTextSuffix(java.lang.String suffix)
          Sets truncated text suffix.
 void uninstallUI(javax.swing.JComponent c)
          Uninstalls UI from the specified component.
 void updateBorder()
          Updates custom WebLaF border.
 
Methods inherited from class javax.swing.plaf.basic.BasicLabelUI
getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, installComponents, installDefaults, installKeyboardActions, installListeners, layoutCL, paintDisabledText, paintEnabledText, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

margin

protected java.awt.Insets margin
Style settings.


preferredRowCount

protected int preferredRowCount

ignoreColorSettings

protected boolean ignoreColorSettings

scriptFontRatio

protected float scriptFontRatio

truncatedTextSuffix

protected java.lang.String truncatedTextSuffix

painter

protected StyledLabelPainter painter
Component painter.


propertyChangeListener

protected java.beans.PropertyChangeListener propertyChangeListener
Label listeners.


styleId

protected java.lang.String styleId
Runtime variables.


label

protected WebStyledLabel label
Constructor Detail

WebStyledLabelUI

public WebStyledLabelUI()
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
Returns an instance of the WebStyledLabelUI for the specified component. This tricky method is used by UIManager to create component UIs when needed.

Parameters:
c - component that will use UI instance
Returns:
instance of the WebStyledLabelUI

installUI

public void installUI(javax.swing.JComponent c)
Installs UI in the specified component.

Overrides:
installUI in class javax.swing.plaf.basic.BasicLabelUI
Parameters:
c - component for this UI

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Uninstalls UI from the specified component.

Overrides:
uninstallUI in class javax.swing.plaf.basic.BasicLabelUI
Parameters:
c - component with this UI

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class javax.swing.plaf.basic.BasicLabelUI

getStyleId

public java.lang.String getStyleId()
Returns component style ID. Custom ID can be specified to override default component style using "setStyleId" method. If style for such custom ID is not found in skin descriptor then default style for that component is used.

Specified by:
getStyleId in interface Styleable
Returns:
component style ID

setStyleId

public void setStyleId(java.lang.String id)
Sets custom component style ID. If style for such custom ID is not found in skin descriptor default style will be used for that component. This method forces component to instantly use component style with the specified ID.

Specified by:
setStyleId in interface Styleable
Parameters:
id - custom component style ID

updateBorder

public void updateBorder()
Updates custom WebLaF border.

Specified by:
updateBorder in interface BorderMethods

getMargin

public java.awt.Insets getMargin()
Returns component margin.

Returns:
component margin

setMargin

public void setMargin(java.awt.Insets margin)
Sets component margin.

Parameters:
margin - component margin

getPreferredRowCount

public int getPreferredRowCount()
Returns preferred row count.

Returns:
preferred row count

setPreferredRowCount

public void setPreferredRowCount(int rows)
Sets preferred row count.

Parameters:
rows - new preferred row count

isIgnoreColorSettings

public boolean isIgnoreColorSettings()
Returns whether color settings should be ignored or not.

Returns:
true if color settings should be ignored, false otherwise

setIgnoreColorSettings

public void setIgnoreColorSettings(boolean ignore)
Sets whether color settings should be ignored or not.

Parameters:
ignore - whether color settings should be ignored or not

getScriptFontRatio

public float getScriptFontRatio()
Returns subscript and superscript font ratio.

Returns:
subscript and superscript font ratio

setScriptFontRatio

public void setScriptFontRatio(float ratio)
Sets subscript and superscript font ratio.

Parameters:
ratio - new subscript and superscript font ratio

getTruncatedTextSuffix

public java.lang.String getTruncatedTextSuffix()
Returns truncated text suffix.

Returns:
truncated text suffix

setTruncatedTextSuffix

public void setTruncatedTextSuffix(java.lang.String suffix)
Sets truncated text suffix.

Parameters:
suffix - new truncated text suffix

getPainter

public Painter getPainter()
Returns label painter.

Returns:
label painter

setPainter

public void setPainter(Painter painter)
Sets label painter. Pass null to remove label painter.

Parameters:
painter - new label painter

applyPainterSettings

protected void applyPainterSettings(StyledLabelPainter painter)
Applies UI settings to this specific painter.

Parameters:
painter - label painter

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Paints label.

Overrides:
paint in class javax.swing.plaf.basic.BasicLabelUI
Parameters:
g - graphics
c - component

getPreferredSize

public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)

Overrides:
getPreferredSize in class javax.swing.plaf.basic.BasicLabelUI