com.sibvisions.rad.ui.swing.impl.container
Class SwingAbstractFrame<C extends java.awt.Container>

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<C>
Type Parameters:
C - the Container.
All Implemented Interfaces:
java.awt.event.ComponentListener, java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.util.EventListener, IFrame, IToolBarPanel, IWindow, IAlignmentConstants, IComponent, IContainer, IResource, INamedObject
Direct Known Subclasses:
SwingApplet.SwingAppletLauncher, SwingFrame, SwingInternalFrame

public abstract class SwingAbstractFrame<C extends java.awt.Container>
extends AwtContainer<C>
implements IFrame

The SwingAbstractFrame is the IFrame implementation for swing.
I is a top-level window with a title and a border.

The size of the frame includes any area designated for the border.

See Also:
JFrame, IFrame

Field Summary
protected  boolean bDisposed
          indicates whether the frame is disposed.
protected  boolean bWindowListener
          whether the window listener was added.
protected  WindowHandler<IWindowActivatedListener> eventWindowActivated
          EventHandler for windowActivated.
protected  WindowHandler<IWindowClosedListener> eventWindowClosed
          EventHandler for windowClosed.
protected  WindowHandler<IWindowClosingListener> eventWindowClosing
          EventHandler for windowClosing.
protected  WindowHandler<IWindowDeactivatedListener> eventWindowDeactivated
          EventHandler for windowDeactivated.
protected  WindowHandler<IWindowDeiconifiedListener> eventWindowDeiconified
          EventHandler for windowDeiconified.
protected  WindowHandler<IWindowIconifiedListener> eventWindowIconified
          EventHandler for windowIconified.
protected  WindowHandler<IWindowOpenedListener> eventWindowOpened
          EventHandler for windowOpened.
protected  IImage iconImage
          the icon image.
protected  IMenuBar menuBar
          the menu bar.
 
Fields inherited from class com.sibvisions.rad.ui.awt.impl.AwtComponent
bComponentListener, bFocusListener, bKeyListener, bMouseListener, eventComponentMoved, eventComponentResized, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, eventSource, factory, parent
 
Fields inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
resource
 
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_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_STRETCH, ALIGN_TOP
 
Constructor Summary
SwingAbstractFrame(C pContainer)
          Creates a new instance of SwingAbstractFrame.
 
Method Summary
protected  void addIntern(java.awt.Component pComponent, java.lang.Object pConstraints, int pIndex)
          Internal function, for adding physical component and supporting layers.
 void addToolBar(IToolBar pToolBar)
          Adds a toolbar to this panel as last component.
 void addToolBar(IToolBar pToolBar, int pIndex)
          Adds a toolbar to this panel at a specified index.
protected  void addToolBarIntern(javax.swing.JToolBar pToolBar, int pIndex)
          Adds the toolbar at a specific index.
protected  void addWindowListener()
          Adds the window listener if not already added.
protected abstract  void addWindowListenerToResource()
          Adds a window listener for this component.
 void dispose()
          Marks the frame as disposed.
 WindowHandler<IWindowActivatedListener> eventWindowActivated()
          The EventHandler for the window activated event.
 WindowHandler<IWindowClosedListener> eventWindowClosed()
          The EventHandler for the window closed event.
 WindowHandler<IWindowClosingListener> eventWindowClosing()
          The EventHandler for the window closing event.
 WindowHandler<IWindowDeactivatedListener> eventWindowDeactivated()
          The EventHandler for the window deactivated event.
 WindowHandler<IWindowDeiconifiedListener> eventWindowDeiconified()
          The EventHandler for the window deiconified event.
 WindowHandler<IWindowIconifiedListener> eventWindowIconified()
          The EventHandler for the window iconified event.
 WindowHandler<IWindowOpenedListener> eventWindowOpened()
          The EventHandler for the window opened event.
 IImage getIconImage()
          Returns the image to be displayed as the icon for this frame.
 IMenuBar getMenuBar()
          Returns the menubar set on this frame.
 IToolBar getToolBar(int pIndex)
          Gets the IToolBar from a specific index.
 int getToolBarArea()
          Gets the area where the toolbar(s) are added.
 int getToolBarCount()
          Gets the number of IToolBars in this panel.
 TranslationMap getTranslation()
          Gets the translation for the window.
 int indexOfToolBar(IToolBar pToolBar)
          Gets the nth position of an IToolBar in this panel.
 boolean isDisposed()
          Checks whether the window is disposed already.
 void removeAllToolBars()
          Removes all toolbars from this panel.
