com.sibvisions.rad.ui.swing.impl
Class SwingApplet.SwingAppletLauncher

java.lang.Object
  extended by com.sibvisions.rad.ui.awt.impl.AwtResource<C>
      extended by com.sibvisions.rad.ui.awt.impl.AwtComponent<C>
          extended by com.sibvisions.rad.ui.awt.impl.AwtContainer<C>
              extended by com.sibvisions.rad.ui.swing.impl.container.SwingAbstractFrame<JApplet>
                  extended by com.sibvisions.rad.ui.swing.impl.SwingApplet.SwingAppletLauncher
All Implemented Interfaces:
ComponentListener, KeyListener, MouseListener, EventListener, ILauncher, IFrame, IToolBarPanel, IWindow, IAlignmentConstants, IComponent, IContainer, IResource, IExceptionListener, INamedObject
Enclosing class:
SwingApplet

public class SwingApplet.SwingAppletLauncher
extends SwingAbstractFrame<JApplet>
implements ILauncher, ComponentListener

The SwingAppletLauncher is the ILauncher implementation for swing applet applications with full access to the JApplet.


Field Summary
 
Fields inherited from class com.sibvisions.rad.ui.swing.impl.container.SwingAbstractFrame
bDisposed, eventWindowActivated, eventWindowClosed, eventWindowClosing, eventWindowDeactivated, eventWindowDeiconified, eventWindowIconified, eventWindowOpened, iconImage, menuBar
 
Fields inherited from class com.sibvisions.rad.ui.awt.impl.AwtComponent
eventComponentMoved, eventComponentResized, eventSource, factory, parent
 
Fields inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
resource
 
Fields inherited from interface javax.rad.application.ILauncher
ENVIRONMENT_DESKTOP, ENVIRONMENT_HEADLESS, ENVIRONMENT_MOBILE, ENVIRONMENT_WEB, PARAM_APPLICATIONLANGUAGE, PARAM_APPLICATIONNAME, PARAM_CODEBASE, PARAM_ENVIRONMENT, PARAM_LOGFACTORY, PARAM_SERVERBASE, PARAM_UIFACTORY
 
Fields inherited from interface javax.rad.ui.container.IFrame
ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, NORMAL
 
Fields inherited from interface javax.rad.ui.container.IToolBarPanel
AREA_BOTTOM, AREA_LEFT, AREA_RIGHT, AREA_TOP
 
Fields inherited from interface javax.rad.ui.IAlignmentConstants
ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_STRETCH, ALIGN_TOP
 
Constructor Summary
SwingApplet.SwingAppletLauncher(JApplet pApplet, String pApplicationClassName)
          Creates a new instance of SwingFrame.
 
Method Summary
protected  void addIntern(Component pComponent, Object pConstraints, int pIndex)
          Internal function, for adding physical component and supporting layers.
 void cancelPendingThreads()
          Cancel/Interrupts all pending threads.
 IImage capture(int pWidth, int pHeight)
          Creates an image/screenshot of the component.
 void centerRelativeTo(IComponent pComponent)
          Centers the window relative to the specified component.
 void componentHidden(ComponentEvent pEvent)
          
 void componentMoved(ComponentEvent pEvent)
          
 void componentResized(ComponentEvent pEvent)
          
 void componentShown(ComponentEvent pEvent)
          Sends the visible notification to the implementation base.
 void destroy()
          Applet will be destroyed.
 void dispose()
          Marks the frame as disposed.
 String getEnvironmentName()
          Gets the name of the environment for this launcher.
 void getFileHandle(IFileHandleReceiver pFileHandleReceiver, String pTitle)
          Technology independent getFileHandle.
 String getParameter(String pName)
          Gets a configuration parameter of the application.
 String getRegistryKey(String pKey)
          Gets the value for a specific key from the applications registry.
 int getState()
          Gets the state of this frame (obsolete).
 String getTitle()
          Gets the title of the frame.
 void handleException(Throwable pThrowable)
          Notification for the listener to handle an exception occured in another part of the program.
 boolean isActive()
          Returns whether this IWindow is active.
 boolean isResizable()
          Indicates whether this frame is resizable by the user.
 void pack()
          Causes this IWindow to be sized to fit the preferred size and layouts of its subcomponents.
