Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/xerox/VTM/engine/AppEventHandler.java


1   /*   FILE: AppEventHandler.java
2    *   DATE OF CREATION:   Jul 28 2000
3    *   AUTHOR :            Emmanuel Pietriga (emmanuel.pietriga@xrce.xerox.com)
4    *   MODIF:              Tue Apr 02 16:50:39 2002 by Emmanuel Pietriga
5    *   Copyright (c) Xerox Corporation, XRCE/Contextual Computing, 2002. All Rights Reserved
6    *
7    * This library is free software; you can redistribute it and/or
8    * modify it under the terms of the GNU Lesser General Public
9    * License as published by the Free Software Foundation; either
10   * version 2.1 of the License, or (at your option) any later version.
11   * 
12   * This library is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   * Lesser General Public License for more details.
16   *
17   * For full terms see the file COPYING.
18   */
19  
20  package com.xerox.VTM.engine;
21  
22  import com.xerox.VTM.engine.*;
23  import com.xerox.VTM.glyphs.*;
24  
25  /**Abstract class that every VTM-based application should subclass - deals with events like mouse clicks, keyboard events, and entering/leaving a glyph - for every method, mod tells if a modifier key is pressed at the time of the event 0 = no key, 1 = shift, 2 = ctrl, 3 = ctrl+shift
26   * @author Emmanuel Pietriga
27   */
28  
29  public abstract class AppEventHandler {
30  
31      public static int CTRL_MOD=2;
32      public static int CTRL_SHIFT_MOD=3;
33      public static int SHIFT_MOD=1;
34      public static int NO_MODIFIER=0;
35  
36      public void press1(ViewPanel v,int mod,int jpx,int jpy){}
37      public void release1(ViewPanel v,int mod,int jpx,int jpy){}
38      public void click1(ViewPanel v,int mod,int jpx,int jpy,int clickNumber){}
39      public void press2(ViewPanel v,int mod,int jpx,int jpy){}
40      public void release2(ViewPanel v,int mod,int jpx,int jpy){}
41      public void click2(ViewPanel v,int mod,int jpx,int jpy,int clickNumber){}
42      public void press3(ViewPanel v,int mod,int jpx,int jpy){}
43      public void release3(ViewPanel v,int mod,int jpx,int jpy){}
44      public void click3(ViewPanel v,int mod,int jpx,int jpy,int clickNumber){}
45  
46      public void mouseMoved(ViewPanel v,int jpx,int jpy){}
47  
48      /** 
49       *@param jpx mouse coord in JPanel coord syst
50       *@param jpy mouse coord in JPanel coord syst
51       */
52      public void mouseDragged(ViewPanel v,int mod,int buttonNumber,int jpx,int jpy){}
53  
54      /**subclassing methods should call super()*/
55      public void enterGlyph(Glyph g){
56    if (g.mouseInsideColor!=null){g.borderColor=g.mouseInsideColor;}
57    else {g.borderColor=g.color;}  
58      }
59  
60      /**subclassing methods should call super()*/
61      public void exitGlyph(Glyph g){
62    if (g.isSelected()){if (g.selectedColor!=null){g.borderColor=g.selectedColor;}else{g.borderColor=g.color;}}
63    else {g.borderColor=g.bColor;}
64    
65      }
66  
67      /**beware: code is always 0 in Ktype (it is the value of KeyEvent.getKeyCode() which is always equal to VK_UNDEFINED according to Sun). If you need to access code, use Kpress or Krelease.*/
68      public void Ktype(ViewPanel v,char c,int code,int mod){}
69      public void Kpress(ViewPanel v,char c,int code,int mod){}
70      public void Krelease(ViewPanel v,char c,int code,int mod){}
71  
72      public void viewActivated(View v){}
73      public void viewDeactivated(View v){}
74      public void viewIconified(View v){}
75      public void viewDeiconified(View v){}
76      public void viewClosing(View v){}
77  }