proper.gui.core.frame
Class ProperFrame

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by proper.gui.core.frame.ProperFrame
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.DocumentListener, javax.swing.RootPaneContainer, javax.swing.WindowConstants, ProperInterface
Direct Known Subclasses:
CommandLineFrame, DummyFrame

public abstract class ProperFrame
extends javax.swing.JFrame
implements java.awt.event.WindowListener, java.awt.event.ActionListener, java.awt.event.KeyListener, ProperInterface, javax.swing.event.DocumentListener, java.awt.event.MouseListener

This abstract Frame is parent to all frames used for Proper.
It only implements the Listener Interfaces, but adds no functionality only empty methods.
Besides that it handles stuff like interpreting the verbose string and propagating changes to its registered listeners.

Version:
$Revision: 1.3 $
Author:
FracPete
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface proper.core.ProperInterface
VERSION
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, PROPERTIES, SOMEBITS
 
Constructor Summary
ProperFrame(java.lang.String title)
          initializes the object
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          invoked when an action occurs
 void addListener(ProperInterface o)
          adds the object to the listener list
 void addOutput(java.io.PrintStream out)
          adds the printstream to use for outputting data, i.e.
 void changedUpdate(javax.swing.event.DocumentEvent e)
          Gives notification that an attribute or set of attributes changed.
 boolean classInVerbose(java.lang.String classname)
          checks whether the given class name is part of the verbose string
 void debugprint(boolean x)
          prints the given boolean to the current ouput stream (debug)
 void debugprint(int x)
          prints the given int to the current output stream (debug)
 void debugprint(java.lang.Object x)
          prints the given object to the current ouput stream (debug)
 void debugprint(java.lang.String x)
          prints the given string to the current ouput stream (debug)
 void debugprintln()
          prints a new line to the current ouput stream (debug)
 void debugprintln(boolean x)
          prints the given boolean to the current ouput stream (debug)
 void debugprintln(int x)
          prints the given int to the current ouput stream (debug)
 void debugprintln(java.lang.Object x)
          prints the given object to the current ouput stream (debug)
 void debugprintln(java.lang.String x)
          prints the given string to the current ouput stream (debug)
 java.util.Vector getListeners()
          returns the current list of listeners
 java.lang.Runtime getRuntime()
          returns the runtime instance for this application
 boolean getVerbose()
          the current verbose state
 int getVerboseLevel()
          the current verbose level
 int getVerboseLevelForClass(java.lang.String classname)
          returns the verbose level for the given classname
 java.lang.String getVerboseString()
          returns the verbose string
 java.lang.String getVerboseStringForClass(java.lang.String classname)
          returns the verbose string (can be "") for the given classname
 void insertUpdate(javax.swing.event.DocumentEvent e)
          Gives notification that there was an insert into the document.
 void keyPressed(java.awt.event.KeyEvent e)
          Invoked when a key has been pressed.
 void keyReleased(java.awt.event.KeyEvent e)
          Invoked when a key has been released.
 void keyTyped(java.awt.event.KeyEvent e)
          Invoked when a key has been typed.
 void mouseClicked(java.awt.event.MouseEvent e)
          Invoked when the mouse button has been clicked (pressed and released) on a component.
 void mouseEntered(java.awt.event.MouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          Invoked when the mouse exits a component
 void mousePressed(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a component
 void mouseReleased(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a component.
 void notifyListener(ProperInterface o)
          notifies the specified listener of changes
 void notifyListeners()
          notifies all the listeners of changes
 void print(boolean x)
          prints the given boolean to the current ouput stream
 void print(int x)
          prints the given int to the current output stream
 void print(java.lang.Object x)
          prints the given object to the current ouput stream
 void print(java.lang.String x)
          prints the given string to the current ouput stream
 void println()
          prints a new line to the current ouput stream
 void println(boolean x)
          prints the given boolean to the current ouput stream
 void println(int x)
          prints the given int to the current ouput stream
 void println(java.lang.Object x)
          prints the given object to the current ouput stream
 void println(java.lang.String x)
          prints the given string to the current ouput stream
 void printMemory()
          prints out the currently free and total memory in the JVM
 void refresh()
          validates and repaints the frame
 void removeListener(ProperInterface o)
          removes the object from the listeners
 void removeUpdate(javax.swing.event.DocumentEvent e)
          Gives notification that a portion of the document has been removed.
 void setCenteredLocation()
          positions the window at the center of the screen
 void setOutput(java.io.PrintStream out)
          sets the printstream to use for outputting data, i.e.
 void setVerbose(boolean verbose)
          sets the verbose state (lots of information of more silent)
 void setVerboseLevel(int verboseLevel)
          sets the verbose level (0 = nothing, >0 = more)
 void setVerboseString(java.lang.String verboseStr)
          sets the string with the class names (comma separated and w/o path) that should set their verbose flag to TRUE
 int showMessageBox(java.lang.String title, java.lang.String msg, java.lang.String[] buttons, java.lang.String icon)
          displays a message box with the given title, message, buttons and icon.
 int showMessageBox(java.lang.String title, java.lang.String msg, java.lang.String[] buttons, java.lang.String icon, int width, int height)
          displays a message box with the given title, message, buttons and icon ant the dimension.
 void showStatus(java.lang.String status)
          sets the given text in the info-label (must be inserted in the derived frame)
 java.lang.String toString()
          returns only the classname
 void windowActivated(java.awt.event.WindowEvent e)
          invoked when a window is activated
 void windowClosed(java.awt.event.WindowEvent e)
          invoked when a window is closed
 void windowClosing(java.awt.event.WindowEvent e)
          invoked when a window is in the process of closing
 void windowDeactivated(java.awt.event.WindowEvent e)
          invoked when a window is deactivated
 void windowDeiconified(java.awt.event.WindowEvent e)
          invoked when a window is deiconified
 void windowIconified(java.awt.event.WindowEvent e)
          invoked when a window is iconified
 void windowOpened(java.awt.event.WindowEvent e)
          invoked when a window is has been opened
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

ProperFrame

public ProperFrame(java.lang.String title)
initializes the object

Parameters:
title - the title of the frame
Method Detail

setCenteredLocation

public void setCenteredLocation()
positions the window at the center of the screen


refresh

public void refresh()
validates and repaints the frame


showStatus

public void showStatus(java.lang.String status)
sets the given text in the info-label (must be inserted in the derived frame)


showMessageBox

public int showMessageBox(java.lang.String title,
                          java.lang.String msg,
                          java.lang.String[] buttons,
                          java.lang.String icon)
displays a message box with the given title, message, buttons and icon. it returns the pressed button. the icon can be any image in the jar-archive.

See Also:
MessageBox

showMessageBox

public int showMessageBox(java.lang.String title,
                          java.lang.String msg,
                          java.lang.String[] buttons,
                          java.lang.String icon,
                          int width,
                          int height)
displays a message box with the given title, message, buttons and icon ant the dimension. it returns the pressed button. the icon can be any image in the jar-archive.

See Also:
MessageBox

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
invoked when a window is activated

Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
invoked when a window is closed

Specified by:
windowClosed in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
invoked when a window is in the process of closing

Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
invoked when a window is deactivated

Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
invoked when a window is deiconified

Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
invoked when a window is iconified

Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
invoked when a window is has been opened

Specified by:
windowOpened in interface java.awt.event.WindowListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
invoked when an action occurs

Specified by:
actionPerformed in interface java.awt.event.ActionListener

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent e)
Gives notification that an attribute or set of attributes changed.

Specified by:
changedUpdate in interface javax.swing.event.DocumentListener

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent e)
Gives notification that there was an insert into the document.

Specified by:
insertUpdate in interface javax.swing.event.DocumentListener

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent e)
Gives notification that a portion of the document has been removed.