protected  void removeIntern(Component pComponent)
          Internal function, for adding physical component and supporting layers.
 void saveFileHandle(IFileHandle pFileHandle, String pTitle)
          Technology independent saveFileHandle.
 void setIconImage(IImage pImage)
          Sets the image to be displayed as the icon for this window.
protected  void setLayoutIntern(LayoutManager pLayoutManager)
          Internal function, for setting the layout.
 void setMenuBar(IMenuBar pMenuBar)
          Sets the menubar for this frame.
 void setParameter(String pName, String pValue)
          Sets a configuration parameter of the application.
 void setRegistryKey(String pKey, String pValue)
          Sets the value for a specific key to the applications registry.
 void setResizable(boolean pResizable)
          Sets whether this frame is resizable by the user.
 void setState(int pState)
          Sets the state of this frame (obsolete).
 void setTitle(String pTitle)
          Sets the title for this frame to the specified string.
 void showDocument(String pDocumentname, IRectangle pBounds, String pTarget)
          Requests that external application shows a document indicated by the pDocumentname argument.
 void showFileHandle(IFileHandle pFileHandle)
          Technology independent showFileHandle.
 void showFileHandle(IFileHandle pFileHandle, IRectangle pBounds, String pTarget)
          Technology independent showFileHandle.
 void start()
          Applet is visible.
 void startDelayed()
          Starts the application and tries to wait until the size is available.
 void toBack()
          If this IWindow is visible, sends this IWindow to the back and may cause it to lose focus or activation if it is the focused or active Window.
 void toFront()
          If this IWindow is visible, brings this IWindow to the front and may make it the focused Window.
 
Methods inherited from class com.sibvisions.rad.ui.swing.impl.container.SwingAbstractFrame
addToolBar, addToolBar, addToolBarIntern, eventWindowActivated, eventWindowClosed, eventWindowClosing, eventWindowDeactivated, eventWindowDeiconified, eventWindowIconified, eventWindowOpened, getIconImage, getMenuBar, getToolBar, getToolBarArea, getToolBarCount, indexOfToolBar, isDisposed, removeAllToolBars, removeToolBar, removeToolBar, removeToolBarIntern, setCursor, setToolBarArea, setVisible
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtContainer
add, add, add, add, checkAdd, getComponent, getComponentCount, getLayout, indexOf, remove, remove, removeAll, setLayout
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtComponent
createImage, eventComponentMoved, eventComponentResized, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getCursor, getEventSource, getFactory, getFont, getForeground, getHorizontalAlignment, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getToolTipText, getVerticalAlignment, isBackgroundSet, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, requestFocus, setBackground, setBounds, setEnabled, setEventSource, setFactory, setFocusable, setFont, setForeground, setHorizontalAlignment, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setName, setParent, setPreferredSize, setSize, setToolTipText, setVerticalAlignment, validate
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
equals, getResource, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.ui.container.IFrame
getIconImage, getMenuBar
 
Methods inherited from interface javax.rad.ui.container.IWindow
eventWindowActivated, eventWindowClosed, eventWindowClosing, eventWindowDeactivated, eventWindowDeiconified, eventWindowIconified, eventWindowOpened, isDisposed
 
Methods inherited from interface javax.rad.ui.container.IToolBarPanel
addToolBar, addToolBar, getToolBar, getToolBarArea, getToolBarCount, indexOfToolBar, removeAllToolBars, removeToolBar, removeToolBar, setToolBarArea
 
Methods inherited from interface javax.rad.ui.IContainer
add, add, add, add, getComponent, getComponentCount, getLayout, indexOf, remove, remove, removeAll, setLayout
 
Methods inherited from interface javax.rad.ui.IComponent
eventComponentMoved, eventComponentResized, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getCursor, getEventSource, getFactory, getFont, getForeground, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getToolTipText, isBackgroundSet, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, requestFocus, setBackground, setBounds, setCursor, setEnabled, setEventSource, setFocusable, setFont, setForeground, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setName, setParent, setPreferredSize, setSize, setToolTipText, setVisible
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 

Constructor Detail

SwingApplet.SwingAppletLauncher

public SwingApplet.SwingAppletLauncher(JApplet pApplet,
                                       String pApplicationClassName)
Creates a new instance of SwingFrame.

