001: /*=============================================================================
002: * Copyright Texas Instruments, Inc., 2001. All Rights Reserved.
003: *
004: * This program is free software; you can redistribute it and/or modify
005: * it under the terms of the GNU General Public License as published by
006: * the Free Software Foundation; either version 2 of the License, or
007: * (at your option) any later version.
008: *
009: * This program is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU General Public License for more details.
013: *
014: * You should have received a copy of the GNU General Public License
015: * along with this program; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */
018:
019: package ti.chimera;
020:
021: import java.util.LinkedList;
022: import java.util.Iterator;
023: import java.awt.*;
024: import java.awt.event.WindowListener;
025: import javax.swing.*;
026:
027: /**
028: * The interface implemented by a dialog window. Like with swing's
029: * <code>JDialog</code> or <code>JInternalFrame</code>, you don't actually
030: * add components to the dialog itself, but rather to it's content pane,
031: * which is returned by {@link #getContentPane}.
032: *
033: * @author Rob Clark
034: * @version 0.2
035: */
036: public interface Dialog {
037: /**
038: * Get the title of this dialog.
039: *
040: * @return a string
041: */
042: public String getTitle();
043:
044: /**
045: * Called to set the visible state of this dialog.
046: *
047: * @param visible the new visible state
048: */
049: public void setVisible(boolean visible);
050:
051: /**
052: * Get the bounds of this dialog, ie the position and size of the window.
053: *
054: * @return a rectangle
055: */
056: public Rectangle getBounds();
057:
058: /**
059: * Set the bounds of this dialog, ie. the size and position of the window.
060: *
061: * @param r the new bounds
062: */
063: public void setBounds(Rectangle r);
064:
065: /**
066: * Bring this dialog to the front.
067: */
068: public void toFront();
069:
070: /**
071: * Center this dialog on the screen.
072: */
073: public void center();
074:
075: /**
076: * Return the content-pane. This is the component that the contents of
077: * the window are to be added to.
078: *
079: * @return a container
080: */
081: public Container getContentPane();
082:
083: /**
084: * Cause the dialog to be sized to fit the preferred size of it's sub-
085: * components.
086: */
087: public void pack();
088:
089: /**
090: * Dispose of this dialog.
091: */
092: public void dispose();
093:
094: // protected void finalize()
095: // {
096: // dispose();
097: // }
098:
099: /**
100: * Show as modal dialog. Do not return until dialog closed.
101: */
102: public void showModal();
103:
104: /**
105: * Add a runnable that will be invoked when this dialog is closed. This
106: * gives the user of the dialog a way to perform cleanup when the dialog
107: * is closed.
108: *
109: * @param r the runnable
110: */
111: public void addCloseRunnable(Runnable r);
112:
113: /**
114: * Remove the runnable from the list of runnables that will get run when
115: * this dialog is closed.
116: *
117: * @param r the runnable
118: */
119: public void removeCloseRunnable(Runnable r);
120:
121: /**
122: * Adds the specified window listener to receive window events.
123: *
124: * @param l the listener
125: */
126: public void addWindowListener(WindowListener l);
127:
128: /**
129: * Removes the specified window listener so that it no longer receives
130: * window events from this component
131: *
132: * @param l the listener
133: */
134: public void removeWindowListener(WindowListener l);
135: }
136:
137: /*
138: * Local Variables:
139: * tab-width: 2
140: * indent-tabs-mode: nil
141: * mode: java
142: * c-indentation-style: java
143: * c-basic-offset: 2
144: * eval: (c-set-offset 'substatement-open '0)
145: * eval: (c-set-offset 'case-label '+)
146: * eval: (c-set-offset 'inclass '+)
147: * eval: (c-set-offset 'inline-open '0)
148: * End:
149: */
|