protected  void removeIntern(java.awt.Component pComponent)
          Internal function, for adding physical component and supporting layers.
 void removeToolBar(int pIndex)
          Removes a toolbar from this panel.
 void removeToolBar(IToolBar pToolBar)
          Removes a toolbar from this panel.
protected  void removeToolBarIntern(javax.swing.JToolBar pToolBar)
          Removes the toolbar from the panel.
 void setCursor(ICursor pCursor)
          Sets the cursor of the glass pane as "global" cursor.
protected  void setLayoutIntern(java.awt.LayoutManager pLayoutManager)
          Internal function, for setting the layout.
 void setToolBarArea(int pArea)
          Sets the display area where the toolbars will be added.
 void setTranslation(TranslationMap pTranslation)
          Sets the translation for the window.
 void setVisible(boolean pVisible)
          Shows or hides this component depending on the value of parameter b.
 
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
addComponentListener, addFocusListener, addKeyListener, addMouseListener, capture, componentHidden, componentMoved, componentResized, componentShown, createImage, createMouseEvent, equals, eventComponentMoved, eventComponentResized, eventFocusGained, eventFocusLost, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, focusGained, focusLost, getBackground, getBounds, getCursor, getEventSource, getFactory, getFont, getForeground, getHorizontalAlignment, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getStyle, getTabIndex, getToolTipText, getVerticalAlignment, hashCode, invalidateLayout, 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, setStyle, setTabIndex, setToolTipText, setVerticalAlignment, validate
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
getResource, 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
getState, getTitle, isResizable, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from interface javax.rad.ui.container.IWindow
centerRelativeTo, isActive, pack, toBack, toFront
 
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
capture, eventComponentMoved, eventComponentResized, eventFocusGained, eventFocusLost, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getCursor, getEventSource, getFactory, getFont, getForeground, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getStyle, getTabIndex, getToolTipText, isBackgroundSet, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, requestFocus, setBackground, setBounds, setEnabled, setEventSource, setFocusable, setFont, setForeground, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setName, setParent, setPreferredSize, setSize, setStyle, setTabIndex, setToolTipText
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 

Field Detail

eventWindowOpened

protected WindowHandler<IWindowOpenedListener> eventWindowOpened
EventHandler for windowOpened.


eventWindowClosing

protected WindowHandler<IWindowClosingListener> eventWindowClosing
EventHandler for windowClosing.


eventWindowClosed

protected WindowHandler<IWindowClosedListener> eventWindowClosed
EventHandler for windowClosed.


eventWindowActivated

protected WindowHandler<IWindowActivatedListener> eventWindowActivated
EventHandler for windowActivated.


eventWindowDeactivated

protected WindowHandler<IWindowDeactivatedListener> eventWindowDeactivated
EventHandler for windowDeactivated.


eventWindowIconified

protected WindowHandler<IWindowIconifiedListener> eventWindowIconified
EventHandler for windowIconified.


eventWindowDeiconified

protected WindowHandler<IWindowDeiconifiedListener> eventWindowDeiconified
EventHandler for windowDeiconified.


iconImage

protected IImage iconImage
the icon image.


menuBar

protected IMenuBar menuBar
the menu bar.


bDisposed

protected boolean bDisposed
indicates whether the frame is disposed.


bWindowListener