Parameters:
pApplet - the SwingApplet.
pApplicationClassName - the full qualified class name of the IApplication to run.
Method Detail

setLayoutIntern

protected void setLayoutIntern(LayoutManager pLayoutManager)
Internal function, for setting the layout.

Overrides:
setLayoutIntern in class SwingAbstractFrame<JApplet>
Parameters:
pLayoutManager - the layout

addIntern

protected void addIntern(Component pComponent,
                         Object pConstraints,
                         int pIndex)
Internal function, for adding physical component and supporting layers.

Overrides:
addIntern in class SwingAbstractFrame<JApplet>
Parameters:
pComponent - the Component to be added
pConstraints - an object expressing layout contraints for this
pIndex - the position in the container's list at which to insert the Component; -1 means insert at the end component
See Also:
AwtContainer.add(IComponent, Object, int)

removeIntern

protected void removeIntern(Component pComponent)
Internal function, for adding physical component and supporting layers.

Overrides:
removeIntern in class SwingAbstractFrame<JApplet>
Parameters:
pComponent - the Component to be removed
See Also:
AwtContainer.remove(int)

capture

public IImage capture(int pWidth,
                      int pHeight)
Creates an image/screenshot of the component.

Specified by:
capture in interface IComponent
Overrides:
capture in class AwtComponent<JApplet>
Parameters:
pWidth - the expected width
pHeight - the expected height
Returns:
the image/screenshot

getParameter

public String getParameter(String pName)
Gets a configuration parameter of the application.

Specified by:
getParameter in interface ILauncher
Parameters:
pName - the parameter name
Returns:
the value of the parameter or null if the parameter does not exist

setParameter

public void setParameter(String pName,
                         String pValue)
Sets a configuration parameter of the application.

Specified by:
setParameter in interface ILauncher
Parameters:
pName - the parameter name
pValue - the value for the parameter or null to delete the parameter

showDocument

public void showDocument(String pDocumentname,
                         IRectangle pBounds,
                         String pTarget)
                  throws Exception
Requests that external application shows a document indicated by the pDocumentname argument. The target argument indicates where the document should be displayed. Applications can also ignore the target information.

Specified by:
showDocument in interface ILauncher
Parameters:
pDocumentname - the location/filename of the document. (local or network adress)
pBounds - the bounds for the document, if supported from the implementation
pTarget - a String indicating where to display the document.
Throws:
Exception

showFileHandle

public void showFileHandle(IFileHandle pFileHandle,
                           IRectangle pBounds,
                           String pTarget)
                    throws Throwable
Technology independent showFileHandle. A file chooser dialog should occur. This Function returns immediate.

Specified by:
showFileHandle in interface ILauncher
Parameters:
pFileHandle - the IFileHandle to save.
pBounds - the bounds for the document, if supported from the implementation
pTarget - a String indicating where to display the document.
Throws:
Throwable - if an error occurs during saving the file.

showFileHandle

public void showFileHandle(IFileHandle pFileHandle)
                    throws Throwable
Technology independent showFileHandle. A file chooser dialog should occur. This Function returns immediate.

Specified by:
showFileHandle in interface ILauncher
Parameters:
pFileHandle - the IFileHandle to save.
Throws:
Throwable - if an error occurs during saving the file.

saveFileHandle

public void saveFileHandle(IFileHandle pFileHandle,
                           String pTitle)
                    throws Throwable
Technology independent saveFileHandle. A file chooser dialog should occur. This Function returns immediate.

Specified by:
saveFileHandle in interface ILauncher
Parameters:
pFileHandle - the IFileHandle to save.
pTitle - the title for the dialog or null to set a default title
Throws:
Throwable - if an error occurs during saving the file.

getFileHandle

public void getFileHandle(IFileHandleReceiver pFileHandleReceiver,
                          String pTitle)
                   throws Throwable
Technology independent getFileHandle. A file chooser dialog should occur, and as result this function informs the IFileHandle receiver.

Specified by:
getFileHandle in interface ILauncher
Parameters:
pFileHandleReceiver - the IFileHandle receiver that should receive the file.
pTitle - the title for the dialog or null to set a default title
Throws:
Throwable - if an error occurs during getting the file.

cancelPendingThreads

public void cancelPendingThreads()
Cancel/Interrupts all pending threads.

