001 package org.LiveGraph.gui.plot;
002
003 import java.awt.Dimension;
004 import java.awt.event.WindowAdapter;
005 import java.awt.event.WindowEvent;
006
007 import org.LiveGraph.LiveGraph;
008 import org.LiveGraph.events.Event;
009 import org.LiveGraph.gui.GUIEvent;
010 import org.LiveGraph.gui.LiveGraphFrame;
011
012 /**
013 * The plot window of the application.
014 *
015 * <p style="font-size:smaller;">This product includes software developed by the
016 * <strong>LiveGraph</strong> project and its contributors.<br />
017 * (<a href="http://www.live-graph.org" target="_blank">http://www.live-graph.org</a>)<br />
018 * Copyright (c) 2007-2008 G. Paperin.<br />
019 * All rights reserved.
020 * </p>
021 * <p style="font-size:smaller;">File: PlotWindow.java</p>
022 * <p style="font-size:smaller;">Redistribution and use in source and binary forms, with or
023 * without modification, are permitted provided that the following terms and conditions are met:
024 * </p>
025 * <p style="font-size:smaller;">1. Redistributions of source code must retain the above
026 * acknowledgement of the LiveGraph project and its web-site, the above copyright notice,
027 * this list of conditions and the following disclaimer.<br />
028 * 2. Redistributions in binary form must reproduce the above acknowledgement of the
029 * LiveGraph project and its web-site, the above copyright notice, this list of conditions
030 * and the following disclaimer in the documentation and/or other materials provided with
031 * the distribution.<br />
032 * 3. All advertising materials mentioning features or use of this software or any derived
033 * software must display the following acknowledgement:<br />
034 * <em>This product includes software developed by the LiveGraph project and its
035 * contributors.<br />(http://www.live-graph.org)</em><br />
036 * 4. All advertising materials distributed in form of HTML pages or any other technology
037 * permitting active hyper-links that mention features or use of this software or any
038 * derived software must display the acknowledgment specified in condition 3 of this
039 * agreement, and in addition, include a visible and working hyper-link to the LiveGraph
040 * homepage (http://www.live-graph.org).
041 * </p>
042 * <p style="font-size:smaller;">THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY
043 * OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
044 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
045 * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
046 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
047 * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
048 * </p>
049 *
050 * @author Greg Paperin (<a href="http://www.paperin.org" target="_blank">http://www.paperin.org</a>)
051 * @version {@value org.LiveGraph.LiveGraph#version}
052 */
053 public class PlotWindow extends LiveGraphFrame {
054
055
056
057 /**
058 * Creates and setts up a plotter window.
059 */
060 public PlotWindow() {
061 super();
062 this.initialize();
063 }
064
065 /**
066 * This method initializes the window.
067 */
068 private void initialize() {
069
070 // Window settings:
071 Dimension frameDim = new Dimension(450, 500);
072 this.setPreferredSize(frameDim);
073 this.setBounds(480, 5, frameDim.width, frameDim.height);
074 this.setTitle("Plot (LiveGraph)");
075
076 // Hide-show listener:
077 this.addWindowListener(new WindowAdapter() {
078 @Override public void windowClosing(WindowEvent e) {
079 LiveGraph.application().disposeGUIAndExit();
080 }
081 });
082 }
083
084
085 /**
086 * Updates local view on GUI events.
087 *
088 * @param event The GUI event.
089 */
090 @Override
091 protected void processGUIEvent(Event<GUIEvent> event) {
092
093 super.processGUIEvent(event);
094 if (event.getType() == GUIEvent.GUI_PlotDisplayStateChanged) {
095 setVisible(event.getInfoBoolean());
096 }
097 }
098
099 } // public class PlotWindow