Examples of ISWTObservableValue


Examples of org.eclipse.jface.databinding.swt.ISWTObservableValue

  protected Text createBeanPropertyTextField(Composite parent, Object bean, String propertyName, String labelText, String tooltip,
      int flags) {
    createLabel(parent, labelText);
    Text text = createText(parent, flags);
    text.setToolTipText(tooltip);
    ISWTObservableValue textValue = Forms.observe(text);
    Forms.bindBeanProperty(getDataBindingContext(), getMessageManager(), bean, propertyName, isMandatory(bean, propertyName), labelText, textValue, text);
    return text;
  }
View Full Code Here

Examples of org.eclipse.jface.databinding.swt.ISWTObservableValue

  protected Text createBeanTextArea(Composite parent, Object bean, String propertyName,
      String labelText, String tooltip) {
    Text text = createTextArea(parent);
    text.setToolTipText(tooltip);
    ISWTObservableValue textValue = Forms.observe(text);
    Forms.bindBeanProperty(getDataBindingContext(), getMessageManager(), bean, propertyName, isMandatory(bean, propertyName), labelText, textValue, text);
    return text;
  }
View Full Code Here

Examples of org.eclipse.jface.databinding.swt.ISWTObservableValue

        // gd.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
        // gd.horizontalAlignment = SWT.LEFT;
        // gd.verticalIndent = 0;
        // gd.verticalAlignment = GridData.FILL;
        text.setLayoutData(gd);
        ISWTObservableValue textValue = Forms.observe(text);

        // NOTE this code only works if the LanguageExpressionBean is
        // not
        // replaced under our feet!
        final LanguageExpressionBean expression = LanguageExpressionBean.bindToNodeProperty(node, id);
        final String expressionPropertyName = "expression";
        Forms.bindBeanProperty(bindingContext, mmng, expression, expressionPropertyName, isMandatory(expression, expressionPropertyName), expressionPropertyName, textValue, text);

        String languageLabel = EditorMessages.propertiesLanguageTitle;
        toolkit.createLabel(composite, languageLabel);
        // toolkit.createSeparator(composite, SWT.SEPARATOR);

        Combo combo = new Combo(composite, SWT.NONE | SWT.BORDER);
        combo.setItems(new Languages().languageArray());
        toolkit.adapt(combo, true, true);

        ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo);
        Forms.bindBeanProperty(bindingContext, mmng, expression, "language", isMandatory(expression, "language"), languageLabel, comboValue, combo);

        String language = expression.getLanguage();
        if (language == null) {
          language = CamelModelHelper.getDefaultLanguageName();
          expression.setLanguage(language);
        }

        // now lets forward property events to the node
        expression.addPropertyChangeListener(new PropertyChangeListener() {
          /*
           * (non-Javadoc)
           *
           * @see
           * java.beans.PropertyChangeListener#propertyChange(java
           * .beans .PropertyChangeEvent)
           */
          @Override
          public void propertyChange(PropertyChangeEvent event) {
            node.firePropertyChange(id.toString(), null, expression);
          }
        });
      } else {
        String propertyName = getPropertyName(id);
        Class refType = isBeanRef(node, propertyName);
        if (refType != null) {
          Combo combo = new Combo(parent, SWT.NONE | SWT.BORDER);
          String[] beanRefs = getBeanRefs(refType);
          combo.setItems(beanRefs);
          toolkit.adapt(combo, true, true);
          widget = combo;

          ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo);
          Forms.bindBeanProperty(bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, comboValue, combo);
        } else if (isEndpointUri(node, propertyName)) {
          Combo combo = new Combo(parent, SWT.NONE | SWT.BORDER);
          combo.setItems(getEndpointUris());
          toolkit.adapt(combo, true, true);
          widget = combo;

          ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo);
          Forms.bindBeanProperty(bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, comboValue, combo);
        } else if (descriptor instanceof BooleanPropertyDescriptor) {
          Button checkbox = new Button(parent, SWT.CHECK);
          widget = checkbox;
          ISWTObservableValue textValue = Forms.observe(checkbox);
          Forms.bindBeanProperty(bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, textValue, checkbox);
        } else if (descriptor instanceof ListPropertyDescriptor) {
          if (CamelModelHelper.isPropertyListOFSetHeaders(id)) {
            Control control = bindSetHeaderTable(toolkit, parent, id);
            widget = control;
          } else {
            Control control = bindListOfValues(toolkit, parent, id);
            widget = control;
          }
        } else if (descriptor instanceof EnumPropertyDescriptor) {
          EnumPropertyDescriptor enumProperty = (EnumPropertyDescriptor) descriptor;
          ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY | SWT.BORDER);
          combo.setContentProvider(ArrayContentProvider.getInstance());
          combo.setInput(getEnumValues(enumProperty.getEnumType()));

          IViewerObservableValue comboValue = ViewersObservables.observeSingleSelection(combo);
          Control control = combo.getControl();
          Forms.bindBeanProperty(bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, comboValue, control);

          toolkit.adapt(control, true, true);
          widget = control;
        } else {
          Text text;
          if (isDescription) {
            text = toolkit.createText(parent, "", SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
          } else {
            text = toolkit.createText(parent, "", SWT.BORDER);
          }
          text.setToolTipText(tooltip);
          widget = text;
          ISWTObservableValue textValue = Forms.observe(text);
          Forms.bindBeanProperty(bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, textValue, text);
        }
      }
    }
    boolean isComplexOrUnion = isComplexProperty || isUnionProperty;
