Changeset 854 for trunk/quest-jfcmonitor/src/main/java/de/ugoe/cs/quest
- Timestamp:
- 10/02/12 12:58:32 (12 years ago)
- Location:
- trunk/quest-jfcmonitor/src/main/java/de/ugoe/cs/quest/jfcmonitor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-jfcmonitor/src/main/java/de/ugoe/cs/quest/jfcmonitor/JFCComponent.java
r853 r854 218 218 this.component = component; 219 219 220 // add PropertyChangeListeners to AccessibleContext 220 221 AccessibleContext context = component.getAccessibleContext(); 221 222 if (context != null){ … … 223 224 context.addPropertyChangeListener(listener); 224 225 } 226 227 // add PropertyChangeListeners to component itself 228 for (PropertyChangeListener listener: propertyChangeListeners) 229 this.component.addPropertyChangeListener(listener); 225 230 226 231 this.parent = parent; -
trunk/quest-jfcmonitor/src/main/java/de/ugoe/cs/quest/jfcmonitor/JFCNameChangeListener.java
r853 r854 30 30 * <p> 31 31 * Constructor. Creates a new JFCNameChangeListener with a given 32 * {@link JFCMonitorOutputWriter} 32 * {@link JFCMonitorOutputWriter}. 33 33 * </p> 34 34 * @param outputWriter … … 40 40 @Override 41 41 public void propertyChange(PropertyChangeEvent evt) { 42 if (evt.getPropertyName().equals("AccessibleName")){ 42 String propertyName = evt.getPropertyName(); 43 Component component = null; 44 45 if (propertyName.equals("AccessibleName")){ 43 46 AccessibleContext context = (AccessibleContext) evt.getSource(); 44 Component component = (Component) context.getAccessibleParent(); 47 component = (Component) context.getAccessibleParent(); 48 } 49 50 if (propertyName.equals("name")){ 51 component = (Component) evt.getSource(); 52 } 53 54 if (propertyName.equals("")){ 55 56 } 57 58 if (component != null){ 59 if (!JFCComponent.isKnown(component)){ 60 System.err.println("Referenced component is not known"); 61 throw new AssertionError("Referenced component is not known."); 62 } 45 63 StringBuilder builder = new StringBuilder(); 46 64 builder.append("<componentNameChange hash=\""); 47 if (!JFCComponent.isKnown(component)){48 System.err.println("Referenced component is not known");49 throw new AssertionError("Referenced component is not known.");50 }51 65 builder.append(Integer.toHexString(component.hashCode())); 52 66 builder.append("\" newName=\"" + evt.getNewValue()); 53 builder.append("\"/>" + StringTools.ENDLINE); 67 builder.append("\" source=\"" + propertyName); 68 builder.append("\" />" + StringTools.ENDLINE); 54 69 outputWriter.write(builder.toString()); 55 } 70 } 56 71 } 57 72
Note: See TracChangeset
for help on using the changeset viewer.