org.eclipse.core.databinding.DataBindingContext Java Examples

The following examples show how to use org.eclipse.core.databinding.DataBindingContext. 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: ExportBarWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void createControl(final Composite parent) {
    dbc = new DataBindingContext();

    final Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(10, 10, 5, 5).create());

    createProcessViewer(mainComposite);

    final Composite group = new Composite(mainComposite, SWT.NONE);
    group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    group.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(0, 0).create());

    createConfiguration(group);
    createDestination(group);

    pageSupport = WizardPageSupport.create(this, dbc);
    setControl(mainComposite);
}
 
Example #2
Source File: LinePropertiesBinder.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
public static Collection<Binding> bind ( final DataBindingContext dbc, final IObservableValue lineInputObservable, final IObservableValue linePropertiesObservable )
{
    final Collection<Binding> result = new LinkedList<Binding> ();

    try
    {
        result.add ( dbc.bindValue ( PojoObservables.observeDetailValue ( lineInputObservable, "lineWidth", null ), EMFObservables.observeDetailValue ( dbc.getValidationRealm (), linePropertiesObservable, ChartPackage.Literals.LINE_PROPERTIES__WIDTH ) ) ); //$NON-NLS-1$
        result.add ( dbc.bindValue ( PojoObservables.observeDetailValue ( lineInputObservable, "lineColor", null ), EMFObservables.observeDetailValue ( dbc.getValidationRealm (), linePropertiesObservable, ChartPackage.Literals.LINE_PROPERTIES__COLOR ) ) ); //$NON-NLS-1$
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to bind line properties", e ); //$NON-NLS-1$
    }

    return result;
}
 
Example #3
Source File: ConstraintEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
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 #4
Source File: CallbackDialog.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
private Composite createComposite ( final Composite wrapper )
{
    this.dbc = new DataBindingContext ( DisplayRealm.getRealm ( wrapper.getDisplay () ) );

    wrapper.addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            CallbackDialog.this.dbc.dispose ();
        }
    } );

    final Composite composite = new Composite ( wrapper, SWT.NONE );
    composite.setLayout ( new GridLayout ( 2, false ) );

    for ( final CallbackWidgetFactory factory : this.factories )
    {
        factory.createGridWidgets ( this.dbc, composite );
    }

    return composite;
}
 
Example #5
Source File: SelectArtifactToDeployPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
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 #6
Source File: BusinessObjectEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public BusinessObjectEditionControl(Composite parent, BusinessDataModelFormPage formPage, DataBindingContext ctx) {
    this.boSelectedObservable = formPage.observeBusinessObjectSelected();
    this.section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    section.setLayout(GridLayoutFactory.fillDefaults().create());

    Composite boEditionComposite = formPage.getToolkit().createComposite(section);
    boEditionComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    boEditionComposite.setLayout(GridLayoutFactory.fillDefaults().create());

    formPage.getToolkit().createLabel(boEditionComposite, "");// filler
    buildDescriptionSection(boEditionComposite, formPage, ctx);
    buildEditionSection(boEditionComposite, formPage, ctx);

    section.setClient(boEditionComposite);
}
 
Example #7
Source File: XAxisViewer.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
public XAxisViewer ( final DataBindingContext dbc, final ChartRenderer manager, final XAxis axis, final boolean top )
{
    super ( dbc, manager, axis );

    this.axis = axis;

    this.control = new org.eclipse.scada.chart.XAxis ();

    this.renderer = new XAxisDynamicRenderer ( manager );
    this.renderer.setAxis ( this.control );
    this.renderer.setAlign ( top ? SWT.TOP : SWT.BOTTOM );
    manager.addRenderer ( this.renderer, -2 );

    addBinding ( this.dbc.bindValue ( BeansObservables.observeValue ( this.control, "label" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__LABEL ) ) ); //$NON-NLS-1$
    addBinding ( this.dbc.bindValue ( BeansObservables.observeValue ( this.control, "min" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.XAXIS__MINIMUM ) ) ); //$NON-NLS-1$
    addBinding ( this.dbc.bindValue ( BeansObservables.observeValue ( this.control, "max" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.XAXIS__MAXIMUM ) ) ); //$NON-NLS-1$

    addBinding ( this.dbc.bindValue ( PojoObservables.observeValue ( this.renderer, "showLabels" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__LABEL_VISIBLE ) ) ); //$NON-NLS-1$
    addBinding ( this.dbc.bindValue ( PojoObservables.observeValue ( this.renderer, "format" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__FORMAT ) ) ); //$NON-NLS-1$
    addBinding ( this.dbc.bindValue ( PojoObservables.observeValue ( this.renderer, "textPadding" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__TEXT_PADDING ) ) ); //$NON-NLS-1$
    addBinding ( this.dbc.bindValue ( PojoObservables.observeValue ( this.renderer, "color" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__COLOR ) ) ); //$NON-NLS-1$
}
 
