uic.widgets
Class AbstractWindow

java.lang.Object
  extended by uic.widgets.AbstractWindow
Direct Known Subclasses:
ExtraWindow, MainWindow, StandardDialog

public abstract class AbstractWindow
extends Object

This abstract class is the superclass of all classes that show a Window or Frame on screen and want intelligence added such as automatic placing and sizing based on screen size, monitor setup and naturally content size.


Field Summary
protected  Window internalWindow
           
 
Constructor Summary
AbstractWindow(Window owner, String title, boolean modal)
          Create an invisible Window with an optional owner and title.
 
Method Summary
protected abstract  Window createInternalWindow(Dialog owner, String title, boolean modal)
           
protected abstract  Window createInternalWindow(Frame owner, String title, boolean modal)
           
 Rectangle getBounds()
          During or after showing you can query the rectangle of the dialog.
 Component getDefaultFocusComponent()
          Returns the component that on show of this AbstractWindow will gain focus
protected  uic.widgets.AbstractWindow.DialogSizePanel getDialogSizePanel()
          An in-between panel is used between the JDialog and the Content of the user, this method fetches it.
 Point getLocation()
          During or after showing you can query the location of the dialog.
protected  RootPaneContainer getRPContainer()
           
 Dimension getSize()
          During or after showing you can query the size of the dialog.
protected  void positionDialog(boolean move)
           
static void positionDialog(boolean move, Window target, Window parent)
          Place the dialog on screen.
 void setComponent(Component c)
          Place a Component on your dialog.
 void setDefaultFocusComponent(Component c)
          Set the component that on show of this AbstractWindow will gain focus
 int show()
          Convenience method for the next version.
 int show(Point location, Dimension size)
          Show the dialog at the given location.
 int show(Rectangle dialogBounds)
          Convenience method for the above version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

internalWindow

protected Window internalWindow
Constructor Detail

AbstractWindow

public AbstractWindow(Window owner,
                      String title,
                      boolean modal)
Create an invisible Window with an optional owner and title.

After creating the AbstractWindow do a setComponent() and a show()

Parameters:
owner - The owner should either be a JFrame or a JDialog extending class (such as another StandardDialog). It can also be null.
title - the name the dialog will get.
modal - true for a modal dialog, false for one that allows other windows to be active at the same time.
Method Detail

createInternalWindow

protected abstract Window createInternalWindow(Frame owner,
                                               String title,
                                               boolean modal)

createInternalWindow

protected abstract Window createInternalWindow(Dialog owner,
                                               String title,
                                               boolean modal)

getRPContainer

protected RootPaneContainer getRPContainer()

setComponent

public void setComponent(Component c)
Place a Component on your dialog.


getDefaultFocusComponent

public Component getDefaultFocusComponent()
Returns the component that on show of this AbstractWindow will gain focus

Returns:
component that will gain focus when window is shown

setDefaultFocusComponent

public void setDefaultFocusComponent(Component c)
Set the component that on show of this AbstractWindow will gain focus

Parameters:
c - component that will gain focus when window is shown

show

public int show(Point location,
                Dimension size)
Show the dialog at the given location.

Parameters:
location - the x and y coordinates on the screen where the dialog should appear, can be null to use parents position.
size - a size hint for the dialog, can be null to use default based on the preferredSize.
Returns:
always 1

show

public int show(Rectangle dialogBounds)
Convenience method for the above version.

Returns:
output of show(Point,Dimension).

show

public int show()
Convenience method for the next version.

Returns:
output of show(Point,Dimension).

positionDialog

protected void positionDialog(boolean move)

positionDialog

public static void positionDialog(boolean move,
                                  Window target,
                                  Window parent)
Place the dialog on screen. Note that this dialog also checks constraints like monitor edges (usefull on multi-monitor setups) and therefor can move slightly even if the move argument is false.

Parameters:
move - the user allows us to move the dialog.

getLocation

public Point getLocation()
During or after showing you can query the location of the dialog. This is usefull to remember and position the same dialog at the same location again next time it is shown.

Returns:
the location
See Also:
show(Point, Dimension)

getSize

public Dimension getSize()
During or after showing you can query the size of the dialog. This is usefull to remember and position the same dialog with the same size again next time it is shown.

Returns:
the size
See Also:
show(Point, Dimension)

getDialogSizePanel

protected uic.widgets.AbstractWindow.DialogSizePanel getDialogSizePanel()
An in-between panel is used between the JDialog and the Content of the user, this method fetches it.


getBounds

public Rectangle getBounds()
During or after showing you can query the rectangle of the dialog. This is usefull to remember and position the same dialog with the same size and position again next time it is shown.

Returns:
the size and location bound in a rectangle
See Also:
show(Rectangle)


Copyright © 2002-2004 Thomas Zander Available under the Free Apache licence