Specified by:
cancelPendingThreads in interface ILauncher

setRegistryKey

public void setRegistryKey(String pKey,
                           String pValue)
Sets the value for a specific key to the applications registry. The registry is a local store for persistent values.

Specified by:
setRegistryKey in interface ILauncher
Parameters:
pKey - the key to set
pValue - the value to set or null to remove the key from the registry

getRegistryKey

public String getRegistryKey(String pKey)
Gets the value for a specific key from the applications registry.

Specified by:
getRegistryKey in interface ILauncher
Parameters:
pKey - the key to get
Returns:
the value for the key or null if the key is not available

getEnvironmentName

public String getEnvironmentName()
Gets the name of the environment for this launcher. The environment could be used to en-/disable features.

Specified by:
getEnvironmentName in interface ILauncher
Returns:
the name of the environment, e.g. ILauncher.ENVIRONMENT_HEADLESS, ILauncher.ENVIRONMENT_DESKTOP

handleException

public void handleException(Throwable pThrowable)
Notification for the listener to handle an exception occured in another part of the program.

Specified by:
handleException in interface IExceptionListener
Parameters:
pThrowable - the occured exception

getTitle

public String getTitle()
Gets the title of the frame. The title is displayed in the frame's border.

Specified by:
getTitle in interface IFrame
Returns:
the title of this frame, or an empty string ("") if this frame doesn't have a title.
See Also:
IFrame.setTitle(String)

setTitle

public void setTitle(String pTitle)
Sets the title for this frame to the specified string.

Specified by:
setTitle in interface IFrame
Parameters:
pTitle - the title to be displayed in the frame's border. A null value is treated as an empty string, "".
See Also:
IFrame.getTitle()

setIconImage

public void setIconImage(IImage pImage)
Sets the image to be displayed as the icon for this window.

Specified by:
setIconImage in interface IFrame
Parameters:
pImage - the icon image to be displayed. If this parameter is null then the icon image is set to the default image, which may vary with platform.
See Also:
IFrame.getIconImage()

getState

public int getState()
Gets the state of this frame (obsolete).

In older versions of JDK a frame state could only be NORMAL or ICONIFIED. Since JDK 1.4 set of supported frame states is expanded and frame state is represented as a bitwise mask.

For compatibility with old programs this method still returns Frame.NORMAL and Frame.ICONIFIED but it only reports the iconic state of the frame, other aspects of frame state are not reported by this method.

Specified by:
getState in interface IFrame
Returns:
Frame.NORMAL or Frame.ICONIFIED.
See Also:
IFrame.setState(int)

setState

public void setState(int pState)
Sets the state of this frame (obsolete).

In older versions of JDK a frame state could only be NORMAL or ICONIFIED. Since JDK 1.4 set of supported frame states is expanded and frame state is represented as a bitwise mask.

For compatibility with old programs this method still accepts Frame.NORMAL and Frame.ICONIFIED but it only changes the iconic state of the frame, other aspects of frame state are not affected by this method.

Specified by:
setState in interface IFrame
Parameters:
pState - either Frame.NORMAL or Frame.ICONIFIED.
See Also:
IFrame.getState(), IFrame.setState(int)

isResizable

public boolean isResizable()
Indicates whether this frame is resizable by the user. By default, all frames are initially resizable.

Specified by:
isResizable in interface IFrame
Returns:
true if the user can resize this frame; false otherwise.
See Also:
IFrame.setResizable(boolean)

setResizable

public void setResizable(boolean pResizable)
Sets whether this frame is resizable by the user.

Specified by:
setResizable in interface IFrame
Parameters:
pResizable - true if this frame is resizable; false otherwise.
See Also:
IFrame.isResizable()

pack

public void pack()
Causes this IWindow to be sized to fit the preferred size and layouts of its subcomponents. If the window and/or its owner are not yet displayable, both are made displayable before calculating the preferred size. The IWindow will be validated after the preferredSize is calculated.

Specified by:
pack in interface IWindow

dispose

public void dispose()
Marks the frame as disposed.

Specified by:
dispose in interface IWindow
Overrides:
dispose in class SwingAbstractFrame<JApplet>
See Also:
IWindow.pack(), IComponent.setVisible(boolean)

isActive

