org.safs
Class GuiClassData

java.lang.Object
  extended by org.safs.GuiClassData
Direct Known Subclasses:
AGuiClassData, DGuiClassData, LocalServerGuiClassData, RGuiClassData

public class GuiClassData
extends java.lang.Object

This class is primarily used to open and read in external data files that map class names to supported class types as well as mapping class types to the library supporting the mapped class type.

Default class to type mapping is stored in "JavaObjectsMap.dat".
Default types to library mapping is stored in "ObjectTypesMap.dat".

Custom class to type mapping is stored in "CustomJavaObjectsMap.dat".
Custom types to library mapping is stored in "CustomObjectTypesMap.dat".


Field Summary
static java.lang.String[] ALT_NAME_TYPES
           
protected static java.util.Hashtable classassigns
           
protected static java.util.Properties classmap
           
static java.lang.String[] CONTAINER_TYPES
           
static java.lang.String CUSTOM_JAVA_OBJECTS_MAP
           
static java.lang.String CUSTOM_OBJECT_TYPES_MAP
           
static java.lang.String DEFAULT_CLASS_TYPE
           
static java.lang.String DEFAULT_JAVA_OBJECTS_MAP
           
static java.lang.String DEFAULT_OBJECT_TYPE
           
static java.lang.String DEFAULT_OBJECT_TYPES_MAP
           
static java.lang.String DEFAULT_TYPE_SEPARATOR
           
static java.lang.String[] POPUP_MENU_CLASSES
           
static java.lang.String[] TOOLTIP_CONTAINER_TYPES
           
protected static java.util.Properties typesmap
           
 
Constructor Summary
GuiClassData()
           
 
Method Summary
protected static boolean classtypeContainsClassType(java.lang.String classtypes, java.lang.String atype)
          See if the comma-separated list of possible class types contains the one type we are looking for.
static java.lang.String deduceOneClassType(java.lang.String _domain, java.lang.String _type)
          GuiClassData supports multiple 'types' for each class.
static java.lang.String getGenericObjectType(java.lang.String classType)
          Returns the case-sensitive, generic object type for the given classType.
 java.lang.String getMappedClassType(java.lang.String classname, java.lang.Object theObject)
          Retrieves the class Type we have stored for the provided class name (if any).
protected static java.net.URL getResourceURL(java.lang.Class clazz, java.lang.String aresource)
           
static java.lang.String[] getTypesAsArray(java.lang.String _type)
          GuiClassData supports multiple 'types' for each class.
static boolean isAltNameType(java.lang.String type)
           
 boolean isAssignableFrom(java.lang.String soughtType, java.lang.String soughtClass, java.lang.Object theObject)
          See if our object is a subclass of a known class type.
static boolean isContainerType(java.lang.String mappedClassType)
           
 boolean isMatched(java.lang.String soughtType, java.lang.String soughtClass, java.lang.Object theObject)
          Subclasses should override this to insure proper invocation of the overridden functions.
This routine merely calls:
static boolean isMatchedType(java.lang.String soughtType, java.lang.String soughtClass)
          Check if our soughtClass is equivalent to a known class type.
static boolean isPopupMenuClass(java.lang.String classname)
           
