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

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


            "  }",
            "}");
    frame.refresh();
    WidgetInfo button = getJavaInfoByName("button");
    //
    Property leftProperty = PropertyUtils.getByPath(button, "Anchor H/left unit");
    assertNotNull(leftProperty);
    assertTrue(leftProperty.isModified());
    assertEquals("PX", getPropertyText(leftProperty));
    leftProperty.setValue("EX");
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootLayoutPanel rootPanel = RootLayoutPanel.get();",
        "    {",
View Full Code Here


            "  }",
            "}");
    frame.refresh();
    WidgetInfo button = getJavaInfoByName("button");
    //
    Property topProperty = PropertyUtils.getByPath(button, "Anchor V/top unit");
    assertNotNull(topProperty);
    assertTrue(topProperty.isModified());
    assertEquals("PX", getPropertyText(topProperty));
    topProperty.setValue("MM");
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootLayoutPanel rootPanel = RootLayoutPanel.get();",
        "    {",
View Full Code Here

            "}");
    frame.refresh();
    DockPanelInfo panel = (DockPanelInfo) frame.getChildrenWidgets().get(0);
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    // check that "Direction" property exists
    Property directionProperty;
    {
      directionProperty = button.getPropertyByTitle("Direction");
      assertNotNull(directionProperty);
      // same instance each time
      assertSame(directionProperty, button.getPropertyByTitle("Direction"));
      // presentation
      assertEquals("Direction", directionProperty.getTitle());
      assertTrue(directionProperty.getCategory().isSystem());
      assertTrue(directionProperty.isModified());
    }
    // current value
    assertEquals("WEST", getPropertyText(directionProperty));
    // set new value
    {
      Object northObject = ReflectionUtils.getFieldObject(panel.getObject(), "NORTH");
      directionProperty.setValue(northObject);
    }
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
View Full Code Here

            "}");
    frame.refresh();
    DockPanelInfo panel = (DockPanelInfo) frame.getChildrenWidgets().get(0);
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    // check that "Cell" property exists
    Property cellProperty;
    {
      cellProperty = button.getPropertyByTitle("Cell");
      assertNotNull(cellProperty);
      // same instance each time
      assertSame(cellProperty, button.getPropertyByTitle("Cell"));
      // presentation
      assertEquals("Cell", cellProperty.getTitle());
      assertTrue(cellProperty.getCategory().isSystem());
      assertFalse(cellProperty.isModified());
      assertEquals("(cell properties)", getPropertyText(cellProperty));
    }
    // sub-properties
    Property[] subProperties = getSubProperties(cellProperty);
    // check "width"
    {
      Property widthProperty = getPropertyByTitle(subProperties, "width");
      assertFalse(widthProperty.isModified());
      assertEquals("", widthProperty.getValue());
      // set new value
      widthProperty.setValue("5cm");
      assertEditor(
          "public class Test implements EntryPoint {",
          "  public void onModuleLoad() {",
          "    RootPanel rootPanel = RootPanel.get();",
          "    DockPanel panel = new DockPanel();",
          "    rootPanel.add(panel);",
          "    {",
          "      Button button = new Button();",
          "      panel.add(button, DockPanel.WEST);",
          "      panel.setCellWidth(button, '5cm');",
          "    }",
          "  }",
          "}");
      assertTrue(widthProperty.isModified());
      assertEquals("5cm", widthProperty.getValue());
      // set different value
      widthProperty.setValue("10cm");
      assertEditor(
          "public class Test implements EntryPoint {",
          "  public void onModuleLoad() {",
          "    RootPanel rootPanel = RootPanel.get();",
          "    DockPanel panel = new DockPanel();",
          "    rootPanel.add(panel);",
          "    {",
          "      Button button = new Button();",
          "      panel.add(button, DockPanel.WEST);",
          "      panel.setCellWidth(button, '10cm');",
          "    }",
          "  }",
          "}");
      assertTrue(widthProperty.isModified());
      assertEquals("10cm", widthProperty.getValue());
      // remove value
      widthProperty.setValue(Property.UNKNOWN_VALUE);
      assertEditor(
          "public class Test implements EntryPoint {",
          "  public void onModuleLoad() {",
          "    RootPanel rootPanel = RootPanel.get();",
          "    DockPanel panel = new DockPanel();",
          "    rootPanel.add(panel);",
          "    {",
          "      Button button = new Button();",
          "      panel.add(button, DockPanel.WEST);",
          "    }",
          "  }",
          "}");
      assertFalse(widthProperty.isModified());
      assertEquals("", widthProperty.getValue());
      // remove again - no changes
      {
        String expectedSource = m_lastEditor.getSource();
        widthProperty.setValue(Property.UNKNOWN_VALUE);
        assertEditor(expectedSource, m_lastEditor);
        assertFalse(widthProperty.isModified());
        assertEquals("", widthProperty.getValue());
      }
    }
    // check "height"
    {
      Property heightProperty = getPropertyByTitle(subProperties, "height");
      assertFalse(heightProperty.isModified());
      assertEquals("", heightProperty.getValue());
      // set new value
      heightProperty.setValue("5cm");
      assertEditor(
          "public class Test implements EntryPoint {",
          "  public void onModuleLoad() {",
          "    RootPanel rootPanel = RootPanel.get();",
          "    DockPanel panel = new DockPanel();",
          "    rootPanel.add(panel);",
          "    {",
          "      Button button = new Button();",
          "      panel.add(button, DockPanel.WEST);",
          "      panel.setCellHeight(button, '5cm');",
          "    }",
          "  }",
          "}");
      assertTrue(heightProperty.isModified());
      assertEquals("5cm", heightProperty.getValue());
      // remove value
      heightProperty.setValue(Property.UNKNOWN_VALUE);
      assertEditor(
          "public class Test implements EntryPoint {",
          "  public void onModuleLoad() {",
          "    RootPanel rootPanel = RootPanel.get();",
          "    DockPanel panel = new DockPanel();",
          "    rootPanel.add(panel);",
          "    {",
          "      Button button = new Button();",
          "      panel.add(button, DockPanel.WEST);",
          "    }",
          "  }",
          "}");
      assertFalse(heightProperty.isModified());
      assertEquals("", heightProperty.getValue());
    }
    // check "horizontalAlignment"
    {
      Class<?> hasAlignmentClass =
          m_lastLoader.loadClass("com.google.gwt.user.client.ui.HasHorizontalAlignment");
      Property alignmentProperty = getPropertyByTitle(subProperties, "horizontalAlignment");
      assertFalse(alignmentProperty.isModified());
      assertEquals("ALIGN_LEFT", getPropertyText(alignmentProperty));
      // set new value
      alignmentProperty.setValue(ReflectionUtils.getFieldObject(hasAlignmentClass, "ALIGN_RIGHT"));
      assertEditor(
          "public class Test implements EntryPoint {",
          "  public void onModuleLoad() {",
          "    RootPanel rootPanel = RootPanel.get();",
          "    DockPanel panel = new DockPanel();",
          "    rootPanel.add(panel);",
          "    {",
          "      Button button = new Button();",
          "      panel.add(button, DockPanel.WEST);",
          "      panel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_RIGHT);",
          "    }",
          "  }",
          "}");
      assertTrue(alignmentProperty.isModified());
      assertEquals("ALIGN_RIGHT", getPropertyText(alignmentProperty));
      // remove value
      alignmentProperty.setValue(Property.UNKNOWN_VALUE);
      assertEditor(
          "public class Test implements EntryPoint {",
          "  public void onModuleLoad() {",
          "    RootPanel rootPanel = RootPanel.get();",
          "    DockPanel panel = new DockPanel();",
          "    rootPanel.add(panel);",
          "    {",
          "      Button button = new Button();",
          "      panel.add(button, DockPanel.WEST);",
          "    }",
          "  }",
          "}");
      assertFalse(alignmentProperty.isModified());
      assertEquals("ALIGN_LEFT", getPropertyText(alignmentProperty));
    }
    // check "verticalAlignment"
    {
      Class<?> hasAlignmentClass =
          m_lastLoader.loadClass("com.google.gwt.user.client.ui.HasVerticalAlignment");
      Property alignmentProperty = getPropertyByTitle(subProperties, "verticalAlignment");
      assertFalse(alignmentProperty.isModified());
      assertEquals("ALIGN_TOP", getPropertyText(alignmentProperty));
      // set new value
      alignmentProperty.setValue(ReflectionUtils.getFieldObject(hasAlignmentClass, "ALIGN_BOTTOM"));
      assertEditor(
          "public class Test implements EntryPoint {",
          "  public void onModuleLoad() {",
          "    RootPanel rootPanel = RootPanel.get();",
          "    DockPanel panel = new DockPanel();",
          "    rootPanel.add(panel);",
          "    {",
          "      Button button = new Button();",
          "      panel.add(button, DockPanel.WEST);",
          "      panel.setCellVerticalAlignment(button, HasVerticalAlignment.ALIGN_BOTTOM);",
          "    }",
          "  }",
          "}");
      assertTrue(alignmentProperty.isModified());
      assertEquals("ALIGN_BOTTOM", getPropertyText(alignmentProperty));
      // remove value
      alignmentProperty.setValue(Property.UNKNOWN_VALUE);
      assertEditor(
          "public class Test implements EntryPoint {",
          "  public void onModuleLoad() {",
          "    RootPanel rootPanel = RootPanel.get();",
          "    DockPanel panel = new DockPanel();",
          "    rootPanel.add(panel);",
          "    {",
          "      Button button = new Button();",
          "      panel.add(button, DockPanel.WEST);",
          "    }",
          "  }",
          "}");
      assertFalse(alignmentProperty.isModified());
      assertEquals("ALIGN_TOP", getPropertyText(alignmentProperty));
    }
  }
View Full Code Here

            "}");
    frame.refresh();
    StackPanelInfo panel = (StackPanelInfo) frame.getChildrenWidgets().get(0);
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    //
    Property textProperty = button.getPropertyByTitle("StackText");
    assertNull(textProperty);
  }
View Full Code Here

            "}");
    frame.refresh();
    HTMLTableInfo panel = (HTMLTableInfo) frame.getChildrenWidgets().get(0);
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    //
    Property cellProperty = button.getPropertyByTitle("Cell");
    assertNotNull(cellProperty);
    Property[] subProperties = getSubProperties(cellProperty);
    assertThat(subProperties).hasSize(10);
    // horizontalAlignment
    {
      Property property = subProperties[0];
      assertEquals("horizontalAlignment", property.getTitle());
      assertFalse(property.isModified());
      assertEquals(ColumnInfo.Alignment.UNKNOWN, property.getValue());
    }
    // verticalAlignment
    {
      Property property = subProperties[1];
      assertEquals("verticalAlignment", property.getTitle());
      assertFalse(property.isModified());
      assertEquals(RowInfo.Alignment.UNKNOWN, property.getValue());
    }
    // width
    {
      Property property = subProperties[2];
      assertEquals("width", property.getTitle());
      assertFalse(property.isModified());
      assertEquals(Property.UNKNOWN_VALUE, property.getValue());
    }
    // height
    {
      Property property = subProperties[3];
      assertEquals("height", property.getTitle());
      assertFalse(property.isModified());
      assertEquals(Property.UNKNOWN_VALUE, property.getValue());
    }
    // styleName
    {
      Property property = subProperties[4];
      assertEquals("styleName", property.getTitle());
      assertFalse(property.isModified());
      assertEquals(Property.UNKNOWN_VALUE, property.getValue());
    }
    // stylePrimaryName
    {
      Property property = subProperties[5];
      assertEquals("stylePrimaryName", property.getTitle());
      assertFalse(property.isModified());
      assertEquals(Property.UNKNOWN_VALUE, property.getValue());
    }
    // visible
    {
      Property property = subProperties[6];
      assertEquals("visible", property.getTitle());
      assertFalse(property.isModified());
      assertEquals(Boolean.TRUE, property.getValue());
    }
    // wordWrap
    {
      Property property = subProperties[7];
      assertEquals("wordWrap", property.getTitle());
      assertFalse(property.isModified());
      assertEquals(Boolean.FALSE, property.getValue());
    }
    // optional "colSpan"
    {
      Property property = subProperties[8];
      assertEquals("colSpan", property.getTitle());
      assertFalse(property.isModified());
      assertEquals(1, property.getValue());
    }
    // optional "rowSpan"
    {
      Property property = subProperties[9];
      assertEquals("rowSpan", property.getTitle());
      assertFalse(property.isModified());
      assertEquals(1, property.getValue());
    }
  }
View Full Code Here

            "}");
    frame.refresh();
    HTMLTableInfo panel = (HTMLTableInfo) frame.getChildrenWidgets().get(0);
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    //
    Property property = PropertyUtils.getByPath(button, "Cell/visible");
    assertTrue(property.isModified());
    assertEquals(Boolean.FALSE, property.getValue());
  }
View Full Code Here

            "  }",
            "}");
    frame.refresh();
    HTMLTableInfo panel = (HTMLTableInfo) frame.getChildrenWidgets().get(0);
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    Property property = PropertyUtils.getByPath(button, "Cell/colSpan");
    // initial value
    assertTrue(property.isModified());
    assertEquals(2, property.getValue());
    // set "3"
    property.setValue(3);
    assertEquals(3, property.getValue());
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    FlexTable panel = new FlexTable();",
        "    rootPanel.add(panel);",
        "    panel.setWidget(0, 0, new Button());",
        "    panel.getFlexCellFormatter().setColSpan(0, 0, 3);",
        "  }",
        "}");
    // set Property.UNKNOWN_VALUE, so delete
    property.setValue(Property.UNKNOWN_VALUE);
    assertEquals(1, property.getValue());
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    FlexTable panel = new FlexTable();",
View Full Code Here

            "  }",
            "}");
    frame.refresh();
    HTMLTableInfo panel = (HTMLTableInfo) frame.getChildrenWidgets().get(0);
    WidgetInfo button = panel.getChildrenWidgets().get(3);
    Property property = PropertyUtils.getByPath(button, "Cell/rowSpan");
    // initial value
    assertTrue(property.isModified());
    assertEquals(2, property.getValue());
    // set "3"
    property.setValue(3);
    assertEquals(3, property.getValue());
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    FlexTable panel = new FlexTable();",
        "    rootPanel.add(panel);",
        "    panel.setWidget(0, 0, new Button());",
        "    panel.setWidget(1, 0, new Button());",
        "    panel.setWidget(2, 0, new Button());",
        "    panel.setWidget(0, 1, new Button());",
        "    panel.getFlexCellFormatter().setRowSpan(0, 1, 3);",
        "    FlexTableHelper.fixRowSpan(panel);",
        "  }",
        "}");
    // set Property.UNKNOWN_VALUE, so delete
    property.setValue(Property.UNKNOWN_VALUE);
    assertEquals(1, property.getValue());
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    FlexTable panel = new FlexTable();",
View Full Code Here

            "  }",
            "}");
    frame.refresh();
    HTMLTableInfo panel = (HTMLTableInfo) frame.getChildrenWidgets().get(0);
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    Property property = PropertyUtils.getByPath(button, "Cell/horizontalAlignment");
    // initial value
    assertTrue(property.isModified());
    assertEquals(ColumnInfo.Alignment.RIGHT, property.getValue());
    // set "center"
    property.setValue(ColumnInfo.Alignment.CENTER);
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    FlexTable panel = new FlexTable();",
        "    rootPanel.add(panel);",
        "    panel.setWidget(0, 0, new Button());",
        "    panel.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);",
        "  }",
        "}");
    // set "unknown", so remove
    property.setValue(ColumnInfo.Alignment.UNKNOWN);
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    FlexTable panel = new FlexTable();",
        "    rootPanel.add(panel);",
        "    panel.setWidget(0, 0, new Button());",
        "  }",
        "}");
    // set "center", so add
    property.setValue(ColumnInfo.Alignment.CENTER);
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    FlexTable panel = new FlexTable();",
        "    rootPanel.add(panel);",
        "    panel.setWidget(0, 0, new Button());",
        "    panel.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);",
        "  }",
        "}");
    // set Property.UNKNOWN_VALUE, so remove
    property.setValue(Property.UNKNOWN_VALUE);
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    FlexTable panel = new FlexTable();",
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.