]> source.dussan.org Git - vaadin-framework.git/commitdiff
added api for components to check testing mode, added TT anchor for FilterSelect...
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 15 Jan 2008 10:38:40 +0000 (10:38 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 15 Jan 2008 10:38:40 +0000 (10:38 +0000)
svn changeset:3510/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java

index f4f3e4658ee25403443276ce6858bf705ec466c2..a94b17e8cfa38128759dde99f76df5fa671ba09a 100755 (executable)
@@ -45,6 +45,8 @@ public class ApplicationConnection {
 
     private static Console console;
 
+    private static boolean testingMode;
+
     private final Vector pendingVariables = new Vector();
 
     private final HashMap idToPaintable = new HashMap();
@@ -82,7 +84,7 @@ public class ApplicationConnection {
             console = new NullConsole();
         }
 
-        if (isTestingMode()) {
+        if (checkTestingMode()) {
             usePaintableIdsInDOM = true;
             initializeTestingTools(getTestServerUri(), this);
         }
@@ -100,9 +102,25 @@ public class ApplicationConnection {
         return $wnd.itmill.testingToolsUri;
     }-*/;
 
-    private native static boolean isTestingMode()
+    /**
+     * Method to check if application is in testing mode. Can be used after
+     * application init.
+     * 
+     * @return true if in testing mode
+     */
+    public static boolean isTestingMode() {
+        return testingMode;
+    }
+
+    /**
+     * Check is application is run in testing mode.
+     * 
+     * @return true if in testing mode
+     */
+    private native static boolean checkTestingMode()
     /*-{
-        return $wnd.itmill.testingToolsUri ? true : false;
+        @com.itmill.toolkit.terminal.gwt.client.ApplicationConnection::testingMode = $wnd.itmill.testingToolsUri ? true : false;
+        return @com.itmill.toolkit.terminal.gwt.client.ApplicationConnection::testingMode;
     }-*/;
 
     private native static void initializeTestingTools(String testServerUri,
index 238afd859bc31ecbf7027142b60246ad9092081d..5ab45205b153b7ea4aa4f29f47ae1fb3a62ee823 100644 (file)
@@ -125,6 +125,13 @@ public class IFilterSelect extends Composite implements Paintable,
 
         public void showSuggestions(Collection currentSuggestions,
                 int currentPage, int totalSuggestions) {
+
+            if (ApplicationConnection.isTestingMode()) {
+                // Add TT anchor point
+                DOM.setElementProperty(getElement(), "id", paintableId
+                        + "_OPTIONLIST");
+            }
+
             menu.setSuggestions(currentSuggestions);
             final int x = IFilterSelect.this.getAbsoluteLeft();
             int y = tb.getAbsoluteTop();