com.sibvisions.rad.ui.awt.impl
Class AwtFactory

java.lang.Object
  extended by com.sibvisions.rad.ui.awt.impl.AwtFactory
All Implemented Interfaces:
IFactory
Direct Known Subclasses:
SwingFactory

public abstract class AwtFactory
extends Object
implements IFactory

The AwtFactory class encapsulates methods to create and access AWT components.


Constructor Summary
AwtFactory()
          Create a new instance of AwtFactory to create and access AWT components.
 
Method Summary
 IColor createColor(int pRGB)
          Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.
 IComponent createCustomComponent(Object pCustomComponent)
          Creates a new Instance of IComponent that contains any Custom Component.
 IContainer createCustomContainer(Object pCustomContainer)
          Creates a new Instance of IContainer that contains any Custom Container.
 IDimension createDimension(int pWidth, int pHeight)
          Creates a new instance of IDimension with the given with and height.
 IFont createFont(String pName, int pStyle, int pSize)
          Creates a new instance of IFont from the specified name, style and point size.
 IInsets createInsets(int pTop, int pLeft, int pBottom, int pRight)
          Creates a new instance of IInsets.
 IPoint createPoint(int pX, int pY)
          Creates a new instance of IPoint with the given x and y.
 IRectangle createRectangle(int pX, int pY, int pWidth, int pHeight)
          Creates a new instance of IRectangle with the given x, y, width and height.
 String[] getAvailableFontFamilyNames()
          Returns an array containing the names of all font families in this GraphicsEnvironment localized for the default locale, as returned by Locale.getDefault().
static int getCurrentModifiers()
          Gets the modifiers of the current event, if it's a InputEvent or ActionEvent.
static long getMostRecentEventTime()
          Returns the timestamp of the most recent event that had a timestamp, and that was dispatched from the EventQueue associated with the calling thread.
 ICursor getPredefinedCursor(int pType)
          Gets a ICursor object with the specified type.
 ICursor getSystemCustomCursor(String pCursorName)
          Returns a system-specific custom ICursor object matching the specified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.rad.ui.IFactory
createBorderLayout, createButton, createCellFormat, createChart, createCheckBox, createCheckBoxMenuItem, createChoiceCellEditor, createDateCellEditor, createDesktopPanel, createEditor, createFlowLayout, createFormLayout, createFrame, createGroupPanel, createIcon, createImageViewer, createInternalFrame, createLabel, createLinkedCellEditor, createMenu, createMenuBar, createMenuItem, createNumberCellEditor, createPanel, createPasswordField, createPopupMenu, createRadioButton, createScrollPanel, createSeparator, createSplitPanel, createTable, createTabsetPanel, createTextArea, createTextCellEditor, createTextField, createToggleButton, createToolBar, createToolBarPanel, createTree, createWindow, getDefaultCellEditor, getImage, getImage, getImageMapping, getImageMappingNames, getSystemColor, invokeAndWait, invokeInThread, invokeLater, setDefaultCellEditor, setImageMapping, setSystemColor
 

Constructor Detail

AwtFactory

public AwtFactory()
Create a new instance of AwtFactory to create and access AWT components.

Method Detail

getAvailableFontFamilyNames

public String[] getAvailableFontFamilyNames()
Returns an array containing the names of all font families in this GraphicsEnvironment localized for the default locale, as returned by Locale.getDefault().

Typical usage would be for presentation to a user for selection of a particular family name. An application can then specify this name when creating a font, in conjunction with a style, such as bold or italic, giving the font system flexibility in choosing its own best match among multiple fonts in the same font family.

Specified by:
getAvailableFontFamilyNames in interface IFactory
Returns:
an array of String containing font family names localized for the default locale, or a suitable alternative name if no name exists for this locale.
See Also:
IFont, IFont.getFamily()

createFont

public IFont createFont(String pName,
                        int pStyle,
                        int pSize)
Creates a new instance of IFont from the specified name, style and point size.

The font name can be a font face name or a font family name. It is used together with the style to find an appropriate font face. When a font family name is specified, the style argument is used to select the most appropriate face from the family. When a font face name is specified, the face's style and the style argument are merged to locate the best matching font from the same family. For example if face name "Arial Bold" is specified with style IFont.ITALIC, the font system looks for a face in the "Arial" family that is bold and italic, and may associate the font instance with the physical font face "Arial Bold Italic". The style argument is merged with the specified face's style, not added or subtracted. This means, specifying a bold face and a bold style does not double-embolden the font, and specifying a bold face and a plain style does not lighten the font.

If no face for the requested style can be found, the font system may apply algorithmic styling to achieve the desired style. For example, if ITALIC is requested, but no italic face is available, glyphs from the plain face may be algorithmically obliqued (slanted).

Font name lookup is case insensitive, using the case folding rules of the US locale.

