]> source.dussan.org Git - vaadin-framework.git/commitdiff
Added support for a Log component
authorArtur Signell <artur.signell@itmill.com>
Tue, 12 Oct 2010 05:27:08 +0000 (05:27 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 12 Oct 2010 05:27:08 +0000 (05:27 +0000)
svn changeset:15495/svn branch:6.4

tests/src/com/vaadin/tests/components/ComponentTestCase.java

index 883812159a752f91a3e7035cf72f52acff60c1fb..0d28ad63958fa40d4adfc6b963e1515fd4576ac2 100644 (file)
@@ -8,6 +8,7 @@ import com.vaadin.data.Item;
 import com.vaadin.data.Property;
 import com.vaadin.data.Property.ValueChangeEvent;
 import com.vaadin.terminal.UserError;
+import com.vaadin.tests.util.Log;
 import com.vaadin.ui.AbstractComponent;
 import com.vaadin.ui.Alignment;
 import com.vaadin.ui.Button;
@@ -31,6 +32,8 @@ public abstract class ComponentTestCase<T extends AbstractComponent> extends
 
     abstract protected void initializeComponents();
 
+    private Log log = null;
+
     @Override
     protected final void setup() {
         ((SpacingHandler) getLayout()).setSpacing(true);
@@ -256,4 +259,20 @@ public abstract class ComponentTestCase<T extends AbstractComponent> extends
     protected String getDescription() {
         return "Generic test case for " + getTestClass().getSimpleName();
     }
+
+    protected void enableLog() {
+        if (log == null) {
+            log = new Log(5).setNumberLogRows(true);
+            getLayout().addComponent(log, 1);
+        }
+
+    }
+
+    protected void log(String msg) {
+        if (log == null) {
+            throw new IllegalStateException(
+                    "Use enableLog() before calling log()");
+        }
+        log.log(msg);
+    }
 }