public boolean isActive()
Returns whether this IWindow is active. Only a Frame or a Dialog may be active. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.

Specified by:
isActive in interface IWindow
Returns:
whether this is the active Window.

toFront

public void toFront()
If this IWindow is visible, brings this IWindow to the front and may make it the focused Window.

Places this IWindow at the top of the stacking order and shows it in front of any other Windows in this VM. No action will take place if this Window is not visible. Some platforms do not allow Windows which own other Windows to appear on top of those owned Windows. Some platforms may not permit this VM to place its Windows above windows of native applications, or Windows of other VMs. This permission may depend on whether a Window in this VM is already focused. Every attempt will be made to move this Window as high as possible in the stacking order; however, developers should not assume that this method will move this Window above all other windows in every situation.

Because of variations in native windowing systems, no guarantees about changes to the focused and active Windows can be made. Developers must never assume that this Window is the focused or active Window until this Window receives a WINDOW_GAINED_FOCUS or WINDOW_ACTIVATED event. On platforms where the top-most window is the focused window, this method will probably focus this Window, if it is not already focused. On platforms where the stacking order does not typically affect the focused window, this method will probably leave the focused and active Windows unchanged.

If this method causes this Window to be focused, and this Window is a Frame or a Dialog, it will also become activated. If this Window is focused, but it is not a Frame or a Dialog, then the first Frame or Dialog that is an owner of this Window will be activated.

If this window is blocked by modal dialog, then the blocking dialog is brought to the front and remains above the blocked window.

Specified by:
toFront in interface IWindow
See Also:
IWindow.toBack()

toBack

public void toBack()
If this IWindow is visible, sends this IWindow to the back and may cause it to lose focus or activation if it is the focused or active Window.

Places this IWindow at the bottom of the stacking order and shows it behind any other Windows in this VM. No action will take place is this Window is not visible. Some platforms do not allow Windows which are owned by other Windows to appear below their owners. Every attempt will be made to move this Window as low as possible in the stacking order; however, developers should not assume that this method will move this Window below all other windows in every situation.

Because of variations in native windowing systems, no guarantees about changes to the focused and active Windows can be made. Developers must never assume that this Window is no longer the focused or active Window until this Window receives a WINDOW_LOST_FOCUS or WINDOW_DEACTIVATED event. On platforms where the top-most window is the focused window, this method will probably cause this Window to lose focus. In that case, the next highest, focusable Window in this VM will receive focus. On platforms where the stacking order does not typically affect the focused window, this method will probably leave the focused and active Windows unchanged.

Specified by:
toBack in interface IWindow
See Also:
IWindow.toFront()

setMenuBar

public void setMenuBar(IMenuBar pMenuBar)
Sets the menubar for this frame.

Specified by:
setMenuBar in interface IFrame
Parameters:
pMenuBar - the menubar being placed in the frame
See Also:
IFrame.getMenuBar()

centerRelativeTo

public void centerRelativeTo(IComponent pComponent)
Centers the window relative to the specified component. If the component is not currently showing, or pComponent is null, the window is centered on the screen.

Specified by:
centerRelativeTo in interface IWindow
Parameters:
pComponent - the component in relation to which the window's location is determined

componentHidden

public void componentHidden(ComponentEvent pEvent)

Specified by:
componentHidden in interface ComponentListener
Overrides:
componentHidden in class AwtComponent<JApplet>

componentMoved

public void componentMoved(ComponentEvent pEvent)

Specified by:
componentMoved in interface ComponentListener
Overrides:
componentMoved in class AwtComponent<JApplet>

componentResized

public void componentResized(ComponentEvent pEvent)

Specified by:
componentResized in interface ComponentListener
Overrides:
componentResized in class AwtComponent<JApplet>

componentShown

public void componentShown(ComponentEvent pEvent)
Sends the visible notification to the implementation base.

Specified by:
componentShown in interface ComponentListener
Overrides:
componentShown in class AwtComponent<JApplet>
Parameters:
pEvent - the triggering event

startDelayed

public void startDelayed()
Starts the application and tries to wait until the size is available. That's important that the application can be sure that the size is not 0 when layouting.


start

public void start()
Applet is visible.


destroy

public void destroy()
Applet will be destroyed.



Copyright © 2009 SIB Visions GmbH. All Rights Reserved.