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

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


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

      private Property getCellComplexProperty(WidgetInfo component) throws Exception {
        ClassLoader editorLoader = JavaInfoUtils.getClassLoader(panel);
        // "width"
        GenericPropertyImpl widthProperty;
        {
          ExpressionAccessor expressionAccessor =
              new CellExpressionAccessor(panel, "setCellWidth", "java.lang.String");
          widthProperty =
              new GenericPropertyImpl(component,
                  "width",
                  new ExpressionAccessor[]{expressionAccessor},
                  "",
                  StringConverter.INSTANCE,
                  StringPropertyEditor.INSTANCE);
        }
        // "height"
        GenericPropertyImpl heightProperty;
        {
          ExpressionAccessor expressionAccessor =
              new CellExpressionAccessor(panel, "setCellHeight", "java.lang.String");
          heightProperty =
              new GenericPropertyImpl(component,
                  "height",
                  new ExpressionAccessor[]{expressionAccessor},
                  "",
                  StringConverter.INSTANCE,
                  StringPropertyEditor.INSTANCE);
        }
        // "horizontalAlignment"
        GenericPropertyImpl horizontalAlignmentProperty;
        {
          StaticFieldPropertyEditor propertyEditor = new StaticFieldPropertyEditor();
          Class<?> hasHorizontalAlignmentClass =
              editorLoader.loadClass("com.google.gwt.user.client.ui.HasHorizontalAlignment");
          ExpressionAccessor expressionAccessor =
              new CellExpressionAccessor(panel,
                  "setCellHorizontalAlignment",
                  "com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant");
          propertyEditor.configure(hasHorizontalAlignmentClass, new String[]{
              "ALIGN_LEFT",
              "ALIGN_CENTER",
              "ALIGN_RIGHT",
              "ALIGN_DEFAULT"});
          Object defaultValue =
              ReflectionUtils.getFieldObject(hasHorizontalAlignmentClass, "ALIGN_DEFAULT");
          horizontalAlignmentProperty =
              new GenericPropertyImpl(component,
                  "horizontalAlignment",
                  new ExpressionAccessor[]{expressionAccessor},
                  defaultValue,
                  null,
                  propertyEditor);
        }
        // "verticalAlignment"
        GenericPropertyImpl verticalAlignmentProperty;
        {
          StaticFieldPropertyEditor propertyEditor = new StaticFieldPropertyEditor();
          Class<?> hasVerticalAlignmentClass =
              editorLoader.loadClass("com.google.gwt.user.client.ui.HasVerticalAlignment");
          propertyEditor.configure(hasVerticalAlignmentClass, new String[]{
              "ALIGN_TOP",
              "ALIGN_MIDDLE",
              "ALIGN_BOTTOM"});
          ExpressionAccessor expressionAccessor =
              new CellExpressionAccessor(panel,
                  "setCellVerticalAlignment",
                  "com.google.gwt.user.client.ui.HasVerticalAlignment.VerticalAlignmentConstant");
          Object defaultValue =
              ReflectionUtils.getFieldObject(hasVerticalAlignmentClass, "ALIGN_TOP");
          verticalAlignmentProperty =
              new GenericPropertyImpl(component,
                  "verticalAlignment",
                  new ExpressionAccessor[]{expressionAccessor},
                  defaultValue,
                  null,
                  propertyEditor);
        }
        // create complex "Cell" property
        ComplexProperty cellProperty = new ComplexProperty("Cell", "(cell properties)");
        cellProperty.setCategory(PropertyCategory.system(7));
        cellProperty.setProperties(new Property[]{
            widthProperty,
            heightProperty,
            horizontalAlignmentProperty,
            verticalAlignmentProperty});
        return cellProperty;
View Full Code Here


  @Override
  protected List<Property> getPropertyList() throws Exception {
    List<Property> properties = super.getPropertyList();
    // "header" property if available
    {
      Property property = getHeaderProperty();
      if (property != null) {
        properties.add(property);
      }
    }
    // "width" property if available
    {
      Property widthProperty = getWidthProperty();
      if (widthProperty != null) {
        properties.add(widthProperty);
      }
    }
    // "comparator" property if available
    {
      Property comparatorProperty = getComparatorProperty();
      if (comparatorProperty != null) {
        properties.add(comparatorProperty);
      }
    }
    // done
View Full Code Here

  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  protected List<Property> getPropertyList() throws Exception {
    List<Property> properties = super.getPropertyList();
    Property sizeProperty = getSizeProperty();
    if (sizeProperty != null) {
      properties.add(sizeProperty);
    }
    return properties;
  }
View Full Code Here

        setPropertyValue(widget, "Association/asHTML", asHTML);
      }

      private void setPropertyValue(WidgetInfo widget, String path, Object value) throws Exception {
        if (value != Property.UNKNOWN_VALUE) {
          Property property = PropertyUtils.getByPath(widget, path);
          property.setValue(value);
        }
      }
    });
  }
