Package org.eclipse.core.databinding

Examples of org.eclipse.core.databinding.DataBindingContext


        tableViewer.setLabelProvider(new TransactionLabelProvider());
        tableViewer.setContentProvider(new SimpleListContentProvider());

        // bindings

        DataBindingContext context = new DataBindingContext();

        context.bindValue(SWTObservables.observeSelection(checkbox), //
                        BeansObservables.observeValue(model, "changeHistoricalQuotes")); //$NON-NLS-1$

        checkbox.addSelectionListener(new SelectionAdapter()
        {
            @Override
View Full Code Here


    private int averageCharWidth = -1;

    public BindingHelper(Model model)
    {
        this.model = model;
        this.context = new DataBindingContext();

        context.bindValue(PojoObservables.observeValue(listener, "status"), //$NON-NLS-1$
                        new AggregateValidationStatus(context, AggregateValidationStatus.MAX_SEVERITY));
    }
View Full Code Here

        //
        // Bind UI
        //

        DataBindingContext context = getBindingContext();

        // multi validator (to and from account must not be identical)
        MultiValidator validator = new MultiValidator()
        {

            @Override
            protected IStatus validate()
            {
                Object from = observableFrom.getValue();
                Object to = observableTo.getValue();

                return from != null && to != null && from != to ? ValidationStatus.ok() : ValidationStatus
                                .error(Messages.MsgAccountMustBeDifferent);
            }

        };
        context.addValidationStatusProvider(validator);

        context.bindValue(validator.observeValidatedValue(observableFrom), //
                        BeansObservables.observeValue(getModel(), "accountFrom")); //$NON-NLS-1$

        context.bindValue(validator.observeValidatedValue(observableTo), //
                        BeansObservables.observeValue(getModel(), "accountTo")); //$NON-NLS-1$

    }
View Full Code Here

        data.left = new FormAttachment(labelColon, 5);
        spinnerOldShares.setLayoutData(data);

        // model binding

        DataBindingContext context = bindings.getBindingContext();
        context.bindValue(ViewersObservables.observeSingleSelection(comboSecurity),
                        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();
            }

        };
        context.addValidationStatusProvider(validator);
    }
