All relevant code is under try catch block. Activated by setting "statistics" parameter on ServletContainer (web.xml).
svn changeset:903/svn branch:trunk
public void valueChange(Property.ValueChangeEvent event) {
+ // FIXME: navigation statistics
+ try {
+ if ((event.getProperty().toString() == null)
+ && ((AbstractComponent) event.getProperty()).getTag()
+ .equals("tree")) {
+ // ignore tree initialization
+ } else {
+ FeatureUtil.debug(getApplication().getUser().toString(),
+ "valueChange "
+ + ((AbstractComponent) event.getProperty())
+ .getTag() + ", " + event.getProperty());
+ }
+ } catch (Exception e) {
+ // ignored, should never happen
+ }
+
// Change feature
if (event.getProperty() == features) {
Object id = features.getValue();
}
public void buttonClick(ClickEvent event) {
+ // FIXME: navigation statistics
+ try {
+ FeatureUtil.debug(getApplication().getUser().toString(),
+ "buttonClick " + event.getButton().getTag() + ", "
+ + event.getButton().getCaption() + ", "
+ + event.getButton().getValue());
+ } catch (Exception e) {
+ // ignored, should never happen
+ }
+
if (properties != null)
properties.setVisible(((Boolean) propertiesSelect.getValue())
.booleanValue());
--- /dev/null
+package com.itmill.toolkit.demo.features;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class FeatureUtil {
+
+ private static boolean statistics = false;
+
+ public static final SimpleDateFormat format = new SimpleDateFormat(
+ "yyyyMMdd HHmmss");
+
+ public static void debug(String userIdentity, String msg) {
+ if (statistics)
+ System.out.println("[" + userIdentity + "] " + msg);
+ }
+
+ public static String getTimestamp() {
+ if (statistics)
+ try {
+ return format.format(new Date());
+ } catch (Exception e) {
+ // ignored, should never happen
+ }
+ return "";
+ }
+
+ public static void setStatistics(boolean statistics) {
+ FeatureUtil.statistics = statistics;
+ }
+}
public class FeaturesApplication extends com.itmill.toolkit.Application {
public void init() {
+ if (getProperty("statistics") != null)
+ FeatureUtil.setStatistics(true);
+ setUser(new Long(System.currentTimeMillis()).toString());
Window main = new Window("IT Mill Toolkit Features Tour");
setMainWindow(main);
main.addComponent(new FeatureBrowser());
public void terminalError(
com.itmill.toolkit.terminal.Terminal.ErrorEvent event) {
Throwable e = event.getThrowable();
+ FeatureUtil.debug(getUser().toString(), "terminalError: "
+ + e.toString());
e.printStackTrace();
}
super.getDescription().setValue(
description + "<br />Browser: "
+ webBrowser.getBrowserApplication());
+ try {
+ FeatureUtil.debug(getApplication().getUser().toString(),
+ "timestamp=[" + FeatureUtil.getTimestamp()
+ + "] userAgent=["
+ + webBrowser.getBrowserApplication() + "]");
+ } catch (Exception e) {
+ // ignored, should never happen
+ }
}
}
super.paint(target);
private Button setButton = new Button("Set", this);
private Button discardButton = new Button("Discard changes", this);
-
+
private Table allProperties = new Table();
private Object objectToConfigure;
updatePropertyList();
}
- /** Handle all button clicks for this panel */
- public void buttonClick(Button.ClickEvent event) {
-
- // Commit all changed on all forms
- if (event.getButton() == setButton) {
- for (Iterator i = forms.iterator(); i.hasNext();)
- ((Form) i.next()).commit();
- }
-
- // Discard all changed on all forms
- if (event.getButton() == discardButton) {
- for (Iterator i = forms.iterator(); i.hasNext();)
- ((Form) i.next()).discard();
- }
-
- }
-
/** Recreate property list contents */
public void updatePropertyList() {
/** Value change listener for listening selections */
public void valueChange(Property.ValueChangeEvent event) {
+ // FIXME: navigation statistics
+ try {
+ FeatureUtil.debug(getApplication().getUser().toString(),
+ "valueChange "
+ + ((AbstractComponent) event.getProperty())
+ .getTag() + ", " + event.getProperty());
+ } catch (Exception e) {
+ // ignored, should never happen
+ }
+
// Adding components to component container
if (event.getProperty() == addComponent) {
String value = (String) addComponent.getValue();
}
}
+ /** Handle all button clicks for this panel */
+ public void buttonClick(Button.ClickEvent event) {
+ // FIXME: navigation statistics
+ try {
+ FeatureUtil.debug(getApplication().getUser().toString(),
+ "buttonClick " + event.getButton().getTag() + ", "
+ + event.getButton().getCaption() + ", "
+ + event.getButton().getValue());
+ } catch (Exception e) {
+ // ignored, should never happen
+ }
+ // Commit all changed on all forms
+ if (event.getButton() == setButton) {
+ for (Iterator i = forms.iterator(); i.hasNext();)
+ ((Form) i.next()).commit();
+ }
+
+ // Discard all changed on all forms
+ if (event.getButton() == discardButton) {
+ for (Iterator i = forms.iterator(); i.hasNext();)
+ ((Form) i.next()).discard();
+ }
+
+ }
+
/**
* Helper function for creating forms from array of propety names.
*/