Package com.google.gdt.eclipse.designer.smart.model.form

Examples of com.google.gdt.eclipse.designer.smart.model.form.DynamicFormInfo


              "  com.google.gwt.user.client.ui.RootPanel __wbp_panel = com.google.gwt.user.client.ui.RootPanel.get();",
              "  __wbp_panel.setPixelSize(800, 600);",};
      panel = (RootPanelInfo) parse(sourceLines);
    }
    // prepare Canvas
    final DynamicFormInfo parentCanvas =
        (DynamicFormInfo) JavaInfoUtils.createJavaInfo(
            m_editor,
            "com.smartgwt.client.widgets.form.DynamicForm",
            new ConstructorCreationSupport());
    {
      // drop Canvas on RootPanel
      panel.command_CREATE2(parentCanvas, null);
      panel.command_BOUNDS(parentCanvas, new Point(10, 10), new Dimension(700, 500));
      // broadcast for set widget as "live"
      parentCanvas.addBroadcastListener(new JavaInfoSetObjectAfter() {
        public void invoke(JavaInfo target, Object o) throws Exception {
          if (target == parentCanvas) {
            parentCanvas.removeBroadcastListener(this);
            m_utils.setLiveWidget(o);
          }
        }
      });
    }
    // prepare component
    FormItemInfo formItem = createClone();
    // add component on Canvas
    parentCanvas.command_CREATE(formItem, null);
    // remove "live" mark from RootPanel,
    // because only one instance of RootPanel exists, so we update it also for "main" hierarchy
    panel.getPropertyByTitle("title").setValue(null);
    // ready to get live values
    return formItem;
View Full Code Here


  ////////////////////////////////////////////////////////////////////////////
  /**
   * Parsing.
   */
  public void test_parse() throws Exception {
    DynamicFormInfo form =
        parseJavaInfo(
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    DynamicForm form = new DynamicForm();",
            "    FormItem field = new TextItem('field', 'Field');",
            "    form.setFields(new FormItem[] { field });",
            "    form.draw();",
            "  }",
            "}");
    form.refresh();
    //
    FormItemInfo formItem = form.getItems().get(0);
    Integer width = Expectations.get(150, new IntValue[]{new IntValue("flanker-desktop", 146)});
    assertThat(formItem.getModelBounds()).isEqualTo(new Rectangle(28, 0, width, 22));
  }
View Full Code Here

    Integer width = Expectations.get(150, new IntValue[]{new IntValue("flanker-desktop", 146)});
    assertThat(formItem.getModelBounds()).isEqualTo(new Rectangle(28, 0, width, 22));
  }

  public void test_parse_this() throws Exception {
    DynamicFormInfo form =
        parseJavaInfo(
            "public class Test extends DynamicForm {",
            "  public Test() {",
            "    FormItem field = new TextItem('field', 'Field');",
            "    setFields(new FormItem[] { field });",
            "  }",
            "}");
    form.refresh();
    //
    FormItemInfo formItem = form.getItems().get(0);
    Integer left = Expectations.get(28, new IntValue[]{new IntValue("flanker-desktop", 100)});
    Integer width = Expectations.get(150, new IntValue[]{new IntValue("flanker-desktop", 146)});
    assertThat(formItem.getModelBounds()).isEqualTo(new Rectangle(left, 0, width, 22));
  }
View Full Code Here

   * Test restriction for "name" property value.
   * <p>
   * We need this because SmartGWT does not allow spaces in field name.
   */
  public void test_name_property() throws Exception {
    DynamicFormInfo form =
        parseJavaInfo(
            "public class Test extends DynamicForm {",
            "  public Test() {",
            "    FormItem field = new TextItem('field', 'Field');",
            "    setFields(new FormItem[] { field });",
            "  }",
            "}");
    form.refresh();
    //
    FormItemInfo formItem = form.getItems().get(0);
    Property nameProperty = formItem.getPropertyByTitle("name");
    assertThat(nameProperty.getValue()).isEqualTo("field");
    // set new "name"
    nameProperty.setValue("field 1");
    // check corrected value
View Full Code Here

  /**
   * Live image.
   */
  public void test_liveImage() throws Exception {
    DynamicFormInfo form = parseJavaInfo( // filler
        "public class Test extends DynamicForm {",
        "  public Test() {",
        "  }",
        "}");
    form.refresh();
    //
    FormItemInfo newField = createJavaInfo("com.smartgwt.client.widgets.form.fields.TextItem");
    assertNotNull(newField.getImage());
  }
View Full Code Here

    FormItemInfo newField = createJavaInfo("com.smartgwt.client.widgets.form.fields.TextItem");
    assertNotNull(newField.getImage());
  }

  public void test_bounds_property() throws Exception {
    DynamicFormInfo form =
        parseJavaInfo(
            "public class Test extends DynamicForm {",
            "  public Test() {",
            "    setItemLayout(FormLayoutType.ABSOLUTE);",
            "    FormItem field = new TextItem('field', 'Field');",
            "    setFields(new FormItem[] { field });",
            "  }",
            "}");
    form.refresh();
    //
    FormItemInfo item = form.getItems().get(0);
    Property property = item.getPropertyByTitle("Bounds");
    assertThat(property).isNotNull();
    assertThat(property).isInstanceOf(ComplexProperty.class);
  }
