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

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


            "}");
    frame.refresh();
    HTMLTableInfo panel = (HTMLTableInfo) frame.getChildrenWidgets().get(0);
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    //
    Property property = PropertyUtils.getByPath(button, "Cell/verticalAlignment");
    // current value
    assertTrue(property.isModified());
    assertEquals(RowInfo.Alignment.BOTTOM, property.getValue());
    // set "center"
    property.setValue(RowInfo.Alignment.MIDDLE);
    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().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);",
        "  }",
        "}");
    // set "unknown", so remove
    property.setValue(RowInfo.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 "middle", so add
    property.setValue(RowInfo.Alignment.MIDDLE);
    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().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);",
        "  }",
        "}");
    // 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


   */
  private void contributeTabTextProperty() {
    addBroadcastListener(new XmlObjectAddProperties() {
      public void invoke(XmlObjectInfo object, List<Property> properties) throws Exception {
        if (object instanceof WidgetInfo && getChildren().contains(object)) {
          Property property = getTabTextProperty(object);
          properties.add(property);
        }
      }
    });
  }
View Full Code Here

  /**
   * @return the existing or new "TabText" property.
   */
  private Property getTabTextProperty(final XmlObjectInfo widget) throws Exception {
    Property property = (Property) widget.getArbitraryValue(this);
    if (property == null) {
      final DocumentElement tabElement = widget.getElement().getParent();
      property = new XmlProperty(widget, "TabText", StringPropertyEditor.INSTANCE) {
        @Override
        public boolean isModified() throws Exception {
          return getValue() != UNKNOWN_VALUE;
        }

        @Override
        public Object getValue() throws Exception {
          String attributeValue = tabElement.getAttribute("text");
          return attributeValue != null ? attributeValue : UNKNOWN_VALUE;
        }

        @Override
        protected void setValueEx(Object value) throws Exception {
          if (value instanceof String) {
            tabElement.setAttribute("text", (String) value);
          }
        }
      };
      property.setCategory(PropertyCategory.system(7));
    }
    return property;
  }
View Full Code Here

    addBroadcastListener(new XmlObjectAddProperties() {
      public void invoke(XmlObjectInfo object, List<Property> properties) throws Exception {
        if (object instanceof WidgetInfo && object.getParent() == DockPanelInfo.this) {
          WidgetInfo widget = (WidgetInfo) object;
          // prepare "Direction" property
          Property directionProperty = (Property) widget.getArbitraryValue(this);
          if (directionProperty == null) {
            directionProperty = createDirectionProperty(widget);
            widget.putArbitraryValue(this, directionProperty);
          }
          // add "Direction" property
View Full Code Here

            "    }",
            "  }",
            "}");
    panel.refresh();
    //
    Property unitProperty = panel.getPropertyByTitle("Unit");
    setPropertyText(unitProperty, "MM");
    assertEditor(
        "public class Test extends DockLayoutPanel {",
        "  public Test() {",
        "    super(Unit.MM);",
View Full Code Here

            "    }",
            "  }",
            "}");
    panel.refresh();
    //
    Property unitProperty = panel.getPropertyByTitle("Unit");
    setPropertyText(unitProperty, "CM");
    assertEditor(
        "public class Test extends DockLayoutPanel {",
        "  public Test() {",
        "    super(Unit.CM);",
View Full Code Here

            "}");
    panel.refresh();
    assertNoErrors(panel);
    WidgetInfo button = getJavaInfoByName("button");
    // prepare "Edge" property
    Property property = button.getPropertyByTitle("Edge");
    assertNotNull(property);
    assertEquals("WEST", getPropertyText(property));
    assertInstanceOf(StringListPropertyEditor.class, property.getEditor());
    // set value
    property.setValue("NORTH");
    assertEditor(
        "public class Test extends DockLayoutPanel {",
        "  public Test() {",
        "    super(Unit.CM);",
        "    {",
View Full Code Here

  @Override
  protected void refreshEditPolicies() {
    super.refreshEditPolicies();
    // install direct text edit policy for "header" property
    {
      Property headerProperty = m_column.getHeaderProperty();
      DirectTextPropertyEditPolicy policy;
      if (headerProperty != null) {
        policy = new DirectTextPropertyEditPolicy(m_column, headerProperty);
      } else {
        policy = null;
View Full Code Here

  /**
   * @return the name of direction field.
   */
  private static String getDirection(WidgetInfo widget) throws Exception {
    Property directionProperty = widget.getPropertyByTitle("Direction");
    return PropertyUtils.getText(directionProperty);
  }
View Full Code Here

    Property directionProperty = widget.getPropertyByTitle("Direction");
    return PropertyUtils.getText(directionProperty);
  }

  public final void setDirection(WidgetInfo widget, String directionField) throws Exception {
    Property directionProperty = widget.getPropertyByTitle("Direction");
    if (directionProperty != null) {
      Object direction = getDirectionValue(directionField);
      directionProperty.setValue(direction);
    }
  }
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.