org.eclipse.core.databinding.beans.PojoProperties Java Examples
The following examples show how to use
org.eclipse.core.databinding.beans.PojoProperties.
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: SelectArtifactToDeployPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createDefaultUserTextWidget(DataBindingContext ctx, final Composite mainComposite) { usernameObservable = PojoProperties.value("defaultUsername").observe(this); usernameProposalProvider = new SimpleContentProposalProvider(); usernameProposalProvider.setFiltering(true); defaultUserTextWidget = new TextWidget.Builder() .useNativeRender() .labelAbove() .widthHint(530) .withLabel(org.bonitasoft.studio.actors.i18n.Messages.defaultUser) .withTootltip(org.bonitasoft.studio.actors.i18n.Messages.defaultUserTooltip) .bindTo(usernameObservable) .withProposalProvider(usernameProposalProvider) .withValidator(defaultUserValidator().create()) .inContext(ctx) .createIn(mainComposite); }
Example #2
Source File: AppEngineDeployPreferencesPanel.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
private void setupProjectSelectorDataBinding() { IViewerObservableValue projectInput = ViewerProperties.input().observe(projectSelector.getViewer()); IViewerObservableValue projectSelection = ViewerProperties.singleSelection().observe(projectSelector.getViewer()); bindingContext.addValidationStatusProvider( new ProjectSelectionValidator(projectInput, projectSelection, requireValues)); IViewerObservableValue projectList = ViewerProperties.singleSelection().observe(projectSelector.getViewer()); IObservableValue<String> projectIdModel = PojoProperties.value("projectId").observe(model); UpdateValueStrategy gcpProjectToProjectId = new UpdateValueStrategy().setConverter(new GcpProjectToProjectIdConverter()); UpdateValueStrategy projectIdToGcpProject = new UpdateValueStrategy().setConverter(new ProjectIdToGcpProjectConverter()); bindingContext.bindValue(projectList, projectIdModel, gcpProjectToProjectId, projectIdToGcpProject); }
Example #3
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 #4
Source File: SelectJarsDialog.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent) { Control control = super.createDialogArea(parent); UpdateValueStrategy selectionStartegy = new UpdateValueStrategy() ; selectionStartegy.setAfterGetValidator(new IValidator() { @Override public IStatus validate(Object value) { if( value == null){ return ValidationStatus.error("Selection is empty") ; } return Status.OK_STATUS; } }) ; context.bindList(ViewersObservables.observeMultiSelection(tableViewer), PojoProperties.list(SelectJarsDialog.class,"selectedJars").observe(this)) ; context.bindValue(ViewersObservables.observeSingleSelection(tableViewer), PojoProperties.value(SelectJarsDialog.class,"selectedJar").observe(this), selectionStartegy, null) ; return control ; }
Example #5
Source File: ProjectSelector.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
public ProjectSelector(Composite parent) { super(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(this); Composite tableComposite = new Composite(this, SWT.NONE); TableColumnLayout tableColumnLayout = new TableColumnLayout(); tableComposite.setLayout(tableColumnLayout); GridDataFactory.fillDefaults().grab(true, true).applyTo(tableComposite); viewer = new TableViewer(tableComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); createColumns(tableColumnLayout); viewer.getTable().setHeaderVisible(true); viewer.getTable().setLinesVisible(false); input = WritableList.withElementType(GcpProject.class); projectProperties = PojoProperties.values(new String[] {"name", "id"}); //$NON-NLS-1$ //$NON-NLS-2$ ViewerSupport.bind(viewer, input, projectProperties); viewer.setComparator(new ViewerComparator()); Composite linkComposite = new Composite(this, SWT.NONE); statusLink = new Link(linkComposite, SWT.WRAP); statusLink.addSelectionListener( new OpenUriSelectionListener(new ErrorDialogErrorHandler(getShell()))); statusLink.setText(""); GridDataFactory.fillDefaults().span(2, 1).applyTo(linkComposite); GridLayoutFactory.fillDefaults().generateLayout(linkComposite); }
Example #6
Source File: ExportBarWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createDestination(final Composite group) { final Label destPath = new Label(group, SWT.NONE); destPath.setText(Messages.destinationPath + " *"); destPath.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create()); // destination name entry field destinationCombo = new Combo(group, SWT.SINGLE | SWT.BORDER); destinationCombo .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).create()); restoreWidgetValues(); final UpdateValueStrategy pathStrategy = new UpdateValueStrategy(); pathStrategy.setBeforeSetValidator(new EmptyInputValidator(Messages.destinationPath)); dbc.bindValue(SWTObservables.observeText(destinationCombo), PojoProperties.value(ExportBarWizardPage.class, "detinationPath").observe(this), pathStrategy, null); // destination browse button destinationBrowseButton = new Button(group, SWT.PUSH); destinationBrowseButton.setText(Messages.browse); destinationBrowseButton.setLayoutData(GridDataFactory.fillDefaults().hint(85, SWT.DEFAULT).create()); destinationBrowseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { handleDestinationBrowseButtonPressed(); } }); }
Example #7
Source File: OpenNameAndVersionDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createNameAndVersion(final Composite res, final DataBindingContext dbc) { final Label nameLabel = new Label(res, SWT.NONE); nameLabel.setText(Messages.name); nameLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create()); final Text nameText = new Text(res, SWT.BORDER); nameText.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, "org.bonitasoft.studio.common.diagram.dialog.name.text"); nameText.setLayoutData( GridDataFactory.fillDefaults().grab(true, false).hint(200, SWT.DEFAULT).indent(10, 0).create()); final ISWTObservableValue observeNameText = SWTObservables.observeText(nameText, SWT.Modify); ControlDecorationSupport.create( dbc.bindValue(observeNameText, PojoProperties.value("name").observe(identifier), nameUpdateStrategy(), null), SWT.LEFT); final Label versionLabel = new Label(res, SWT.NONE); versionLabel.setText(Messages.version); final Text versionText = new Text(res, SWT.BORDER); versionText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(10, 0).create()); final ISWTObservableValue observeVersionText = SWTObservables.observeText(versionText, SWT.Modify); ControlDecorationSupport.create(dbc.bindValue(observeVersionText, PojoProperties.value("version").observe(identifier), versionUpdateStrategy(), null), SWT.LEFT); if (isForceNameUpdate()) { final MustUpdateValidator mustUpdateValidator = new MustUpdateValidator(abstractProcess, observeNameText, observeVersionText); dbc.addValidationStatusProvider(mustUpdateValidator); ControlDecorationSupport.create(mustUpdateValidator, SWT.LEFT); } final MultiValidator multiValidator = unicityValidator(observeNameText, observeVersionText); dbc.addValidationStatusProvider(multiValidator); ControlDecorationSupport.create(multiValidator, SWT.LEFT); }
Example #8
Source File: UserManagementPreferencePage.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
protected DataBindingContext initDataBindings(){ DataBindingContext bindingContext = new DataBindingContext(); // IObservableValue observeSelectionBtnIsAdminObserveWidget = WidgetProperties.selection().observe(btnUserIsAdmin); IObservableValue wvAdminObserveDetailValue = PojoProperties.value(User.class, "administrator", Boolean.class).observeDetail(wvUser); bindingContext.bindValue(observeSelectionBtnIsAdminObserveWidget, wvAdminObserveDetailValue, null, null); // IObservableValue observeSelectionBtnIsMandatorObserveWidget = WidgetProperties.selection().observe(btnIsExecutiveDoctor); IObservableValue wvMandatorObserveDetailValue = PojoProperties .value(Anwender.class, "executiveDoctor", Boolean.class).observeDetail(wvAnwender); bindingContext.bindValue(observeSelectionBtnIsMandatorObserveWidget, wvMandatorObserveDetailValue, null, null); // IObservableValue observeSelectionBtnIsActiveObserveWidget = WidgetProperties.selection().observe(btnUserIsLocked); IObservableValue wvActiveObserveDetailValue = PojoProperties.value(User.class, "active", Boolean.class).observeDetail(wvUser); bindingContext.bindValue(observeSelectionBtnIsActiveObserveWidget, wvActiveObserveDetailValue, new UpdateValueStrategy().setConverter(new BooleanNotConverter()), new UpdateValueStrategy().setConverter(new BooleanNotConverter())); // return bindingContext; }
Example #9
Source File: ConverterBuilderTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Test public void should_create_and_use_string_to_int_converter() { IConverter stringToInt = ConverterBuilder.<String, Integer> newConverter() .fromType(String.class) .toType(Integer.class) .withConvertFunction(Integer::parseInt) .create(); IConverter intToString = ConverterBuilder.<Integer, String> newConverter() .fromType(Integer.class) .toType(String.class) .withConvertFunction(String::valueOf) .create(); A a = new A(); B b = new B(); DataBindingContext ctx = new DataBindingContext(); IObservableValue<String> observeA = PojoProperties.value("a").observe(a); IObservableValue<Integer> observeB = PojoProperties.value("b").observe(b); ctx.bindValue(observeA, observeB, UpdateStrategyFactory.updateValueStrategy().withConverter(stringToInt).create(), UpdateStrategyFactory.updateValueStrategy().withConverter(intToString).create()); observeA.setValue("123"); assertThat(b.getB()).isEqualTo(123); observeB.setValue(321); assertThat(a.getA()).isEqualTo("321"); }
Example #10
Source File: StockManagementPreferencePage.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
protected DataBindingContext initDataBindings(){ DataBindingContext bindingContext = new DataBindingContext(); // IObservableValue observeTextTxtCodeObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtCode); IObservableValue stockDetailCodeObserveDetailValue = PojoProperties.value(Stock.class, "code", String.class).observeDetail(stockDetail); bindingContext.bindValue(observeTextTxtCodeObserveWidget, stockDetailCodeObserveDetailValue, null, null); // IObservableValue observeTextTxtDescriptionObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtDescription); IObservableValue stockDetailDescriptionObserveDetailValue = PojoProperties .value(Stock.class, "description", String.class).observeDetail(stockDetail); bindingContext.bindValue(observeTextTxtDescriptionObserveWidget, stockDetailDescriptionObserveDetailValue, null, null); // IObservableValue observeTextTxtLocationObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtLocation); IObservableValue stockDetailLocationObserveDetailValue = PojoProperties.value(Stock.class, "location", String.class).observeDetail(stockDetail); bindingContext.bindValue(observeTextTxtLocationObserveWidget, stockDetailLocationObserveDetailValue, null, null); // IObservableValue observeTextTxtPrioObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtPrio); IObservableValue stockDetailGlobalPreferenceObserveDetailValue = PojoProperties.value(Stock.class, "priority", Integer.class).observeDetail(stockDetail); bindingContext.bindValue(observeTextTxtPrioObserveWidget, stockDetailGlobalPreferenceObserveDetailValue, null, null); // IObservableValue observeTextTxtMachineConfigObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtMachineConfig); IObservableValue stockDetailMachineConfigObserveDetailValue = PojoProperties .value(Stock.class, "driverConfig", String.class).observeDetail(stockDetail); bindingContext.bindValue(observeTextTxtMachineConfigObserveWidget, stockDetailMachineConfigObserveDetailValue, null, null); // return bindingContext; }
Example #11
Source File: CronEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createMinutesTab(TabFolder tablFolder) { final TabItem item = new TabItem(tablFolder, SWT.NONE); item.setText(Messages.minutes); final Composite minuteContent = new Composite(tablFolder, SWT.NONE); minuteContent.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); minuteContent.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(15, 10).create()); final Label everyLabel = new Label(minuteContent, SWT.NONE); everyLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create()); everyLabel.setText(Messages.every); final Text minuteText = new Text(minuteContent, SWT.BORDER | SWT.SINGLE); minuteText.setLayoutData(GridDataFactory.fillDefaults().hint(70, SWT.DEFAULT).create()); UpdateValueStrategy strategy = new UpdateValueStrategy(); strategy.setAfterGetValidator(dotValidator); strategy.setConverter(StringToNumberConverter.toInteger(true)); strategy.setBeforeSetValidator(new FrequencyValidator()); context.bindValue(SWTObservables.observeText(minuteText, SWT.Modify), PojoProperties.value("minuteFrequencyForMinute").observe(cronExpression), strategy, null); final Label minuteLabel = new Label(minuteContent, SWT.NONE); minuteLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create()); minuteLabel.setText(Messages.minuteLabel); item.setControl(minuteContent); cronExpression.setMode(item.getText()); }
Example #12
Source File: PersonalAnamnesisComposite.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(PersAnamnesisText.class, "text", String.class).observeDetail(item); bindingContext.bindValue(target, model, null, null); }
Example #13
Source File: SelectArtifactToDeployPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createToolbarComposite(DataBindingContext ctx, Composite parent) { Composite composite = new Composite(parent, SWT.INHERIT_FORCE); composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).extendedMargins(0, 0, 8, 0).create()); composite.setLayoutData( GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).grab(true, false).create()); Button onlyLatestProcessVersionButton = new Button(composite, SWT.CHECK); onlyLatestProcessVersionButton.setText(Messages.selectLatestVersion); ctx.bindValue(WidgetProperties.selection().observe(onlyLatestProcessVersionButton), PojoProperties.value("latestVersionOnly").observe(this)); ToolBar toolBar = new ToolBar(composite, SWT.HORIZONTAL | SWT.RIGHT | SWT.NO_FOCUS | SWT.FLAT); new ToolItem(toolBar, SWT.SEPARATOR | SWT.VERTICAL); ToolItem expandAll = new ToolItem(toolBar, SWT.PUSH); expandAll.setImage(Pics.getImage(PicsConstants.expandAll)); expandAll.setToolTipText(Messages.expandAll); expandAll.addListener(SWT.Selection, e -> fileStoreViewer.expandAll()); ToolItem collapseAll = new ToolItem(toolBar, SWT.PUSH); collapseAll.setImage(Pics.getImage(PicsConstants.collapseAll)); collapseAll.setToolTipText(Messages.collapseAll); collapseAll.addListener(SWT.Selection, e -> fileStoreViewer.collapseAll()); }
Example #14
Source File: DeploySuccessDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Control createCustomArea(Composite parent) { ctx = new DataBindingContext(); Composite container = new Composite(parent, SWT.NONE); container.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); container.setLayout(GridLayoutFactory.fillDefaults().create()); new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL) .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); contentProvider.setSelection(defaultSelection(dialogSettings)); new ComboWidget.Builder() .withLabel(Messages.youCanOpenApp) .labelAbove() .fill() .grabHorizontalSpace() .readOnly() .withMessage(String.format("%s : %s", org.bonitasoft.studio.actors.i18n.Messages.defaultUser, new ActiveOrganizationProvider().getDefaultUser())) .withItems(contentProvider.getItems()) .bindTo(PojoProperties.value("selection").observe(contentProvider)) .inContext(ctx) .createIn(container); return container; }
Example #15
Source File: ImportBosArchiveControlSupplier.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createTreeHeader(Composite parent, DataBindingContext ctx) { treeSection = new Section(parent, Section.TREE_NODE); treeSection.setLayout(GridLayoutFactory.fillDefaults().create()); treeSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); treeSection.setText(Messages.importDetails); treeSection.addExpansionListener(new UpdateLayoutListener(parent)); treeSection.setExpanded(false); descriptionLabel = new Label(treeSection, SWT.WRAP); archiveStatusObservable = PojoProperties.value("archiveStatus").observe(this); ctx.bindValue(WidgetProperties.text().observe(descriptionLabel), archiveStatusObservable, neverUpdateValueStrategy().create(), updateValueStrategy().withValidator(this::archiveStatusValidator) .withConverter(createArchiveStatusConverter()).create()); treeSection.setDescriptionControl(descriptionLabel); }
Example #16
Source File: ImportBosArchiveControlSupplier.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private Composite doFileLocationBrowser(Composite parent, DataBindingContext dbc) { Composite fileBrowserComposite = new Composite(parent, SWT.NONE); fileBrowserComposite .setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create()); fileBrowserComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); filePathObserveValue = PojoProperties.value("filePath").observe(this); filePathObserveValue.addValueChangeListener(this::parseArchive); textWidget = new TextWidget.Builder() .withLabel(Messages.selectLocation) .grabHorizontalSpace() .fill() .alignMiddle() .labelAbove() .withTargetToModelStrategy(updateValueStrategy() .withValidator(new MultiValidator.Builder() .havingValidators(getEmptyInputValidator("")).create())) .bindTo(filePathObserveValue) .inContext(dbc) .readOnly() .withButton(Messages.browseButton_label) .onClickButton(this::browseFile) .createIn(fileBrowserComposite); textWidget.focusButton(); return parent; }
Example #17
Source File: SelectDataWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void bindRadioButtonsToComposite(final DataBindingContext dbc) { dbc.bindValue(PojoProperties.value("topControl").observe(stackLayout), selectionTypeObservable, neverUpdateValueStrategy().create(), updateValueStrategy() .withConverter(dataTypeSelectionToCompositeConverter()).create()); dbc.bindValue(selectionTypeObservable, PojoProperties.value("businessDataTypeSelected").observe(this)); }
Example #18
Source File: AllergyIntoleranceComposite.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(AllergyIntoleranceText.class, "text", String.class) .observeDetail(item); bindingContext.bindValue(target, model, null, null); }
Example #19
Source File: ConfirmationWidgetFactory.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override protected void createInput ( final DataBindingContext dbc, final Label label, final Composite composite ) { this.input = new Text ( composite, SWT.BORDER ); this.input.setLayoutData ( new GridData ( SWT.FILL, SWT.CENTER, true, false ) ); dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( this.input ), PojoProperties.value ( TextCallback.PROP_VALUE ).observe ( this.callback ) ); }
Example #20
Source File: TextWidgetFactory.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override protected void createInput ( final DataBindingContext dbc, final Label label, final Composite composite ) { this.input = new Text ( composite, SWT.BORDER ); this.input.setLayoutData ( new GridData ( SWT.FILL, SWT.CENTER, true, false ) ); dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( this.input ), PojoProperties.value ( TextCallback.PROP_VALUE ).observe ( this.callback ) ); }
Example #21
Source File: ServerDescriptorImpl.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public String getLabel () { try { return (String)PojoProperties.value ( "hiveId" ).getValue ( this.hive ); } catch ( final Exception e ) { } return this.hive.toString (); }
Example #22
Source File: AttributesPart.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public void createPart ( final Composite parent ) { super.createPart ( parent ); this.viewer = new TableViewer ( parent, SWT.FULL_SELECTION ); final TableLayout tableLayout = new TableLayout (); final TableViewerColumn col1 = new TableViewerColumn ( this.viewer, SWT.NONE ); col1.getColumn ().setText ( Messages.AttributesPart_NameLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 50 ) ); final TableViewerColumn col2 = new TableViewerColumn ( this.viewer, SWT.NONE ); col2.getColumn ().setText ( Messages.AttributesPart_TypeLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 20 ) ); final TableViewerColumn col3 = new TableViewerColumn ( this.viewer, SWT.NONE ); col3.getColumn ().setText ( Messages.AttributesPart_ValueLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 50 ) ); this.viewer.getTable ().setHeaderVisible ( true ); this.viewer.getTable ().setLayout ( tableLayout ); ViewerSupport.bind ( this.viewer, this.entries, new IValueProperty[] { PojoProperties.value ( "name" ), PojoProperties.value ( "type" ), PojoProperties.value ( "value" ) } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ this.viewer.setComparator ( new ViewerComparator () ); }
Example #23
Source File: AppEngineDeployPreferencesPanel.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
private void setupAccountEmailDataBinding() { AccountSelectorObservableValue accountSelectorObservableValue = new AccountSelectorObservableValue(accountSelector); UpdateValueStrategy modelToTarget = new UpdateValueStrategy().setConverter(new Converter(String.class, String.class) { @Override public Object convert(Object savedEmail) { Preconditions.checkArgument(savedEmail instanceof String); if (accountSelector.isEmailAvailable((String) savedEmail)) { return savedEmail; } else if (requireValues && accountSelector.getAccountCount() == 1) { return accountSelector.getFirstEmail(); } else { return null; } } }); final IObservableValue<String> accountEmailModel = PojoProperties.value("accountEmail").observe(model); Binding binding = bindingContext.bindValue(accountSelectorObservableValue, accountEmailModel, new UpdateValueStrategy(), modelToTarget); /* * Trigger an explicit target -> model update for the auto-select-single-account case. When the * model has a null account but there is exactly 1 login account, then the AccountSelector * automatically selects that account. That change means the AccountSelector is at odds with the * model. */ binding.updateTargetToModel(); bindingContext.addValidationStatusProvider(new AccountSelectorValidator( requireValues, accountSelector, accountSelectorObservableValue)); }
Example #24
Source File: AppEngineDeployPreferencesPanel.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
/** * Binds a {@link Text} field with a property of the {@link DeployPreferences deploy * preferences model} given to the panel. This method honors the panel's validation mode (set * through the {@code requireValues} parameter when this panel was instantiated) such that {@code * validator} is ignored if {@code requireValues} is {@code false}. * * @see #AppEngineDeployPreferencesPanel */ protected void setupPossiblyUnvalidatedTextFieldDataBinding(Text text, String modelPropertyName, ValidationStatusProvider validator) { ISWTObservableValue textValue = WidgetProperties.text(SWT.Modify).observe(text); IObservableValue modelValue = PojoProperties.value(modelPropertyName).observe(model); bindingContext.bindValue(textValue, modelValue); if (requireValues) { bindingContext.addValidationStatusProvider(validator); } }
Example #25
Source File: AppEngineDeployPreferencesPanel.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
/** * Binds a {@link Text} field with a property of the {@link DeployPreferences deploy * preferences model} given to the panel. * * Unlike {@link #setupFileFieldDataBinding}, {@code setAfterGetValidator} is always enforced * regardless of the panel's validation mode. * * @see #setupTextFieldDataBinding */ private void setupTextFieldDataBinding(Text text, String modelPropertyName, IValidator afterGetValidator) { ISWTObservableValue textValue = WidgetProperties.text(SWT.Modify).observe(text); IObservableValue modelValue = PojoProperties.value(modelPropertyName).observe(model); bindingContext.bindValue(textValue, modelValue, new UpdateValueStrategy().setAfterGetValidator(afterGetValidator), new UpdateValueStrategy().setAfterGetValidator(afterGetValidator)); }
Example #26
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 #27
Source File: ManageConnectorJarDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { context = new DataBindingContext() ; Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(15, 15).create()); if(infoLabel != null){ addLabel(composite); } createTree(composite); UpdateValueStrategy selectionStartegy = new UpdateValueStrategy() ; selectionStartegy.setAfterGetValidator(new IValidator() { @Override public IStatus validate(Object value) { if( value == null){ return ValidationStatus.error("Selection is empty") ; } return Status.OK_STATUS; } }) ; context.bindSet(ViewersObservables.observeCheckedElements(languageViewer, IRepositoryFileStore.class.getName()), PojoProperties.set(ManageConnectorJarDialog.class,"selectedJars").observe(this)) ; return composite; }
Example #28
Source File: CategorySelectionDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { final Composite mainComposite = new Composite(parent, SWT.NONE) ; mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(300, 300).create()) ; mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(10,10).create()) ; context = new DataBindingContext() ; categoryViewer = new TreeViewer(mainComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION) ; categoryViewer.getTree().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()) ; categoryViewer.setContentProvider(new DefinitionCategoryContentProvider()) ; categoryViewer.setLabelProvider(new ConnectorDefinitionTreeLabelProvider(messageProvider)) ; categoryViewer.setInput(getAllCategories()) ; final IViewerObservableList observeSelection = ViewerProperties.multipleSelection().observe(categoryViewer); MultiValidator validator = new MultiValidator() { @Override protected IStatus validate() { if(observeSelection.isEmpty()){ return ValidationStatus.error(""); } return ValidationStatus.ok(); } }; context.addValidationStatusProvider(validator); context.bindList(observeSelection, validator.observeValidatedList(PojoProperties.list("categories").observe(this)), null,new UpdateListStrategy()) ; DialogSupport.create(this,context); return mainComposite ; }
Example #29
Source File: RiskComposite.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(RiskText.class, "text", String.class).observeDetail(item); bindingContext.bindValue(target, model, null, null); }
Example #30
Source File: SaveConnectorConfigurationWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected void doCreateControl(Composite composite) { super.doCreateControl(composite); final Composite saveComposite = new Composite(composite, SWT.NONE) ; saveComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true,false).create()) ; saveComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 10).create()) ; final Label nameLabel = new Label(saveComposite, SWT.NONE) ; nameLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END,SWT.CENTER).create()) ; nameLabel.setText(Messages.name +" *") ; final Text nameText = new Text(saveComposite, SWT.BORDER) ; nameText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()) ; final UpdateValueStrategy targetToModel = new UpdateValueStrategy() ; targetToModel.setBeforeSetValidator(new IValidator() { @Override public IStatus validate(Object newText) { if(newText == null || newText.toString().isEmpty()){ return ValidationStatus.error(Messages.nameIsEmpty); } if(configurationStore.getChild(newText+"."+configurationStore.getCompatibleExtensions().iterator().next(), true) != null){ return ValidationStatus.error(Messages.nameAlreadyExists) ; } return Status.OK_STATUS; } }) ; context.bindValue(SWTObservables.observeText(nameText, SWT.Modify), PojoProperties.value(SaveConnectorConfigurationWizardPage.class, "confName").observe(this), targetToModel, null) ; }