Example #8
Source File: SelectionRenamePage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Control createControl(Composite parent, IWizardContainer wizardContainer, DataBindingContext ctx) {
    Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    super.createControl(mainComposite, wizardContainer, ctx);
    currentShell = wizardContainer.getShell();

    ButtonWidget renameButton = new ButtonWidget.Builder()
            .alignLeft()
            .withLabel(org.bonitasoft.studio.ui.i18n.Messages.rename)
            .onClick(this::rename)
            .createIn(mainComposite);
    renameButton.disable();

    tableViewer.addSelectionChangedListener(e -> {
        if (getSelection().count() == 1
                && !Objects.equals(getSelection().findFirst().get().getName(), unRenamableFile.orElse(""))) {
            renameButton.enable();
        } else {
            renameButton.disable();
        }
    });

    return mainComposite;
}
 
Example #9
Source File: ButtonProfileEntry.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
public ButtonProfileEntry ( final DataBindingContext dbc, final Composite parent, final ProfileManager profileManager, final Profile profile, final ChartContext chartContext )
{
    super ( dbc, profileManager, profile, chartContext );

    this.widget = new Button ( parent, SWT.TOGGLE );

    addBinding ( dbc.bindValue ( SWTObservables.observeText ( this.widget ), EMFObservables.observeValue ( profile, ChartPackage.Literals.PROFILE__LABEL ) ) );

    this.widget.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            fireSelection ( ButtonProfileEntry.this.widget.getSelection () );
        };
    } );
}
 
Example #10
Source File: SmartImportBdmPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Control createControl(Composite parent, IWizardContainer wizardContainer, DataBindingContext ctx) {
    resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(GridLayoutFactory.fillDefaults().create());
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    super.createControl(composite, wizardContainer, ctx);
    Composite importComposite = createImportComposite(composite);
    filePathObservable.addValueChangeListener(e -> parseInput());
    ctx.bindValue(WidgetProperties.visible().observe(importComposite), new ComputedValue<Boolean>() {

        @Override
        protected Boolean calculate() {
            return filePathObservable.getValue() != null;
        }
    });

    ctx.bindValue(new WritableValue(), importBdmModelObservable, // Purpose: disable on finish button when input isn't correct
            UpdateStrategyFactory.neverUpdateValueStrategy().create(),
            UpdateStrategyFactory.updateValueStrategy()
                    .withValidator(new SmartImportBdmModelValidator())
                    .create());

    return composite;
}
 
Example #11
Source File: ContactSelectorView.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
protected DataBindingContext initDataBindings(){
	DataBindingContext bindingContext = new DataBindingContext();
	
	tableViewerContacts.setContentProvider(contentProvider);
	IObservableMap[] observeMaps =
		BeansObservables.observeMaps(contentProvider.getKnownElements(), IContact.class,
			new String[] {
				"description1", "description2", "mandator", "patient", "user"
			});
	ILabelDecorator decorator =
		PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
	tableViewerContacts.setLabelProvider(new TableDecoratingLabelProvider(
		new ContactSelectorObservableMapLabelProvider(observeMaps), decorator));
	tableViewerContacts.setInput(contactList);
	return bindingContext;
}
 
Example #12
Source File: SelectArtifactToDeployPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createSearch(DataBindingContext ctx, Composite parent) {
    Composite searchComposite = new Composite(parent, SWT.NONE);
    searchComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    searchComposite.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BOTTOM).create());

    new SearchWidget.Builder()
            .useNativeRender()
            .labelAbove()
            .fill()
            .widthHint(400)
            .withPlaceholder(Messages.searchArtifact)
            .bindTo(searchObservableValue)
            .withDelay(500)
            .inContext(ctx)
            .createIn(searchComposite);
}
 