Specified by:
removeUpdate in interface javax.swing.event.DocumentListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component

Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Invoked when a key has been pressed.

Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Invoked when a key has been released.

Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Invoked when a key has been typed.

Specified by:
keyTyped in interface java.awt.event.KeyListener

addListener

public void addListener(ProperInterface o)
adds the object to the listener list

Specified by:
addListener in interface ProperInterface

removeListener

public void removeListener(ProperInterface o)
removes the object from the listeners

Specified by:
removeListener in interface ProperInterface

getListeners

public java.util.Vector getListeners()
returns the current list of listeners

Specified by:
getListeners in interface ProperInterface

notifyListener

public void notifyListener(ProperInterface o)
notifies the specified listener of changes

Specified by:
notifyListener in interface ProperInterface

notifyListeners

public void notifyListeners()
notifies all the listeners of changes

Specified by:
notifyListeners in interface ProperInterface

setVerbose

public void setVerbose(boolean verbose)
sets the verbose state (lots of information of more silent)

Specified by:
setVerbose in interface ProperInterface

getVerbose

public boolean getVerbose()
the current verbose state

Specified by:
getVerbose in interface ProperInterface

setVerboseLevel

public void setVerboseLevel(int verboseLevel)
sets the verbose level (0 = nothing, >0 = more)