View Full Code Here

    assertThat(property).isNotNull();
    assertThat(property).isInstanceOf(ComplexProperty.class);
  }

  public void test_canvasItem() throws Exception {
    DynamicFormInfo form = parseJavaInfo( // filler
        "public class Test extends DynamicForm {",
        "  public Test() {",
        //"    setItemLayout(FormLayoutType.ABSOLUTE);",
        "    CanvasItem field = new CanvasItem('field');",
        "    Label label = new Label('Label');",
        "    field.setCanvas(label);",
        "    setFields(new FormItem[] { field });",
        "  }",
        "}");
    form.refresh();
    //
    CanvasItemInfo canvasItem = (CanvasItemInfo) form.getItems().get(0);
    CanvasInfo canvas = canvasItem.getCanvas();
    assertThat(canvas).isNotNull();
    assertThat(canvasItem.getBounds().getSize()).isEqualTo(new Dimension(350, 100));
  }
View Full Code Here

  //
  // Bounds
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_setLeft_setTop() throws Exception {
    DynamicFormInfo form =
        parseJavaInfo(
            "public class Test extends DynamicForm {",
            "  public Test() {",
            "    setItemLayout(FormLayoutType.ABSOLUTE);",
            "    FormItem field = new TextItem('field', 'Field');",
            "    field.setLeft(70);",
            "    field.setTop(50);",
            "    setFields(new FormItem[] { field });",
            "  }",
            "}");
    form.refresh();
    //
    FormItemInfo item = form.getItems().get(0);
    Rectangle bounds = item.getBounds();
    assertThat(bounds.getLocation()).isEqualTo(new Point(70, 50));
  }
View Full Code Here

    Rectangle bounds = item.getBounds();
    assertThat(bounds.getLocation()).isEqualTo(new Point(70, 50));
  }

  public void test_setWidth_setHeight() throws Exception {
    DynamicFormInfo form =
        parseJavaInfo(
            "public class Test extends DynamicForm {",
            "  public Test() {",
            "    setItemLayout(FormLayoutType.ABSOLUTE);",
            "    FormItem field = new TextItem('field', 'Field');",
            "    field.setWidth(150);",
            "    field.setHeight(100);",
            "    setFields(new FormItem[] { field });",
            "  }",
            "}");
    form.refresh();
    //
    FormItemInfo item = form.getItems().get(0);
    Rectangle bounds = item.getBounds();
    assertThat(bounds.getSize()).isEqualTo(new Dimension(150, 100));
  }
View Full Code Here

    Rectangle bounds = item.getBounds();
    assertThat(bounds.getSize()).isEqualTo(new Dimension(150, 100));
  }

  public void test_bounds_update() throws Exception {
    DynamicFormInfo form =
        parseJavaInfo(
            "public class Test extends DynamicForm {",
            "  public Test() {",
            "    setItemLayout(FormLayoutType.ABSOLUTE);",
            "    FormItem field = new TextItem('field', 'Field');",
            "    setFields(new FormItem[] { field });",
            "  }",
            "}");
    form.refresh();
    // set new bounds
    FormItemInfo item = form.getItems().get(0);
    form.command_BOUNDS(item, new Point(30, 20), new Dimension(150, 100));
    form.refresh();
    // check bounds
    Rectangle bounds = item.getBounds();
    assertThat(bounds.getLocation()).isEqualTo(new Point(30, 20));
    assertThat(bounds.getSize()).isEqualTo(new Dimension(150, 100));
    assertEditor(
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.smart.model.form.DynamicFormInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.