当前位置: 首页>>代码示例>>Java>>正文


Java UpdateValueStrategy.POLICY_UPDATE属性代码示例

本文整理汇总了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);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:22,代码来源:DurationBindingFactory.java

示例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);

}
 
开发者ID:frincon,项目名称:abstractform,代码行数:17,代码来源:EclipseBindingToolkit.java

示例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);
}
 
开发者ID:FI13,项目名称:afbb-bibo,代码行数:28,代码来源:RegisterCopyView.java

示例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);
}
 
开发者ID:frincon,项目名称:abstractform,代码行数:8,代码来源:EclipseBindingToolkit.java

示例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);

}
 
开发者ID:frincon,项目名称:abstractform,代码行数:9,代码来源:EclipseBindingToolkit.java

示例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);
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:11,代码来源:ConfigSLOComposite.java

示例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);
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:11,代码来源:ConfigSLOComposite.java

示例8: updatingValueStrategy

public UpdateValueStrategy updatingValueStrategy() {
	UpdateValueStrategy strat = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
	strat.setConverter(this);
	return strat;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:5,代码来源:WizardComponentDataConverters.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:41,代码来源:URLBindingFactory.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:42,代码来源:URIBindingFactory.java

示例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();
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:45,代码来源:ConfigCapacityComposite.java


注:本文中的org.eclipse.core.databinding.UpdateValueStrategy.POLICY_UPDATE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。