Package org.eclipse.wb.internal.core.model.property

Examples of org.eclipse.wb.internal.core.model.property.Property


    {
      assertNotNull(PropertyUtils.getByPath(item, "Constructor/text"));
      assertNotNull(PropertyUtils.getByPath(item, "Constructor/cmd"));
    }
    // check "text" property
    Property textProperty = item.getPropertyByTitle("text");
    assertEquals("A", textProperty.getValue());
    textProperty.setValue("B");
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    MenuBar bar = new MenuBar();",
View Full Code Here


    {
      assertNotNull(PropertyUtils.getByPath(item, "Factory/text"));
      assertNotNull(PropertyUtils.getByPath(item, "Factory/cmd"));
    }
    // check "text" property
    Property textProperty = item.getPropertyByTitle("text");
    assertEquals("A", textProperty.getValue());
    textProperty.setValue("B");
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    MenuBar bar = new MenuBar();",
View Full Code Here

            "  }",
            "}");
    container.refresh();
    WidgetInfo button = container.getWidgets().get(0);
    VBoxLayoutDataInfo boxData = VBoxLayoutInfo.getVBoxData(button);
    Property marginAllProperty = boxData.getPropertyByTitle("margin-all");
    // set margin
    marginAllProperty.setValue(10);
    assertEditor(
        "public class Test extends LayoutContainer {",
        "  public Test() {",
        "    setLayout(new VBoxLayout());",
        "    {",
        "      Button button = new Button();",
        "      add(button, new VBoxLayoutData(10, 10, 10, 10));",
        "    }",
        "  }",
        "}");
    // set margin
    marginAllProperty.setValue(Property.UNKNOWN_VALUE);
    assertEditor(
        "public class Test extends LayoutContainer {",
        "  public Test() {",
        "    setLayout(new VBoxLayout());",
        "    {",
View Full Code Here

            "  }",
            "}");
    container.refresh();
    WidgetInfo button = container.getWidgets().get(0);
    VBoxLayoutDataInfo boxData = VBoxLayoutInfo.getVBoxData(button);
    Property marginTopProperty = boxData.getPropertyByTitle("margin-top");
    // set margin
    marginTopProperty.setValue(0);
    assertEditor(
        "public class Test extends LayoutContainer {",
        "  public Test() {",
        "    setLayout(new VBoxLayout());",
        "    {",
View Full Code Here

  private void assert_column_header(ColumnInfo column,
      boolean exist,
      boolean modified,
      Object value,
      Object newValue) throws Exception {
    Property property = column.getHeaderProperty();
    if (exist) {
      assertThat(property).isNotNull();
      assertThat(property.isModified()).isEqualTo(modified);
      assertThat(column.getPropertyByTitle("header")).isSameAs(property);
      if (value != null) {
        assertThat(property.getValue()).isEqualTo(value);
      } else {
        assertThat(property.getValue()).isNull();
      }
      property.setValue(newValue);
    } else {
      assertThat(property).isNull();
      assertThat(column.getPropertyByTitle("header")).isNull();
    }
  }
View Full Code Here

    // parse
    parseJavaInfo(get_widthProperty_lines(null));
    refresh();
    ColumnInfo column = getJavaInfoByName("column");
    // no "width" property
    Property property = column.getPropertyByTitle("width");
    assertNull(property);
  }
View Full Code Here

  public void test_widthProperty_asString() throws Exception {
    parseJavaInfo(get_widthProperty_lines("'150px'"));
    refresh();
    ColumnInfo column = getJavaInfoByName("column");
    // prepare property
    Property property = column.getPropertyByTitle("width");
    assertNotNull(property);
    // has value
    assertTrue(property.isModified());
    assertEquals("150px", property.getValue());
    // set value
    property.setValue("5cm");
    assertEditor(get_widthProperty_lines("'5cm'"));
    // remove value
    property.setValue(null);
    assertEditor(get_widthProperty_lines(null));
    // remove value (again), ignored
    property.setValue(null);
    assertEditor(get_widthProperty_lines(null));
    // generate new setColumnWidth()
    property.setValue("40mm");
    assertEditor(get_widthProperty_lines("'40mm'"));
    // remove again
    property.setValue(Property.UNKNOWN_VALUE);
    assertEditor(get_widthProperty_lines(null));
  }
