View Javadoc

1   /*
2   * The contents of this file are subject to the BT "ZEUS" Open Source 
3   * Licence (L77741), Version 1.0 (the "Licence"); you may not use this file 
4   * except in compliance with the Licence. You may obtain a copy of the Licence
5   * from $ZEUS_INSTALL/licence.html or alternatively from
6   * http://www.labs.bt.com/projects/agents/zeus/licence.htm
7   * 
8   * Except as stated in Clause 7 of the Licence, software distributed under the
9   * Licence is distributed WITHOUT WARRANTY OF ANY KIND, either express or 
10  * implied. See the Licence for the specific language governing rights and 
11  * limitations under the Licence.
12  * 
13  * The Original Code is within the package zeus.*.
14  * The Initial Developer of the Original Code is British Telecommunications
15  * public limited company, whose registered office is at 81 Newgate Street, 
16  * London, EC1A 7AJ, England. Portions created by British Telecommunications 
17  * public limited company are Copyright 1996-9. All Rights Reserved.
18  * 
19  * THIS NOTICE MUST BE INCLUDED ON ANY COPY OF THIS FILE
20  */
21  
22  
23  
24  /*****************************************************************************
25  * Toolbar for the Control Tool                                              *
26  *****************************************************************************/
27  
28  package zeus.visualiser.control;
29  
30  import javax.swing.*;
31  import javax.swing.border.*;
32  import java.awt.*;
33  import java.awt.event.*;
34  
35  import zeus.util.SystemProps;
36  
37  
38  public class ControlToolBar extends JToolBar
39  {
40    protected JButton  killBtn;
41    protected JButton  addGoalBtn, addFactBtn;
42    protected JButton  addTaskBtn, tuneAgentBtn;
43    protected JButton  addRelBtn, addStratBtn;
44    public    JToggleButton  helpBtn;
45  
46  
47    public ControlToolBar(ActionListener caller)
48    {
49      // setBorder( new BevelBorder(BevelBorder.LOWERED ) );
50      setFloatable(false);
51  
52      String sep = System.getProperty("file.separator");
53      String path = SystemProps.getProperty("gif.dir") + sep + "control" + sep;
54  
55      // Kill Agents Button
56      killBtn = new JButton(new ImageIcon(path + "kill.gif"));
57      add(killBtn);
58      killBtn.setToolTipText("Closedown All Agents");
59      killBtn.setMargin(new Insets(0, 0, 0, 0));
60      killBtn.addActionListener(caller);
61      killBtn.setActionCommand("Kill");
62      addSeparator();
63  
64      addGoalBtn = new JButton(new ImageIcon(path + "addgoal.gif"));
65      add(addGoalBtn);
66      addGoalBtn.setToolTipText("Add a New Goal");
67      addGoalBtn.setMargin(new Insets(0, 0, 0, 0));
68      addGoalBtn.addActionListener(caller);
69      addGoalBtn.setActionCommand("AddGoal");
70  
71      addFactBtn = new JButton(new ImageIcon(path + "addfact.gif"));
72      add(addFactBtn);
73      addFactBtn.setToolTipText("Add a New Fact");
74      addFactBtn.setMargin(new Insets(0, 0, 0, 0));
75      addFactBtn.addActionListener(caller);
76      addFactBtn.setActionCommand("AddFact");
77  
78      addTaskBtn = new JButton(new ImageIcon(path + "addtask.gif"));
79      add(addTaskBtn);
80      addTaskBtn.setToolTipText("Add a New Task");
81      addTaskBtn.setMargin(new Insets(0, 0, 0, 0));
82      addTaskBtn.addActionListener(caller);
83      addTaskBtn.setActionCommand("AddFact");
84  
85      tuneAgentBtn = new JButton(new ImageIcon(path + "tuneagent.gif"));
86      add(tuneAgentBtn);
87      tuneAgentBtn.setToolTipText("Modify Agent Attributes");
88      tuneAgentBtn.setMargin(new Insets(0, 0, 0, 0));
89      tuneAgentBtn.addActionListener(caller);
90      tuneAgentBtn.setActionCommand("TuneAgent");
91  
92      addRelBtn = new JButton(new ImageIcon(path + "addrelation.gif"));
93      add(addRelBtn);
94      addRelBtn.setToolTipText("Add a new relationship");
95      addRelBtn.setMargin(new Insets(0, 0, 0, 0));
96      addRelBtn.addActionListener(caller);
97      addRelBtn.setActionCommand("AddRelation");
98  
99      addStratBtn = new JButton(new ImageIcon(path + "addstrategy.gif"));
100     add(addStratBtn);
101     addStratBtn.setToolTipText("Add a new strategy");
102     addStratBtn.setMargin(new Insets(0, 0, 0, 0));
103     addStratBtn.addActionListener(caller);
104     addStratBtn.setActionCommand("AddStrategy");
105     addSeparator();
106 
107     helpBtn = new JToggleButton(new ImageIcon(path + "help.gif"));
108     add(helpBtn);
109     helpBtn.setToolTipText("Help");
110     helpBtn.setMargin(new Insets(0, 0, 0, 0));
111     helpBtn.addActionListener(caller);
112     helpBtn.setActionCommand("Help");
113   }
114 }