Specified by:
setVerboseLevel in interface ProperInterface

getVerboseLevel

public int getVerboseLevel()
the current verbose level

Specified by:
getVerboseLevel in interface ProperInterface

setOutput

public void setOutput(java.io.PrintStream out)
sets the printstream to use for outputting data, i.e. stdout and this stream

Specified by:
setOutput in interface ProperInterface

addOutput

public void addOutput(java.io.PrintStream out)
adds the printstream to use for outputting data, i.e. adds the stream to the existing ones

Specified by:
addOutput in interface ProperInterface

getVerboseStringForClass

public java.lang.String getVerboseStringForClass(java.lang.String classname)
returns the verbose string (can be "") for the given classname

Specified by:
getVerboseStringForClass in interface ProperInterface
Parameters:
classname - the list of classes to verbose

getVerboseLevelForClass

public int getVerboseLevelForClass(java.lang.String classname)
returns the verbose level for the given classname

Specified by:
getVerboseLevelForClass in interface ProperInterface
Parameters:
classname - the list of classes to verbose

classInVerbose

public boolean classInVerbose(java.lang.String classname)
checks whether the given class name is part of the verbose string

Specified by:
classInVerbose in interface ProperInterface

setVerboseString

public void setVerboseString(java.lang.String verboseStr)
sets the string with the class names (comma separated and w/o path) that should set their verbose flag to TRUE

Specified by:
setVerboseString in interface ProperInterface

getVerboseString

public java.lang.String getVerboseString()
returns the verbose string

Specified by:
getVerboseString in interface ProperInterface

getRuntime

public java.lang.Runtime getRuntime()
returns the runtime instance for this application

Specified by:
getRuntime in interface ProperInterface

printMemory

public void printMemory()
prints out the currently free and total memory in the JVM

Specified by:
printMemory in interface ProperInterface

print

public void print(int x)
prints the given int to the current output stream

Specified by:
print in interface ProperInterface

print

public void print(boolean x)
prints the given boolean to the current ouput stream

Specified by:
print in interface ProperInterface

print

public void print(java.lang.String x)
prints the given string to the current ouput stream

Specified by:
print in interface ProperInterface

print

public void print(java.lang.Object x)
prints the given object to the current ouput stream

Specified by:
print in interface ProperInterface

println

public void println()
prints a new line to the current ouput stream

Specified by:
println in interface ProperInterface

println

public void println(int x)
prints the given int to the current ouput stream

Specified by:
println in interface ProperInterface

println

public void println(boolean x)
prints the given boolean to the current ouput stream

Specified by:
println in interface ProperInterface

println

public void println(java.lang.String x)
prints the given string to the current ouput stream

Specified by:
println in interface ProperInterface

println

public void println(java.lang.Object x)
prints the given object to the current ouput stream

Specified by:
println in interface ProperInterface

debugprint

public void debugprint(int x)
prints the given int to the current output stream (debug)

Specified by:
debugprint in interface ProperInterface

debugprint

public void debugprint(boolean x)
prints the given boolean to the current ouput stream (debug)

Specified by:
debugprint in interface ProperInterface

debugprint

public void debugprint(java.lang.String x)
prints the given string to the current ouput stream (debug)

Specified by:
debugprint in interface ProperInterface

debugprint

public void debugprint(java.lang.Object x)
prints the given object to the current ouput stream (debug)

Specified by:
debugprint in interface ProperInterface

debugprintln

public void debugprintln()
prints a new line to the current ouput stream (debug)

Specified by:
debugprintln in interface ProperInterface

debugprintln

public void debugprintln(int x)
prints the given int to the current ouput stream (debug)

Specified by:
debugprintln in interface ProperInterface

debugprintln

public void debugprintln(boolean x)
prints the given boolean to the current ouput stream (debug)

Specified by:
debugprintln in interface ProperInterface

debugprintln

public void debugprintln(java.lang.String x)
prints the given string to the current ouput stream (debug)

Specified by:
debugprintln in interface ProperInterface

debugprintln

public void debugprintln(java.lang.Object x)
prints the given object to the current ouput stream (debug)

Specified by:
debugprintln in interface ProperInterface

toString

public java.lang.String toString()
returns only the classname

Overrides:
toString in class java.awt.Component