Package org.eclipse.e4.xwt.javabean.metadata.properties

Examples of org.eclipse.e4.xwt.javabean.metadata.properties.DynamicBeanProperty


      return ObjectToObject.instance;
    }
    if (String.class == source && target.isEnum()) {
      return new StringToEnum(target);
    }
    ValueConvertorRegister convertorRegister = (ValueConvertorRegister)
        getService(ValueConvertorRegister.class);
    if (convertorRegister == null) {
      return null;
    }
    return convertorRegister.findConverter(source, target);
  }
View Full Code Here


   * .conversion.IConverter)
   */
  public void registerConvertor(IConverter converter) {
    Class<?> source = (Class<?>) converter.getFromType();
    Class<?> target = (Class<?>) converter.getToType();
    ValueConvertorRegister convertorRegister = (ValueConvertorRegister)
        getService(ValueConvertorRegister.class);
    convertorRegister.register(source, target, converter);
  }
View Full Code Here

      if (factory != null) {
        return factory.create(javaClass, superMetaclass, xwtLoader);
      }
    }
    boolean lazyLoading = false; // TODO Get value from preference
    return new Metaclass(javaClass, superMetaclass, lazyLoading, xwtLoader);
  }
View Full Code Here

    registerMetaclass(org.eclipse.swt.widgets.Table.class);
    type = org.eclipse.swt.widgets.TableItem.class;
    IMetaclass metaclass = (IMetaclass) registerMetaclass(type);
    metaclass.addProperty(new TableItemProperty());
    metaclass.addProperty(new TableItemEditorProperty());
    metaclass.addProperty(new DynamicBeanProperty(TableItem.class,
        String[].class, PropertiesConstants.PROPERTY_TEXTS,
        PropertiesConstants.PROPERTY_TEXT));

    registerMetaclass(TableItemProperty.Cell.class);
    registerMetaclass(ControlEditor.class);
    registerMetaclass(TableEditor.class);

    IMetaclass TableEditorMetaclass = core.getMetaclass(TableEditor.class,
        IConstants.XWT_NAMESPACE);
    TableEditorMetaclass.addProperty(new TableEditorDynamicProperty());

    type = org.eclipse.swt.widgets.TableColumn.class;
    metaclass = (IMetaclass) registerMetaclass(type);
    metaclass.addProperty(new TableColumnEditorProperty());

    registerMetaclass(org.eclipse.swt.widgets.Text.class);
    registerMetaclass(org.eclipse.swt.widgets.ToolBar.class);
    registerMetaclass(org.eclipse.swt.widgets.ToolItem.class);
    registerMetaclass(org.eclipse.swt.widgets.ToolTip.class);
    registerMetaclass(org.eclipse.swt.widgets.Tracker.class);
    registerMetaclass(org.eclipse.swt.widgets.Tray.class);
    registerMetaclass(org.eclipse.swt.widgets.Tree.class);
    registerMetaclass(org.eclipse.swt.widgets.TreeColumn.class);
    registerMetaclass(org.eclipse.swt.widgets.TreeItem.class);
    type = org.eclipse.swt.widgets.TreeItem.class;
    metaclass = (IMetaclass) registerMetaclass(type);
    metaclass.addProperty(new DynamicBeanProperty(TreeItem.class,
        String[].class, PropertiesConstants.PROPERTY_TEXTS,
        PropertiesConstants.PROPERTY_TEXT));

    // registerMetaclass(org.eclipse.swt.layout.FillData.class);
    registerMetaclass(org.eclipse.swt.layout.FillLayout.class);
    registerMetaclass(org.eclipse.swt.layout.FormAttachment.class);
    registerMetaclass(org.eclipse.swt.layout.FormData.class);
    registerMetaclass(org.eclipse.swt.layout.FormLayout.class);
    registerMetaclass(org.eclipse.swt.layout.GridData.class);
    registerMetaclass(org.eclipse.swt.layout.GridLayout.class);
    registerMetaclass(org.eclipse.swt.layout.RowData.class);
    registerMetaclass(org.eclipse.swt.layout.RowLayout.class);
    registerMetaclass(org.eclipse.swt.custom.StackLayout.class);

    registerMetaclass(org.eclipse.swt.custom.CLabel.class);
    registerMetaclass(org.eclipse.swt.custom.CCombo.class);
    registerMetaclass(org.eclipse.swt.custom.CTabFolder.class);
    registerMetaclass(org.eclipse.swt.custom.CTabItem.class);
    registerMetaclass(org.eclipse.swt.custom.SashForm.class);
    registerMetaclass(org.eclipse.swt.custom.StyledText.class);
    registerMetaclass(org.eclipse.swt.custom.ScrolledComposite.class);
    registerMetaclass(org.eclipse.swt.custom.TableTree.class);
    registerMetaclass(org.eclipse.swt.custom.ViewForm.class);
    registerMetaclass(org.eclipse.swt.custom.CBanner.class);
    registerMetaclass(org.eclipse.swt.custom.TableCursor.class);

    type = org.eclipse.swt.widgets.Widget.class;
    metaclass = (IMetaclass) registerMetaclass(type);
    metaclass.addProperty(new DataProperty(IConstants.XAML_DATA_CONTEXT,
        IUserDataConstants.XWT_DATACONTEXT_KEY));
    metaclass.addProperty(new DataProperty(IConstants.XAML_BINDING_CONTEXT,
        IUserDataConstants.XWT_BINDING_CONTEXT_KEY));
    metaclass.addProperty(new DataProperty(IConstants.XAML_TRIGGERS,
        IUserDataConstants.XWT_TRIGGERS_KEY, TriggerBase[].class));
    metaclass.addProperty(new StyleProperty());
    registerEventGroup(type, new RadioEventGroup(IEventConstants.KEY_GROUP));
    registerEventGroup(type, new RadioEventGroup(
        IEventConstants.MOUSE_GROUP));
    registerEventGroup(type, new RadioEventGroup(
        IEventConstants.MOUSE_MOVING_GROUP));
    registerEventGroup(type, new RadioEventGroup(
        IEventConstants.FOCUS_GROUP));
    registerEventGroup(type, new RadioEventGroup(
        IEventConstants.EXPAND_GROUP));
    registerEventGroup(type, new RadioEventGroup(
        IEventConstants.WINDOW_GROUP));
    registerEventGroup(type, new RadioEventGroup(
        IEventConstants.ACTIVATION_GROUP));
    registerEventGroup(type, new RadioEventGroup(IEventConstants.HARD_KEY));

    type = org.eclipse.jface.viewers.Viewer.class;
    metaclass = (IMetaclass) core.getMetaclass(type,
        IConstants.XWT_NAMESPACE);
    if (metaclass != null) {
      IProperty property = metaclass.findProperty("Input");

      metaclass.addProperty(new InputBeanProperty(property));
      metaclass.addProperty(new DataProperty(
          IConstants.XAML_DATA_CONTEXT,
          IUserDataConstants.XWT_DATACONTEXT_KEY));

      metaclass.removeProperty("selection");

      metaclass.addProperty(new DataProperty(
          PropertiesConstants.PROPERTY_BINDING_PATH,
          IUserDataConstants.XWT_PROPERTY_DATA_KEY, String.class));
      metaclass.addProperty(new DataProperty(
          PropertiesConstants.PROPERTY_ITEM_TEXT,
          IUserDataConstants.XWT_PROPERTY_ITEM_TEXT_KEY,
          IBinding.class));
      metaclass.addProperty(new DataProperty(
          PropertiesConstants.PROPERTY_ITEM_IMAGE,
          IUserDataConstants.XWT_PROPERTY_ITEM_IMAGE_KEY,
          IBinding.class));
      metaclass.addProperty(new SingleSelectionBeanProperty(
          PropertiesConstants.PROPERTY_SINGLE_SELECTION));
      metaclass.addProperty(new MultiSelectionBeanProperty(
          PropertiesConstants.PROPERTY_MULTI_SELECTION));
    }

    type = org.eclipse.jface.viewers.AbstractListViewer.class;
    metaclass = (IMetaclass) core.getMetaclass(type,
        IConstants.XWT_NAMESPACE);
    if (metaclass != null) {
      metaclass.addInitializer(new JFaceInitializer());
    }

    type = org.eclipse.jface.viewers.ColumnViewer.class;
    metaclass = (IMetaclass) core.getMetaclass(type,
        IConstants.XWT_NAMESPACE);
    if (metaclass != null) {
      metaclass.addProperty(new DynamicBeanProperty(type, String[].class,
          PropertiesConstants.PROPERTY_COLUMN_PROPERTIES));
      metaclass.addProperty(new ColumnViewerColumnsProperty());

      metaclass.addInitializer(new JFaceInitializer());
    }