If the name parameter represents something other than a logical font, i.e. is interpreted as a physical font face or family, and this cannot be mapped by the implementation to a physical font or a compatible alternative, then the font system will map the Font to a standard font.

Specified by:
createFont in interface IFactory
Parameters:
pName - the font name. This can be a font face name or a font family name, and may represent either a logical font or a physical font found in this GraphicsEnvironment.
pStyle - the style constant for the IFont The style argument is an integer bitmask that may be PLAIN, or a bitwise union of BOLD and/or ITALIC (for example, ITALIC or BOLD|ITALIC). If the style argument does not conform to one of the expected integer bitmasks then the style is set to PLAIN.
pSize - the point size of the IFont
Returns:
the IFont
See Also:
IFont, IFactory.getAvailableFontFamilyNames()

createColor

public IColor createColor(int pRGB)
Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. If the pHasalpha argument is false, alpha is defaulted to 255.

Specified by:
createColor in interface IFactory
Parameters:
pRGB - the combined RGBA components
Returns:
the IColor
See Also:
IColor, IColor.getRed(), IColor.getGreen(), IColor.getBlue(), IColor.getAlpha(), IColor.getRGBA()

getPredefinedCursor

public ICursor getPredefinedCursor(int pType)
Gets a ICursor object with the specified type.

Specified by:
getPredefinedCursor in interface IFactory
Parameters:
pType - the type of cursor
Returns:
the ICursor
See Also:
ICursor

getSystemCustomCursor

public ICursor getSystemCustomCursor(String pCursorName)
Returns a system-specific custom ICursor object matching the specified name. Cursor names are, for example: "Invalid.16x16"

Specified by:
getSystemCustomCursor in interface IFactory
Parameters:
pCursorName - a string describing the desired system-specific custom cursor
Returns:
the system specific custom cursor named
See Also:
ICursor

createPoint

public IPoint createPoint(int pX,
                          int pY)
Creates a new instance of IPoint with the given x and y.

Specified by:
createPoint in interface IFactory
Parameters:
pX - the x value
pY - the y value
Returns:
the IPoint
See Also:
IPoint

createDimension

public IDimension createDimension(int pWidth,
                                  int pHeight)
Creates a new instance of IDimension with the given with and height.

Specified by:
createDimension in interface IFactory
Parameters:
pWidth - the width
pHeight - the height
Returns:
the IDimension
See Also:
IDimension

createRectangle

public IRectangle createRectangle(int pX,
                                  int pY,
                                  int pWidth,
                                  int pHeight)
Creates a new instance of IRectangle with the given x, y, width and height.

Specified by:
createRectangle in interface IFactory
Parameters:
pX - the x value
pY - the y value
pWidth - the width
pHeight - the height
Returns:
the IRectangle
See Also:
IRectangle

createInsets

public IInsets createInsets(int pTop,
                            int pLeft,
                            int pBottom,
                            int pRight)
Creates a new instance of IInsets.

Specified by:
createInsets in interface IFactory
Parameters:
pTop - the top
pLeft - the left
pBottom - the bottom
pRight - the right
Returns:
the IInsets
See Also:
IInsets

createCustomComponent

public IComponent createCustomComponent(Object pCustomComponent)
Creates a new Instance of IComponent that contains any Custom Component.

Specified by:
createCustomComponent in interface IFactory
Parameters:
pCustomComponent - the custom Component.
Returns:
the IComponent custom component.

createCustomContainer

public IContainer createCustomContainer(Object pCustomContainer)
Creates a new Instance of IContainer that contains any Custom Container.

Specified by:
createCustomContainer in interface IFactory
Parameters:
pCustomContainer - the custom Container.
Returns:
the IContainer custom container.

getCurrentModifiers

public static int getCurrentModifiers()
Gets the modifiers of the current event, if it's a InputEvent or ActionEvent.

Returns:
the event modifiers

getMostRecentEventTime

public static long getMostRecentEventTime()
Returns the timestamp of the most recent event that had a timestamp, and that was dispatched from the EventQueue associated with the calling thread. If an event with a timestamp is currently being dispatched, its timestamp will be returned. If no events have yet been dispatched, the EventQueue's initialization time will be returned instead.In the current version of the JDK, only InputEvents, ActionEvents, and InvocationEvents have timestamps; however, future versions of the JDK may add timestamps to additional event types. Note that this method should only be invoked from an application's event dispatching thread. If this method is invoked from another thread, the current system time (as reported by System.currentTimeMillis()) will be returned instead.

Returns:
the timestamp of the last InputEvent, ActionEvent, or InvocationEvent to be dispatched, or System.currentTimeMillis() if this method is invoked on a thread other than an event dispatching thread
See Also:
InputEvent.getWhen(), ActionEvent.getWhen(), InvocationEvent.getWhen()


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.