View Javadoc

1   /*
2    * ToolInternalFrame.java
3    *
4    * Created on 14. mai 2005, 11:01
5    */
6   
7   package com.vikash.firsttool.UI;
8   import com.vikash.firsttool.Diagram.*;
9   import com.vikash.firsttool.Diagram.DiagramBars.*;
10  import java.awt.*;
11  import java.net.URL;
12  import javax.swing.*;
13  import javax.swing.event.*;
14  import java.beans.*;
15  
16  /***
17   *
18   * @author  studajb
19   */
20  public class ToolInternalFrame extends JInternalFrame {
21      EditorPanel panel;
22      JToolBar iconbar;
23      ToolGraph graph;
24      boolean diagramremoved=false;
25      /*** Creates a new instance of ToolInternalFrame */
26      public ToolInternalFrame(final MainEditor editor, final EditorPanel panel) {
27          
28          super(null,true,true,true,true);
29          this.panel=panel;
30          graph= panel.getgraph();
31          iconbar=createIconBar(graph);
32          Container contentpane=getContentPane();
33          contentpane.add(iconbar,BorderLayout.NORTH);
34          contentpane.add(panel,BorderLayout.CENTER);
35          setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
36          
37      }
38      private JToolBar createIconBar(ToolGraph graph) {
39          URL icon;
40          if(graph instanceof SWOTDiagram){
41              iconbar=new SWOTBar(panel);
42              icon=getClass().getClassLoader().getResource("com/vikash/firsttool/resources/SWOT.gif");
43              
44          }
45          else if (graph instanceof AssetDiagram){
46              iconbar=new AssetBar(panel);
47              icon=getClass().getClassLoader().getResource("com/vikash/firsttool/resources/Asset.gif");
48          }
49          
50          else if(graph instanceof UnwantedIncidentDiagram){
51              iconbar=new UnwantedBar(panel);
52              icon=getClass().getClassLoader().getResource("com/vikash/firsttool/resources/UnwantedIncident.gif");
53          }
54          else if(graph instanceof RiskDiagram){
55              iconbar=new RiskBar(panel);
56              icon=getClass().getClassLoader().getResource("com/vikash/firsttool/resources/Risk.gif");
57          }
58          else if(graph instanceof TreatmentDiagram){
59              iconbar=new TreatmentBar(panel);
60              icon=getClass().getClassLoader().getResource("com/vikash/firsttool/resources/Treatment.gif");
61          }
62          else{
63              iconbar=new TreatmentEffectBar(panel);
64              icon=getClass().getClassLoader().getResource("com/vikash/firsttool/resources/TreatmentEffect.gif");
65          }
66          this.setFrameIcon(new ImageIcon(icon));
67          
68          return iconbar;
69      }
70      public void setDiagramRemoved(boolean flag){
71          diagramremoved=flag;
72      }
73      public boolean getDiagramRemoved(){
74          return diagramremoved;
75      }
76      public EditorPanel getPanel(){
77          return panel;
78      }
79      public ToolGraph getGraph(){
80          return graph;
81      }
82      public String getFrameTitle(){
83          return this.getTitle();
84      }
85      
86      public void setFrameTitle(String name){
87          this.setTitle(name);
88      }
89      
90      
91  }