View Full Code Here

          ObservableTreeContentProvider xwtContentProvider = (ObservableTreeContentProvider) contentProvider;
          xwtContentProvider.updateContext(viewer, value);
        }
        if (contentProvider instanceof ObservableTreeContentProvider) {
          ObservableTreeContentProvider listContentProvider = (ObservableTreeContentProvider) contentProvider;
          viewer.setLabelProvider(new ObservableMapLabelProvider(
              viewer, listContentProvider.getKnownElements(),
              propertyNames));
        }
      }
      else {
        IContentProvider contentProvider = viewer.getContentProvider();
        if (value instanceof List<?> || value.getClass().isArray()) {
          if (contentProvider == null) {
            contentProvider = new ObservableListContentProvider();
            viewer.setContentProvider(contentProvider);
          }
          if (propertyNames != null && propertyNames.length > 0 && hasDefaultLabelProvider(viewer)
              && contentProvider instanceof ObservableListContentProvider) {
            ObservableListContentProvider listContentProvider = (ObservableListContentProvider) contentProvider;
            viewer.setLabelProvider(new ObservableMapLabelProvider(
                viewer, listContentProvider.getKnownElements(),
                propertyNames));
          }
        } else if (value instanceof Set<?>) {
          if (contentProvider == null) {
            contentProvider = new ObservableSetContentProvider();
            viewer.setContentProvider(contentProvider);
          }
          if (propertyNames != null && propertyNames.length > 0 && hasDefaultLabelProvider(viewer)
              && contentProvider instanceof ObservableSetContentProvider) {
            ObservableSetContentProvider setContentProvider = (ObservableSetContentProvider) contentProvider;
            viewer.setLabelProvider(new ObservableMapLabelProvider(
                viewer, setContentProvider.getKnownElements(), propertyNames));
          }
        }
      }
    }
