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


Java UpdateValueStrategy类代码示例

本文整理汇总了Java中org.eclipse.core.databinding.UpdateValueStrategy的典型用法代码示例。如果您正苦于以下问题:Java UpdateValueStrategy类的具体用法?Java UpdateValueStrategy怎么用?Java UpdateValueStrategy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UpdateValueStrategy类属于org.eclipse.core.databinding包,在下文中一共展示了UpdateValueStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bind

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
@Override
protected void bind ()
{
    this.dbc.bindValue ( SWTObservables.observeText ( this.label ), this.model, null, new UpdateValueStrategy ().setConverter ( new VariantToStringConverter () ) );
    this.model.addValueChangeListener ( new IValueChangeListener () {

        @Override
        public void handleValueChange ( final ValueChangeEvent event )
        {
            if ( !PlainDataItemLabel.this.label.isDisposed () )
            {
                PlainDataItemLabel.this.label.getParent ().layout ();
            }
        }
    } );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:PlainDataItemLabel.java

示例2: setupProjectSelectorDataBinding

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
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 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);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:21,代码来源:AppEngineDeployPreferencesPanel.java

示例3: initBinding

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
@Override
protected void initBinding() throws ConnectException {
	BindingHelper.bindStringToTextField(txtBarcode, getInputObservable(), Copy.FIELD_BARCODE, bindingContext,
			false);
	BindingHelper.bindStringToTextField(txtCondition, getInputObservable(), Copy.FIELD_CONDITION, bindingContext,
			false);
	BindingHelper.bindStringToTextField(txtEdition, getInputObservable(), Copy.FIELD_EDITION, bindingContext,
			false);

	// one-way binding to update the input in sub-form
	bindingContext.bindValue(BeansObservables.observeValue(mediumInformationForm, INPUT),
			BeansObservables.observeDetailValue(inputObservable, Copy.FIELD_MEDIUM, Medium.class),
			new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), null);
	bindingContext.bindValue(BeansObservables.observeValue(movementForm, INPUT), inputObservable,
			new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), null);
}
 
开发者ID:FI13,项目名称:afbb-bibo,代码行数:17,代码来源:InventoryView.java

示例4: initBinding

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
@Override
protected void initBinding() throws ConnectException {
	BindingHelper.bindStringToTextField(txtBarcode, copyToModifyObservable, Copy.FIELD_BARCODE, bindingContext,
			false);
	BindingHelper.bindStringToTextField(txtEdition, copyToModifyObservable, Copy.FIELD_EDITION, bindingContext,
			false);
	BindingHelper.bindStringToTextField(txtCondition, copyToModifyObservable, Copy.FIELD_CONDITION, bindingContext,
			false);

	// one-way binding to update the pseudo-input in sub-forms
	bindingContext.bindValue(BeansObservables.observeValue(movementForm, INPUT), copyToModifyObservable,
			new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), null);
	bindingContext.bindValue(BeansObservables.observeValue(informationForm, INPUT),
			BeansObservables.observeDetailValue(copyToModifyObservable, Copy.FIELD_MEDIUM, Medium.class),
			new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), null);
}
 
开发者ID:FI13,项目名称:afbb-bibo,代码行数:17,代码来源:LendCopyView.java

示例5: createContents

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
@Override
protected Control createContents(Composite parent) {
	Control control = super.createContents(parent);

	DataBindingContext binding = new DataBindingContext();

	ControlDecoration controlDecoration = new ControlDecoration(tname, SWT.LEFT | SWT.TOP);
	controlDecoration.setDescriptionText(Messages.ThemesPreferencePage_duplicateName);
	FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
			FieldDecorationRegistry.DEC_ERROR);
	controlDecoration.setImage(fieldDecoration.getImage());

	binding.bindValue(SWTObservables.observeText(tname, SWT.Modify), PojoObservables.observeValue(this, "themename"), //$NON-NLS-1$
			new UpdateValueStrategy().setAfterConvertValidator(new StringRequiredValidator(Messages.ThemesPreferencePage_enternameMessage,
					controlDecoration, getButton(IDialogConstants.OK_ID))), null);

	return control;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:19,代码来源:ThemesPreferencePage.java

