Java Code Examples for org.eclipse.core.databinding.DataBindingContext#bindValue()
The following examples show how to use
org.eclipse.core.databinding.DataBindingContext#bindValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConstraintEditionControl.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createConstraintEditionComposite(DataBindingContext ctx) { Composite composite = formPage.getToolkit().createComposite(mainComposite); composite.setLayout(GridLayoutFactory.fillDefaults().create()); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); createConstraintDescriptionSection(composite, ctx); createConstraintEditionSection(composite); ctx.bindValue(WidgetProperties.visible().observe(composite), new ComputedValue<Boolean>() { @Override protected Boolean calculate() { return selectedConstraintObservable.getValue() != null; } }); }
Example 2
Source File: RolesToAccessRightsPreferencePage.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
protected DataBindingContext initDataBindings(){ DataBindingContext bindingContext = new DataBindingContext(); // IObservableValue observeTextTxti18nObserveWidget = WidgetProperties.text(SWT.Modify).observe(txti18n); IObservableValue wvTranslatedLabelObserveDetailValue = PojoProperties.value(Role.class, "translatedLabel", String.class).observeDetail(wv); bindingContext.bindValue(observeTextTxti18nObserveWidget, wvTranslatedLabelObserveDetailValue, null, null); // IObservableValue observeEnabledTxtRoleNameObserveWidget = WidgetProperties.enabled().observe(txtRoleName); IObservableValue wvSystemRoleObserveDetailValue = PojoProperties.value(Role.class, "systemRole", Boolean.class).observeDetail(wv); UpdateValueStrategy strategy = new UpdateValueStrategy(); strategy.setConverter(new BooleanNotConverter()); bindingContext.bindValue(observeEnabledTxtRoleNameObserveWidget, wvSystemRoleObserveDetailValue, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), strategy); // return bindingContext; }
Example 3
Source File: SelectDataWizardPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public void createBusinessVariableTableViewerComposite(final Composite parent, final DataBindingContext dbc) { businessVariableTableViewerComposite = new Composite(parent, SWT.NONE); businessVariableTableViewerComposite.setLayout(GridLayoutFactory.swtDefaults().create()); businessVariableTableViewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final TableViewer businessDataTableViewer = new TableViewer(businessVariableTableViewerComposite, SWT.BORDER | SWT.SINGLE | SWT.NO_FOCUS | SWT.H_SCROLL | SWT.V_SCROLL); businessDataTableViewer.getTable().setLayout(GridLayoutFactory.fillDefaults().create()); businessDataTableViewer.getTable() .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(200, 100).create()); final ObservableListContentProvider contentProvider = new ObservableListContentProvider(); businessDataTableViewer.setContentProvider(contentProvider); final IObservableSet knownElements = contentProvider.getKnownElements(); final IObservableMap[] labelMaps = EMFObservables.observeMaps(knownElements, new EStructuralFeature[] { ProcessPackage.Literals.ELEMENT__NAME, ProcessPackage.Literals.DATA__MULTIPLE, ProcessPackage.Literals.JAVA_OBJECT_DATA__CLASS_NAME }); businessDataTableViewer .setLabelProvider(new BusinessObjectDataStyledLabelProvider(businessObjectStore, labelMaps)); businessDataTableViewer .setInput(new WritableList(availableBusinessData, ProcessPackage.Literals.BUSINESS_OBJECT_DATA)); final IViewerObservableValue observeSingleSelection = ViewersObservables .observeSingleSelection(businessDataTableViewer); dbc.bindValue(observeSingleSelection, selectedDataObservable); businessVariableButton.addSelectionListener(createBusinessVariableSelectionAdapter()); }
Example 4
Source File: BusinessObjectList.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public BusinessObjectList( Composite parent, AbstractBdmFormPage formPage, DataBindingContext ctx) { this.ctx = ctx; section = formPage.getToolkit().createSection(parent, Section.EXPANDED); section.setLayout(GridLayoutFactory.fillDefaults().create()); section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); section.setText(Messages.listOfBusinessObjects); Composite boListComposite = createBusinessObjectListComposite(formPage); ctx.bindValue(businessObjectSelectionObservable, selectionObservable, UpdateStrategyFactory.updateValueStrategy().create(), UpdateStrategyFactory.updateValueStrategy() .withConverter(ConverterBuilder.<Object, BusinessObject> newConverter() .fromType(Object.class) .toType(BusinessObject.class) .withConvertFunction(o -> o instanceof BusinessObject ? (BusinessObject) o : null) .create()) .create()); ctx.bindValue(businessObjectSelectionObservable, formPage.observeBusinessObjectSelected()); section.setClient(boListComposite); }
Example 5
Source File: ImportConfigurationWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void createControl(Composite parent) { Composite mainComposite = new Composite(parent, SWT.NONE) ; mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()) ; mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(20,20).create()) ; databindingContext = new DataBindingContext() ; final TableViewer viewer = new TableViewer(mainComposite, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE ) ; viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()) ; viewer.setContentProvider(new ArrayContentProvider()) ; viewer.setLabelProvider(new ActionLabelProvider()) ; viewer.setInput(getConfigurationImporterContributions()) ; UpdateValueStrategy startegy = new UpdateValueStrategy() ; startegy.setBeforeSetValidator(new IValidator() { @Override public IStatus validate(Object value) { if(value instanceof IAction){ return Status.OK_STATUS ; } return ValidationStatus.error(Messages.mustSelectExportError); } }) ; WizardPageSupport.create(this,databindingContext) ; databindingContext.bindValue(ViewersObservables.observeSingleSelection(viewer), PojoObservables.observeValue(this, "action"),startegy,null) ; setControl(mainComposite) ; }
Example 6
Source File: ProjectSettingLanguagePage.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
private void initDataBindings() { DataBindingContext ctx = new DataBindingContext(); IObservableValue widgetValue = ViewersObservables.observeSingleSelection(srcLangComboViewer); IObservableValue modelValue = BeanProperties.value(ProjectInfoBean.class, "sourceLang").observe(projCfgBean); ctx.bindValue(widgetValue, modelValue, null, null); }
Example 7
Source File: EssentialsPage.java From thym with Eclipse Public License 1.0 | 5 votes |
protected DataBindingContext initDataBindings() { DataBindingContext bindingContext = new DataBindingContext(); // IObservableValue observeTextTxtIdtxtObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtIdtxt); IObservableValue idGetWidgetObserveValue = BeanProperties.value("id").observe(getWidget()); bindingContext.bindValue(observeTextTxtIdtxtObserveWidget, idGetWidgetObserveValue, null, null); // IObservableValue observeTextTxtNameObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtName); IObservableValue nameGetWidgetObserveValue = BeanProperties.value("name").observe(getWidget()); UpdateValueStrategy strategy_3 = new UpdateValueStrategy(); strategy_3.setConverter(new StringToDisplayableStringConverter()); bindingContext.bindValue(observeTextTxtNameObserveWidget, nameGetWidgetObserveValue, null, strategy_3); // IObservableValue observeTextTxtDescriptionObserveWidget = WidgetProperties.text(SWT.Modify) .observe(txtDescription); IObservableValue descriptionGetWidgetObserveValue = BeanProperties.value("description").observe(getWidget()); UpdateValueStrategy strategy_2 = new UpdateValueStrategy(); strategy_2.setConverter(new StringToDisplayableStringConverter()); bindingContext.bindValue(observeTextTxtDescriptionObserveWidget, descriptionGetWidgetObserveValue, null, strategy_2); // IObservableValue observeTextTxtVersionObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtVersion); IObservableValue versionGetWidgetObserveValue = BeanProperties.value("version").observe(getWidget()); bindingContext.bindValue(observeTextTxtVersionObserveWidget, versionGetWidgetObserveValue, null, null); // return bindingContext; }
Example 8
Source File: ConverterUtil.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public static void bindValue(DataBindingContext context,ComboViewer comboViewer, ConverterViewModel model) { // ViewerSupport.bind(comboViewer, BeansObservables.observeList( // model, "supportTypes", String.class), // Properties.selfValue(String.class)); // // // context.bindValue(ViewersObservables // .observeSingleSelection(comboViewer), BeansObservables // .observeValue(model, // "selectedType")); // ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider(); comboViewer.setContentProvider(new ArrayContentProvider()); comboViewer.setComparator(new ViewerComparator()); // IObservableMap[] attributeMaps = BeansObservables.observeMaps( // viewerContentProvider.getKnownElements(), // ConverterBean.class, new String[] { "description" }); // comboViewer.setLabelProvider(new ObservableMapLabelProvider( // attributeMaps)); // comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class)); comboViewer.setInput(model.getSupportTypes()); IViewerObservableValue selection=ViewersObservables.observeSingleSelection(comboViewer); IObservableValue observableValue=BeansObservables.observeDetailValue(selection, "name", ConverterBean.class); context.bindValue(observableValue, BeansObservables .observeValue(model, "selectedType")); }
Example 9
Source File: SelectDataWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createActionModeSelectionRadioButtons(DataBindingContext dbc, Composite parent) { Label actionLabel = new Label(parent, SWT.NONE); actionLabel.setLayoutData(GridDataFactory.fillDefaults().create()); actionLabel.setText(Messages.action); actionLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); Composite buttonComposite = new Composite(parent, SWT.NONE); buttonComposite.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create()); buttonComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).spacing(20, 0).create()); Button createButton = new Button(buttonComposite, SWT.RADIO); createButton.setText(Messages.createDataFromContractChoice); ControlDecoration createModeCcontrolDecoration = new ControlDecoration(createButton, SWT.RIGHT); createModeCcontrolDecoration.setDescriptionText(Messages.createActionHint); createModeCcontrolDecoration.setImage(Pics.getImage(PicsConstants.hint)); createModeCcontrolDecoration.setShowOnlyOnFocus(false); createModeCcontrolDecoration.setMarginWidth(-5); Button editButton = new Button(buttonComposite, SWT.RADIO); editButton.setText(Messages.editDataFromContractChoice); ControlDecoration editModeCcontrolDecoration = new ControlDecoration(editButton, SWT.RIGHT); editModeCcontrolDecoration.setDescriptionText(Messages.editActionHint); editModeCcontrolDecoration.setImage(Pics.getImage(PicsConstants.hint)); editModeCcontrolDecoration.setShowOnlyOnFocus(false); editModeCcontrolDecoration.setMarginWidth(-5); SelectObservableValue creationTypeObservable = new SelectObservableValue<EditMode>(EditMode.class); creationTypeObservable.addOption(EditMode.CREATE, WidgetProperties.selection().observe(createButton)); creationTypeObservable.addOption(EditMode.EDIT, WidgetProperties.selection().observe(editButton)); editButton.setEnabled(contract.eContainer() instanceof Task); generateOptions.setEditMode(contract.eContainer() instanceof Task ? EditMode.EDIT : EditMode.CREATE); dbc.bindValue(creationTypeObservable, generateOptions.getEditModeObservable()); }
Example 10
Source File: DateTimeControl.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void bindControl(final DataBindingContext dbc, final IObservableValue modelObservable) { final DateTimeObservable dateObservable = new DateTimeObservable(dateControl); final DateTimeObservable timeObservable = new DateTimeObservable(timeControl); dbc.bindValue(dateObservable, modelObservable); dateControl.notifyListeners(SWT.Selection, new Event()); timeObservable.addValueChangeListener(new IValueChangeListener() { @Override public void handleValueChange(final ValueChangeEvent event) { final Date newValue = (Date) event.diff.getNewValue(); dateControl.setTime(newValue.getHours(), newValue.getMinutes(), newValue.getMinutes()); dateControl.notifyListeners(SWT.Selection, new Event()); } }); }
Example 11
Source File: FamilyAnamnesisComposite.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
protected void initDataBindings(){ DataBindingContext bindingContext = new DataBindingContext(); IObservableValue target = WidgetProperties.text(SWT.Modify).observeDelayed(1500, textOberservation); IObservableValue model = PojoProperties.value(FamAnamnesisText.class, "text", String.class).observeDetail(item); bindingContext.bindValue(target, model, null, null); }
Example 12
Source File: FormMappingRadioGroup.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void doBindControl(final DataBindingContext context, final IObservableValue formMappingObservable) { context.bindValue(PojoObservables.observeValue(stackLayout, "topControl"), mappingTypeObservable, neverUpdateValueStrategy().create(), updateValueStrategy() .withConverter(mappingTypeToCompositeConverter()).create()); context.bindValue(mappingTypeObservable, CustomEMFEditObservables.observeDetailValue(Realm.getDefault(), formMappingObservable, ProcessPackage.Literals.FORM_MAPPING__TYPE)); pageDesignerMappingComposite.doBindControl(context, formMappingObservable); urlMappingComposite.doBindControl(context, formMappingObservable); noneComposite.doBindControl(context, formMappingObservable, FormMappingType.NONE); }
Example 13
Source File: DriverSelectionDialog.java From neoscada with Eclipse Public License 1.0 | 4 votes |
protected void createDataModel ( final TreeViewer viewer ) { final DataBindingContext dbc = new DataBindingContext (); final IObservableFactory listFactory = new IObservableFactory () { @Override public IObservable createObservable ( final Object target ) { if ( target instanceof IObservableList ) { return (IObservableList)target; } else if ( target instanceof World ) { return EMFObservables.observeList ( (EObject)target, InfrastructurePackage.Literals.WORLD__NODES ); } else if ( target instanceof SystemNode ) { return EMFObservables.observeList ( (EObject)target, InfrastructurePackage.Literals.SYSTEM_NODE__DRIVERS ); } return null; } }; final AdapterFactory adapterFactory = new InfrastructureItemProviderAdapterFactory (); final AdapterFactoryLabelProvider labelProvider = new AdapterFactoryLabelProvider ( adapterFactory ); final ObservableListTreeContentProvider cp = new ObservableListTreeContentProvider ( listFactory, null ); viewer.setContentProvider ( cp ); viewer.setLabelProvider ( labelProvider ); viewer.setInput ( EMFObservables.observeList ( this.world, InfrastructurePackage.Literals.WORLD__NODES ) ); dbc.bindValue ( ViewersObservables.observeSingleSelection ( viewer ), this.driverValue ); this.driverValue.addValueChangeListener ( new IValueChangeListener () { @Override public void handleValueChange ( final ValueChangeEvent event ) { update (); } } ); viewer.getControl ().addDisposeListener ( new DisposeListener () { @Override public void widgetDisposed ( final DisposeEvent e ) { dbc.dispose (); } } ); }
Example 14
Source File: StammDatenComposite.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
protected void initDataBindings(){ DataBindingContext bindingContext = new DataBindingContext(); Text[] control = { txtTitleFront, txtFirstName, txtFamilyName, txtTitleBack, txtZIP, txtCity, txtStreet, txtTelefon, txtTelefon2, txtFax, txtEmail, txtWebsite, txtMobil, txtNotes }; String[] property = { "titel", "description2", "description1", "titelSuffix", "zip", "city", "street", "phone1", "phone2", "fax", "email", "website", "mobile", "comment" }; for (int i = 0; i < control.length; i++) { bindValue(control[i], property[i], bindingContext); } // DateTime // TODO // IObservableValue dateTimeObserveWidget = SWTObservables.observeSelection(dateTimeDob); // IObservableValue dateTimeObserveValue = // BeansObservables.observeDetailValue(contactObservable, "dateOfBirth", // org.joda.time.DateTime.class); // UpdateValueStrategy targetToModel = new UpdateValueStrategy(); // targetToModel.setConverter(new DateDateTimeConverter()); // UpdateValueStrategy modelToTarget = new UpdateValueStrategy(); // modelToTarget.setConverter(new DateTimeDateConverter()); // bindingContext.bindValue(dateTimeObserveWidget, dateTimeObserveValue, targetToModel, // modelToTarget); // Warum liegt denn hier Stroh rum? IObservableValue sexObserver = ViewersObservables.observeSingleSelection(comboViewerSex); bindingContext.bindValue(sexObserver, BeansObservables.observeDetailValue(contactObservable, "gender", ContactGender.class), null, null); IObservableValue countryObserver = ViewersObservables.observeSingleSelection(comboViewerCountry); bindingContext.bindValue(countryObserver, BeansObservables.observeDetailValue(contactObservable, "country", Country.class), null, null); }
Example 15
Source File: JSONBindingUIHelper.java From typescript.java with MIT License | 4 votes |
public static void bind(Text text, IJSONPath path, String defaultValue, IDocument document, DataBindingContext context) { context.bindValue(WidgetProperties.text(SWT.Modify).observe(text), JSONProperties.value(path, defaultValue).observe(document)); }
Example 16
Source File: URLMappingComposite.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
public void doBindControl(final DataBindingContext context, final IObservableValue formMappingObservable) { context.bindValue(SWTObservables.observeText(urlText, SWT.Modify), CustomEMFEditObservables.observeDetailValue(Realm.getDefault(), formMappingObservable, ProcessPackage.Literals.FORM_MAPPING__URL)); doBindInfo(context, formMappingObservable); }
Example 17
Source File: WorkspaceWizardPage.java From n4js with Eclipse Public License 1.0 | 4 votes |
private void setupBindings(WorkspaceWizardPageForm wizardForm) { databindingContext = new DataBindingContext(); WorkspaceWizardModelValidator<M> validator = getValidator(); // Project property binding IObservableValue<IPath> projectModelValue = BeanProperties .value(WorkspaceWizardModel.class, WorkspaceWizardModel.PROJECT_PROPERTY, IPath.class) .observe(model); IObservableValue<String> projectUI = WidgetProperties.text(SWT.Modify).observe(wizardForm.getProjectText()); // Note: No model to UI conversation here as IPath is castable to String (default behavior) databindingContext.bindValue(projectUI, projectModelValue, new StringToPathConverter().updatingValueStrategy(), new UpdateValueStrategy<>(UpdateValueStrategy.POLICY_UPDATE)); // Source folder property binding IObservableValue<IPath> sourceFolderModelValue = BeanProperties .value(WorkspaceWizardModel.class, WorkspaceWizardModel.SOURCE_FOLDER_PROPERTY, IPath.class) .observe(model); IObservableValue<String> sourceFolderUI = WidgetProperties.text(SWT.Modify) .observe(wizardForm.getSourceFolderText()); // Note: No model to UI conversation (see above) databindingContext.bindValue(sourceFolderUI, sourceFolderModelValue, new StringToPathConverter().updatingValueStrategy(), new UpdateValueStrategy<>(UpdateValueStrategy.POLICY_UPDATE)); IObservableValue<Boolean> projectValidModelValue = BeanProperties .value(WorkspaceWizardModelValidator.class, WorkspaceWizardModelValidator.PROJECT_PROPERTY_VALID, Boolean.class) .observe(validator); IObservableValue<Boolean> sourceFolderBrowseEnabled = WidgetProperties.enabled() .observe(wizardForm.getSourceFolderBrowseButton()); databindingContext.bindValue(sourceFolderBrowseEnabled, projectValidModelValue, new UpdateValueStrategy<>(UpdateValueStrategy.POLICY_NEVER), new UpdateValueStrategy<>(UpdateValueStrategy.POLICY_UPDATE)); // Module specifier property binding IObservableValue<String> moduleSpecifierModelValue = BeanProperties .value(WorkspaceWizardModel.class, WorkspaceWizardModel.MODULE_SPECIFIER_PROPERTY, String.class) .observe(model); IObservableValue<String> moduleSpecifierUI = BeanProperties .value(SuffixText.class, SuffixText.TEXT_PROPERTY, String.class) .observe(wizardForm.getModuleSpecifierText()); databindingContext.bindValue(moduleSpecifierUI, moduleSpecifierModelValue); // Conditional activation of the browse buttons according to the precedent input fields validity IObservableValue<Boolean> moduleSpecifierBrowseEnabled = WidgetProperties.enabled() .observe(wizardForm.getModuleSpecifierBrowseButton()); IObservableValue<Boolean> sourceFolderValidValue = BeanProperties.value(WorkspaceWizardModelValidator.class, WorkspaceWizardModelValidator.SOURCE_FOLDER_PROPERTY_VALID, Boolean.class).observe(validator); IObservableValue<Boolean> projectValidValue = BeanProperties.value(WorkspaceWizardModelValidator.class, WorkspaceWizardModelValidator.PROJECT_PROPERTY_VALID, Boolean.class).observe(validator); ConditionalConverter moduleSpecifierBrowseableConverter = new ConditionalConverter() { @Override public boolean validate(Object object) { return validator.getSourceFolderValid() && validator.getProjectValid(); } }; // Bind model changes of project or source folder property to the enabled state of the module specifier browse // button. databindingContext.bindValue(moduleSpecifierBrowseEnabled, projectValidValue, new UpdateValueStrategy<>(UpdateValueStrategy.POLICY_NEVER), moduleSpecifierBrowseableConverter.updatingValueStrategy()); databindingContext.bindValue(moduleSpecifierBrowseEnabled, sourceFolderValidValue, new UpdateValueStrategy<>(UpdateValueStrategy.POLICY_NEVER), moduleSpecifierBrowseableConverter.updatingValueStrategy()); }
Example 18
Source File: ExportBusinessDataModelWizardPage.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected void createDestinationTextAndLabel(Composite mainComposite, DataBindingContext context) { final Composite composite = new Composite(mainComposite, SWT.NONE); composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(0, 0).create()); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); final Label destinationLabel = new Label(composite, SWT.NONE); destinationLabel.setText(Messages.destinationPath + " *"); destinationLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).grab(false, false).create()); final Text destinationText = new Text(composite, SWT.BORDER); destinationText.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create()); UpdateValueStrategy targetToModelStrategy = new UpdateValueStrategy(); targetToModelStrategy.setAfterGetValidator(new EmptyInputValidator(Messages.destinationPath)); targetToModelStrategy.setBeforeSetValidator(new IValidator() { @Override public IStatus validate(Object value) { return validateFilePath(value); } }); context.bindValue(SWTObservables.observeText(destinationText, SWT.Modify), PojoObservables.observeValue(this, "destinationPath"), targetToModelStrategy, null); final Button browseButton = new Button(composite, SWT.PUSH); browseButton.setText(Messages.browse); browseButton.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).create()); browseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { DirectoryDialog directoryDialog = new DirectoryDialog(Display.getDefault().getActiveShell(), SWT.SAVE); String path = directoryDialog.open(); if (path != null) { destinationText.setText(path); } } }); }
Example 19
Source File: ArticleDefaultSignatureComposite.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
public DataBindingContext initDataBindings(DataBindingContext dbc){ if (dbc == null) { databindingContext = new DataBindingContext(); } else { databindingContext = dbc; } targetToModelStrategies = new ArrayList<>(); IObservableValue observeTextTextSignatureMorningObserveWidget = WidgetProperties.text(new int[] { SWT.Modify, SWT.FocusOut }).observeDelayed(100, txtSignatureMorning); IObservableValue itemSignatureMorningObserveDetailValue = PojoProperties.value(IArticleDefaultSignature.class, "morning", String.class) //$NON-NLS-1$ .observeDetail(signatureItem); SavingTargetToModelStrategy targetToModelStrategy = new SavingTargetToModelStrategy(this); targetToModelStrategies.add(targetToModelStrategy); databindingContext.bindValue(observeTextTextSignatureMorningObserveWidget, itemSignatureMorningObserveDetailValue, targetToModelStrategy, null); IObservableValue observeTextTextSignatureNoonObserveWidget = WidgetProperties.text(new int[] { SWT.Modify, SWT.FocusOut }).observeDelayed(100, txtSignatureNoon); IObservableValue itemSignatureNoonObserveDetailValue = PojoProperties.value(IArticleDefaultSignature.class, "noon", String.class) //$NON-NLS-1$ .observeDetail(signatureItem); targetToModelStrategy = new SavingTargetToModelStrategy(this); targetToModelStrategies.add(targetToModelStrategy); databindingContext.bindValue(observeTextTextSignatureNoonObserveWidget, itemSignatureNoonObserveDetailValue, targetToModelStrategy, null); IObservableValue observeTextTextSignatureEveningObserveWidget = WidgetProperties.text(new int[] { SWT.Modify, SWT.FocusOut }).observeDelayed(100, txtSignatureEvening); IObservableValue itemSignatureEveningObserveDetailValue = PojoProperties.value(IArticleDefaultSignature.class, "evening", String.class) //$NON-NLS-1$ .observeDetail(signatureItem); targetToModelStrategy = new SavingTargetToModelStrategy(this); targetToModelStrategies.add(targetToModelStrategy); databindingContext.bindValue(observeTextTextSignatureEveningObserveWidget, itemSignatureEveningObserveDetailValue, targetToModelStrategy, null); IObservableValue observeTextTextSignatureNightObserveWidget = WidgetProperties.text(new int[] { SWT.Modify, SWT.FocusOut }).observeDelayed(100, txtSignatureNight); IObservableValue itemSignatureNightObserveDetailValue = PojoProperties.value(IArticleDefaultSignature.class, "night", String.class) //$NON-NLS-1$ .observeDetail(signatureItem); targetToModelStrategy = new SavingTargetToModelStrategy(this); targetToModelStrategies.add(targetToModelStrategy); databindingContext.bindValue(observeTextTextSignatureNightObserveWidget, itemSignatureNightObserveDetailValue, targetToModelStrategy, null); IObservableValue observeTextFreeTextDosageObserveWidget = WidgetProperties.text(new int[] { SWT.Modify, SWT.FocusOut }).observeDelayed(100, txtFreeTextDosage); IObservableValue itemSignatureFreeTextDosageObserveDetailValue = PojoProperties .value(IArticleDefaultSignature.class, "freeText", String.class) //$NON-NLS-1$ .observeDetail(signatureItem); targetToModelStrategy = new SavingTargetToModelStrategy(this); targetToModelStrategies.add(targetToModelStrategy); databindingContext.bindValue(observeTextFreeTextDosageObserveWidget, itemSignatureFreeTextDosageObserveDetailValue, targetToModelStrategy, null); IObservableValue observeTextTextSignatureCommentObserveWidget = WidgetProperties.text(new int[] { SWT.Modify, SWT.FocusOut }).observeDelayed(100, txtSignatureComment); IObservableValue itemSignatureCommentObserveDetailValue = PojoProperties.value(IArticleDefaultSignature.class, "comment", String.class) //$NON-NLS-1$ .observeDetail(signatureItem); targetToModelStrategy = new SavingTargetToModelStrategy(this); targetToModelStrategies.add(targetToModelStrategy); databindingContext.bindValue(observeTextTextSignatureCommentObserveWidget, itemSignatureCommentObserveDetailValue, targetToModelStrategy, null); return databindingContext; }
Example 20
Source File: IconsPage.java From thym with Eclipse Public License 1.0 | 4 votes |
protected DataBindingContext initDataBindings() { DataBindingContext bindingContext = new DataBindingContext(); // ObservableListContentProvider listContentProvider = new ObservableListContentProvider(); IObservableMap observeMap = BeansObservables.observeMap(listContentProvider.getKnownElements(), Icon.class, "src"); iconsTableViewer.setLabelProvider(new ObservableMapLabelProvider(observeMap)); iconsTableViewer.setContentProvider(listContentProvider); // IObservableList iconsGetWidgetObserveList = BeanProperties.list("icons").observe(getWidget()); iconsTableViewer.setInput(iconsGetWidgetObserveList); // ObservableListContentProvider listContentProvider_1 = new ObservableListContentProvider(); IObservableMap observeMap_1 = BeansObservables.observeMap(listContentProvider_1.getKnownElements(), Splash.class, "src"); splashTableViewer.setLabelProvider(new ObservableMapLabelProvider(observeMap_1)); splashTableViewer.setContentProvider(listContentProvider_1); // IObservableList splashesGetWidgetObserveList = BeanProperties.list("splashes").observe(getWidget()); splashTableViewer.setInput(splashesGetWidgetObserveList); // IObservableValue observeSingleSelectionIconsTableViewer = ViewerProperties.singleSelection().observe(iconsTableViewer); IObservableValue iconsTableViewerWidthObserveDetailValue = BeanProperties.value(Icon.class, "width", int.class).observeDetail(observeSingleSelectionIconsTableViewer); IObservableValue observeTextTxtWidthObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtWidth); bindingContext.bindValue(iconsTableViewerWidthObserveDetailValue, observeTextTxtWidthObserveWidget, null, null); // IObservableValue observeSingleSelectionIconsTableViewer_1 = ViewerProperties.singleSelection().observe(iconsTableViewer); IObservableValue iconsTableViewerHeightObserveDetailValue = BeanProperties.value(Icon.class, "height", int.class).observeDetail(observeSingleSelectionIconsTableViewer_1); IObservableValue observeTextTxtHeightObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtHeight); bindingContext.bindValue(iconsTableViewerHeightObserveDetailValue, observeTextTxtHeightObserveWidget, null, null); // IObservableValue observeSingleSelectionIconsTableViewer_2 = ViewerProperties.singleSelection().observe(iconsTableViewer); IObservableValue iconsTableViewerPlatformObserveDetailValue = BeanProperties.value(Icon.class, "platform", String.class).observeDetail(observeSingleSelectionIconsTableViewer_2); IObservableValue observeTextTxtPlatformObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtPlatform); bindingContext.bindValue(iconsTableViewerPlatformObserveDetailValue, observeTextTxtPlatformObserveWidget, null, null); // IObservableValue observeSingleSelectionIconsTableViewer_3 = ViewerProperties.singleSelection().observe(iconsTableViewer); IObservableValue iconsTableViewerDensityObserveDetailValue = BeanProperties.value(Icon.class, "density", String.class).observeDetail(observeSingleSelectionIconsTableViewer_3); IObservableValue observeTextTxtDensityObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtDensity); bindingContext.bindValue(iconsTableViewerDensityObserveDetailValue, observeTextTxtDensityObserveWidget, null, null); // IObservableValue observeSingleSelectionSplashTableViewer = ViewerProperties.singleSelection().observe(splashTableViewer); IObservableValue splashTableViewerWidthObserveDetailValue = BeanProperties.value(Splash.class, "width", int.class).observeDetail(observeSingleSelectionSplashTableViewer); IObservableValue observeTextTxtSplshWidthObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtSplshWidth); bindingContext.bindValue(splashTableViewerWidthObserveDetailValue, observeTextTxtSplshWidthObserveWidget, null, null); // IObservableValue observeSingleSelectionSplashTableViewer_1 = ViewerProperties.singleSelection().observe(splashTableViewer); IObservableValue splashTableViewerHeightObserveDetailValue = BeanProperties.value(Splash.class, "height", int.class).observeDetail(observeSingleSelectionSplashTableViewer_1); IObservableValue observeTextTxtSplshHeightObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtSplshHeight); bindingContext.bindValue(splashTableViewerHeightObserveDetailValue, observeTextTxtSplshHeightObserveWidget, null, null); // IObservableValue observeSingleSelectionSplashTableViewer_2 = ViewerProperties.singleSelection().observe(splashTableViewer); IObservableValue splashTableViewerPlatformObserveDetailValue = BeanProperties.value(Splash.class, "platform", String.class).observeDetail(observeSingleSelectionSplashTableViewer_2); IObservableValue observeTextTxtSplshPlatformObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtSplshPlatform); bindingContext.bindValue(splashTableViewerPlatformObserveDetailValue, observeTextTxtSplshPlatformObserveWidget, null, null); // IObservableValue observeSingleSelectionSplashTableViewer_3 = ViewerProperties.singleSelection().observe(splashTableViewer); IObservableValue splashTableViewerDensityObserveDetailValue = BeanProperties.value(Splash.class, "density", String.class).observeDetail(observeSingleSelectionSplashTableViewer_3); IObservableValue observeTextTxtSplshDensityObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtSplshDensity); bindingContext.bindValue(splashTableViewerDensityObserveDetailValue, observeTextTxtSplshDensityObserveWidget, null, null); // return bindingContext; }