DESY ACOP Beans Home

com.cosylab.gui.displayers
Class DisplayerUtilities

java.lang.Object
  extended by com.cosylab.gui.displayers.DisplayerUtilities

public final class DisplayerUtilities
extends java.lang.Object

DisplayerUtilities contains set of usefull methods and fields which help to implement various Displayer interfaces.

Since:
Dec 3, 2003.
Version:
$Id: DisplayerUtilities.java,v 1.19 2008-04-22 12:31:02 jbobnar Exp $
Author:
Igor Kriznar

Field Summary
static java.lang.String[] COMMON_NUMERIC_DISPLAYER_CHARACTERISTICS
          List of commonly supporter characteristics for numeric displayers (double, long).
static java.lang.String[] COMMON_NUMERIC_DISPLAYER_PROPERTIES
          List of commonly supported Java Bean properties for numeric displayers (double, long).
static java.lang.String[] COMMON_OBJECT_DISPLAYER_CHARACTERISTICS
          List of commonly supporter characteristics for object displayer.
static java.lang.String[] PATTERN_DISPLAYER_CHARACTERISTICS
          List of commonly supporter characteristics for numeric displayers (double, long).
 
Method Summary
static java.lang.String[] combineCharacteristics(java.lang.String[] char1, java.lang.String charName)
          Combines arrays of characteristics names with singe characteristic name in to one.
static java.lang.String[] combineCharacteristics(java.lang.String[] char1, java.lang.String[] char2)
          Combines two arrays of characteristics names in to one.
static double extract(int index, double[] array)
          Extracts single value from an array.
static java.lang.String extract(int index, java.lang.String[] array)
          Extracts single value from an array.
static void prepareNewConverter(Converter converter, ConvertibleDisplayer disp)
          This method can be used from setConverter() method from convertible displayer, which is passed as parameter.
static void prepareNewDataSource(DataSource dataSource, ConvertibleDisplayer disp)
          This method can be used from setDataSource() method from displayer, which is passed as parameter.
static void prepareNewDataSource(DataSource dataSource, Displayer disp)
          This method can be used from setDataSource() method from displayer, which is passed as parameter.
static void setCharacteristics(java.util.Map characteristics, DoubleDisplayer disp)
          Sets characteristics from Map to the displayer.
static void setCharacteristics(java.util.Map characteristics, LongDisplayer disp)
          Sets characteristics from Map to the displayer.
static void setCharacteristics(java.util.Map characteristics, PatternDisplayer disp)
          Sets characteristics from Map to the displayer.
static java.lang.String toLongFormat(java.lang.String format)
          Trys to transform double format string to long format string.
static java.lang.String toString(java.lang.Object[] value)
          Converts the array to string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMON_NUMERIC_DISPLAYER_CHARACTERISTICS

public static final java.lang.String[] COMMON_NUMERIC_DISPLAYER_CHARACTERISTICS
List of commonly supporter characteristics for numeric displayers (double, long).


COMMON_NUMERIC_DISPLAYER_PROPERTIES

public static final java.lang.String[] COMMON_NUMERIC_DISPLAYER_PROPERTIES
List of commonly supported Java Bean properties for numeric displayers (double, long).


PATTERN_DISPLAYER_CHARACTERISTICS

public static final java.lang.String[] PATTERN_DISPLAYER_CHARACTERISTICS
List of commonly supporter characteristics for numeric displayers (double, long).


COMMON_OBJECT_DISPLAYER_CHARACTERISTICS

public static final java.lang.String[] COMMON_OBJECT_DISPLAYER_CHARACTERISTICS
List of commonly supporter characteristics for object displayer.

Method Detail

combineCharacteristics

public static final java.lang.String[] combineCharacteristics(java.lang.String[] char1,
                                                              java.lang.String[] char2)
Combines two arrays of characteristics names in to one.

Parameters:
char1 - array to be combined
char2 - array to be combined
Returns:
conbined array of characteristic names

combineCharacteristics

public static final java.lang.String[] combineCharacteristics(java.lang.String[] char1,
                                                              java.lang.String charName)
Combines arrays of characteristics names with singe characteristic name in to one.

Parameters:
char1 - array to be combined
charName - characteeristic name to be combined
Returns:
conbined array of characteristic names

setCharacteristics

public static final void setCharacteristics(java.util.Map characteristics,
                                            DoubleDisplayer disp)
Sets characteristics from Map to the displayer.

Parameters:
characteristics - the Map with characteristics
disp - the displayer to which characteristics will be set
Throws:
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException

setCharacteristics

public static final void setCharacteristics(java.util.Map characteristics,
                                            LongDisplayer disp)
Sets characteristics from Map to the displayer.

Parameters:
characteristics - the Map with characteristics
disp - the displayer to which characteristics will be set
Throws:
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException

setCharacteristics

public static final void setCharacteristics(java.util.Map characteristics,
                                            PatternDisplayer disp)
Sets characteristics from Map to the displayer.

Parameters:
characteristics - the Map with characteristics
disp - the displayer to which characteristics will be set
Throws:
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException

toLongFormat

public static java.lang.String toLongFormat(java.lang.String format)
Trys to transform double format string to long format string.

Parameters:
format - double prinf format string
Returns:
possibly safer long compatible format string

prepareNewConverter

public static void prepareNewConverter(Converter converter,
                                       ConvertibleDisplayer disp)
                                throws java.beans.PropertyVetoException
This method can be used from setConverter() method from convertible displayer, which is passed as parameter. This method must be called before new converter was stored in local field and after this method new converter must be stored in local field.

Parameters:
converter - new converter to be set to displayer
disp - displayer which receives new converter
Throws:
java.beans.PropertyVetoException

prepareNewDataSource

public static void prepareNewDataSource(DataSource dataSource,
                                        ConvertibleDisplayer disp)
                                 throws java.beans.PropertyVetoException
This method can be used from setDataSource() method from displayer, which is passed as parameter. This method must be called before new datasource was stored in local field and after this method new datasource must be stored in local field.

Parameters:
dataSource - new datasource to be set to displayer
disp - displayer which receives new converter
Throws:
java.beans.PropertyVetoException

prepareNewDataSource

public static void prepareNewDataSource(DataSource dataSource,
                                        Displayer disp)
                                 throws java.beans.PropertyVetoException
This method can be used from setDataSource() method from displayer, which is passed as parameter. This method must be called before new datasource was stored in local field and after this method new datasource must be stored in local field.

Parameters:
dataSource - new datasource to be set to displayer
disp - displayer which receives new converter
Throws:
java.beans.PropertyVetoException

extract

public static double extract(int index,
                             double[] array)
Extracts single value from an array. If index is over array size, then returns value from index position closest to requested index.

Parameters:
index - an index of value to return
array - source array
Returns:
value at specified index if valud or closes valid index

extract

public static java.lang.String extract(int index,
                                       java.lang.String[] array)
Extracts single value from an array. If index is over array size, then returns value from index position closest to requested index.

Parameters:
index - an index of value to return
array - source array
Returns:
value at specified index if valud or closes valid index

toString

public static java.lang.String toString(java.lang.Object[] value)
Converts the array to string. This method is used displayer to transform a sequence to string.

Parameters:
value -
Returns:


Copyright © 2010. All Rights Reserved.