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

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


    cellProperty.setProperties(properties);
    return cellProperty;
  }

  private void addSpanProperties(final WidgetInfo widget, List<Property> properties) {
    Property colSpanProperty = new JavaProperty(widget, "colSpan", IntegerPropertyEditor.INSTANCE) {
      @Override
      public boolean isModified() throws Exception {
        return (Integer) getValue() != 1;
      }

      @Override
      public Object getValue() throws Exception {
        return HTMLTableInfo.getConstraints(widget).getWidth();
      }

      @Override
      public void setValue(Object value) throws Exception {
        final int newSpan = value instanceof Integer ? (Integer) value : 1;
        ExecutionUtils.run(widget, new RunnableEx() {
          public void run() throws Exception {
            m_panel.setComponentColSpan(widget, 1);
            m_panel.setComponentColSpan(widget, newSpan);
          }
        });
      }
    };
    Property rowSpanProperty = new JavaProperty(widget, "rowSpan", IntegerPropertyEditor.INSTANCE) {
      @Override
      public boolean isModified() throws Exception {
        return (Integer) getValue() != 1;
      }
View Full Code Here


    }
    // update sub-properties
    String[] propertyTitles = getLocationPropertyTitles(signature);
    String title_1 = propertyTitles[0];
    String title_3 = propertyTitles[1];
    Property property_1 = new LocationValue_Property(title_1, invocation, 1);
    Property property_1u = new LocationUnit_Property(title_1 + " unit", invocation, 2, horizontal);
    Property property_3 = new LocationValue_Property(title_3, invocation, 3);
    Property property_3u = new LocationUnit_Property(title_3 + " unit", invocation, 4, horizontal);
    Property[] subProperties = new Property[]{property_1, property_1u, property_3, property_3u};
    complexProperty.setProperties(subProperties);
  }
View Full Code Here

    addBroadcastListener(new XmlObjectMove() {
      @Override
      public void before(XmlObjectInfo child, ObjectInfo oldParent, ObjectInfo newParent)
          throws Exception {
        if (oldParent == StackPanelInfo.this && newParent != oldParent) {
          Property property = getStackTextProperty(child);
          property.setValue(Property.UNKNOWN_VALUE);
        }
      }
    });
  }
View Full Code Here

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

  /**
   * @return the existing or new "StackText" property.
   */
  private Property getStackTextProperty(final XmlObjectInfo widget) throws Exception {
    Property property = (Property) widget.getArbitraryValue(this);
    if (property == null) {
      final String attributeName = getElement().getTagNS() + "StackPanel-text";
      property = new XmlProperty(widget, "StackText", StringPropertyEditor.INSTANCE) {
        @Override
        public boolean isModified() throws Exception {
          return getValue() != UNKNOWN_VALUE;
        }

        @Override
        public Object getValue() throws Exception {
          String attributeValue = widget.getElement().getAttribute(attributeName);
          return attributeValue != null ? attributeValue : UNKNOWN_VALUE;
        }

        @Override
        protected void setValueEx(Object value) throws Exception {
          if (value instanceof String) {
            widget.setAttribute(attributeName, (String) value);
          }
          if (value == UNKNOWN_VALUE) {
            widget.removeAttribute(attributeName);
          }
        }
      };
      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 && getChildren().contains(object)) {
          WidgetInfo widget = (WidgetInfo) object;
          {
            Property textProperty = getHeaderTextProperty(widget);
            if (textProperty != null) {
              properties.add(textProperty);
            }
          }
          {
            Property sizeProperty = getHeaderSizeProperty(widget);
            properties.add(sizeProperty);
          }
        }
      }
    });
