2
* TouchGraph LLC. Apache-Style Software License
5
* Copyright (c) 2001-2002 Alexander Shapiro. All rights reserved.
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions
11
* 1. Redistributions of source code must retain the above copyright
12
* notice, this list of conditions and the following disclaimer.
14
* 2. Redistributions in binary form must reproduce the above copyright
15
* notice, this list of conditions and the following disclaimer in
16
* the documentation and/or other materials provided with the
19
* 3. The end-user documentation included with the redistribution,
20
* if any, must include the following acknowledgment:
21
* "This product includes software developed by
22
* TouchGraph LLC (http://www.touchgraph.com/)."
23
* Alternately, this acknowledgment may appear in the software itself,
24
* if and wherever such third-party acknowledgments normally appear.
26
* 4. The names "TouchGraph" or "TouchGraph LLC" must not be used to endorse
27
* or promote products derived from this software without prior written
28
* permission. For written permission, please contact
31
* 5. Products derived from this software may not be called "TouchGraph",
32
* nor may "TouchGraph" appear in their name, without prior written
33
* permission of alex@touchgraph.com.
35
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38
* DISCLAIMED. IN NO EVENT SHALL TOUCHGRAPH OR ITS CONTRIBUTORS BE
39
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
40
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
41
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
42
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
43
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
44
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
45
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46
* ====================================================================
50
package com.touchgraph.graphlayout.interaction;
52
import com.touchgraph.graphlayout.*;
55
import java.awt.event.*;
56
import java.util.Vector;
58
/** TGUIManager switches between major user interfaces, and allows
59
* them to be referred to by name. This will probably come in handy
60
* when switching user interfaces from menus.
62
* @author Alexander Shapiro
63
* @version 1.22-jre1.1 $Id: TGUIManager.java,v 1.1 2002/09/19 15:58:21 ldornbusch Exp $
65
public class TGUIManager {
67
Vector userInterfaces;
71
/** Default constructor.
73
public TGUIManager() {
74
userInterfaces = new Vector();
81
NamedUI( TGUserInterface ui, String n ) {
87
public void addUI( TGUserInterface ui, String name ) {
88
userInterfaces.addElement(new NamedUI(ui,name));
91
public void addUI( TGUserInterface ui ) {
95
public void removeUI( String name ) {
96
for (int i=0;i<userInterfaces.size();i++)
97
if (((NamedUI) userInterfaces.elementAt(i)).name.equals(name)) userInterfaces.removeElementAt(i);
101
public void removeUI( TGUserInterface ui ) {
102
for (int i=0;i<userInterfaces.size();i++)
103
if (((NamedUI) userInterfaces.elementAt(i)).ui==ui) userInterfaces.removeElementAt(i);
107
public void activate( String name ) {
108
for (int i=0;i<userInterfaces.size();i++) {
109
NamedUI namedInterf = (NamedUI) userInterfaces.elementAt(i);
110
TGUserInterface ui=namedInterf.ui;
111
if (((NamedUI) userInterfaces.elementAt(i)).name.equals(name)) ui.activate();
112
else ui.deactivate();
116
public void activate( TGUserInterface ui ) {
117
for (int i=0;i<userInterfaces.size();i++) {
118
if (((NamedUI) userInterfaces.elementAt(i)).ui==ui) ui.activate();
119
else ui.deactivate();
123
} // end com.touchgraph.graphlayout.interaction.TGUIManager