View Full Code Here

    ScrolledForm scrolledForm = toolkit.createScrolledForm( form.getBody() );
    scrolledForm.getBody().setLayout( new GridLayout( 2, false ) );
    Composite sectionParent = scrolledForm.getBody();

    dbc = new DataBindingContext();
    IWidgetValueProperty textModify = WidgetProperties.text( SWT.Modify );
    IWidgetValueProperty selChange = WidgetProperties.selection();

    {
      Section section = toolkit.createSection( sectionParent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED );
View Full Code Here

  private FadeTransition fadeInTransition;
 
  public void initialize(URL location, ResourceBundle resources) {
    IJFXBeanValueProperty uiProp = JFXBeanProperties.value("text");
   
    DataBindingContext ctx = new DataBindingContext();
    ctx.bindValue(uiProp.observe(firstname), BeanProperties.value("firstname").observeDetail(master));
    ctx.bindValue(uiProp.observe(lastname), BeanProperties.value("lastname").observeDetail(master));
    ctx.bindValue(uiProp.observe(street), BeanProperties.value("street").observeDetail(master));
    ctx.bindValue(uiProp.observe(zip), BeanProperties.value("zip").observeDetail(master));
    ctx.bindValue(uiProp.observe(city), BeanProperties.value("city").observeDetail(master));
   
    fadeOutTransition = new FadeTransition(Duration.millis(500), personroot);
        fadeOutTransition.setFromValue(1.0f);
        fadeOutTransition.setToValue(0.0f);
        fadeOutTransition.setAutoReverse(true);
View Full Code Here

    clazz = createInstance();
    clazz.setFragmentRoot(froot);
    clazz.setPackageFragment(fragment);
   
   
    DataBindingContext dbc = new DataBindingContext();
   
    {
      Label l = new Label(parent, SWT.NONE);
      l.setText("Source folder");

      Text t = new Text(parent, SWT.BORDER);
      t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      t.setEditable(false);
      final Binding bd = dbc.bindValue(
          WidgetProperties.text().observe(t),
          BeanProperties.value("fragmentRoot").observe(clazz),
          new UpdateValueStrategy(),
          new UpdateValueStrategy().setConverter(new PackageFragmentRootToStringConverter())
      );

      Button b = new Button(parent, SWT.PUSH);
      b.setText("Browse ...");
      b.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          IPackageFragmentRoot root = choosePackageRoot();
          if( root != null ) {
            froot = root;
            clazz.setFragmentRoot(root)
          }
          bd.updateModelToTarget(); //TODO Find out why this is needed
        }
      });
    }

    {
      Label l = new Label(parent, SWT.NONE);
      l.setText("Package");

      Text t = new Text(parent, SWT.BORDER);
      t.setEditable(false);
      t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      final Binding bd = dbc.bindValue(
          WidgetProperties.text().observe(t),
          BeanProperties.value("packageFragment").observe(clazz),
          new UpdateValueStrategy(),
          new UpdateValueStrategy().setConverter(new PackageFragmentToStringConverter())
      );

      Button b = new Button(parent, SWT.PUSH);
      b.setText("Browse ...");
      b.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          IPackageFragment fragment = choosePackage();
          if( fragment != null ) {
            clazz.setPackageFragment(fragment)
          }
          bd.updateModelToTarget(); //TODO Find out why this is needed
        }
      });
    }

    {
      IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);

      Label l = new Label(parent, SWT.NONE);
      l.setText("Name");

      nameField = new Text(parent, SWT.BORDER);
      nameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      dbc.bindValue(textProp.observe(nameField), BeanProperties.value("name", String.class).observe(clazz));

      new Label(parent, SWT.NONE);
    }

    {
View Full Code Here

    clazz = createInstance();
    clazz.setFragmentRoot(froot);
    clazz.setPackageFragment(fragment);
   
   
    DataBindingContext dbc = new DataBindingContext();
   
    {
      Label l = new Label(parent, SWT.NONE);
      l.setText("Source folder");

      Text t = new Text(parent, SWT.BORDER);
      t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      t.setEditable(false);
      final Binding bd = dbc.bindValue(
          WidgetProperties.text().observe(t),
          BeanProperties.value("fragmentRoot").observe(clazz),
          new UpdateValueStrategy(),
          new UpdateValueStrategy().setConverter(new PackageFragmentRootToStringConverter())
      );

      Button b = new Button(parent, SWT.PUSH);
      b.setText("Browse ...");
      b.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          IPackageFragmentRoot root = choosePackageRoot();
          if( root != null ) {
            froot = root;
            clazz.setFragmentRoot(root)
          }
          bd.updateModelToTarget(); //TODO Find out why this is needed
        }
      });
    }

    {
      Label l = new Label(parent, SWT.NONE);
      l.setText("Package");

      Text t = new Text(parent, SWT.BORDER);
      t.setEditable(false);
      t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      final Binding bd = dbc.bindValue(
          WidgetProperties.text().observe(t),
          BeanProperties.value("packageFragment").observe(clazz),
          new UpdateValueStrategy(),
          new UpdateValueStrategy().setConverter(new PackageFragmentToStringConverter())
      );

      Button b = new Button(parent, SWT.PUSH);
      b.setText("Browse ...");
      b.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          IPackageFragment fragment = choosePackage();
          if( fragment != null ) {
            clazz.setPackageFragment(fragment)
          }
          bd.updateModelToTarget(); //TODO Find out why this is needed
        }
      });
    }

    {
      IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);

      Label l = new Label(parent, SWT.NONE);
      l.setText("Name");

      nameField = new Text(parent, SWT.BORDER);
      nameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      dbc.bindValue(textProp.observe(nameField), BeanProperties.value("name", String.class).observe(clazz));

      new Label(parent, SWT.NONE);
    }

    {
View Full Code Here

TOP

Related Classes of org.eclipse.core.databinding.DataBindingContext

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.