harmonic.mz.gui
Class Monolog

java.lang.Object
  |
  +--HWPanel
        |
        +--harmonic.mz.gui.Monolog
All Implemented Interfaces:
java.util.EventListener, java.awt.event.KeyListener, NodeListener, harmonic.viewer3D.Task, java.awt.event.WindowListener
Direct Known Subclasses:
AutoMonolog, NodeValueDialog, NodeValuesDialog, SequenceFunctionDialog, SingleNodeDialog

public class Monolog
extends HWPanel
implements java.awt.event.WindowListener, java.awt.event.KeyListener, harmonic.viewer3D.Task, NodeListener

The monolog is a JPanel with some special abilities. It is indented to be an assemlage of widgets in a dialog box. A Monolog can float or be inside another Monolog. This class will not automatically format its contents. For automatic formating use a class like AutoMonolog, or manually format override format(). A monolog may be embeded in another, since unlike a JDialog this is not by nature a floating frame. A frame is build around a Monolog by the post() function.

See Also:
Serialized Form

Nested Class Summary
static class Monolog.MonoFrame
           
 
Field Summary
 boolean bPermanent
           
static int CLOSED
           
 Module creatingModule
          Module that created this.
static int DOCK_MONOLOG
           
static int FLOAT_MONOLOG
           
 int postMethod
           
static int stdDialogWidth
           
 BooleanField visibility
           
 
Constructor Summary
Monolog(FunctionStarter action)
          Constructs a Monolog.
Monolog(java.lang.String name)
          Constructs a Monolog.
 
Method Summary
 void addListener(java.lang.Object o, java.lang.String callback, int id)
           
 void addSubMonolog(Monolog mono)
          Add a logical sub window that is in an independant frame.
 void afterPost()
          Called after dialog is posted.
 void begin()
          Does MZ.tasks().addRootTask(this).
 void beginTask(harmonic.viewer3D.Task parentTask)
          Implements Task by calling init(), then post().
 void cancel()
          Override to respond do canceling
 void cancelTask()
          Implements Task by calling unpost()
 void cleanTask()
           
 void destroyIfTemporary()
          Calls purgeFinal() if this dialog is not flaged as permanent.
 boolean drop(java.awt.Component wnd)
           
 void finish()
          Override to finish
 void finishTask()
          Implements Task by calling unpost()
static java.awt.Dimension frameSize(java.awt.Dimension rect)
          Return the frame size for the given content rectangle
 java.awt.Component getFrame()
          Return the frame this has been floated in, or null if this dialog is not floated.
 java.awt.Dimension getPreferredSize()
           
 java.lang.String getTaskName()
          Implements Task
 void init_Bottom(int i)
          Initialize this to appear in the i'th panel of bottom side tray.
 void init_Floating(int x, int y, int w, int h)
          Initialize this to come up floating, with given frame rectangle.
 void init_Info(int postType, java.awt.Rectangle rect)
          Intialize this to come up as given.
 void init_Left(int i)
          Initialize this to appear in the i'th panel of left side tray.
 void init_Right(int i)
          Initialize this to appear in the i'th panel of right side tray.
 void init_Top(int i)
          Initialize this to appear in the i'th panel of top side tray.
 void init()
          Override to initialize.
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void nodeChanged(NodeEvent e)
          Node has changed
 void noPost()
           
 void onCancel()
           
 void onDismiss()
           
 void onHelp()
           
 void onOK()
           
 void post()
          Post the dialog a position specified by the initX functions.
 void post(FunctionStarter fn)
          This a convience for assigning the user function what created this monolog.
 void post(int postType, int x, int y)
          Call this one if only the location is known, and this size will be figured
 void post(int postType, int x, int y, int w, int h)
          Post the monolog
 void postModal()
          Post modally.
 void postModal(FunctionStarter fn)
          Post modally.
 void processKeyEvent(java.awt.event.KeyEvent e)
           
 void reformat()
           
 void removeStandardButtons()
          Remove any comonents extending StandardButtonPanel.
 void setFunction(FunctionStarter fn)
          Set the FunctionStarter that starts this dialog, if there is one.
 void setMonologClass(java.lang.String type)
          Set the type of dialog this should be considered.
 void setPermenant(boolean b)
           
 void setPosted(boolean b)
           
 void setResizeable(boolean b)
          Set whether user can resize the frame.
 void setTitle(java.lang.String s)
          Set frame title of this Monolog.
 boolean shouldPost()
           
 void unpost()
          this.unpost(false)
 void unpost(boolean bReuseFrame)
          Visually remove dialog.
 void updateMonologInfo()
          Set the current state of this Monolog to the info table
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stdDialogWidth

public static int stdDialogWidth

visibility

public BooleanField visibility

creatingModule

public Module creatingModule
Module that created this. If this is non null the dialog will be automatically removed when module is unloaded.


bPermanent

public boolean bPermanent

postMethod

public int postMethod

FLOAT_MONOLOG

public static final int FLOAT_MONOLOG
See Also:
Constant Field Values

DOCK_MONOLOG

public static final int DOCK_MONOLOG
See Also:
Constant Field Values

CLOSED

public static final int CLOSED
See Also:
Constant Field Values
Constructor Detail

Monolog

public Monolog(java.lang.String name)
Constructs a Monolog.


Monolog

public Monolog(FunctionStarter action)
Constructs a Monolog.

Method Detail

getFrame

public java.awt.Component getFrame()
Return the frame this has been floated in, or null if this dialog is not floated.


setMonologClass