示例6: initCustomDataBindings

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
private void initCustomDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();

    UpdateValueStrategy defaultStrategy = new UpdateValueStrategy();

    IObservableValue<String> observedNewName = WidgetProperties.text(SWT.Modify).observe(textNewName);
    IObservableValue<String> observedNewAlias = new WritableValue<String>("", String.class);
    if (aliasIsAvailable) {
        observedNewAlias = WidgetProperties.text(SWT.Modify).observe(textNewAlias);
    }

    MultiValidator nameAndAliasValidator = new NameAndAliasValidator(observedNewName, observedNewAlias,
            elementNameMightBeEmpty);
    bindingContext.addValidationStatusProvider(nameAndAliasValidator);
    IObservableValue<String> validatedNewName = nameAndAliasValidator.observeValidatedValue(observedNewName);
    IObservableValue<String> validatedNewAlias = nameAndAliasValidator.observeValidatedValue(observedNewAlias);

    bindingContext.bindValue(validatedNewName, newName, defaultStrategy, defaultStrategy);
    bindingContext.bindValue(validatedNewAlias, newAlias, defaultStrategy, defaultStrategy);

    aggregatedStatus = new AggregateValidationStatus(bindingContext, AggregateValidationStatus.MAX_SEVERITY);
    aggregatedStatus.addChangeListener(aggregatedStatusListener);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:24,代码来源:RenameUMLElementRefactoringWizardUserPageComposite.java

示例7: createBinding

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
private void createBinding(DataBindingContext dbc, Text text, DuplexingObservableValue observable) {
	dbc.addBinding(dbc.bindValue(
			SWTObservables.observeText(text, SWT.FocusOut), 
			observable, 
			new StringifierUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE), 
			new StringifierUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE) {

				@Override
				public Object convert(Object value) {
					String string = (String) super.convert(value);
					if (string.startsWith("-")) {
						string = string.substring(1);
					}
					return string;
				}
				
			}));
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:19,代码来源:TemporalPropertyDescriptorContributor.java

示例8: bindEditabilityAndCalculatedVariable

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
private void bindEditabilityAndCalculatedVariable(DataBindingContext dbc, EObject target, Object feature, Control control) {
	ISWTObservableValue textEditability = SWTObservables.observeEnabled(control);
	IObservableValue calculatedVariableValue = observeCalculatedVariable(target);
	final CalculatedVariable calculatedVariable = getCalculatedVariable(feature);
	UpdateValueStrategy calculatedVariableToEditability = new UpdateValueStrategy() {
		@Override
		public Object convert(Object value) {
			if (value instanceof Set) {
				return !(((Set) value).contains(calculatedVariable));
			}
			if (value == calculatedVariable) {
				return false;
			}
			return true;
		}
	};
	Binding editabilityBinding = dbc.bindValue(textEditability, calculatedVariableValue, null, calculatedVariableToEditability);
	dbc.addBinding(editabilityBinding);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:20,代码来源:TemporalDetailProvider.java

示例9: createBinding

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
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,代码行数:23,代码来源:DurationBindingFactory.java

示例10: initDataBindings

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
protected DataBindingContext initDataBindings() {
		DataBindingContext bindingContext = new DataBindingContext();
		//
		IObservableValue observeSelectionScaleObserveWidget = WidgetProperties.selection().observe(scale);
		IObservableValue observeSelectionSpinnerObserveWidget = WidgetProperties.selection().observe(spinner);
		bindingContext.bindValue(observeSelectionScaleObserveWidget, observeSelectionSpinnerObserveWidget, null, null);
		//
		IObservableValue observeMaxScaleObserveWidget = WidgetProperties.maximum().observe(scale);
		IObservableValue sizeLogObserveValue = BeanProperties.value("size").observe(log);
		bindingContext.bindValue(observeMaxScaleObserveWidget, sizeLogObserveValue, null,
				new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
		//
		
		IObservableValue observeMaxSpinnerObserveWidget = WidgetProperties.maximum().observe(spinner);
//		IObservableValue sizeLogObserveValue = BeanProperties.value("size").observe(log);
		bindingContext.bindValue(observeMaxSpinnerObserveWidget, sizeLogObserveValue, null,
				new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
		return bindingContext;
	}
 
开发者ID:fp7-netide,项目名称:IDE,代码行数:20,代码来源:ReplayPanel.java

示例11: bindField

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
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,代码行数:18,代码来源:EclipseBindingToolkit.java

示例12: addDataBinder

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
private void addDataBinder(Widget toObserve, IValidator validator, Class<?> observableClass,
        String propertyName, Object observedProperty, boolean textDecorationEnabled) {
    IObservableValue textObservable = WidgetProperties.text(SWT.Modify).observe(toObserve);
    UpdateValueStrategy strategy = new UpdateValueStrategy();
    strategy.setBeforeSetValidator(validator);

    ValidationStatusProvider binding = this.ctx.bindValue(textObservable,
        PojoProperties.value(observableClass, propertyName).observe(observedProperty), strategy,
        null);
    if (textDecorationEnabled) {
        ControlDecorationSupport.create(binding, SWT.LEFT);
    }
    final IObservableValue errorObservable = WidgetProperties.text()
            .observe(this.addDialog.getErrorLabel());

    ctx.bindValue(errorObservable, new AggregateValidationStatus(ctx.getBindings(),
            AggregateValidationStatus.MAX_SEVERITY),
        null, null);

}
 
开发者ID:apache,项目名称:ant-ivyde,代码行数:21,代码来源:SecuritySetupController.java

示例13: createDataBindings

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
protected void createDataBindings(SensidlProjectDTO sensidlProjectDTO) {
	DataBindingContext bindingContext = new DataBindingContext();
	
	UpdateValueStrategy strategyAtomicStringToModel = new UpdateValueStrategy();
	strategyAtomicStringToModel.setAfterGetValidator(new NonEmptyStringValidator());
	UpdateValueStrategy strategyAtomicStringToTarget = new UpdateValueStrategy(); 
	
	IObservableValue observeTextTxtSensidlFileNameObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtSensidlFileName);
	IObservableValue atomicValidatedProjectName = new WritableValue(null, String.class);
	bindingContext.bindValue(observeTextTxtSensidlFileNameObserveWidget, atomicValidatedProjectName, strategyAtomicStringToModel, strategyAtomicStringToTarget);
	
	IObservableValue model = BeanProperties.value("sensidlFileName").observe(sensidlProjectDTO);
	bindingContext.bindValue(observeTextTxtSensidlFileNameObserveWidget, model);
	
	aggregatedStatus = new AggregateValidationStatus(bindingContext, AggregateValidationStatus.MAX_SEVERITY);
	aggregatedStatus.addChangeListener(sensidlProjectStatusListener);
}
 
开发者ID:SENSIDL-PROJECT,项目名称:SensIDL,代码行数:18,代码来源:SensidlProjectWizardComposite.java

示例14: initDataBindings

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
protected DataBindingContext initDataBindings() {
	DataBindingContext bindingContext = new DataBindingContext();
	//
	IObservableValue observeTextTxtAtlFileObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtAtlFile);
	IObservableValue revengModelTransformationObserveValue = EMFObservables.observeValue(revengModel, Literals.REVENG_MODEL__TRANSFORMATION);
	UpdateValueStrategy strategy_1 = new UpdateValueStrategy();
	strategy_1.setConverter(new TransformationToTextConverter());
	bindingContext.bindValue(observeTextTxtAtlFileObserveWidget, revengModelTransformationObserveValue, null, strategy_1);
	//
	IObservableValue observeTextTxtTemplatePathObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtTemplatePath);
	IObservableValue revengModelTemplateObserveValue = EMFObservables.observeValue(revengModel, Literals.REVENG_MODEL__TEMPLATE);
	UpdateValueStrategy strategy_2 = new UpdateValueStrategy();
	strategy_2.setConverter(new TransformationToTextConverter());
	bindingContext.bindValue(observeTextTxtTemplatePathObserveWidget, revengModelTemplateObserveValue, null, strategy_2);
	//
	IObservableValue observeTextTxtComponentNameObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtComponentFile);
	IObservableValue revengModelComponentPathObserveValue = EMFObservables.observeValue(revengModel, Literals.REVENG_MODEL__COMPONENT_PATH);
	bindingContext.bindValue(observeTextTxtComponentNameObserveWidget, revengModelComponentPathObserveValue, null, null);
	//
	return bindingContext;
}
 
开发者ID:jesusc,项目名称:bento,代码行数:22,代码来源:TransformationConfigurationPage.java

示例15: createOsgiQualifiersGroup

import org.eclipse.core.databinding.UpdateValueStrategy; //导入依赖的package包/类
private void createOsgiQualifiersGroup(Composite container) {
	Group osgiQualifierGroup = new Group(container, SWT.BORDER);
	osgiQualifierGroup.setText(Messages.preferencesOsgiQualifierTitleLabel);
	osgiQualifierGroup.setLayout(new GridLayout(1, false));
	osgiQualifierGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

	createMavenToOsgiVersionMappingStrategy(osgiQualifierGroup);
	
	OsgiQualifierValidator validator = new OsgiQualifierValidator();
	UpdateValueStrategy strategy = new UpdateValueStrategy();
	strategy.setBeforeSetValidator(validator);
	
	createOsgiReleaseQualifier(strategy, osgiQualifierGroup);

	createOsgiSnapshotQualifier(strategy, osgiQualifierGroup);
}
 
开发者ID:inventage,项目名称:version-tiger,代码行数:17,代码来源:VersionTigerPreferencesPage.java


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