View Javadoc

1   // Copyright 2003-2005, FreeHEP.
2   package hep.wired.interaction;
3   
4   import java.awt.*;
5   import java.awt.event.*;
6   import javax.swing.*;
7   
8   import org.freehep.application.Application;
9   import org.freehep.graphics2d.VectorGraphics;
10  import org.freehep.xml.io.XMLIOManager;
11  
12  import hep.wired.services.RecordPlot;
13  import hep.wired.services.InteractionHandler;
14  
15  /***
16   * Near complete (null) implementation of an InteractionHandler.
17   *
18   * @author Mark Donszelmann
19   * @version $Id: AbstractInteractionHandler.java 680 2005-03-14 02:09:43Z duns $
20   */
21  public abstract class AbstractInteractionHandler implements InteractionHandler {
22  
23      private transient int width;
24      private transient int height;
25      private String name;
26  
27      /*** 
28       * Creates an AbstractInteractionHandler.
29       */
30      protected AbstractInteractionHandler(String name) {
31          this.name = name;
32      }
33          
34      public String getID() {
35          String[] names = getClass().getName().split(".");
36          return names[names.length-1];
37      }
38  
39      public String getName() {
40          return name;
41      }
42  
43      public void setRecord(RecordPlot plot, Object record) {
44      }
45  
46      public void setSelected(RecordPlot plot, boolean selected) {
47      }
48          
49      public void setSize(RecordPlot plot, int width, int height) {
50          this.width = width;
51          this.height = height;
52      }
53          
54      public int getWidth() {
55          return width;
56      }
57      
58      public int getHeight() {
59          return height;
60      }
61  
62      public Icon getIcon(int size) {
63          return null;
64      }
65    
66      public void reset(RecordPlot plot, InputEvent event) {
67          Application.getApplication().setStatusMessage("");
68      }
69  
70      public void mouseButton1Clicked(RecordPlot plot, MouseEvent event) {
71      }
72  
73      public void mouseButton1Pressed(RecordPlot plot, MouseEvent event) {
74      }
75  
76      public void mouseButton1Released(RecordPlot plot, MouseEvent event) {
77      }
78  
79      public void mouseButton1DragStarted(RecordPlot plot, MouseEvent event) {
80      }
81  
82      public void mouseButton1Dragged(RecordPlot plot, MouseEvent event) {
83      }
84  
85      public void mouseButton1DragEnded(RecordPlot plot, MouseEvent event) {
86      }
87  
88      public void mouseMoved(RecordPlot plot, MouseEvent event) {
89      }
90  
91      public void mouseEntered(RecordPlot plot, MouseEvent event) {
92      }
93  
94      public void mouseExited(RecordPlot plot, MouseEvent event) {
95      }
96  
97      public void mouseWheelMoved(RecordPlot plot, MouseWheelEvent event) {
98      }
99  
100     public boolean escKeyPressed(RecordPlot plot, KeyEvent event) {
101         return false;
102     }
103 
104     public boolean escKeyReleased(RecordPlot plot, KeyEvent event) {
105         return false;
106     }
107 
108     public boolean altKeyPressed(RecordPlot plot, KeyEvent event) {
109         return false;
110     }
111 
112     public boolean altKeyReleased(RecordPlot plot, KeyEvent event) {
113         return false;
114     }
115 
116     public boolean ctrlKeyPressed(RecordPlot plot, KeyEvent event) {
117         return false;
118     }
119 
120     public boolean ctrlKeyReleased(RecordPlot plot, KeyEvent event) {
121         return false;
122     }
123 
124     public boolean shiftKeyPressed(RecordPlot plot, KeyEvent event) {
125         return false;
126     }
127 
128     public boolean shiftKeyReleased(RecordPlot plot, KeyEvent event) {
129         return false;
130     }
131 
132     public boolean otherKeyPressed(RecordPlot plot, KeyEvent event) {
133         return false;
134     }
135 
136     public boolean otherKeyReleased(RecordPlot plot, KeyEvent event) {
137         return false;
138     }
139 
140     public boolean keyTyped(RecordPlot plot, KeyEvent event) {
141         return false;
142     }
143             
144 //
145 // XMLIO
146 //
147     public void save(XMLIOManager xmlioManager,
148                      org.jdom.Element nodeEl) {
149         // just save class
150     }
151     
152     public void restore(XMLIOManager xmlioManager,
153                         org.jdom.Element nodeEl) {
154         // just restore class
155     }    
156 }