protected boolean bWindowListener
whether the window listener was added.

Constructor Detail

SwingAbstractFrame

public SwingAbstractFrame(C pContainer)
Creates a new instance of SwingAbstractFrame.

Parameters:
pContainer - the Container
Method Detail

isDisposed

public boolean isDisposed()
Checks whether the window is disposed already.

Specified by:
isDisposed in interface IWindow
Returns:
true if the window is disposed, otherwiese false

getIconImage

public IImage getIconImage()
Returns the image to be displayed as the icon for this frame.

Specified by:
getIconImage in interface IFrame
Returns:
the icon image for this frame, or null if this frame doesn't have an icon image.
See Also:
IFrame.setIconImage(IImage)

getMenuBar

public IMenuBar getMenuBar()
Returns the menubar set on this frame.

Specified by:
getMenuBar in interface IFrame
Returns:
the menubar for this frame
See Also:
IFrame.setMenuBar(javax.rad.ui.menu.IMenuBar)

setTranslation

public void setTranslation(TranslationMap pTranslation)
Sets the translation for the window. A window might have components which needs to be translated, e.g. Buttons or Menu in titlebar.

Specified by:
setTranslation in interface IWindow
Parameters:
pTranslation - the translation mapping

getTranslation

public TranslationMap getTranslation()
Gets the translation for the window.

Specified by:
getTranslation in interface IWindow
Returns:
the translation mapping

addToolBar

public void addToolBar(IToolBar pToolBar)
Adds a toolbar to this panel as last component.

Specified by:
addToolBar in interface IToolBarPanel
Parameters:
pToolBar - the toolbar to be added

addToolBar

public void addToolBar(IToolBar pToolBar,
                       int pIndex)
Adds a toolbar to this panel at a specified index.

Specified by:
addToolBar in interface IToolBarPanel
Parameters:
pToolBar - the toolbar to be added
pIndex - the index for the toolbar

removeToolBar

public void removeToolBar(IToolBar pToolBar)
Removes a toolbar from this panel.

Specified by:
removeToolBar in interface IToolBarPanel
Parameters:
pToolBar - the toolbar

removeToolBar

public void removeToolBar(int pIndex)
Removes a toolbar from this panel.

Specified by:
removeToolBar in interface IToolBarPanel
Parameters:
pIndex - the index

removeAllToolBars

public void removeAllToolBars()
Removes all toolbars from this panel.

Specified by:
removeAllToolBars in interface IToolBarPanel

getToolBarCount

public int getToolBarCount()
Gets the number of IToolBars in this panel.

Specified by:
getToolBarCount in interface IToolBarPanel
Returns:
the number of toolbars

getToolBar

public IToolBar getToolBar(int pIndex)
Gets the IToolBar from a specific index.

Specified by:
getToolBar in interface IToolBarPanel
Parameters:
pIndex - the index
Returns:
the toolbar at pIndex

indexOfToolBar

public int indexOfToolBar(IToolBar pToolBar)
Gets the nth position of an IToolBar in this panel.

Specified by:
indexOfToolBar in interface IToolBarPanel
Parameters:
pToolBar - the IToolBar to search
Returns:
the nth position of pToolBar in this panel or -1 if pToolBar is not added

setToolBarArea

public void setToolBarArea(int pArea)
Sets the display area where the toolbars will be added.

Specified by:
setToolBarArea in interface IToolBarPanel
Parameters:
pArea - an area constant IToolBarPanel.AREA_TOP, IToolBarPanel.AREA_LEFT, IToolBarPanel.AREA_BOTTOM, IToolBarPanel.AREA_RIGHT

getToolBarArea

public int getToolBarArea()
Gets the area where the toolbar(s) are added.

Specified by:
getToolBarArea in interface IToolBarPanel
Returns:
an area constant IToolBarPanel.AREA_TOP, IToolBarPanel.AREA_LEFT, IToolBarPanel.AREA_BOTTOM, IToolBarPanel.AREA_RIGHT