Example #13
Source File: QueryEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public QueryEditionControl(Composite parent,
        QueryFormPage formPage,
        DataBindingContext ctx) {
    this.formPage = formPage;
    this.boSelectedObservable = formPage.observeBusinessObjectSelected();
    this.ctx = ctx;
    this.queryContentCreator = new QueryContentCreator();

    Composite queryEditionComposite = formPage.getToolkit().createComposite(parent);
    queryEditionComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
    queryEditionComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    createDefinitionSection(queryEditionComposite);
    queryDetailsControl = new QueryDetailsControl(queryEditionComposite, querySelectedObservable, formPage,
            boSelectedObservable, viewer);
    enableButtons();

    customQueries = EMFObservables.observeDetailList(Realm.getDefault(), boSelectedObservable,
            BusinessDataModelPackage.Literals.BUSINESS_OBJECT__QUERIES);
    defaultQueries = EMFObservables.observeDetailList(Realm.getDefault(), boSelectedObservable,
            BusinessDataModelPackage.Literals.BUSINESS_OBJECT__DEFAULT_QUERIES);
}
 
Example #14
Source File: TestGroovyScriptDialog.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent) {
    dbc = new DataBindingContext();

    final Composite mainComposite = (Composite) super.createDialogArea(parent);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().hint(400, SWT.DEFAULT).create());
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().extendedMargins(15, 15, 10, 0).spacing(0, 15).create());
    final Label descriptionLabel = new Label(mainComposite, SWT.WRAP);
    descriptionLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    descriptionLabel.setText(Messages.testGroovyScriptDialogDescription);
    final Map<String, Serializable> procVariables = getProcessVariables(variables);
    final Map<String, Serializable> unknownVariables = getUnknownVariables(variables);
    if (!procVariables.isEmpty()) {
        createVariableGroup(mainComposite, Messages.processVariableLabel, procVariables, dbc);
    }
    if (!unknownVariables.isEmpty()) {
        createVariableGroup(mainComposite, Messages.unknownVariableLabel, unknownVariables, dbc);
    }

    return mainComposite;
}
 
Example #15
Source File: SelectDataWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void createDocumentTableViewerComposite(final Composite parent, final DataBindingContext dbc) {
    documentTableViewerComposite = new Composite(parent, SWT.NONE);
    documentTableViewerComposite.setLayout(GridLayoutFactory.swtDefaults().create());
    documentTableViewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    final TableViewer documentTableViewer = new TableViewer(documentTableViewerComposite,
            SWT.BORDER | SWT.SINGLE | SWT.NO_FOCUS | SWT.H_SCROLL
                    | SWT.V_SCROLL);
    documentTableViewer.getTable()
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(200, 100).create());
    final ObservableListContentProvider contentProvider = new ObservableListContentProvider();
    documentTableViewer.setContentProvider(contentProvider);
    documentTableViewer.setLabelProvider(new DocumentStyledLabelProvider());
    documentTableViewer.setInput(new WritableList(availableDocuments, ProcessPackage.Literals.DOCUMENT));
    final IViewerObservableValue observeSingleSelection = ViewersObservables
            .observeSingleSelection(documentTableViewer);
    dbc.bindValue(observeSingleSelection, selectedDataObservable,
            updateValueStrategy().withValidator(createDefaultValueAlreadyDefinedValidator()).create(), null);
    documentButton.addSelectionListener(createDocumentSelectionAdapter());
}
 
Example #16
Source File: RelationFieldDetailsControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public RelationFieldDetailsControl(Composite parent, BusinessDataModelFormPage formPage,
        IObservableValue<Field> selectedFieldObservable, IObservableValue<String> descriptionObservable,
        DataBindingContext ctx) {
    super(parent, SWT.None);
    this.descriptionObservable = descriptionObservable;
    setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());
    formPage.getToolkit().adapt(this);

    this.formPage = formPage;
    this.selectedFieldObservable = selectedFieldObservable;
    this.ctx = ctx;

    createDescriptionTextArea();
    createRelationKindLabel();
    createRelationKindCombo();
    createLoadingModeRadioButtons();
}
 