View Full Code Here

  public void test_widthProperty_asValueUnit() throws Exception {
    parseJavaInfo(get_widthProperty_lines("30, Unit.MM"));
    refresh();
    ColumnInfo column = getJavaInfoByName("column");
    // prepare property
    Property property = column.getPropertyByTitle("width");
    assertNotNull(property);
    // has value
    assertTrue(property.isModified());
    assertEquals("30.0mm", property.getValue());
    // set value
    property.setValue("5cm");
    assertEditor(get_widthProperty_lines("5.0, Unit.CM"));
    // no unit, use PX
    property.setValue("123");
    assertEditor(get_widthProperty_lines("123.0, Unit.PX"));
    // bad value, ignored
    property.setValue("qwerty");
    assertEditor(get_widthProperty_lines("123.0, Unit.PX"));
    // bad unit, ignored
    property.setValue("10qw");
    assertEditor(get_widthProperty_lines("123.0, Unit.PX"));
    // remove value
    property.setValue(null);
    assertEditor(get_widthProperty_lines(null));
    // remove value (again)
    property.setValue(null);
  }
View Full Code Here

        "  }",
        "}");
    refresh();
    ColumnInfo column = getJavaInfoByName("column");
    // prepare property
    Property property = column.getPropertyByTitle("comparator");
    assertNotNull(property);
    // has value
    assertTrue(property.isModified());
    assertEquals("<comparator>", property.getValue());
    assertEquals("<comparator>", getPropertyText(property));
    // open Comparator
    {
      // set mock for DesignPageSite
      IDesignPageSite pageSite;
      Capture<Integer> openSourcePosition = new Capture<Integer>();
      {
        pageSite = EasyMock.createStrictMock(IDesignPageSite.class);
        pageSite.openSourcePosition(capture(openSourcePosition));
        EasyMock.replay(pageSite);
        // do set
        DesignPageSite.Helper.setSite(column, pageSite);
      }
      // ask open
      property.getEditor().doubleClick(property, null);
      waitEventLoop(0);
      // test results
      EasyMock.verify(pageSite);
      assertEquals(
          getNode("new Comparator").getStartPosition(),
          openSourcePosition.getValue().intValue());
    }
    // remove
    property.setValue(Property.UNKNOWN_VALUE);
    assertFalse(property.isModified());
    assertEquals("<empty>", property.getValue());
    assertEquals("<empty>", getPropertyText(property));
    assertEditor(
        "import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;",
        "public class Test extends CellTable<User> {",
        "  public Test() {",
        "    ListHandler<User> sortHandler = new ListHandler<User>(Collections.<User>emptyList());",
        "    addColumnSortHandler(sortHandler);",
        "    {",
        "      TextColumn<User> column = new TextColumn<User>() {",
        "        @Override",
        "        public String getValue(User object) {",
        "          return null;",
        "        }",
        "      };",
        "      addColumn(column);",
        "    }",
        "  }",
        "}");
    // try to remove again, no changes
    property.setValue(Property.UNKNOWN_VALUE);
  }
View Full Code Here

        "  }",
        "}");
    refresh();
    ColumnInfo column = getJavaInfoByName("column");
    // prepare property
    Property property = column.getPropertyByTitle("comparator");
    assertNotNull(property);
    // no value
    assertFalse(property.isModified());
    assertEquals("<empty>", property.getValue());
    assertEquals("<empty>", getPropertyText(property));
    // ask open
    {
      DesignPageSite.Helper.setSite(column, DesignPageSite.EMPTY);
      property.getEditor().doubleClick(property, null);
    }
    assertTrue(property.isModified());
    assertEquals("<comparator>", property.getValue());
    assertEquals("<comparator>", getPropertyText(property));
    assertEditor(
        "import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;",
        "public class Test extends CellTable<User> {",
        "  public Test() {",
View Full Code Here

TOP

Related Classes of org.eclipse.wb.internal.core.model.property.Property

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.