com.tensegrity.gui.swing.control.attributetree
Class AttributeTreeIcon

java.lang.Object
  extended bycom.tensegrity.gui.swing.control.attributetree.AttributeTreeIcon
All Implemented Interfaces:
javax.swing.Icon

public class AttributeTreeIcon
extends java.lang.Object
implements javax.swing.Icon

Icon that is used in the SwingAttributeTree to display the attributes with a specific indentation and with an expand/collapse icon.

Author:
BurkhardWick

Field Summary
static int TYPE_COLLAPSED
          Icon type: Collapsed.
static int TYPE_EXPANDED
          Icon type: Expanded.
static int TYPE_INDENTATION
          Icon type: Indentation.
 
Constructor Summary
AttributeTreeIcon(int width, int height, int type)
          Constructor
 
Method Summary
 javax.swing.border.Border getBorder()
          Creates and returns a border that will contain the same indentation and icon than this icon instance.
 int getIconHeight()
           
 int getIconTextSpacing()
          Returns the iconTextSpacing.
 int getIconWidth()
           
 int getIndent()
          Returns the current indentation of this icon
 void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
           
 void setIconTextSpacing(int iconTextSpacing)
          Sets the iconTextSpacing
 void setLevel(int level)
          Sets the depth, which is used to calculate the indentation
 void setType(int type)
          Sets the type of this icon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_INDENTATION

public static final int TYPE_INDENTATION
Icon type: Indentation. No icon drawn, just for indentation.

See Also:
Constant Field Values

TYPE_COLLAPSED

public static final int TYPE_COLLAPSED
Icon type: Collapsed. A '+' icon.

See Also:
Constant Field Values

TYPE_EXPANDED

public static final int TYPE_EXPANDED
Icon type: Expanded. A '-' icon.

See Also:
Constant Field Values
Constructor Detail

AttributeTreeIcon

public AttributeTreeIcon(int width,
                         int height,
                         int type)
Constructor

Parameters:
width - The with of the icon to create
height - The heiht of the icon to create
type - The type of the icon
Method Detail

setType

public void setType(int type)
Sets the type of this icon

Parameters:
type - The type to set

setLevel

public void setLevel(int level)
Sets the depth, which is used to calculate the indentation

Parameters:
level - the depth, which is used to calculate the indentation

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics g,
                      int x,
                      int y)
Specified by:
paintIcon in interface javax.swing.Icon

getIconWidth

public int getIconWidth()
Specified by:
getIconWidth in interface javax.swing.Icon

getIconHeight

public int getIconHeight()
Specified by:
getIconHeight in interface javax.swing.Icon

getIndent

public int getIndent()
Returns the current indentation of this icon

Returns:
the current indentation of this icon

getIconTextSpacing

public int getIconTextSpacing()
Returns the iconTextSpacing.

Returns:
the iconTextSpacing.

setIconTextSpacing

public void setIconTextSpacing(int iconTextSpacing)
Sets the iconTextSpacing

Parameters:
iconTextSpacing - The iconTextSpacing to set.

getBorder

public javax.swing.border.Border getBorder()
Creates and returns a border that will contain the same indentation and icon than this icon instance. This border can be used for TextFields, which will then have the same look as the labels used for cell rendering.

Returns:
The created border


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.