View Full Code Here

      }
    });
  }

  private static Object getPropertyValue(WidgetInfo widget, String path) throws Exception {
    Property property = PropertyUtils.getByPath(widget, path);
    return property != null ? property.getValue() : Property.UNKNOWN_VALUE;
  }
View Full Code Here

        WidgetInfo header = getHeader(javaInfo);
        if (header != null) {
          for (Property property : header.getProperties()) {
            if (isTextProperty(property)) {
              GenericPropertyImpl genericProperty = (GenericPropertyImpl) property;
              Property copy = new GenericPropertyImpl(genericProperty, "HeaderText");
              copy.setCategory(PropertyCategory.system(7));
              properties.add(copy);
              return;
            }
          }
        }
View Full Code Here

  private Command getResizeCommand(ChangeBoundsRequest request) {
    final Rectangle newBounds = request.getTransformedRectangle(getHostFigure().getBounds());
    return new EditCommand(m_column) {
      @Override
      protected void executeEdit() throws Exception {
        Property widthProperty = m_column.getWidthProperty();
        if (widthProperty != null) {
          widthProperty.setValue(newBounds.width + "px");
        }
      }
    };
  }
View Full Code Here

  public static void install(final AbstractWidgetHandleEditPart editPart, final String propertyPath) {
    ExecutionUtils.runLog(new RunnableEx() {
      public void run() throws Exception {
        AbstractWidgetHandle<?> handle = (AbstractWidgetHandle<?>) editPart.getModel();
        IWidgetInfo widget = handle.getWidget();
        Property property = PropertyUtils.getByPath(widget.getUnderlyingModel(), propertyPath);
        if (property != null) {
          editPart.installEditPolicy(new AbstractWidgetHandleDirectTextEditPolicy(property));
        }
      }
    });
View Full Code Here

    m_panel.addBroadcastListener(new JavaInfoAddProperties() {
      public void invoke(JavaInfo javaInfo, List<Property> properties) throws Exception {
        if (javaInfo instanceof WidgetInfo && javaInfo.getParent() == m_panel) {
          WidgetInfo widget = (WidgetInfo) javaInfo;
          // prepare "Cell" property
          Property cellProperty = (Property) widget.getArbitraryValue(this);
          if (cellProperty == null) {
            cellProperty = createCellComplexProperty(widget);
            widget.putArbitraryValue(this, cellProperty);
          }
          // add "Cell" property
View Full Code Here

    GenericPropertyImpl visibleProperty =
        createBooleanProperty(widget, "setVisible", "visible", true);
    GenericPropertyImpl wordWrapProperty =
        createBooleanProperty(widget, "setWordWrap", "wordWrap", false);
    // "horizontalAlignment"
    Property horizontalAlignmentProperty;
    {
      horizontalAlignmentProperty =
          new CellAlignmentProperty<ColumnInfo.Alignment>(widget, "horizontalAlignment",
              ColumnInfo.Alignment.class, ColumnInfo.Alignment.UNKNOWN) {
            @Override
            protected ColumnInfo.Alignment getAlignmentEx(CellConstraintsSupport constraints) {
              return constraints.getHorizontalAlignment();
            }

            @Override
            protected void setAlignmentEx(CellConstraintsSupport constraints,
                ColumnInfo.Alignment alignment) throws Exception {
              constraints.setHorizontalAlignment(alignment);
            }
          };
    }
    // "verticalAlignment"
    Property verticalAlignmentProperty;
    {
      verticalAlignmentProperty =
          new CellAlignmentProperty<RowInfo.Alignment>(widget, "verticalAlignment",
              RowInfo.Alignment.class, RowInfo.Alignment.UNKNOWN) {
            @Override
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.