View Full Code Here

  /**
   * @return the existing or new "HeaderText" property.
   */
  private Property getHeaderTextProperty(final XmlObjectInfo widget) throws Exception {
    Property property = (Property) widget.getArbitraryValue(this);
    if (property == null) {
      final DocumentElement headerElement = getHeaderElement(widget);
      if (headerElement.getTagLocal().equals("header")) {
        property = new XmlProperty(widget, "HeaderText", StringPropertyEditor.INSTANCE) {
          @Override
          public boolean isModified() throws Exception {
            return getValue() != UNKNOWN_VALUE;
          }

          @Override
          public Object getValue() throws Exception {
            return headerElement.getTextNode().getText();
          }

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

  /**
   * @return the existing or new "HeaderSize" property.
   */
  private Property getHeaderSizeProperty(final WidgetInfo widget) throws Exception {
    Property property = (Property) widget.getArbitraryValue(this);
    if (property == null) {
      property = new XmlProperty(widget, "HeaderSize", DoublePropertyEditor.INSTANCE) {
        @Override
        public boolean isModified() throws Exception {
          return getValue() != UNKNOWN_VALUE;
        }

        @Override
        public Object getValue() throws Exception {
          Object panelObject = StackLayoutPanelInfo.this.getObject();
          List<?> dataList = (List<?>) ReflectionUtils.getFieldObject(panelObject, "layoutData");
          Object widgetData = dataList.get(getWidgetIndex(widget));
          return ReflectionUtils.getFieldObject(widgetData, "headerSize");
        }

        @Override
        protected void setValueEx(Object value) throws Exception {
          if (value instanceof Double) {
            String sizeString = SIZE_FORMAT.format(value);
            DocumentElement headerElement = getHeaderElement(widget);
            headerElement.setAttribute("size", sizeString);
          }
        }
      };
      property.setCategory(PropertyCategory.system(7));
    }
    return property;
  }
View Full Code Here

            "  }",
            "}");
    frame.refresh();
    WidgetInfo panel = frame.getChildrenWidgets().get(0);
    // "headerText"
    Property property = panel.getPropertyByTitle("headerText");
    assertNotNull(property);
    assertEquals("My header", property.getValue());
  }
View Full Code Here

    addBroadcastListener(new XmlObjectAddProperties() {
      public void invoke(XmlObjectInfo object, List<Property> properties) throws Exception {
        if (object instanceof WidgetInfo && object.getParent() == panel) {
          WidgetInfo widget = (WidgetInfo) object;
          // prepare "Cell" property
          Property cellProperty = (Property) widget.getArbitraryValue(this);
          if (cellProperty == null) {
            cellProperty = getCellComplexProperty(widget);
            widget.putArbitraryValue(this, cellProperty);
          }
          // add "Cell" property
          properties.add(cellProperty);
        }
      }

      private Property getCellComplexProperty(WidgetInfo widget) throws Exception {
        ClassLoader editorLoader = getContext().getClassLoader();
        String namespace = StringUtils.substringBefore(getElement().getTag(), ":") + ":";
        // "width"
        Property widthProperty;
        {
          ExpressionAccessor expressionAccessor = new CellExpressionAccessor(namespace, "width");
          GenericPropertyDescription propertyDescription =
              new GenericPropertyDescription(null, "width", String.class, expressionAccessor);
          propertyDescription.setEditor(StringPropertyEditor.INSTANCE);
          propertyDescription.setConverter(StringConverter.INSTANCE);
          widthProperty = new GenericPropertyImpl(widget, propertyDescription);
        }
        // "height"
        Property heightProperty;
        {
          ExpressionAccessor expressionAccessor = new CellExpressionAccessor(namespace, "height");
          GenericPropertyDescription propertyDescription =
              new GenericPropertyDescription(null, "height", String.class, expressionAccessor);
          propertyDescription.setEditor(StringPropertyEditor.INSTANCE);
          propertyDescription.setConverter(StringConverter.INSTANCE);
          heightProperty = new GenericPropertyImpl(widget, propertyDescription);
        }
        // "horizontalAlignment"
        Property horizontalAlignmentProperty;
        {
          StaticFieldPropertyEditor propertyEditor = new StaticFieldPropertyEditor();
          Class<?> hasHorizontalAlignmentClass =
              editorLoader.loadClass("com.google.gwt.user.client.ui.HasHorizontalAlignment");
          propertyEditor.configure(hasHorizontalAlignmentClass, new String[]{
              "ALIGN_LEFT",
              "ALIGN_CENTER",
              "ALIGN_RIGHT"});
          Object defaultValue =
              ReflectionUtils.getFieldObject(hasHorizontalAlignmentClass, "ALIGN_LEFT");
          // create property
          ExpressionAccessor expressionAccessor =
              new CellExpressionAccessor(namespace, "horizontalAlignment");
          GenericPropertyDescription propertyDescription =
              new GenericPropertyDescription(null,
                  "horizontalAlignment",
                  String.class,
                  expressionAccessor);
          propertyDescription.setEditor(propertyEditor);
          propertyDescription.setDefaultValue(defaultValue);
          horizontalAlignmentProperty = new GenericPropertyImpl(widget, propertyDescription);
        }
        // "verticalAlignment"
        Property verticalAlignmentProperty;
        {
          StaticFieldPropertyEditor propertyEditor = new StaticFieldPropertyEditor();
          Class<?> hasVerticalAlignmentClass =
              editorLoader.loadClass("com.google.gwt.user.client.ui.HasVerticalAlignment");
          propertyEditor.configure(hasVerticalAlignmentClass, new String[]{
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.