com.sibvisions.rad.ui.swing.ext
Class JVxUtil

java.lang.Object
  extended by com.sibvisions.rad.ui.swing.ext.JVxUtil

public final class JVxUtil
extends Object

The JVxUtil is a utility class with often used functionality encapsulated in useful methods.


Constructor Summary
protected JVxUtil()
          Invisible constructor, because the JVxUtil class is a utility class.
 
Method Summary
static Color getAverageColor(Color pColor1, Color pColor2)
          Gets the average color from pColor1 and pColor2.
static ICellEditor getDefaultCellEditor(Class<?> pClass)
          Gets the default ICellEditor for the given class.
static Cursor getGlobalCursor(Component pComponent)
          Gets the application global cursor.
static ImageIcon getIcon(String pImageName)
          Gets an ImageIcon from the resource bundle.
static ImageIcon getIcon(String pImageName, byte[] pData)
          Gets an ImageIcon from the resource bundle.
static Image getImage(String pImageName)
          Gets an image from the resource bundle.
static Image getImage(String pImageName, byte[] pData)
          Gets an ImageIcon from the resource bundle.
static String getImageMapping(String pMappingName)
          Gets the image name for the given mapping name.
static String[] getImageMappingNames()
          Gets all used mapping names.
static Dimension getMinimumSize(Component pComponent)
          Gets the minimum size of a component.
static Dimension getPreferredSize(Component pComponent)
          Gets the preferred size of a component.
static Color getSystemColor(String pType)
          Gets the system color.
static void installActions(JTextComponent pComponent)
          Installs copy/paste/cut actions for the given text component.
static void invokeLater(Runnable pRunnable)
          Uses InvokerLaterThread, to invoke guarantee even in another Thread, that it will be invoked later.
static void revalidateAll(Component pComponent)
          Searches the parent tree until a parent without layout was found.
static void setDefaultCellEditor(Class<?> pClass, ICellEditor pCellEditor)
          Sets the default ICellEditor for the given class.
static void setGlobalCursor(Component pComponent, Cursor pCursor)
          Sets an application global cursor.
static void setImageMapping(String pMappingName, String pImageName)
          Sets the image name for the given mapping name.
static void setSystemColor(String pType, Color pSystemColor)
          Sets the system color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JVxUtil

protected JVxUtil()
Invisible constructor, because the JVxUtil class is a utility class.

Method Detail

getPreferredSize

public static Dimension getPreferredSize(Component pComponent)
Gets the preferred size of a component. The size is between the minimum and maximum size.

Parameters:
pComponent - the component
Returns:
the preferred size dependent of the minimum and maximum size

getMinimumSize

public static Dimension getMinimumSize(Component pComponent)
Gets the minimum size of a component. It analyses BorderLayout in a correct way.

Parameters:
pComponent - the component
Returns:
the minimum size

revalidateAll

public static void revalidateAll(Component pComponent)
Searches the parent tree until a parent without layout was found. The "first" parent with a layout will be validated. Through the parent validaten, all sub components of the parent will be validated.

Parameters:
pComponent - the start component

getDefaultCellEditor

public static ICellEditor getDefaultCellEditor(Class<?> pClass)
Gets the default ICellEditor for the given class. This function should always return an editor. It should look for best matching editor with Class.isAssignableFrom.

Parameters:
pClass - the class type to be edited.
Returns:
the ICellEditor
See Also:
ICellEditor

setDefaultCellEditor

public static void setDefaultCellEditor(Class<?> pClass,
                                        ICellEditor pCellEditor)
Sets the default ICellEditor for the given class. This function should always return an editor. It should look for best matching editor with Class.isAssignableFrom. If the given ICellEditor is null, it is removed as editor for the given class.

Parameters:
pClass - the class type to be edited.
pCellEditor - the ICellEditor
See Also:
ICellEditor

getSystemColor

public static Color getSystemColor(String pType)
Gets the system color.

Parameters:
pType - the color type
Returns:
the system color

setSystemColor

public static void setSystemColor(String pType,
                                  Color pSystemColor)
Sets the system color.

Parameters:
pType - the color type
pSystemColor - the system color

getAverageColor

public static Color getAverageColor(Color pColor1,
                                    Color pColor2)
Gets the average color from pColor1 and pColor2.

Parameters:
pColor1 - the first Color.
pColor2 - the second Color.
Returns:
the average color from pColor1 and pColor2.

getImage

public static Image getImage(String pImageName)
Gets an image from the resource bundle.

Parameters:
pImageName - the icon resource name
Returns:
the Image or null if the resource is not available

getIcon

public static ImageIcon getIcon(String pImageName)
Gets an ImageIcon from the resource bundle.

Parameters:
pImageName - the icon resource name
Returns:
the Image or null if the resource is not available

getImage

public static Image getImage(String pImageName,
                             byte[] pData)
Gets an ImageIcon from the resource bundle.

Parameters:
pImageName - the image name (used for cache mechanism) or null if the image should not be cached
pData - the image byte data
Returns:
the Image or null if the resource is not available

getIcon

public static ImageIcon getIcon(String pImageName,
                                byte[] pData)
Gets an ImageIcon from the resource bundle.

Parameters:
pImageName - the image name (used for cache mechanism) or null if the image should not be cached
pData - the image byte data
Returns:
the Image or null if the resource is not available

getImageMapping

public static String getImageMapping(String pMappingName)
Gets the image name for the given mapping name.

Parameters:
pMappingName - the mapping name.
Returns:
the image name.

setImageMapping

public static void setImageMapping(String pMappingName,
                                   String pImageName)
Sets the image name for the given mapping name.

Parameters:
pMappingName - the mapping name.
pImageName - the image name.

getImageMappingNames

public static String[] getImageMappingNames()
Gets all used mapping names.

Returns:
the mapping names.

getGlobalCursor

public static Cursor getGlobalCursor(Component pComponent)
Gets the application global cursor.

Parameters:
pComponent - the component.
Returns:
the cursor.

setGlobalCursor

public static void setGlobalCursor(Component pComponent,
                                   Cursor pCursor)
Sets an application global cursor.

Parameters:
pComponent - the component.
pCursor - the cursor.

invokeLater

public static void invokeLater(Runnable pRunnable)
Uses InvokerLaterThread, to invoke guarantee even in another Thread, that it will be invoked later.

Parameters:
pRunnable - the Runnable

installActions

public static void installActions(JTextComponent pComponent)
Installs copy/paste/cut actions for the given text component. Since 1.6.0 u24 it is not allowed to access the clipboard with standard swing controls

Parameters:
pComponent - the text component


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.