Example #17
Source File: IndexEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void bindIndexedFieldObservableLists(DataBindingContext ctx, IObservableList<Field> actualsFieldsObservable) {
    ctx.bindList(indexedFieldsObservable, indexedFieldNameObservable,
            UpdateStrategyFactory.updateListStrategyFactory()
                    .withConverter(ConverterBuilder.<Field, String> newConverter()
                            .fromType(Field.class)
                            .toType(String.class)
                            .withConvertFunction(Field::getName)
                            .create())
                    .create(),
            UpdateStrategyFactory.updateListStrategyFactory()
                    .withConverter(ConverterBuilder.<String, Field> newConverter()
                            .fromType(String.class)
                            .toType(Field.class)
                            .withConvertFunction(fieldName -> actualsFieldsObservable
                                    .stream()
                                    .filter(aField -> Objects.equals(fieldName, aField.getName()))
                                    .findFirst()
                                    .orElseThrow(() -> new IllegalArgumentException(
                                            String.format("The field %s doesn't exists.", fieldName))))
                            .create())
                    .create());
}
 
Example #18
Source File: FieldDetailsControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public FieldDetailsControl(Composite parent, BusinessDataModelFormPage formPage,
        IObservableValue<Field> selectedFieldObservable, DataBindingContext ctx) {
    super(parent, SWT.None);
    this.formPage = formPage;
    this.ctx = ctx;
    this.selectedFieldObservable = selectedFieldObservable;
    this.descriptionObservable = EMFObservables.observeDetailValue(Realm.getDefault(),
            selectedFieldObservable, BusinessDataModelPackage.Literals.FIELD__DESCRIPTION);
    formPage.getToolkit().adapt(this);

    stackLayout = new CustomStackLayout(this);
    setLayout(stackLayout);
    setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    createStringFieldDetailsComposite(ctx);
    createDateDeprecatedDetailsComposite();
    createDateOnlyDetailsComposite();
    createDateTimeComposite();
    createDateTimeInTimeZoneComposite();
    createTextFieldComposite();
    createRelationFieldComposite(ctx);
    createNoDetailsComposite();

    selectedFieldObservable.addValueChangeListener(e -> updateTopControl());
}
 
Example #19
Source File: SelectArtifactToDeployPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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 #20
Source File: CategorySelectionDialog.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@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 #21
Source File: ReverseConversionWizardPage.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 对 UI 和 View Model 进行绑定 ;
 */
