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

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


  private void removeHtmlProperty_whenAddChild() {
    addBroadcastListener(new JavaEventListener() {
      @Override
      public void addAfter(JavaInfo parent, JavaInfo child) throws Exception {
        if (parent == PanelInfo.this) {
          Property property = getPropertyByTitle("html");
          if (property.isModified()) {
            property.setValue(Property.UNKNOWN_VALUE);
          }
        }
      }
    });
  }
View Full Code Here


  /**
   * Fetches initial col/row snap values.
   */
  void initializeSpans() throws Exception {
    {
      Property property = getPropertyByTitle("colspan");
      width = property.isModified() ? (Integer) property.getValue() : 1;
    }
    {
      Property property = getPropertyByTitle("rowspan");
      height = property.isModified() ? (Integer) property.getValue() : 1;
    }
  }
View Full Code Here

  // Access
  //
  ////////////////////////////////////////////////////////////////////////////
  public void setWidth(double width) throws Exception {
    materialize();
    Property property = PropertyUtils.getByPath(this, "Constructor/columnWidth");
    if (property != null) {
      property.setValue(width);
    }
  }
View Full Code Here

  public boolean isChecked() throws Exception {
    return (Boolean) ReflectionUtils.invokeMethod(getObject(), "isChecked()");
  }

  public boolean isCheckedProperty() throws Exception {
    Property property = getPropertyByTitle("checked");
    return (Boolean) property.getValue();
  }
View Full Code Here

            "  }",
            "}");
    panel.refresh();
    WidgetInfo button = getJavaInfoByName("button");
    //
    Property property = button.getPropertyByTitle("HeaderText");
    assertNotNull(property);
    assertTrue(property.getCategory().isSystem());
    assertEquals("My widget", property.getValue());
    // test that "HeaderText" is not considered as "text" property of "button"
    assertEquals("button", ObjectsLabelProvider.INSTANCE.getText(button));
    // set new value
    property.setValue("New text");
    assertEditor(
        "public class Test extends StackLayoutPanel {",
        "  public Test() {",
        "    super(Unit.EM);",
        "    {",
View Full Code Here

    assertTrue(button.getPropertyByTitle("width").getCategory().isHidden());
    assertTrue(button.getPropertyByTitle("height").getCategory().isHidden());
  }

  public void test_sizeProperty_noSize() throws Exception {
    Property sizeProperty = getSizeProperty("");
    assertTrue(sizeProperty.getCategory().isSystem());
    // value for this property is always "null"
    assertNull(sizeProperty.getValue());
    // no any size-related invocations, so property is not modified
    assertFalse(sizeProperty.isModified());
    // text, we don't know exact value, but know format
    assertThat(getPropertyText(sizeProperty)).contains("(").contains(",").contains(")");
  }
View Full Code Here

    // text, we don't know exact value, but know format
    assertThat(getPropertyText(sizeProperty)).contains("(").contains(",").contains(")");
  }

  public void test_sizeProperty_setSize() throws Exception {
    Property sizeProperty = getSizeProperty("button.setSize('10cm', '20mm');");
    assertTrue(sizeProperty.getCategory().isSystem());
    // value for this property is always "null"
    assertNull(sizeProperty.getValue());
    // we have "setSize()" invocation, so property is modified
    assertTrue(sizeProperty.isModified());
    // text
    assertEquals("(10cm, 20mm)", getPropertyText(sizeProperty));
    // setValue() does nothing
    {
      String expectedSource = m_lastEditor.getSource();
      sizeProperty.setValue(null);
      assertEditor(expectedSource, m_lastEditor);
    }
    // sub-properties
    {
      Property[] subProperties = getSubProperties(sizeProperty);
      // check "width"
      {
        Property widthProperty = subProperties[0];
        assertEquals("width", widthProperty.getTitle());
        assertTrue(widthProperty.isModified());
        assertEquals("10cm", widthProperty.getValue());
        // reset width
        setSizeProperty(widthProperty, Property.UNKNOWN_VALUE);
        assertEditor(getSizeSource("button.setHeight('20mm');"), m_lastEditor);
        // restore width
        setSizeProperty(widthProperty, "5in");
        assertEditor(getSizeSource("button.setSize('5in', '20mm');"), m_lastEditor);
      }
      // check "height"
      {
        Property heightProperty = subProperties[1];
        assertEquals("height", heightProperty.getTitle());
        assertTrue(heightProperty.isModified());
        assertEquals("20mm", heightProperty.getValue());
        // reset width
        setSizeProperty(heightProperty, Property.UNKNOWN_VALUE);
        assertEditor(getSizeSource("button.setWidth('5in');"), m_lastEditor);
        // restore width
        setSizeProperty(heightProperty, "2cm");
View Full Code Here

      }
    }
  }

  public void test_sizeProperty_removeSize() throws Exception {
    Property sizeProperty = getSizeProperty("button.setSize('10cm', '20mm');");
    assertTrue(sizeProperty.getCategory().isSystem());
    // use setValue() to remove size
    sizeProperty.setValue(Property.UNKNOWN_VALUE);
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    {",
View Full Code Here

            "    RootPanel rootPanel = RootPanel.get();",
            "  }",
            "}");
    frame.refresh();
    //
    Property property = PropertyUtils.getByPath(frame, "Size/width");
    property.setValue("200px");
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    rootPanel.setWidth('200px');",
View Full Code Here

            "  }",
            "}");
    panel.refresh();
    WidgetInfo button = getJavaInfoByName("button");
    //
    Property property = button.getPropertyByTitle("TabText");
    assertNotNull(property);
    assertTrue(property.getCategory().isSystem());
    assertEquals("My widget", property.getValue());
    // test that "TabText" is not considered as "text" property of "button"
    assertEquals("button", ObjectsLabelProvider.INSTANCE.getText(button));
    // set new value
    property.setValue("New text");
    assertEditor(
        "public class Test extends TabLayoutPanel {",
        "  public Test() {",
        "    super(1.5, Unit.EM);",
        "    {",
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.