View Full Code Here

      String[] propertyNames = JFacesHelper.getViewerProperties(viewer);
      if (target instanceof AbstractTreeViewer) {
        IContentProvider contentProvider = (IContentProvider) viewer.getContentProvider();
        if (contentProvider instanceof ObservableTreeContentProvider) {
          ObservableTreeContentProvider xwtContentProvider = (ObservableTreeContentProvider) contentProvider;
          xwtContentProvider.updateContext(viewer, value);
        }
        if (contentProvider instanceof ObservableTreeContentProvider) {
          ObservableTreeContentProvider listContentProvider = (ObservableTreeContentProvider) contentProvider;
          viewer.setLabelProvider(new ObservableMapLabelProvider(
              viewer, listContentProvider.getKnownElements(),
              propertyNames));
        }
      }
      else {
        IContentProvider contentProvider = viewer.getContentProvider();
        if (value instanceof List<?> || value.getClass().isArray()) {
          if (contentProvider == null) {
            contentProvider = new ObservableListContentProvider();
            viewer.setContentProvider(contentProvider);
          }
          if (propertyNames != null && propertyNames.length > 0 && hasDefaultLabelProvider(viewer)
              && contentProvider instanceof ObservableListContentProvider) {
            ObservableListContentProvider listContentProvider = (ObservableListContentProvider) contentProvider;
            viewer.setLabelProvider(new ObservableMapLabelProvider(
                viewer, listContentProvider.getKnownElements(),
                propertyNames));
          }
        } else if (value instanceof Set<?>) {
          if (contentProvider == null) {
            contentProvider = new ObservableSetContentProvider();
View Full Code Here

            propertyName, updateSourceTrigger, observeKind);
      }

      if (observable == null
          && dataProvider instanceof IObjectDataProvider) {
        IMetaclass mateclass = XWT.getMetaclass(type);
        IProperty property = mateclass.findProperty(propertyName);
        if (property instanceof EventProperty) {
          observable = new EventPropertyObservableValue(object,
              (EventProperty) property);
        }
      }
View Full Code Here

  public IMetaclass register(Class<?> javaClass) {
    return register(javaClass, null);
  }

  public IMetaclass register(Class<?> javaClass, IMetaclass superMetaclass) {
    IMetaclass metaclass = getMetaclass(javaClass);
    if (metaclass != null) {
      return metaclass;
    }
    if (superMetaclass == null) {
      Class<?> superclass = javaClass.getSuperclass();
      if (superclass != null && superclass != Object.class) {
        register(superclass, null);
      }
      superMetaclass = getMetaclass(superclass);
    }
    IMetaclass thisMetaclass = createMetaclass(javaClass, superMetaclass);
    register(thisMetaclass);
    return thisMetaclass;
  }
View Full Code Here

    return new Metaclass(javaClass, superMetaclass, lazyLoading, xwtLoader);
  }

  public IMetaclass getMetaclass(ILoadingContext context, String name,
      String namespace) {
    IMetaclass metaclass = nameRegister.get(name);
    if (metaclass != null) {
      if (namespace == null || namespace.equals(IConstants.XWT_NAMESPACE)) {
        return metaclass;
      }
      if (namespace != null
          && namespace
              .startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
        String packageName = namespace
            .substring(IConstants.XAML_CLR_NAMESPACE_PROTO.length());
        int index = packageName.indexOf('=');
        if (index != -1) {
          packageName = packageName.substring(0, index);
        }
        // if using default package(null), use only name as class name,
        // else use package.class as class name
        String className = packageName.length() == 0 ? name
            : (packageName + "." + name);
        if (metaclass.getType().getName().equals(className)) {
          return metaclass;
        }
      }
    }
    if (namespace == null
View Full Code Here

    return getMetaclass(type);
  }

  public IMetaclass getMetaclass(Class<?> type) {
    if (classRegister.contains(type)) {
      IMetaclass metaclass = nameRegister.get(type.getSimpleName());
      if (metaclass != null && metaclass.getType() == type) {
        return metaclass;
      }
    }
    if (parent != null) {
      IMetaclass metaclass = parent.getMetaclass(type);
      if (metaclass != null) {
        return metaclass;
      }
    }
    return null;
View Full Code Here

TOP

Related Classes of org.eclipse.e4.xwt.javabean.metadata.properties.DynamicBeanProperty

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.