KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > logger > listeners > WMPropertyListener


1 /*
2  * PropertyWindow.java
3  *
4  * Created on April 5, 2005, 4:31 PM
5  */

6
7 package org.netbeans.modules.logger.listeners;
8
9 /**
10  *
11  * @author loicsegapelli
12  */

13
14 import org.openide.windows.Mode;
15 import org.openide.windows.WindowManager;
16 import java.beans.*;
17 import java.io.*;
18
19 public class WMPropertyListener extends ListenerTools implements PropertyChangeListener{
20     
21     /** Creates a new instance of PropertyWindow */
22     public WMPropertyListener() throws IOException{
23         super("WM");
24     }
25     
26     public void propertyChange(PropertyChangeEvent evt) {
27         newBuffer();
28         String JavaDoc evtPpty=evt.getPropertyName();
29         append(System.currentTimeMillis()+"\t"+evtPpty);
30         if(evtPpty.equalsIgnoreCase("activeMode")){
31             /*
32             Mode m = (Mode)evt.getNewValue();
33             if(m!=null) append("name: "+m.getName());
34             else {
35                 m = (Mode)evt.getOldValue();
36                 if(m!=null){
37                     append("name: "+m.getName());
38                 } else append("!found no info!");
39             }
40             return;*/

41             
42             // this mode is not interesting, just erase
43
erase();
44         } else if(evtPpty.equalsIgnoreCase("maximizedMode")){
45             Mode m = (Mode)evt.getNewValue();
46             if(m!=null) append(m.getName());
47             else {
48                 m = (Mode)evt.getOldValue();
49                 if(m!=null){
50                     append(m.getName());
51                 } else return;
52             }
53         } else if(evtPpty.equalsIgnoreCase("modes")){
54             /*
55             Mode m = (Mode)evt.getNewValue();
56             if(m!=null) append("name : "+m.getName());
57             else {
58                 m = (Mode)evt.getOldValue();
59                 if(m!=null){
60                     append("name : "+m.getName());
61                 } else append("!found no info! ask Jarda");
62             }
63             return;*/

64             
65             // this mode is not interesting, just erase
66
erase();
67         } else {
68             append("unknown mode");
69         }
70         flush();
71     }
72     
73 }
74
Popular Tags