private void bindValue() {
	DataBindingContext dbc = new DataBindingContext();
	WizardPageSupport.create(this, dbc);
	ConversionConfigBean configBean = conversionConfigBeans.get(0);

	// bind the target encoding
	dbc.bindList(SWTObservables.observeItems(tgtEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$
}
 
Example #22
Source File: ConstraintEditionControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void enableButtons(DataBindingContext ctx) {
    ctx.bindValue(WidgetProperties.enabled().observe(deleteConstraintItem),
            new ComputedValue<Boolean>() {

                @Override
                protected Boolean calculate() {
                    return selectedConstraintObservable.getValue() != null;
                }
            });
}
 
Example #23
Source File: BusinessDataModelFormPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createMavenArtifactPropertiesGroup(Composite parent, DataBindingContext ctx) {
    Section section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setText(Messages.mavenArtifactProperties);

    Composite client = formPage.getToolkit().createComposite(section);
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    client.setLayout(GridLayoutFactory.fillDefaults().margins(5, 10).create());

    new TextWidget.Builder()
            .withLabel(Messages.groupId)
            .labelAbove()
            .fill()
            .withTootltip(Messages.mavenArtifactPropertiesHint)
            .grabHorizontalSpace()
            .bindTo(EMFObservables.observeDetailValue(Realm.getDefault(), formPage.observeWorkingCopy(),
                    BusinessDataModelPackage.Literals.BUSINESS_OBJECT_MODEL__GROUP_ID))
            .withTargetToModelStrategy(UpdateStrategyFactory.updateValueStrategy()
                    .withValidator(new GroupIdValidator(formPage.getRepositoryAccessor().getWorkspace()))
                    .create())
            .inContext(ctx)
            .adapt(formPage.getToolkit())
            .createIn(client);

    formPage.getToolkit().createLabel(client, "");

    section.setClient(client);
}
 
Example #24
Source File: EditableControlWidget.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected ControlMessageSupport bindControl(DataBindingContext ctx, IObservableValue controlObservable,
        IObservableValue modelObservable,
        UpdateValueStrategy targetToModel,
        UpdateValueStrategy modelToTarget) {
    valueBinding = ctx.bindValue(controlObservable, modelObservable,
            targetToModel, modelToTarget);
    return new ControlMessageSupport(valueBinding) {

        @Override
        protected void statusChanged(IStatus status) {
            EditableControlWidget.this.statusChanged(status);
        }

    };
}
 
Example #25
Source File: AbstractAxisManager.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public AbstractAxisManager ( final DataBindingContext dbc, final ChartRenderer manager )
{
    this.dbc = dbc;
    this.manager = manager;

    this.list.addListChangeListener ( this.listener = new IListChangeListener () {

        @Override
        public void handleListChange ( final ListChangeEvent event )
        {
            handleListeChange ( event.diff );
        }
    } );
}
 
Example #26
Source File: ConversionWizardPage.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 对 UI 和 View Model 进行绑定 ;
 */
private void bindValue() {
	DataBindingContext dbc = new DataBindingContext();
	WizardPageSupport.create(this, dbc);
	ConversionConfigBean configBean = conversionConfigBeans.get(0);

	// bind the format
	dbc.bindList(SWTObservables.observeItems(formatCombo), BeansObservables.observeList(configBean, "fileFormats")); //$NON-NLS-1$
	// final IObservableValue format = BeansObservables.observeValue(selectedModel, "selectedType");
	// dbc.bindValue(SWTObservables.observeSelection(formatCombo), format);

	// bind the source encoding
	dbc.bindList(SWTObservables.observeItems(srcEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$

}
 
Example #27
Source File: NativeTextWidget.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected NativeTextWidget(Composite container, String id, boolean topLabel, int horizontalLabelAlignment,
        int verticalLabelAlignment, int labelWidth, boolean readOnly, String label, String message,
        boolean useCompositeMessageDecorator,
        Optional<String> labelButton, boolean transactionalEdit, BiConsumer<String, String> onEdit,
        Optional<FormToolkit> toolkit, Optional<IContentProposalProvider> proposalProvider,
        Optional<ComputedValue<Boolean>> editableStrategy,
        Optional<DataBindingContext> ctx) {
    super(container, id, topLabel, horizontalLabelAlignment, verticalLabelAlignment, labelWidth, readOnly, label,
            message, useCompositeMessageDecorator, labelButton, transactionalEdit, onEdit, toolkit, proposalProvider,
            editableStrategy, ctx);
}
 
Example #28
Source File: AbstractAxisViewer.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public AbstractAxisViewer ( final DataBindingContext dbc, final ChartRenderer manager, final Axis axis )
{
    this.dbc = dbc;
    this.manager = manager;

    manager.addDisposeListener ( new DisposeListener () {

        @Override
        public void onDispose ()
        {
            dispose ();
        }
    } );
}
 
Example #29
Source File: ImportWorkspaceControlSupplier.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Composite doCreateFileBrowser(Composite parent, DataBindingContext dbc) {
    final Composite folderBrowserComposite = new Composite(parent, SWT.NONE);
    folderBrowserComposite
            .setLayout(GridLayoutFactory.fillDefaults().create());
    folderBrowserComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    final IObservableValue folderPathObserveValue = PojoObservables.observeValue(this, "folderPath");
    textWidget = new TextWidget.Builder()
            .withLabel(Messages.selectABonitaStudioWorkspace)
            .grabHorizontalSpace()
            .fill()
            .alignMiddle()
            .labelAbove()
            .withTargetToModelStrategy(updateValueStrategy()
                    .withValidator(new MultiValidator.Builder()
                            .havingValidators(new EmptyInputValidator(""),
                                    new PathValidator.Builder().withMessage(Messages.invalidFilePath).create(),
                                    this::scannerValidator)
                            .create()))
            .bindTo(folderPathObserveValue)
            .inContext(dbc)
            .readOnly()
            .withButton(Messages.browseButton_label)
            .onClickButton(this::browseFile)
            .createIn(folderBrowserComposite);

    textWidget.focusButton();
    return parent;
}
 
Example #30
Source File: FamilyAnamnesisComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
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);
}