Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.port80.eclipse.util
Class CursorFactory  view CursorFactory download CursorFactory.java

java.lang.Object
  extended bycom.port80.eclipse.util.CursorFactory
All Implemented Interfaces:
org.eclipse.swt.events.DisposeListener, java.util.EventListener, com.port80.util.attr.IAttrFactory, org.eclipse.swt.internal.SWTEventListener

public class CursorFactory
extends java.lang.Object
implements com.port80.util.attr.IAttrFactory, org.eclipse.swt.events.DisposeListener

SWT Cursor factory and cache.


Field Summary
private static boolean DEBUG
           
private  java.util.Map fCursorTable
           
private static CursorFactory fDefault
           
private static org.eclipse.swt.widgets.Display fDisplay
           
private static com.port80.util.struct.IntKeyHashMap fPredefinedNames
           
private static com.port80.util.struct.IntValueHashMap fPredefinedStyles
           
private static java.lang.String NAME
           
private static java.lang.String[] PREDEFINED
           
private static int[] PREDEFINED_ID
           
private static boolean VERBOSE
           
 
Constructor Summary
CursorFactory()
           
 
Method Summary
 org.eclipse.swt.graphics.Cursor create(int style)
          Create or get the specified predefined cursor from cache if already created.
 org.eclipse.swt.graphics.Cursor create(java.lang.String name)
          Create or get the specified predefined cursor from cache if already created.
 org.eclipse.swt.graphics.Cursor create(java.lang.String name, org.eclipse.swt.graphics.ImageData imagedata, int hotx, int hoty)
           
 java.lang.Object createObject(java.lang.String attrvalue)
          Convert String representation of an attribute value to the appropriate object for storing in AttrTable.
 void dispose()
           
 void dispose(java.lang.String name)
           
static CursorFactory getDefault()
           
 java.lang.Class getObjectClass()
           
 boolean isValid(java.lang.Object a)
          Check that given object is valid value for this factory.
static void main(java.lang.String[] args)
           
 java.lang.Object promptUser(java.lang.String prompt)
          Prompt user and present a user interface to obtain an attribute value from user.
 java.lang.String toString()
          The String representation of attribute type itself.
 java.lang.String toString(java.lang.Object attr)
          The String representation of an attribute value.
 void widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
          Dispose cached cursor resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

private static final java.lang.String NAME
See Also:
Constant Field Values

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

VERBOSE

private static boolean VERBOSE

PREDEFINED

private static final java.lang.String[] PREDEFINED

PREDEFINED_ID

private static final int[] PREDEFINED_ID

fPredefinedNames

private static com.port80.util.struct.IntKeyHashMap fPredefinedNames

fPredefinedStyles

private static com.port80.util.struct.IntValueHashMap fPredefinedStyles

fDefault

private static CursorFactory fDefault

fDisplay

private static org.eclipse.swt.widgets.Display fDisplay

fCursorTable

private java.util.Map fCursorTable
Constructor Detail

CursorFactory

public CursorFactory()
Method Detail

getDefault

public static CursorFactory getDefault()

create

public org.eclipse.swt.graphics.Cursor create(java.lang.String name)
Create or get the specified predefined cursor from cache if already created.


create

public org.eclipse.swt.graphics.Cursor create(int style)
Create or get the specified predefined cursor from cache if already created.


create

public org.eclipse.swt.graphics.Cursor create(java.lang.String name,
                                              org.eclipse.swt.graphics.ImageData imagedata,
                                              int hotx,
                                              int hoty)

dispose

public void dispose(java.lang.String name)

widgetDisposed

public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
Dispose cached cursor resource. Typically this should be listening to the main window DisposeEvent.

Specified by:
widgetDisposed in interface org.eclipse.swt.events.DisposeListener

dispose

public void dispose()

createObject

public java.lang.Object createObject(java.lang.String attrvalue)
Convert String representation of an attribute value to the appropriate object for storing in AttrTable. String representation of a cursor spec., accepted format: eg. "comic sans-bold italic-12" Note: Case is insignificant in the cursor spec. but spaces in cursorname is significant. Spaces and order in cursor style is not significant. Size must be an integer.

Specified by:
createObject in interface com.port80.util.attr.IAttrFactory

isValid

public boolean isValid(java.lang.Object a)
Description copied from interface: com.port80.util.attr.IAttrFactory
Check that given object is valid value for this factory.

Specified by:
isValid in interface com.port80.util.attr.IAttrFactory

getObjectClass

public java.lang.Class getObjectClass()

toString

public java.lang.String toString(java.lang.Object attr)
The String representation of an attribute value.

Specified by:
toString in interface com.port80.util.attr.IAttrFactory

toString

public java.lang.String toString()
The String representation of attribute type itself.

Specified by:
toString in interface com.port80.util.attr.IAttrFactory

promptUser

public java.lang.Object promptUser(java.lang.String prompt)
Prompt user and present a user interface to obtain an attribute value from user.

Specified by:
promptUser in interface com.port80.util.attr.IAttrFactory

main

public static void main(java.lang.String[] args)