eventWindowOpened

public WindowHandler<IWindowOpenedListener> eventWindowOpened()
The EventHandler for the window opened event.

Specified by:
eventWindowOpened in interface IWindow
Returns:
the EventHandler for the window opened event.

eventWindowClosing

public WindowHandler<IWindowClosingListener> eventWindowClosing()
The EventHandler for the window closing event.

Specified by:
eventWindowClosing in interface IWindow
Returns:
the EventHandler for the window closing event.

eventWindowClosed

public WindowHandler<IWindowClosedListener> eventWindowClosed()
The EventHandler for the window closed event.

Specified by:
eventWindowClosed in interface IWindow
Returns:
the EventHandler for the window closed event.

eventWindowIconified

public WindowHandler<IWindowIconifiedListener> eventWindowIconified()
The EventHandler for the window iconified event.

Specified by:
eventWindowIconified in interface IWindow
Returns:
the EventHandler for the window iconified event.

eventWindowDeiconified

public WindowHandler<IWindowDeiconifiedListener> eventWindowDeiconified()
The EventHandler for the window deiconified event.

Specified by:
eventWindowDeiconified in interface IWindow
Returns:
the EventHandler for the window deiconified event.

eventWindowActivated

public WindowHandler<IWindowActivatedListener> eventWindowActivated()
The EventHandler for the window activated event.

Specified by:
eventWindowActivated in interface IWindow
Returns:
the EventHandler for the window activated event.

eventWindowDeactivated

public WindowHandler<IWindowDeactivatedListener> eventWindowDeactivated()
The EventHandler for the window deactivated event.

Specified by:
eventWindowDeactivated in interface IWindow
Returns:
the EventHandler for the window deactivated event.

addWindowListenerToResource

protected abstract void addWindowListenerToResource()
Adds a window listener for this component.


setCursor

public void setCursor(ICursor pCursor)
Sets the cursor of the glass pane as "global" cursor.

Specified by:
setCursor in interface IComponent
Overrides:
setCursor in class AwtComponent<C extends java.awt.Container>
Parameters:
pCursor - the "global" cursor
See Also:
IComponent.isEnabled(), IComponent.getCursor(), Toolkit.createCustomCursor(java.awt.Image, java.awt.Point, java.lang.String), ICursor

setVisible

public void setVisible(boolean pVisible)
Shows or hides this component depending on the value of parameter b.

Specified by:
setVisible in interface IComponent
Overrides:
setVisible in class AwtComponent<C extends java.awt.Container>
Parameters:
pVisible - if true, shows this component; otherwise, hides this component
See Also:
IComponent.isVisible()

setLayoutIntern

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

Overrides:
setLayoutIntern in class AwtContainer<C extends java.awt.Container>
Parameters:
pLayoutManager - the layout

addIntern

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

Overrides:
addIntern in class AwtContainer<C extends java.awt.Container>
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(java.awt.Component pComponent)
Internal function, for adding physical component and supporting layers.

Overrides:
removeIntern in class AwtContainer<C extends java.awt.Container>
Parameters:
pComponent - the Component to be removed
See Also:
AwtContainer.remove(int)

dispose

public void dispose()
Marks the frame as disposed.

Specified by:
dispose in interface IWindow
See Also:
IWindow.pack(), IComponent.setVisible(boolean)

addToolBarIntern

protected void addToolBarIntern(javax.swing.JToolBar pToolBar,
                                int pIndex)
Adds the toolbar at a specific index.

Parameters:
pToolBar - the toolbar to be added
pIndex - the position

removeToolBarIntern

protected void removeToolBarIntern(javax.swing.JToolBar pToolBar)
Removes the toolbar from the panel.

Parameters:
pToolBar - the toolbar to be removed

addWindowListener

protected void addWindowListener()
Adds the window listener if not already added.



Copyright © 2009 SIB Visions GmbH. All Rights Reserved.