static boolean isToolTipContainerType(java.lang.String mappedClassType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_JAVA_OBJECTS_MAP

public static final java.lang.String DEFAULT_JAVA_OBJECTS_MAP
See Also:
Constant Field Values

DEFAULT_OBJECT_TYPES_MAP

public static final java.lang.String DEFAULT_OBJECT_TYPES_MAP
See Also:
Constant Field Values

CUSTOM_JAVA_OBJECTS_MAP

public static final java.lang.String CUSTOM_JAVA_OBJECTS_MAP
See Also:
Constant Field Values

CUSTOM_OBJECT_TYPES_MAP

public static final java.lang.String CUSTOM_OBJECT_TYPES_MAP
See Also:
Constant Field Values

DEFAULT_CLASS_TYPE

public static final java.lang.String DEFAULT_CLASS_TYPE
See Also:
Constant Field Values

DEFAULT_OBJECT_TYPE

public static final java.lang.String DEFAULT_OBJECT_TYPE
See Also:
Constant Field Values

DEFAULT_TYPE_SEPARATOR

public static final java.lang.String DEFAULT_TYPE_SEPARATOR
See Also:
Constant Field Values

CONTAINER_TYPES

public static final java.lang.String[] CONTAINER_TYPES

ALT_NAME_TYPES

public static final java.lang.String[] ALT_NAME_TYPES

TOOLTIP_CONTAINER_TYPES

public static final java.lang.String[] TOOLTIP_CONTAINER_TYPES

POPUP_MENU_CLASSES

public static final java.lang.String[] POPUP_MENU_CLASSES

classmap

protected static java.util.Properties classmap

typesmap

protected static java.util.Properties typesmap

classassigns

protected static java.util.Hashtable classassigns
Constructor Detail

GuiClassData

public GuiClassData()
Method Detail

getResourceURL

protected static java.net.URL getResourceURL(java.lang.Class clazz,
                                             java.lang.String aresource)

getMappedClassType

public java.lang.String getMappedClassType(java.lang.String classname,
                                           java.lang.Object theObject)
Retrieves the class Type we have stored for the provided class name (if any). We will cycle through all possible superclasses (except Object) looking for a match to a superclass.

Tool-dependent subclasses will most likely have to subclass this class and provide similar mechanisms for evaluating the class hierarchy.

Parameters:
classname - the actual classname sought as a known class type.
obj - the object we are going to evaluate for "type"
Returns:
the class Type (i.e. JavaPanel) for the provided class name (i.e. javax.swing.JPanel). null if no mapped type is found. The classtype may be returned as a comma-separated list of all types supported for the class.

classtypeContainsClassType

protected static boolean classtypeContainsClassType(java.lang.String classtypes,
                                                    java.lang.String atype)
See if the comma-separated list of possible class types contains the one type we are looking for. The comparison is NOT case-sensitive.


isMatchedType

public static boolean isMatchedType(java.lang.String soughtType,
                                    java.lang.String soughtClass)
Check if our soughtClass is equivalent to a known class type. We first loop through a predefined list mapping classes to class types.

Parameters:
soughtType - the Type= identifier we are seeking.
soughtClass - the actual classname we are trying to type match.
Returns:
true if the class or a superclass is a mapped type. false if it is not.

isAssignableFrom

public boolean isAssignableFrom(java.lang.String soughtType,
                                java.lang.String soughtClass,
                                java.lang.Object theObject)
See if our object is a subclass of a known class type. We do the latter via getMappedClassType.

Tool-dependent subclasses will override this method to handle their unique object proxies.

Parameters:
soughtType - the Type= identifier we are seeking.
soughtClass - the actual classname we are trying to type match.
Returns:
true if the class or a superclass is a mapped type. false if it is not.

isMatched

public boolean isMatched(java.lang.String soughtType,
                         java.lang.String soughtClass,
                         java.lang.Object theObject)
Subclasses should override this to insure proper invocation of the overridden functions.
This routine merely calls:

isMatchingType - usually not overridden isAssignableFrom - usually overridden by tool-dependent subclasses.


getGenericObjectType

public static java.lang.String getGenericObjectType(java.lang.String classType)
Returns the case-sensitive, generic object type for the given classType. classType should be provided as a result of a call to getMappedClassType. However, the call to getMappedClassType can return a comma-separated list. We will always return the object map of the first classtype in such a list.

classType is also case-sensitive, so it should be used from getMappedClassType unmodified.

This object type is used to instance particular classes of Component Function libraries. A single library may handle several subtypes or even similar types in different domains (Web, Java, etc.)

Parameters:
classType - getMappedClassType value. If a comma-separated list is provided then we will only return the object type of the first item in the list.

Returns:
String generically mapped object type for classType. If classType is null or some other problem occurs we will generically return the DEFAULT_OBJECT_TYPE string.

isContainerType

public static boolean isContainerType(java.lang.String mappedClassType)

isPopupMenuClass

public static boolean isPopupMenuClass(java.lang.String classname)

isToolTipContainerType

public static boolean isToolTipContainerType(java.lang.String mappedClassType)

isAltNameType

public static boolean isAltNameType(java.lang.String type)

deduceOneClassType

public static java.lang.String deduceOneClassType(java.lang.String _domain,
                                                  java.lang.String _type)
GuiClassData supports multiple 'types' for each class. That is given class might be mappable to more than one type (or one type might be appropriate for one class). Example: mapping to "JavaPanel, Panel". This routine attempts to return one mapped type based on multiple mapped types and the provided domain. The logic relies on the convention that the object type with the domain in its name is the most suitable match or an object type with no domain in its name is next best.

Parameters:
_domain - "Java", "Win", "Html", or "Java;Html;Flex" etc...
_type - potentially comma-separated list of possible types. Must not be null.
Returns:
String best matching type.

getTypesAsArray

public static java.lang.String[] getTypesAsArray(java.lang.String _type)
GuiClassData supports multiple 'types' for each class. That is given class might be mappable to more than one type (or one type might be appropriate for one class). Example: mapping to "JavaPanel, Panel". This routine attempts to return these multiple class types as an array.

Parameters:
_type - potentially comma-separated list of types retrieved from getMappedClassType. Must not be null.
Returns:
String[] of types. Can be an array of only 0 items on input error.
See Also:
getMappedClassType(String, Object)