Java Code Examples for org.eclipse.core.databinding.UpdateValueStrategy#POLICY_CONVERT

The following examples show how to use org.eclipse.core.databinding.UpdateValueStrategy#POLICY_CONVERT . 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: TextWidget.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public TextWidget createIn(Composite container) {
    if (transactionalEdit && targetToModelStrategy == null) {
        throw new IllegalStateException("A target to model strategy is required with transactionalEdit");
    }
    if (transactionalEdit && targetToModelStrategy.getUpdatePolicy() != UpdateValueStrategy.POLICY_CONVERT) {
        throw new IllegalStateException(
                "Target to model strategy must have a POLICY_CONVERT strategy with transactionalEdit");
    }
    final TextWidget control = (useNativeRender || GTKStyleHandler.isGTK3())
            ? new NativeTextWidget(container, id, labelAbove, horizontalLabelAlignment, verticalLabelAlignment,
                    labelWidth, readOnly, label, message, useCompositeMessageDecorator, labelButton,
                    transactionalEdit, onEdit, toolkit, proposalProvider, editableStrategy, Optional.ofNullable(ctx))
            : new TextWidget(container, id, labelAbove, horizontalLabelAlignment, verticalLabelAlignment,
                    labelWidth, readOnly, label, message, useCompositeMessageDecorator, labelButton,
                    transactionalEdit, onEdit, toolkit, proposalProvider, editableStrategy,
                    Optional.ofNullable(ctx));
    control.init();
    control.setLayoutData(layoutData != null ? layoutData : gridData);
    buttonListner.ifPresent(control::onClickButton);
    placeholder.ifPresent(control::setPlaceholder);
    tooltip.ifPresent(control::setTooltip);
    if (ctx != null && modelObservable != null) {
        control.bindControl(ctx,
                delay.map(time -> control.observeText(time, SWT.Modify))
                        .orElse(control.observeText(SWT.Modify)),
                modelObservable, targetToModelStrategy, modelToTargetStrategy);
        validator.ifPresent(
                v -> control.bindValidator(ctx, delay.map(time -> control.observeText(time, SWT.Modify))
                        .orElse(control.observeText(SWT.Modify)), modelObservable, v));
    }
    return control;
}
 
Example 2
Source File: DefaultEditingSupport.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
protected UpdateValueStrategy createTargetToModelStrategy ()
{
    return new UpdateValueStrategy ( UpdateValueStrategy.POLICY_CONVERT );
}
 
Example 3
Source File: UpdateStrategyFactory.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public static UpdateValueStrategyFactory convertUpdateValueStrategy() {
    return new UpdateValueStrategyFactory(UpdateValueStrategy.POLICY_CONVERT);
}
 
Example 4
Source File: UpdateStrategyFactory.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Deprecated
public static UpdateValueStrategyFactory convertUpdateValueStrategy() {
    return new UpdateValueStrategyFactory(UpdateValueStrategy.POLICY_CONVERT);
}