public void setMonologClass(java.lang.String type)
Set the type of dialog this should be considered. All dialogs with this setting will post in the same place.


updateMonologInfo

public void updateMonologInfo()
Set the current state of this Monolog to the info table


init_Info

public void init_Info(int postType,
                      java.awt.Rectangle rect)
Intialize this to come up as given.

Parameters:
postType - Way dialog is shown
rect - Frame rectangle if floated

init_Floating

public void init_Floating(int x,
                          int y,
                          int w,
                          int h)
Initialize this to come up floating, with given frame rectangle. The post() function looks at the information given here to position the dialog box.


init_Left

public void init_Left(int i)
Initialize this to appear in the i'th panel of left side tray. The post() function looks at the information given here to position the dialog box.


init_Right

public void init_Right(int i)
Initialize this to appear in the i'th panel of right side tray. The post() function looks at the information given here to position the dialog box.


init_Top

public void init_Top(int i)
Initialize this to appear in the i'th panel of top side tray. The post() function looks at the information given here to position the dialog box.


init_Bottom

public void init_Bottom(int i)
Initialize this to appear in the i'th panel of bottom side tray. The post() function looks at the information given here to position the dialog box.


nodeChanged

public void nodeChanged(NodeEvent e)
Description copied from interface: NodeListener
Node has changed

Specified by:
nodeChanged in interface NodeListener

setTitle

public void setTitle(java.lang.String s)
Set frame title of this Monolog. The title will appear how ever it can, depending on what type of window is framing this.


setResizeable

public void setResizeable(boolean b)
Set whether user can resize the frame.


removeStandardButtons

public void removeStandardButtons()
Remove any comonents extending StandardButtonPanel.


keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

addListener

public void addListener(java.lang.Object o,
                        java.lang.String callback,
                        int id)

getPreferredSize

public java.awt.Dimension getPreferredSize()

processKeyEvent

public void processKeyEvent(java.awt.event.KeyEvent e)

reformat

public void reformat()

addSubMonolog

public void addSubMonolog(Monolog mono)
Add a logical sub window that is in an independant frame. The given window is not added as a child of this in the windowing system. When this Monolog is closed the logical sub windows are closed as well.


frameSize

public static java.awt.Dimension frameSize(java.awt.Dimension rect)
Return the frame size for the given content rectangle


setPermenant

public void setPermenant(boolean b)

setPosted

public void setPosted(boolean b)

setFunction

public void setFunction(FunctionStarter fn)
Set the FunctionStarter that starts this dialog, if there is one. This information is needed for the help button to work.


drop

public boolean drop(java.awt.Component wnd)

shouldPost

public boolean shouldPost()

postModal

public void postModal()
Post modally. When the dialog is finished this function returns. The result of the user interaction is obtaintained by questioning the dialog after the posting. While this dialog is up the user must use this dialog. Generally the use of the function is discouraged. Instead the programer should give the dialog a call back function to call when it is finished. If this is posted in a secondary thread, only that thread will be blocked, and it maybe possible to user the interface aside from the dialog. The purpose of posting modally is ease of programing:

 someuserfn(){
    dialog.post();
    respond_to_dialog();
 }


postModal

public void postModal(FunctionStarter fn)
Post modally. When the dialog is finished this function returns.


post

public void post(FunctionStarter fn)
This a convience for assigning the user function what created this monolog. The assigment of this is needed for the help button to work


post

public void post()
Post the dialog a position specified by the initX functions.


post

public void post(int postType,
                 int x,
                 int y)
Call this one if only the location is known, and this size will be figured


post

public void post(int postType,
                 int x,
                 int y,
                 int w,
                 int h)
Post the monolog

Parameters:
x - x position
y - y position
w - width
h - height

unpost

public void unpost()
this.unpost(false)


unpost

public void unpost(boolean bReuseFrame)
Visually remove dialog. Do NOT do a this.setVisible(false) because it may have just been added somewhere else. If bResuseFrame is true, the same frame will be used to frame the next posting of any monolog object. This was added for the functions repeted in sequence.


begin

public void begin()
Does MZ.tasks().addRootTask(this).


beginTask

public void beginTask(harmonic.viewer3D.Task parentTask)
Implements Task by calling init(), then post(). Will not call post() if shouldPost() is false. This alows a dialog to complete its innput withoug showing, it this is possible.

Specified by:
beginTask in interface harmonic.viewer3D.Task

finishTask

public void finishTask()
Implements Task by calling unpost()

Specified by:
finishTask in interface harmonic.viewer3D.Task

cancelTask

public void cancelTask()
Implements Task by calling unpost()

Specified by:
cancelTask in interface harmonic.viewer3D.Task

cleanTask

public void cleanTask()
Specified by:
cleanTask in interface harmonic.viewer3D.Task

getTaskName

public java.lang.String getTaskName()
Implements Task

Specified by:
getTaskName in interface harmonic.viewer3D.Task

init

public void init()
Override to initialize. This is called BEFORE post(), and before shouldPost() is consulted.


afterPost

public void afterPost()
Called after dialog is posted. Override to start any tasks, or anything else that should happen.


noPost

public void noPost()

finish

public void finish()
Override to finish


cancel

public void cancel()
Override to respond do canceling


destroyIfTemporary

public void destroyIfTemporary()
Calls purgeFinal() if this dialog is not flaged as permanent. Call this in umpost() or any override of unpost().


onOK

public void onOK()

onCancel

public void onCancel()

onDismiss

public void onDismiss()

onHelp

public void onHelp()

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener