aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2007-12-14 09:51:46 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2007-12-14 09:51:46 +0000
commit4d20bbdb46c3ad38e341a432867bbf5881836b2b (patch)
tree9b22626790db9289621229b50aed93ee0f972a15
parente294decedef3925ccd8bd0e1582409478825a0ab (diff)
downloadvaadin-framework-4d20bbdb46c3ad38e341a432867bbf5881836b2b.tar.gz
vaadin-framework-4d20bbdb46c3ad38e341a432867bbf5881836b2b.zip
added testingId field to Paintable
svn changeset:3240/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/data/Buffered.java10
-rw-r--r--src/com/itmill/toolkit/data/Validator.java9
-rw-r--r--src/com/itmill/toolkit/terminal/CompositeErrorMessage.java9
-rw-r--r--src/com/itmill/toolkit/terminal/Paintable.java11
-rw-r--r--src/com/itmill/toolkit/terminal/SystemError.java9
-rw-r--r--src/com/itmill/toolkit/terminal/UserError.java9
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java6
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java6
-rw-r--r--src/com/itmill/toolkit/ui/AbstractComponent.java10
-rw-r--r--src/com/itmill/toolkit/ui/CustomComponent.java10
10 files changed, 85 insertions, 4 deletions
diff --git a/src/com/itmill/toolkit/data/Buffered.java b/src/com/itmill/toolkit/data/Buffered.java
index bddcb8489e..450d63c37c 100644
--- a/src/com/itmill/toolkit/data/Buffered.java
+++ b/src/com/itmill/toolkit/data/Buffered.java
@@ -298,5 +298,15 @@ public interface Buffered {
public void requestRepaintRequests() {
}
+ public String getTestingIdentifier() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setTestingIdentifier(String id) {
+ throw new UnsupportedOperationException(
+ "Setting testing id for this Paintable is not implemented");
+ }
+
}
}
diff --git a/src/com/itmill/toolkit/data/Validator.java b/src/com/itmill/toolkit/data/Validator.java
index b56186bf69..e2cb3b31f9 100644
--- a/src/com/itmill/toolkit/data/Validator.java
+++ b/src/com/itmill/toolkit/data/Validator.java
@@ -162,5 +162,14 @@ public interface Validator {
public void requestRepaintRequests() {
}
+ public String getTestingIdentifier() {
+ return null;
+ }
+
+ public void setTestingIdentifier(String id) {
+ throw new UnsupportedOperationException(
+ "Setting testing id for this Paintable is not implemented");
+ }
+
}
}
diff --git a/src/com/itmill/toolkit/terminal/CompositeErrorMessage.java b/src/com/itmill/toolkit/terminal/CompositeErrorMessage.java
index ba3616466c..da4533e629 100644
--- a/src/com/itmill/toolkit/terminal/CompositeErrorMessage.java
+++ b/src/com/itmill/toolkit/terminal/CompositeErrorMessage.java
@@ -174,4 +174,13 @@ public class CompositeErrorMessage implements ErrorMessage {
return retval;
}
+
+ public String getTestingIdentifier() {
+ return null;
+ }
+
+ public void setTestingIdentifier(String id) {
+ throw new UnsupportedOperationException(
+ "Setting testing id for this Paintable is not implemented");
+ }
}
diff --git a/src/com/itmill/toolkit/terminal/Paintable.java b/src/com/itmill/toolkit/terminal/Paintable.java
index aad66cdaf2..4ea9b4ed5e 100644
--- a/src/com/itmill/toolkit/terminal/Paintable.java
+++ b/src/com/itmill/toolkit/terminal/Paintable.java
@@ -44,6 +44,17 @@ public interface Paintable extends java.util.EventListener {
public void requestRepaint();
/**
+ * Adds an unique id for component that get's transferred to terminal for
+ * testing purposes.
+ *
+ * @param id
+ * A short (< 20 chars) alphanumeric indentifier
+ */
+ public void setTestingIdentifier(String id);
+
+ public String getTestingIdentifier();
+
+ /**
* Repaint request event is thrown when the paintable needs to be repainted.
* This is typically done when the <code>paint</code> method would return
* dissimilar UIDL from the previous call of the method.
diff --git a/src/com/itmill/toolkit/terminal/SystemError.java b/src/com/itmill/toolkit/terminal/SystemError.java
index f5f3623ef5..b8571323fe 100644
--- a/src/com/itmill/toolkit/terminal/SystemError.java
+++ b/src/com/itmill/toolkit/terminal/SystemError.java
@@ -123,4 +123,13 @@ public class SystemError extends RuntimeException implements ErrorMessage {
public void requestRepaintRequests() {
}
+ public String getTestingIdentifier() {
+ return null;
+ }
+
+ public void setTestingIdentifier(String id) {
+ throw new UnsupportedOperationException(
+ "Setting testing id for this Paintable is not implemented");
+ }
+
}
diff --git a/src/com/itmill/toolkit/terminal/UserError.java b/src/com/itmill/toolkit/terminal/UserError.java
index 8d13b3c155..5318dbc686 100644
--- a/src/com/itmill/toolkit/terminal/UserError.java
+++ b/src/com/itmill/toolkit/terminal/UserError.java
@@ -140,4 +140,13 @@ public class UserError implements ErrorMessage {
return msg;
}
+ public String getTestingIdentifier() {
+ return null;
+ }
+
+ public void setTestingIdentifier(String id) {
+ throw new UnsupportedOperationException(
+ "Setting testing id for this Paintable is not implemented");
+ }
+
}
diff --git a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java
index bdc93fcd0b..b6b0792a3f 100644
--- a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java
+++ b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java
@@ -723,9 +723,9 @@ public class ApplicationServlet extends HttpServlet {
if (testingToolsServerUri == null) {
// Default behavior is that ATFServer application exists on
// same application server as current application does.
- testingToolsServerUri = "http" + (request.isSecure() ? "s" : "")
- + "://" + request.getServerName() + ":"
- + request.getLocalPort() + "/ATF/ATFServer";
+ testingToolsServerUri = "http" + (request.isSecure() ? "s" : "") + "://"
+ + request.getServerName() + ":" + request.getLocalPort()
+ + "/ATF/ATFServer";
}
return testingToolsServerUri;
}
diff --git a/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java b/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java
index a73d6acc39..e636f47105 100644
--- a/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java
+++ b/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java
@@ -737,7 +737,11 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
String id = (String) paintableIdMap.get(paintable);
if (id == null) {
- id = "PID" + Integer.toString(idSequence++);
+ // use testing identifier as id if set
+ id = paintable.getTestingIdentifier();
+ if (id == null) {
+ id = "PID" + Integer.toString(idSequence++);
+ }
paintableIdMap.put(paintable, id);
idPaintableMap.put(id, paintable);
}
diff --git a/src/com/itmill/toolkit/ui/AbstractComponent.java b/src/com/itmill/toolkit/ui/AbstractComponent.java
index d62939add7..8750fbce8f 100644
--- a/src/com/itmill/toolkit/ui/AbstractComponent.java
+++ b/src/com/itmill/toolkit/ui/AbstractComponent.java
@@ -113,6 +113,8 @@ public abstract class AbstractComponent implements Component, MethodEventSource
*/
private boolean repaintRequestListenersNotified = false;
+ private String testingId;
+
/* Constructor ***************************************************** */
/**
@@ -130,6 +132,14 @@ public abstract class AbstractComponent implements Component, MethodEventSource
*/
public abstract String getTag();
+ public void setTestingIdentifier(String id) {
+ testingId = id;
+ }
+
+ public String getTestingIdentifier() {
+ return testingId;
+ }
+
/**
* Gets style for component. Multiple styles are joined with spaces.
*
diff --git a/src/com/itmill/toolkit/ui/CustomComponent.java b/src/com/itmill/toolkit/ui/CustomComponent.java
index 42fadb63dd..f407d1b05a 100644
--- a/src/com/itmill/toolkit/ui/CustomComponent.java
+++ b/src/com/itmill/toolkit/ui/CustomComponent.java
@@ -62,6 +62,8 @@ public class CustomComponent implements Component {
*/
private boolean repaintRequestListenersNotified = false;
+ private String testingId;
+
/**
* Constructs a new custom component.
*
@@ -498,4 +500,12 @@ public class CustomComponent implements Component {
}
+ public void setTestingIdentifier(String id) {
+ testingId = id;
+ }
+
+ public String getTestingIdentifier() {
+ return testingId;
+ }
+
}