|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sibvisions.rad.ui.awt.impl.AwtFactory
com.sibvisions.rad.ui.swing.impl.SwingFactory
public class SwingFactory
The SwingFactory
class encapsulates methods to
create and access Swing components.
AwtFactory
Constructor Summary | |
---|---|
SwingFactory()
Creates a new instance of SwingFactory . |
Method Summary | |
---|---|
IBorderLayout |
createBorderLayout()
Creates a new instance of IBorderLayout . |
IButton |
createButton()
Creates a new instance of IButton . |
ICellFormat |
createCellFormat(IColor pBackground,
IColor pForeground,
IFont pFont,
IImage pImage,
int pLeftIndent)
Creates a new instance of ICellFormat . |
IChart |
createChart()
Creates a new instance of IChart . |
ICheckBox |
createCheckBox()
Creates a new instance of ICheckBox . |
ICheckBoxMenuItem |
createCheckBoxMenuItem()
Creates a new instance of ICheckBoxMenuItem . |
IChoiceCellEditor |
createChoiceCellEditor()
Creates a new instance of IChoiceCellEditor . |
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. |
IDateCellEditor |
createDateCellEditor()
Creates a new instance of IDateCellEditor . |
IDesktopPanel |
createDesktopPanel()
Creates a new instance of IDesktopPanel . |
IEditor |
createEditor()
Creates a new instance of IEditor . |
IFlowLayout |
createFlowLayout()
Creates a new instance of IFlowLayout . |
IFormLayout |
createFormLayout()
Creates a new instance of IFormLayout . |
IFrame |
createFrame()
Creates a new instance of IFrame . |
IGroupPanel |
createGroupPanel()
Creates a new instance of IGroupPanel . |
IIcon |
createIcon()
Creates a new instance of IIcon . |
IImageViewer |
createImageViewer()
Creates a new instance of IImageViewer . |
IInternalFrame |
createInternalFrame(IDesktopPanel pDesktopPanel)
Creates a new instance of IInternalFrame . |
ILabel |
createLabel()
Creates a new instance of ILabel . |
ILinkedCellEditor |
createLinkedCellEditor()
Creates a new instance of ILinkedCellEditor . |
IMenu |
createMenu()
Creates a new instance of IMenu . |
IMenuBar |
createMenuBar()
Creates a new instance of IMenuBar . |
IMenuItem |
createMenuItem()
Creates a new instance of IMenuItem . |
INumberCellEditor |
createNumberCellEditor()
Creates a new instance of INumberCellEditor . |
IPanel |
createPanel()
Creates a new instance of IPanel . |
IPasswordField |
createPasswordField()
Creates a new instance of IPasswordField . |
IPopupMenu |
createPopupMenu()
Creates a new instance of IPopupMenu . |
IRadioButton |
createRadioButton()
Creates a new instance of IRadioButton . |
IScrollPanel |
createScrollPanel()
Creates a new instance of IScrollPanel . |
ISeparator |
createSeparator()
Creates a new instance of ISeparator . |
ISplitPanel |
createSplitPanel()
Creates a new instance of ISplitPanel . |
ITable |
createTable()
Creates a new instance of ITable . |
ITabsetPanel |
createTabsetPanel()
Creates a new instance of ITabsetPanel . |
ITextArea |
createTextArea()
Creates a new instance of ITextArea . |
ITextCellEditor |
createTextCellEditor()
Creates a new instance of ITextCellEditor . |
ITextField |
createTextField()
Creates a new instance of ITextField . |
IToggleButton |
createToggleButton()
Creates a new instance of IToggleButton . |
IToolBar |
createToolBar()
Creates a new instance of IToolBar . |
IToolBarPanel |
createToolBarPanel()
Creates a new instance of IToolBarPanel . |
ITree |
createTree()
Creates a new instance of ITree . |
IWindow |
createWindow()
Creates a new instance of IWindow . |
ICellEditor |
getDefaultCellEditor(Class<?> pClass)
Gets the default ICellEditor for the given class. |
static int |
getHorizontalAlignment(int pAlign)
Gets the horizontal IAlignmentConstants alignment from given
JVxConstants alignment. |
static int |
getHorizontalSwingAlignment(int pAlign)
Gets the horizontal JVxConstants alignment from given
IAlignmentConstants alignment. |
IImage |
getImage(String pImageName)
Searches the image if it is available as: File ClassLoader resource. |
IImage |
getImage(String pImageName,
byte[] pData)
Creates an image from byte data. |
String |
getImageMapping(String pMappingName)
Gets the image name for the given mapping name. |
String[] |
getImageMappingNames()
Gets all used mapping names. |
static Key |
getKey(KeyStroke pKeyStroke)
Gets the Key for a KeyStroke . |
static KeyStroke |
getKeyStroke(Key pKey)
Gets the KeyStroke for a Key . |
IColor |
getSystemColor(String pType)
This encapsulate symbolic colors representing the color of native GUI objects on a system. |
static int |
getVerticalAlignment(int pAlign)
Gets the vertical IAlignmentConstants alignment from given
JVxConstants alignment. |
static int |
getVerticalSwingAlignment(int pAlign)
Gets the vertical JVxConstants alignment from given
IAlignmentConstants alignment. |
void |
invokeAndWait(Runnable pRunnable)
Causes pRunnable.run() to be executed synchronously on the event dispatching thread. |
void |
invokeInThread(Runnable pRunnable)
Causes pRunnable.run() to be executed asynchronously in a new thread. |
void |
invokeLater(Runnable pRunnable)
Causes pRunnable.run() to be executed asynchronously on the event dispatching thread. |
static boolean |
isLaFOpaque()
Gets wheter the current Look and Feel draws its own background independent of the background color and opaque setting. |
void |
setDefaultCellEditor(Class<?> pClass,
ICellEditor pCellEditor)
Sets the default ICellEditor for the given class. |
void |
setImageMapping(String pMappingName,
String pImageName)
Gets the image name for the given mapping name. |
static void |
setLookAndFeel(ILauncher pLauncher,
String pClassName)
Sets the look and feel which decorates all components. |
void |
setSystemColor(String pType,
IColor pSystemColor)
Sets the given IColor as SystemColor. |
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtFactory |
---|
createColor, createDimension, createFont, createInsets, createPoint, createRectangle, getAvailableFontFamilyNames, getCurrentModifiers, getMostRecentEventTime, getPredefinedCursor, getSystemCustomCursor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SwingFactory()
SwingFactory
.
Method Detail |
---|
public IColor getSystemColor(String pType)
SystemColor
object with a non-symbolic Color object,
getRGB
should be used rather than equals
.
Note that the way in which these system colors are applied to GUI objects may vary slightly from platform to platform since GUI objects may be rendered differently on each platform.
pType
- the color type.
IColor
IColor
public void setSystemColor(String pType, IColor pSystemColor)
IColor
as SystemColor.
If pSystemColor
is null
the
original SystemColor
is restored.
pType
- the color type.pSystemColor
- the IColor
IColor
public IImage getImage(String pImageName)
pImageName
- the name of a resource containing pixel data
in a recognized file format.
IImage
which gets its pixel data from
the specified file.IImage
public IImage getImage(String pImageName, byte[] pData)
pImageName
- the name for the image. The name will be used
for cache mechanism. If the name is set to null
then the cache will ignore the image.pData
- the image data
public String getImageMapping(String pMappingName)
pMappingName
- the mapping name.
public void setImageMapping(String pMappingName, String pImageName)
pMappingName
- the mapping name.pImageName
- the image name.public String[] getImageMappingNames()
public ILabel createLabel()
ILabel
.
ILabel
ILabel
public ITextField createTextField()
ITextField
.
ITextField
ITextField
public IPasswordField createPasswordField()
IPasswordField
.
IPasswordField
IPasswordField
public ITextArea createTextArea()
ITextArea
.
ITextArea
ITextArea
public IIcon createIcon()
IIcon
.
IIcon
IIcon
public IButton createButton()
IButton
.
IButton
IButton
public IToggleButton createToggleButton()
IToggleButton
.
IToggleButton
IToggleButton
public ICheckBox createCheckBox()
ICheckBox
.
ICheckBox
ICheckBox
public IRadioButton createRadioButton()
IRadioButton
.
IRadioButton
IRadioButton
public IMenuItem createMenuItem()
IMenuItem
.
IMenuItem
IMenuItem
public ICheckBoxMenuItem createCheckBoxMenuItem()
ICheckBoxMenuItem
.
ICheckBoxMenuItem
ICheckBoxMenuItem
public IMenu createMenu()
IMenu
.
IMenu
IMenu
public IMenuBar createMenuBar()
IMenuBar
.
IMenuBar
IMenuBar
public IPopupMenu createPopupMenu()
IPopupMenu
.
IPopupMenu
IPopupMenu
public ISeparator createSeparator()
ISeparator
.
ISeparator
ISeparator
public ITable createTable()
ITable
.
ITable
ITable
public ITree createTree()
ITree
.
ITree
ITree
public IChart createChart()
IChart
.
IChart
IChart
public ICellFormat createCellFormat(IColor pBackground, IColor pForeground, IFont pFont, IImage pImage, int pLeftIndent)
ICellFormat
.
pBackground
- the background of the Cell.pForeground
- the foreground of the Cell.pFont
- the font of the Cell.pImage
- the image of the Cell.pLeftIndent
- the left indent.
ICellFormat
ICellFormat
public IEditor createEditor()
IEditor
.
IEditor
IEditor
public ICellEditor getDefaultCellEditor(Class<?> pClass)
ICellEditor
for the given class.
This function should always return an editor.
It should look for best matching editor with Class.isAssignableFrom.
pClass
- the class type to be edited.
ICellEditor
ICellEditor
public void setDefaultCellEditor(Class<?> pClass, ICellEditor pCellEditor)
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.
pClass
- the class type to be edited.pCellEditor
- the ICellEditor
ICellEditor
public IImageViewer createImageViewer()
IImageViewer
.
IImageViewer
IImageViewer
public IChoiceCellEditor createChoiceCellEditor()
IChoiceCellEditor
.
IChoiceCellEditor
IChoiceCellEditor
public IDateCellEditor createDateCellEditor()
IDateCellEditor
.
IDateCellEditor
IDateCellEditor
public ILinkedCellEditor createLinkedCellEditor()
ILinkedCellEditor
.
ILinkedCellEditor
ILinkedCellEditor
public INumberCellEditor createNumberCellEditor()
INumberCellEditor
.
INumberCellEditor
INumberCellEditor
public ITextCellEditor createTextCellEditor()
ITextCellEditor
.
ITextCellEditor
ITextCellEditor
public IPanel createPanel()
IPanel
.
IPanel
IPanel
public IToolBarPanel createToolBarPanel()
IToolBarPanel
.
IToolBarPanel
IToolBarPanel
public IGroupPanel createGroupPanel()
IGroupPanel
.
IGroupPanel
IGroupPanel
public IScrollPanel createScrollPanel()
IScrollPanel
.
IScrollPanel
IScrollPanel
public ISplitPanel createSplitPanel()
ISplitPanel
.
ISplitPanel
ISplitPanel
public ITabsetPanel createTabsetPanel()
ITabsetPanel
.
ITabsetPanel
ITabsetPanel
public IToolBar createToolBar()
IToolBar
.
IToolBar
IToolBar
public IDesktopPanel createDesktopPanel()
IDesktopPanel
.
IDesktopPanel
IDesktopPanel
public IInternalFrame createInternalFrame(IDesktopPanel pDesktopPanel)
IInternalFrame
.
pDesktopPanel
- the associated desktop for the internal frame
IInternalFrame
IInternalFrame
public IWindow createWindow()
IWindow
.
IWindow
IWindow
public IFrame createFrame()
IFrame
.
IFrame
IFrame
public IComponent createCustomComponent(Object pCustomComponent)
createCustomComponent
in interface IFactory
createCustomComponent
in class AwtFactory
pCustomComponent
- the custom Component.
IComponent
custom component.public IContainer createCustomContainer(Object pCustomContainer)
createCustomContainer
in interface IFactory
createCustomContainer
in class AwtFactory
pCustomContainer
- the custom Container.
IContainer
custom container.public IBorderLayout createBorderLayout()
IBorderLayout
.
IBorderLayout
IBorderLayout
public IFlowLayout createFlowLayout()
IFlowLayout
.
IFlowLayout
IFlowLayout
public IFormLayout createFormLayout()
IFormLayout
.
IFormLayout
IFormLayout
public void invokeLater(Runnable pRunnable)
pRunnable.run()
to be executed asynchronously on the event dispatching thread.
This will happen after all pending events have been processed. This method
should be used when an application thread needs to update the GUI.
pRunnable
- the asynchronous callIFactory.invokeAndWait(Runnable)
public void invokeAndWait(Runnable pRunnable) throws Exception
pRunnable.run()
to be executed synchronously on the event dispatching thread. This call blocks
until all pending events have been processed and (then) pRunnable.run()
returns.
This method should be used when an application thread needs to update the GUI.
pRunnable
- the call
Exception
- if the call causes an exceptionpublic void invokeInThread(Runnable pRunnable)
pRunnable.run()
to be executed asynchronously in a new thread.
Action calls and UI Calls in the thread should be synchronized with the event dispatching thread
by using invokeLater or invokeAndWait.
To guarantee functionality of invokeLater in Threads, IFactory implementations should use
InvokeLaterThread to create threads. The InvokeLaterThread calls all invokeLater notifications
after the Thread. In thread loops InvokeLaterThread.executeInvokeLater
can
be called to invoke thread safe all invokeLater runnables immediate.
This gives the IFactory implementation a chance to decide how and when to run the threads.
pRunnable
- the callIFactory.invokeAndWait(Runnable)
,
IFactory.invokeLater(Runnable)
public static int getVerticalAlignment(int pAlign)
IAlignmentConstants
alignment from given
JVxConstants
alignment.
pAlign
- the alignment from JVxConstants
IAlignmentConstants
public static int getVerticalSwingAlignment(int pAlign)
JVxConstants
alignment from given
IAlignmentConstants
alignment.
pAlign
- the alignment from IAlignmentConstants
JComponent
public static int getHorizontalAlignment(int pAlign)
IAlignmentConstants
alignment from given
JVxConstants
alignment.
pAlign
- the alignment from JVxConstants
IAlignmentConstants
public static int getHorizontalSwingAlignment(int pAlign)
JVxConstants
alignment from given
IAlignmentConstants
alignment.
pAlign
- the alignment from IAlignmentConstants
JComponent
public static void setLookAndFeel(ILauncher pLauncher, String pClassName)
pLauncher
- the launcher for which the LaF should be changedpClassName
- the full qualified class name of the look and feelpublic static KeyStroke getKeyStroke(Key pKey)
KeyStroke
for a Key
.
pKey
- the UI Key
KeyStroke
public static Key getKey(KeyStroke pKeyStroke)
Key
for a KeyStroke
.
pKeyStroke
- the swing KeyStroke
Key
public static boolean isLaFOpaque()
true
whether the LaF has its own opaque drawind mechanism
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |