예제 #1
0
 /** Has constructor marked with @UiConstructor, but it has no parameters, so no properties. */
 public void test_hasUiConstructor_noParameters() throws Exception {
   dontUseSharedGWTState();
   setFileContentSrc(
       "test/client/MyButton.java",
       getJavaSource(
           "import com.google.gwt.uibinder.client.UiConstructor;",
           "// filler filler filler filler filler",
           "// filler filler filler filler filler",
           "public class MyButton extends Button {",
           "  @UiConstructor",
           "  public MyButton() {",
           "  }",
           "}"));
   waitForAutoBuild();
   // parse
   parse(
       "// filler filler filler filler filler",
       "// filler filler filler filler filler",
       "<ui:UiBinder>",
       "  <g:FlowPanel>",
       "    <t:MyButton wbp:name='button'/>",
       "  </g:FlowPanel>",
       "</ui:UiBinder>");
   refresh();
   WidgetInfo button = getObjectByName("button");
   // no UiConstructor property
   assertNull(button.getPropertyByTitle("UiConstructor"));
 }
예제 #2
0
 public void test_hasUiConstructor_disabled() throws Exception {
   dontUseSharedGWTState();
   setFileContentSrc(
       "test/client/MyButton.java",
       getJavaSource(
           "import com.google.gwt.uibinder.client.UiConstructor;",
           "// filler filler filler filler filler",
           "// filler filler filler filler filler",
           "public class MyButton extends Button {",
           "  @UiConstructor",
           "  public MyButton(int foo, String bar) {",
           "  }",
           "}"));
   setFileContentSrc(
       "test/client/MyButton.wbp-component.xml",
       getSourceDQ(
           "<?xml version='1.0' encoding='UTF-8'?>",
           "<component xmlns='http://www.eclipse.org/wb/WBPComponent'>",
           "  <parameters>",
           "    <parameter name='UiConstructor.disabled'>true</parameter>",
           "  </parameters>",
           "</component>"));
   waitForAutoBuild();
   // parse
   parse(
       "// filler filler filler filler filler",
       "// filler filler filler filler filler",
       "<ui:UiBinder>",
       "  <g:FlowPanel>",
       "    <t:MyButton wbp:name='button' foo='1' bar='abc'/>",
       "  </g:FlowPanel>",
       "</ui:UiBinder>");
   refresh();
   WidgetInfo button = getObjectByName("button");
   // no UiConstructor property
   assertSame(null, button.getPropertyByTitle("UiConstructor"));
 }