View Full Code Here

Examples of org.eclipse.jface.databinding.swt.ISWTObservableValue

    Class refType = isBeanRef(value, propertyName);
    IObservable observable;
    if (boolean.class.isAssignableFrom(propertyType) || Boolean.class.isAssignableFrom(propertyType)) {
      Button checkbox = new Button(parent, SWT.CHECK | SWT.BORDER);
      widget = checkbox;
      ISWTObservableValue textValue = Forms.observe(checkbox);
      observable = textValue;
      Forms.bindPojoProperty(bindingContext, mmng, value, propertyName, isMandatory(value, propertyName), labelText, textValue, checkbox);
    } else if (refType != null) {
      Combo combo = new Combo(parent, SWT.NONE | SWT.BORDER);
      String[] beanRefs = getBeanRefs(refType);
      combo.setItems(beanRefs);
      toolkit.adapt(combo, true, true);
      widget = combo;

      ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo);
      observable = comboValue;
      Forms.bindPojoProperty(bindingContext, mmng, value, propertyName, isMandatory(value, propertyName), labelText, comboValue, combo);
    } else if (isEndpointUri(value, propertyName)) {
      Combo combo = new Combo(parent, SWT.NONE | SWT.BORDER);
      combo.setItems(getEndpointUris());
      toolkit.adapt(combo, true, true);
      widget = combo;

      ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo);
      observable = comboValue;
      Forms.bindPojoProperty(bindingContext, mmng, value, propertyName, isMandatory(value, propertyName), labelText, comboValue, combo);
    } else if (Enum.class.isAssignableFrom(propertyType)) {
      ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY | SWT.BORDER);
      combo.setContentProvider(ArrayContentProvider.getInstance());
      combo.setInput(getEnumValues((Class<? extends Enum>) propertyType));

      IViewerObservableValue comboValue = ViewersObservables.observeSingleSelection(combo);
      observable = comboValue;
      Control control = combo.getControl();
      Forms.bindPojoProperty(bindingContext, mmng, value, propertyName, isMandatory(value, propertyName), labelText, comboValue, control);

      toolkit.adapt(control, true, true);
      widget = control;

    } else {
      Text text = toolkit.createText(parent, "");
      widget = text;
      // text.setToolTipText(tooltip);
      ISWTObservableValue textValue = Forms.observe(text);
      observable = textValue;
      Forms.bindPojoProperty(bindingContext, mmng, value, propertyName, isMandatory(value, propertyName), labelText, textValue, text);
    }
    widget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (observable != null && node != null) {
View Full Code Here

Examples of org.eclipse.jface.databinding.swt.ISWTObservableValue

    public final IObservableValue bindStringInput(Composite editArea, final String label, String property, int style,
                    int lenghtInCharacters)
    {
        Text txtValue = createTextInput(editArea, label, style, lenghtInCharacters);

        ISWTObservableValue observeText = SWTObservables.observeText(txtValue, SWT.Modify);
        context.bindValue(observeText, BeansObservables.observeValue(model, property));

        return observeText;
    }
View Full Code Here

Examples of org.eclipse.jface.databinding.swt.ISWTObservableValue

                        BeansObservables.observeValue(model, "security"), null, null); //$NON-NLS-1$

        context.bindValue(new SimpleDateTimeSelectionProperty().observe(boxExDate),
                        BeansObservables.observeValue(model, "exDate")); //$NON-NLS-1$

        final ISWTObservableValue observeNewShares = SWTObservables.observeSelection(spinnerNewShares);
        context.bindValue(observeNewShares, BeansObservables.observeValue(model, "newShares")); //$NON-NLS-1$

        final ISWTObservableValue observeOldShares = SWTObservables.observeSelection(spinnerOldShares);
        context.bindValue(observeOldShares, BeansObservables.observeValue(model, "oldShares")); //$NON-NLS-1$

        MultiValidator validator = new MultiValidator()
        {

            @Override
            protected IStatus validate()
            {
                Object newShares = observeNewShares.getValue();
                Object oldShares = observeOldShares.getValue();

                return newShares.equals(oldShares) ? ValidationStatus
                                .error(Messages.SplitWizardErrorNewAndOldMustNotBeEqual) : ValidationStatus.ok();
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.