本文整理汇总了Java中org.eclipse.core.databinding.UpdateValueStrategy.POLICY_UPDATE属性的典型用法代码示例。如果您正苦于以下问题:Java UpdateValueStrategy.POLICY_UPDATE属性的具体用法?Java UpdateValueStrategy.POLICY_UPDATE怎么用?Java UpdateValueStrategy.POLICY_UPDATE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.core.databinding.UpdateValueStrategy
的用法示例。
在下文中一共展示了UpdateValueStrategy.POLICY_UPDATE属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBinding
public Binding createBinding(Composite parent, boolean createLabel, DetailProviderParameter p) {
FormToolkit toolkit = p.getDetailFormToolkit();
EObject target = p.getTarget();
IItemPropertyDescriptor pd = p.getPropertyDescriptor();
EStructuralFeature feature = (EStructuralFeature) pd.getFeature(target);
if (feature == null) {
return null;
}
boolean isEditable = pd.canSetProperty(target);
if (createLabel) {
EMFDetailUtils.createLabel(parent, toolkit, target, pd);
}
CDateTime cdt = new CDateTime(parent, CDT.BORDER | CDT.TAB_FIELDS | CDT.SPINNER);
cdt.setPattern(formatPattern);
cdt.setTimeZone("GMT");
cdt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
cdt.setEnabled(isEditable);
EMFDetailUtils.bindControlViability(p, new Control[] {cdt});
DurationUpdateValueStrategy targetToModel = new DurationUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
DurationUpdateValueStrategy modelToTarget = new DurationUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
return EMFDetailUtils.bindEMFUndoable(p, new CDateTimeObservableValue(cdt), targetToModel, modelToTarget);
}
示例2: bindField
protected <S> Binding bindField(DataBindingContext dbCtx, BField field, IObservableValue master,
BFormInstance<S, ?> formInstance, boolean immediate, IObservableValue presenterValue) {
IObservableValue model = getObservableValue(field, presenterValue);
IObservableValue target = AbstractFormProperties.field(field.getId()).observe(formInstance);
UpdateValueStrategy modelToTarget = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
UpdateValueStrategy targetToModel = new UpdateValueStrategy(immediate ? UpdateValueStrategy.POLICY_UPDATE
: UpdateValueStrategy.POLICY_CONVERT);
if (field.isRequired()) {
targetToModel.setAfterConvertValidator(RequiredValidator.INSTANCE);
}
if (field.getValidator() != null) {
targetToModel.setBeforeSetValidator(new ValidatorSTub(field.getValidator()));
}
return dbCtx.bindValue(target, model, targetToModel, modelToTarget);
}
示例3: initBinding
@Override
protected void initBinding() throws ConnectException {
BindingHelper.bindStringToTextField(txtBarcode, getInputObservable(), Copy.FIELD_BARCODE, bindingContext,
false);
BindingHelper.bindStringToTextField(txtEdition, getInputObservable(), Copy.FIELD_EDITION, bindingContext,
false);
BindingHelper.bindStringToTextField(txtCondition, getInputObservable(), Copy.FIELD_CONDITION, bindingContext,
false);
final IObservableValue mediumObservable = BeansObservables.observeDetailValue(getInputObservable(),
Copy.FIELD_MEDIUM, Medium.class);
BindingHelper.bindStringToTextField(txtTitle, mediumObservable, Medium.FIELD_TITLE, bindingContext, false);
BindingHelper.bindStringToTextField(txtAuthor, mediumObservable, Medium.FIELD_AUTHOR, bindingContext, false);
BindingHelper.bindStringToTextField(txtLanguage, mediumObservable, Medium.FIELD_LANGUAGE, bindingContext,
false);
BindingHelper.bindStringToTextField(txtPublisher, mediumObservable, Medium.FIELD_PUBLISHER, bindingContext,
false);
BindingHelper.bindStringToTextField(txtIsbn, mediumObservable, Medium.FIELD_ISBN, bindingContext, false);
BindingHelper.bindObjectToCCombo(comboMediumType, mediumObservable, Medium.class, Medium.FIELD_TYPE,
MediumType.class, ServiceLocator.getInstance().getTypService().list(), new MediumTypeLabelProvider(),
bindingContext, false);
// dummy binding to validate that barcode isn't taken
final UpdateValueStrategy modelToTarget = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
modelToTarget.setAfterGetValidator(new BarcodeTakenValidator());
bindingContext.bindValue(new WritableValue(null, String.class), barcodeObservable,
new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), modelToTarget);
}
示例4: bindFormValue
private <S> void bindFormValue(DataBindingContext dbCtx, IObservableValue formValue, BForm<S> form,
BFormInstance<S, ?> formInstance) {
IObservableValue target = formValue;
IObservableValue model = AbstractFormProperties.value(form).observe(formInstance);
UpdateValueStrategy modelToTarget = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
UpdateValueStrategy targetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER);
dbCtx.bindValue(target, model, targetToModel, modelToTarget);
}
示例5: bindReadOnlyProperty
private <S> Binding bindReadOnlyProperty(DataBindingContext dbc, BField field, BFormInstance<S, ?> formInstance,
IObservableValue presenterValue) {
IObservableValue model = PresenterProperties.value(field.getReadOnlyPropertyName()).observeDetail(presenterValue);
IObservableValue target = AbstractFormProperties.readOnlyField(field.getId()).observe(formInstance);
UpdateValueStrategy modelToTarget = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
UpdateValueStrategy targetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER);
return dbc.bindValue(target, model, targetToModel, modelToTarget);
}
示例6: bindCreateThresholdCheck
private Binding bindCreateThresholdCheck(Button button, FeaturePath path, Threshold tr){
IObservableValue thresholdObserve = EMFEditProperties.value(editingDomain, path).observe(slo);
IObservableValue textObserve = WidgetProperties.selection().observe(button);
UpdateValueStrategy t2mStrategy = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
t2mStrategy.setConverter(Converters.getBoolEObjectConverter(tr)[0]);
UpdateValueStrategy m2tStrategy = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
m2tStrategy.setConverter(Converters.getBoolEObjectConverter(tr)[1]);
return bindingContext.bindValue(textObserve, thresholdObserve, t2mStrategy, m2tStrategy);
}
示例7: bindThresholdMeasure
private Binding bindThresholdMeasure(Text text, FeaturePath path){
IObservableValue thresholdMeasureObserve = EMFEditProperties.value(editingDomain, path).observe(slo);
IObservableValue textObserve = WidgetProperties.text(SWT.FocusOut).observe(text);
UpdateValueStrategy t2mStrategy = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
t2mStrategy.setConverter(Converters.getStringMeasureSecondsConverter()[0]);
UpdateValueStrategy m2tStrategy = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
m2tStrategy.setConverter(Converters.getStringMeasureSecondsConverter()[1]);
return bindingContext.bindValue(textObserve, thresholdMeasureObserve, t2mStrategy, m2tStrategy);
}
示例8: updatingValueStrategy
public UpdateValueStrategy updatingValueStrategy() {
UpdateValueStrategy strat = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
strat.setConverter(this);
return strat;
}
示例9: createBinding
@Override
public Binding createBinding(DetailProviderParameter p) {
FormToolkit toolkit = p.getDetailFormToolkit();
Composite parent = p.getParent();
EObject target = p.getTarget();
IItemPropertyDescriptor pd = p.getPropertyDescriptor();
Object propertyValueObject = pd.getPropertyValue(target);
String propertyName = pd.getDisplayName(target);
String propertyValue = null;
if (propertyValueObject != null && propertyValueObject instanceof PropertyValueWrapper) {
PropertyValueWrapper propertyValueWrapper = (PropertyValueWrapper) propertyValueObject;
Object editableValue = propertyValueWrapper.getEditableValue(target);
propertyValue = editableValue.toString();
}
if (propertyValue == null) {
propertyValue = "";
}
EMFDetailUtils.createLabel(parent, toolkit, target, pd);
Composite rootComposite = createRootComposite(toolkit, parent);
Composite hyperlinkAndBrowseComposite = hyperlinkAndBrowseComposite(rootComposite);
Text hyperlinkTextField = createHyperlinkTextField(hyperlinkAndBrowseComposite, propertyValue);
@SuppressWarnings("unused")
Button browseButton = createBrowseButton(hyperlinkAndBrowseComposite, hyperlinkTextField);
Button openButton = createOpenButton(rootComposite, propertyName, hyperlinkTextField);
hyperlinkAndBrowseComposite.setData(BUTTON_KEY, openButton);
openButton.setEnabled(!hyperlinkTextField.getText().trim().equals(""));
StringifierUpdateValueStrategy targetToModel = new StringifierUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
StringifierUpdateValueStrategy modelToTarget = new StringifierUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
ISWTObservableValue observeText = SWTObservables.observeText(hyperlinkTextField, SWT.FocusOut);
EMFDetailUtils.bindValidatorDecoration(p, hyperlinkTextField);
EMFDetailUtils.bindControlViability(p, new Control[] { browseButton, openButton, hyperlinkTextField });
Binding binding = EMFDetailUtils.bindEMFUndoable(p, observeText, targetToModel, modelToTarget);
EMFDetailUtils.bindTextModifyUndoable(hyperlinkTextField, target, propertyName);
targetToModel.setBinding(binding);
return binding;
}
示例10: createBinding
@Override
public Binding createBinding(DetailProviderParameter p) {
FormToolkit toolkit = p.getDetailFormToolkit();
Composite parent = p.getParent();
EObject target = p.getTarget();
IItemPropertyDescriptor pd = p.getPropertyDescriptor();
Object propertyValueObject = pd.getPropertyValue(target);
String propertyName = pd.getDisplayName(target);
String propertyValue = null;
if (propertyValueObject != null && propertyValueObject instanceof PropertyValueWrapper) {
PropertyValueWrapper propertyValueWrapper = (PropertyValueWrapper) propertyValueObject;
Object editableValue = propertyValueWrapper.getEditableValue(target);
propertyValue = editableValue.toString();
}
if (propertyValue == null) {
propertyValue = "";
}
uriConverter = target.eResource().getResourceSet().getURIConverter();
projectUriStringfier = new URIStrigifier(uriConverter);
EMFDetailUtils.createLabel(parent, toolkit, target, pd);
Composite rootComposite = createRootComposite(toolkit, parent);
Composite hyperlinkAndBrowseComposite = hyperlinkAndBrowseComposite(rootComposite);
Text hyperlinkTextField = createHyperlinkTextField(hyperlinkAndBrowseComposite, propertyValue);
Button browseButton = createBrowseButton(hyperlinkAndBrowseComposite, hyperlinkTextField);
Button openButton = createOpenButton(rootComposite, propertyName, hyperlinkTextField);
hyperlinkAndBrowseComposite.setData(BUTTON_KEY, openButton);
openButton.setEnabled(!hyperlinkTextField.getText().trim().equals(""));
StringifierUpdateValueStrategy targetToModel = new ProjectUrlUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
StringifierUpdateValueStrategy modelToTarget = new ProjectUrlUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
ISWTObservableValue observeText = SWTObservables.observeText(hyperlinkTextField, SWT.FocusOut);
EMFDetailUtils.bindValidatorDecoration(p, hyperlinkTextField);
EMFDetailUtils.bindControlViability(p, new Control[] { browseButton, openButton, hyperlinkTextField });
Binding binding = EMFDetailUtils.bindEMFUndoable(p, observeText, targetToModel, modelToTarget);
EMFDetailUtils.bindTextModifyUndoable(hyperlinkTextField, target, propertyName);
targetToModel.setBinding(binding);
return binding;
}
示例11: refresh
@Override
public void refresh() {
super.refresh();
List<ValueProvider> nestedIntValProviders
= alternative.getVariationValueProviders(ExperimentsPackage.Literals.NESTED_INTERVALS_LONG_VALUE_PROVIDER);
if(nestedIntValProviders.isEmpty()){
textMaxValue.setEnabled(false);
textMinValue.setEnabled(false);
return;
}
NestedIntervalsLongValueProvider valueProvider = (NestedIntervalsLongValueProvider)nestedIntValProviders.get(0);
//data binding
if(bindingContext != null){
bindingContext.dispose();
bindingContext = null;
}
bindingContext = new DataBindingContext();
UpdateValueStrategy t2mStrategy = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
t2mStrategy.setConverter(StringToNumberConverter.toLong(true));
UpdateValueStrategy m2tStrategy = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
m2tStrategy.setConverter(NumberToStringConverter.fromLong(true));
IObservableValue minValObs = EMFEditProperties.value(alternative.getEditingDomain(),
ExperimentsPackage.Literals.NESTED_INTERVALS_LONG_VALUE_PROVIDER__MIN_VALUE).observe(valueProvider);
IObservableValue maxValObs = EMFEditProperties.value(alternative.getEditingDomain(),
ExperimentsPackage.Literals.NESTED_INTERVALS_LONG_VALUE_PROVIDER__MAX_VALUE).observe(valueProvider);
Binding minValBind = bindingContext.bindValue(WidgetProperties.text(SWT.Modify).observe(textMinValue),
minValObs, t2mStrategy, m2tStrategy);
Binding maxValBind = bindingContext.bindValue(WidgetProperties.text(SWT.Modify).observe(textMaxValue),
maxValObs, t2mStrategy, m2tStrategy);
ControlDecorationSupport.create(minValBind, SWT.TOP | SWT.LEFT);
ControlDecorationSupport.create(maxValBind, SWT.TOP | SWT.LEFT);
bindingContext.updateTargets();
}