Changeset 355 for trunk/JFCMonitor
- Timestamp:
- 01/26/12 14:46:47 (13 years ago)
- Location:
- trunk/JFCMonitor/src/de/ugoe/cs/eventbench/jfcmonitor
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JFCMonitor/src/de/ugoe/cs/eventbench/jfcmonitor/JFCListener.java
r354 r355 8 8 import java.io.IOException; 9 9 import java.io.OutputStreamWriter; 10 import java.lang.reflect.InvocationTargetException;11 import java.lang.reflect.Method;12 10 13 11 import de.ugoe.cs.util.StringTools; … … 128 126 if (event.getSource() instanceof Component) { 129 127 Component source = (Component) event.getSource(); 130 addComponentInfo(builder,source);131 builder.append(" <parent>" + ENDLINE);132 addComponentInfo(builder, source.getParent());133 builder.append(" </parent>" + ENDLINE);128 JFCComponent jfcComponent = JFCComponent.find(source); 129 if (jfcComponent != null) { 130 builder.append(jfcComponent.getXML()); 131 } 134 132 } 135 133 builder.append(" </source>" + ENDLINE); 136 }137 138 /**139 * <p>140 * Appends information about the component to the a {@link StringBuilder}.141 * The prefix can be used to give further information about the component.142 * </p>143 *144 * @param builder145 * {@link StringBuilder} where the information is appended146 * @param component147 * component whose information is appended148 */149 private void addComponentInfo(StringBuilder builder, Component component) {150 builder.append(" <param name=\"getName\" value=\""151 + StringTools.xmlEntityReplacement(component.getName())152 + "\" />" + ENDLINE);153 for (Method method : component.getClass().getMethods()) {154 try {155 if (method.getName() == "getText") {156 String text = (String) method.invoke(component,157 new Object[] {});158 if (text != null) {159 builder.append(" <param name=\"getText\" value=\""160 + StringTools.xmlEntityReplacement(text)161 + "\" />" + ENDLINE);162 }163 }164 if (method.getName() == "getTitle") {165 String title = (String) method.invoke(component,166 new Object[] {});167 if (title != null) {168 builder.append(" <param name=\"getTitle\" value=\""169 + StringTools.xmlEntityReplacement(title)170 + "\" />" + ENDLINE);171 }172 }173 } catch (IllegalArgumentException e) {174 } catch (IllegalAccessException e) {175 } catch (InvocationTargetException e) {176 System.err.println("Found method with name " + method.getName()177 + " but could not access it.");178 }179 }180 134 } 181 135 -
trunk/JFCMonitor/src/de/ugoe/cs/eventbench/jfcmonitor/Runner.java
r308 r355 63 63 Toolkit.getDefaultToolkit().addAWTEventListener(listenerFile, 64 64 AWTEvent.MOUSE_EVENT_MASK); 65 Toolkit.getDefaultToolkit().addAWTEventListener(new WindowMonitor(), 66 AWTEvent.WINDOW_EVENT_MASK); 65 67 66 68 if (stdOutputWrite) {
Note: See TracChangeset
for help on using the changeset viewer.