com.tensegrity.gui.swing.control.attributeeditor
Class SwingAttributeEditorUtil

java.lang.Object
  extended bycom.tensegrity.gui.component.AttributeEditorUtil
      extended bycom.tensegrity.gui.swing.control.attributeeditor.SwingAttributeEditorUtil

public class SwingAttributeEditorUtil
extends AttributeEditorUtil

Swing dependent utilities for use with attribute editors.

Version:
$Id: SwingAttributeEditorUtil.java,v 1.73 2006/03/02 11:40:58 BurkhardWick Exp $
Author:
BurkhardWick

Nested Class Summary
static class SwingAttributeEditorUtil.InitTextFieldRunnable
          Runnable to use with SwingUtilities.invokeLater() to prepare a text cell for editing.
 
Field Summary
static boolean USE_TEXT_INPUT_POPUP
          Defines whether to use the text popup (=true) or the dialog (=false)
 
Constructor Summary
protected SwingAttributeEditorUtil()
          Constructor (should not be called)
 
Method Summary
static void configureComponent(javax.swing.JTable table, javax.swing.JComponent comp, boolean isCategory, boolean selected, boolean enabled)
          Sets the color and font of a component that is used for rendering or editing a attribute tree cell depending on the selection state and value type of the cell.
static SwingAttributeEditorComponents.ValueComponent getComponentForEditing(Attribute attribute, javax.swing.JTable table, int row, int column, UIManager uiManager, java.awt.event.ActionListener al, boolean undefined)
          Returns the component that can be used for editing a value or name of an attribute in a JTable cell.
static java.awt.Component getComponentForRendering(Attribute attribute, javax.swing.JTable table, int row, int column, boolean isSelected, boolean hasFocus, javax.swing.table.TableCellRenderer fallback, boolean undefined)
          Returns the component that can be used for rendering a value or name of an attribute in a JTable cell.
static java.awt.Color getTableCategoryBackColor()
          Returns the color to use for the background of the table categories
static java.awt.Color getTableCategoryBackColor(boolean forceUpdate)
          Returns the color to use for the background of the table categories
static java.lang.String getTextForRendering(java.lang.String value)
          Returns a shortened string for multiline strings
static void setDisabledColor(java.awt.Component comp)
          Sets the disabled foreground color to the given component
 
Methods inherited from class com.tensegrity.gui.component.AttributeEditorUtil
isCustomAttribute, isCustomAttribute, isEditorAvailable, isUndefinedEditable, renameCustomAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_TEXT_INPUT_POPUP

public static boolean USE_TEXT_INPUT_POPUP
Defines whether to use the text popup (=true) or the dialog (=false)

Constructor Detail

SwingAttributeEditorUtil

protected SwingAttributeEditorUtil()
Constructor (should not be called)

Method Detail

getComponentForRendering

public static java.awt.Component getComponentForRendering(Attribute attribute,
                                                          javax.swing.JTable table,
                                                          int row,
                                                          int column,
                                                          boolean isSelected,
                                                          boolean hasFocus,
                                                          javax.swing.table.TableCellRenderer fallback,
                                                          boolean undefined)
Returns the component that can be used for rendering a value or name of an attribute in a JTable cell.

Parameters:
attribute - The attribute to display
table - The table the cell belongs to
row - The row of the cell
column - The column of the cell
isSelected - True, if the cell is currently selected
hasFocus - True, if the cell currently has the focus
fallback - A TableCellRenderer to use, if this attribute doesn't belong to the group of types for use with special renderers
undefined - True, if the component should be rendered in undefined state
Returns:
The component that can be used for rendering a value or name of an attribute.

getComponentForEditing

public static SwingAttributeEditorComponents.ValueComponent getComponentForEditing(Attribute attribute,
                                                                                   javax.swing.JTable table,
                                                                                   int row,
                                                                                   int column,
                                                                                   UIManager uiManager,
                                                                                   java.awt.event.ActionListener al,
                                                                                   boolean undefined)
Returns the component that can be used for editing a value or name of an attribute in a JTable cell.

Parameters:
attribute - The attribute to edit
table - The table the cell belongs to
row - The row of the cell
column - The column of the cell
uiManager - The UIManager used to read text resources from
al - An ActionListener to add to the created editor, usually used for stopping the editing whenever an action occurs.
undefined - True, if the component should be in undefined state
Returns:
The component to use for editing the given attribute value

configureComponent

public static void configureComponent(javax.swing.JTable table,
                                      javax.swing.JComponent comp,
                                      boolean isCategory,
                                      boolean selected,
                                      boolean enabled)
Sets the color and font of a component that is used for rendering or editing a attribute tree cell depending on the selection state and value type of the cell.

Parameters:
table - The table the component is part of as a cell
comp - The component to configure
isCategory - True, if the cell represents a category row
selected - The selection status of the cell
enabled - True, if the cell component should be enabled

getTableCategoryBackColor

public static java.awt.Color getTableCategoryBackColor()
Returns the color to use for the background of the table categories

Returns:
the color to use for the background of the table categories

getTableCategoryBackColor

public static java.awt.Color getTableCategoryBackColor(boolean forceUpdate)
Returns the color to use for the background of the table categories

Parameters:
forceUpdate - true, to enforce the creation of a new color instance
Returns:
the color to use for the background of the table categories

getTextForRendering

public static java.lang.String getTextForRendering(java.lang.String value)
Returns a shortened string for multiline strings

Parameters:
value - The string to check
Returns:
The shortened string, if necessary

setDisabledColor

public static void setDisabledColor(java.awt.Component comp)
Sets the disabled foreground color to the given component

Parameters:
comp - The component to modify


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