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