本文整理汇总了Java中org.eclipse.core.databinding.UpdateValueStrategy.setConverter方法的典型用法代码示例。如果您正苦于以下问题:Java UpdateValueStrategy.setConverter方法的具体用法?Java UpdateValueStrategy.setConverter怎么用?Java UpdateValueStrategy.setConverter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.databinding.UpdateValueStrategy
的用法示例。
在下文中一共展示了UpdateValueStrategy.setConverter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: initDataBindings
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
protected DataBindingContext initDataBindings(){
DataBindingContext bindingContext = new DataBindingContext();
//
IObservableValue observeTextTxti18nObserveWidget =
WidgetProperties.text(SWT.Modify).observe(txti18n);
IObservableValue wvTranslatedLabelObserveDetailValue =
PojoProperties.value(Role.class, "translatedLabel", String.class).observeDetail(wv);
bindingContext.bindValue(observeTextTxti18nObserveWidget,
wvTranslatedLabelObserveDetailValue, null, null);
//
IObservableValue observeEnabledTxtRoleNameObserveWidget =
WidgetProperties.enabled().observe(txtRoleName);
IObservableValue wvSystemRoleObserveDetailValue =
PojoProperties.value(Role.class, "systemRole", Boolean.class).observeDetail(wv);
UpdateValueStrategy strategy = new UpdateValueStrategy();
strategy.setConverter(new BooleanNotConverter());
bindingContext.bindValue(observeEnabledTxtRoleNameObserveWidget,
wvSystemRoleObserveDetailValue,
new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), strategy);
//
return bindingContext;
}
示例3: initDataBindings
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
protected DataBindingContext initDataBindings() {
bindingContext = new DataBindingContext();
//
IObservableValue observeTagsObserveWidget = WidgetProperties.text(SWT.Modify).observe(text);
IObservableValue solutionTagsObserveValue = EMFObservables.observeValue(solution, Literals.NODE__IUS);
UpdateValueStrategy solutionTagsToModelStrategy = new UpdateValueStrategy();
solutionTagsToModelStrategy.setConverter(new StringToFeatureConverter());
UpdateValueStrategy solutionModelToTagsStrategy = new UpdateValueStrategy();
solutionModelToTagsStrategy.setConverter(new FeatureToStringConverter());
bindingContext.bindValue(observeTagsObserveWidget, solutionTagsObserveValue, solutionTagsToModelStrategy, solutionModelToTagsStrategy);
//
return bindingContext;
}
示例4: addTabFolderBinding
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
private void addTabFolderBinding(Control tabItem, String property) {
IObservableValue tfObs = WidgetProperties.enabled().observe(tabItem);
IObservableValue sshOn = BeanProperties.value(UiStatusModel.class, property).observe(this.statusModel);
UpdateValueStrategy modelToView = new UpdateValueStrategy();
modelToView.setConverter(new RunningBoolInverter(Boolean.class, Boolean.class));
UpdateValueStrategy viewToModel = new UpdateValueStrategy();
this.ctx.bindValue(tfObs, sshOn, viewToModel, modelToView);
}
示例5: addComboDisabledDataBinding
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
private void addComboDisabledDataBinding(Combo combo, String property) {
IObservableValue widgetValue = WidgetProperties.enabled().observe(combo);
IObservableValue modelValue = BeanProperties.value(UiStatusModel.class, property).observe(this.statusModel);
UpdateValueStrategy modelToView = new UpdateValueStrategy();
modelToView.setConverter(new RunningBoolInverter(Boolean.class, Boolean.class));
UpdateValueStrategy viewToModel = new UpdateValueStrategy();
this.ctx.bindValue(widgetValue, modelValue, viewToModel, modelToView);
}
示例6: addButtonDisabledDataBinding
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
private void addButtonDisabledDataBinding(Button button, String property) {
IObservableValue widgetValue = WidgetProperties.enabled().observe(button);
IObservableValue modelValue = BeanProperties.value(UiStatusModel.class, property).observe(this.statusModel);
UpdateValueStrategy modelToView = new UpdateValueStrategy();
modelToView.setConverter(new RunningBoolInverter(Boolean.class, Boolean.class));
UpdateValueStrategy viewToModel = new UpdateValueStrategy();
this.ctx.bindValue(widgetValue, modelValue, viewToModel, modelToView);
}
示例7: addStatusLabelDataBinding
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
private void addStatusLabelDataBinding(Label label, String property) {
IObservableValue widgetValue = WidgetProperties.text().observe(label);
IObservableValue modelValue = BeanProperties.value(UiStatusModel.class, property).observe(this.statusModel);
// WidgetProperties.font() bind with bool to display color corresponding
// to running status
UpdateValueStrategy modelToView = new UpdateValueStrategy();
modelToView.setConverter(new RunningBoolToStringConverter());
UpdateValueStrategy viewToModel = new UpdateValueStrategy();
viewToModel.setConverter(new RunningStringToBoolConverter());
this.ctx.bindValue(widgetValue, modelValue, viewToModel, modelToView);
}
示例8: initDataBindings
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
//
IObservableValue observeTextTxtIdtxtObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtIdtxt);
IObservableValue idGetWidgetObserveValue = BeanProperties.value("id").observe(getWidget());
bindingContext.bindValue(observeTextTxtIdtxtObserveWidget, idGetWidgetObserveValue, null, null);
//
IObservableValue observeTextTxtNameObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtName);
IObservableValue nameGetWidgetObserveValue = BeanProperties.value("name").observe(getWidget());
UpdateValueStrategy strategy_3 = new UpdateValueStrategy();
strategy_3.setConverter(new StringToDisplayableStringConverter());
bindingContext.bindValue(observeTextTxtNameObserveWidget, nameGetWidgetObserveValue, null, strategy_3);
//
IObservableValue observeTextTxtDescriptionObserveWidget = WidgetProperties.text(SWT.Modify)
.observe(txtDescription);
IObservableValue descriptionGetWidgetObserveValue = BeanProperties.value("description").observe(getWidget());
UpdateValueStrategy strategy_2 = new UpdateValueStrategy();
strategy_2.setConverter(new StringToDisplayableStringConverter());
bindingContext.bindValue(observeTextTxtDescriptionObserveWidget, descriptionGetWidgetObserveValue, null,
strategy_2);
//
IObservableValue observeTextTxtVersionObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtVersion);
IObservableValue versionGetWidgetObserveValue = BeanProperties.value("version").observe(getWidget());
bindingContext.bindValue(observeTextTxtVersionObserveWidget, versionGetWidgetObserveValue, null, null);
//
return bindingContext;
}
示例9: bindCreateThresholdCheck
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
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);
}
示例10: bindThresholdMeasure
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
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);
}
示例11: bindText
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
/**
* Returns an observable observing the text attribute of the provided <code>control</code>. The supported types
* are:
* <ul>
* <li>org.eclipse.swt.widgets.Text</li>
* <li>org.eclipse.swt.custom.StyledText (as of 1.3)</li>
* </ul>
*
* @param control
* @param event event type to register for change events {@literal SWT.FocusOut SWT.Modify or SWT.NONE}
* @param bean
* @param propertyName
* @param validator
* @param converter
* @return binding
* @throws IllegalArgumentException if <code>control</code> type is unsupported
*/
public DecoratedBinding bindText(Control control, int event, Object bean, String propertyName,
IValidator validator, IConverter targetToModelConverter, IConverter modelToTargetConverter) {
// IObservableValue widgetValue =
// WidgetProperties.text(SWT.Modify).observe(serverUriText);
// IObservableValue modelValuea = BeanProperties.value(Connection.class,
// "serverURI").observe(connection);
// observe
IObservableValue widgetValue = SWTObservables.observeText(control, event);
IObservableValue modelValue = BeansObservables.observeValue(bean, propertyName);
UpdateValueStrategy targetToModel = new UpdateValueStrategy();
UpdateValueStrategy modelToTarget = new UpdateValueStrategy();
// targetToModel
// validator
if (validator != null) {
targetToModel.setBeforeSetValidator(validator);
}
// converter
if (targetToModelConverter != null) {
targetToModel.setConverter(targetToModelConverter);
}
// modelToTarget
if (modelToTargetConverter != null) {
modelToTarget.setConverter(modelToTargetConverter);
}
Binding bindValue = context.bindValue(widgetValue, modelValue, targetToModel, modelToTarget);
// decoration
ControlDecorationSupport decorationSupport = ControlDecorationSupport.create(bindValue, SWT.TOP | SWT.LEFT);
return new DecoratedBinding(bindValue, decorationSupport);
}
示例12: updatingValueStrategy
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
public UpdateValueStrategy updatingValueStrategy() {
UpdateValueStrategy strat = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
strat.setConverter(this);
return strat;
}
示例13: initDataBindings
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
//
IObservableValue observeNameObserveWidget = WidgetProperties.text(SWT.Modify).observe(name);
IObservableValue solutionNameObserveValue = EMFObservables.observeValue(solution, Literals.NODE__NAME);
bindingContext.bindValue(observeNameObserveWidget, solutionNameObserveValue, null, null);
//
IObservableValue observeOrganisationObserveWidget = WidgetProperties.text(SWT.Modify).observe(organization);
IObservableValue solutionCompanynameObserveValue = EMFObservables.observeValue(solution, Literals.NODE__COMPANYNAME);
bindingContext.bindValue(observeOrganisationObserveWidget, solutionCompanynameObserveValue, null, null);
//
IObservableValue observeOwnerObserveWidget = WidgetProperties.text(SWT.Modify).observe(owner);
IObservableValue solutionOwnerObserveValue = EMFObservables.observeValue(solution, Literals.NODE__OWNER);
bindingContext.bindValue(observeOwnerObserveWidget, solutionOwnerObserveValue, null, null);
//
IObservableValue observeWebsiteUrlObserveWidget = WidgetProperties.text(SWT.Modify).observe(websiteUrl);
IObservableValue solutionUrlObserveValue = EMFObservables.observeValue(solution, Literals.NODE__URL);
bindingContext.bindValue(observeWebsiteUrlObserveWidget, solutionUrlObserveValue, null, null);
//
IObservableValue observeSupportUrlObserveWidget = WidgetProperties.text(SWT.Modify).observe(supportUrl);
IObservableValue solutionSupporturlObserveValue = EMFObservables.observeValue(solution, Literals.NODE__SUPPORTURL);
bindingContext.bindValue(observeSupportUrlObserveWidget, solutionSupporturlObserveValue, null, null);
//
IObservableValue observeStatusObserveWidget = WidgetProperties.text().observe(status);
IObservableValue solutionStatusObserveValue = EMFObservables.observeValue(solution, Literals.NODE__STATUS);
bindingContext.bindValue(observeStatusObserveWidget, solutionStatusObserveValue, null, null);
//
IObservableValue observeLicenseObserveWidget = WidgetProperties.text().observe(license);
IObservableValue solutionLicenseObserveValue = EMFObservables.observeValue(solution, Literals.NODE__LICENSE);
bindingContext.bindValue(observeLicenseObserveWidget, solutionLicenseObserveValue, null, null);
//
IObservableValue observeTagsObserveWidget = WidgetProperties.text(SWT.Modify).observe(tags);
IObservableValue solutionTagsObserveValue = EMFObservables.observeValue(solution, Literals.NODE__TAGS);
UpdateValueStrategy solutionTagsToModelStrategy = new UpdateValueStrategy();
solutionTagsToModelStrategy.setConverter(new CommaSeparatedListToTagsConverter());
UpdateValueStrategy solutionModelToTagsStrategy = new UpdateValueStrategy();
solutionModelToTagsStrategy.setConverter(new TagsToCommaSeparatedListConverter());
bindingContext.bindValue(observeTagsObserveWidget, solutionTagsObserveValue, solutionTagsToModelStrategy, solutionModelToTagsStrategy);
//
return bindingContext;
}
示例14: createDataBindings
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
protected DataBindingContext createDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
// atomic host
IObservableValue<String> observeTextTxtCDOHostnameObserveWidget = WidgetProperties.text(SWT.Modify)
.observeDelayed(UPDATE_DELAY, txtCDOHostname);
IObservableValue<String> atomicValidatedHostname = new WritableValue<>(null, String.class);
UpdateValueStrategy strategyAtomicStringToModel = new UpdateValueStrategy();
strategyAtomicStringToModel.setAfterGetValidator(new NonEmptyStringValidator());
UpdateValueStrategy strategyAtomicStringToTarget = new UpdateValueStrategy();
bindingContext.bindValue(observeTextTxtCDOHostnameObserveWidget, atomicValidatedHostname,
strategyAtomicStringToModel, strategyAtomicStringToTarget);
// atomic port
IObservableValue<String> observeTextTxtCDOPortObserveWidget = WidgetProperties.text(SWT.Modify)
.observeDelayed(UPDATE_DELAY, txtCDOPort);
IObservableValue<Integer> atomicValidatedPort = new WritableValue<>(null, Integer.class);
UpdateValueStrategy strategy = new UpdateValueStrategy();
strategy.setConverter(new StringToNumberConverter());
strategy.setAfterGetValidator(new StringToNumberConverter());
UpdateValueStrategy strategy1 = new UpdateValueStrategy();
strategy1.setConverter(new NumberToStringConverter());
strategy1.setAfterGetValidator(new NumberToStringConverter());
bindingContext.bindValue(observeTextTxtCDOPortObserveWidget, atomicValidatedPort, strategy, strategy1);
// atomic repo
IObservableValue<String> observeTextTxtCDORepositoryObserveWidget = WidgetProperties.text(SWT.Modify)
.observeDelayed(UPDATE_DELAY, txtCDORepository);
IObservableValue<String> atomicValidatedRepository = new WritableValue<>(null, String.class);
bindingContext.bindValue(observeTextTxtCDORepositoryObserveWidget, atomicValidatedRepository,
strategyAtomicStringToModel, strategyAtomicStringToTarget);
// connection validation
MultiValidator connectionValidator = new CDOCredentialsValidator(atomicValidatedHostname, atomicValidatedPort,
atomicValidatedRepository);
bindingContext.addValidationStatusProvider(connectionValidator);
IObservableValue<String> validatedHostname = connectionValidator.observeValidatedValue(atomicValidatedHostname);
IObservableValue<Integer> validatedPort = connectionValidator.observeValidatedValue(atomicValidatedPort);
IObservableValue<String> validatedRepo = connectionValidator.observeValidatedValue(atomicValidatedRepository);
// model bindings
IObservableValue<String> cdoHostPreferencesDTOObserveValue = BeanProperties.value("cdoHost")
.observe(preferencesDTO);
bindingContext.bindValue(validatedHostname, cdoHostPreferencesDTOObserveValue);
IObservableValue<Integer> cdoPortPreferencesDTOObserveValue = BeanProperties.value("cdoPort")
.observe(preferencesDTO);
bindingContext.bindValue(validatedPort, cdoPortPreferencesDTOObserveValue);
IObservableValue<String> cdoRepoPreferencesDTOObserveValue = BeanProperties.value("cdoRepo")
.observe(preferencesDTO);
bindingContext.bindValue(validatedRepo, cdoRepoPreferencesDTOObserveValue);
// validation status notifier
aggregatedStatus = new AggregateValidationStatus(bindingContext, AggregateValidationStatus.MAX_SEVERITY);
aggregatedStatus.addChangeListener(validatorStatusListener);
// return binding context
return bindingContext;
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:52,代码来源:ProjectPropertiesComposite.java
示例15: initCustomDataBindings
import org.eclipse.core.databinding.UpdateValueStrategy; //导入方法依赖的package包/类
private void initCustomDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
IObservableValue<?> observedDiagramName = WidgetProperties.text(SWT.Modify).observe(textDiagramName);
IObservableValue<?> observedModelName = WidgetProperties.text(SWT.Modify).observe(textModelName);
IObservableValue<?> observedProjectName = WidgetProperties.text(SWT.Modify).observe(textProject);
IObservableValue<String> atomicValidatedDiagramName = new WritableValue<>(null, String.class);
IObservableValue<String> atomicValidatedModelName = new WritableValue<>(null, String.class);
IObservableValue<ProjectName> atomicValidatedProjectName = new WritableValue<>(null, ProjectName.class);
UpdateValueStrategy strategyAtomicModelNameTargetToModel = new UpdateValueStrategy();
strategyAtomicModelNameTargetToModel.setAfterGetValidator(new AtomicModelNameProcessor());
bindingContext.bindValue(observedModelName, atomicValidatedModelName, strategyAtomicModelNameTargetToModel,
new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
UpdateValueStrategy strategyAtomicDiagramNameTargetToModel = new UpdateValueStrategy();
strategyAtomicDiagramNameTargetToModel.setAfterGetValidator(new AtomicDiagramNameProcessor());
bindingContext.bindValue(observedDiagramName, atomicValidatedDiagramName,
strategyAtomicDiagramNameTargetToModel, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
UpdateValueStrategy strategyAtomicProjectNameTargetToModel = new UpdateValueStrategy();
strategyAtomicProjectNameTargetToModel.setAfterGetValidator(new AtomicProjectNameProcessor());
strategyAtomicProjectNameTargetToModel.setConverter(new AtomicProjectNameProcessor());
bindingContext.bindValue(observedProjectName, atomicValidatedProjectName,
strategyAtomicProjectNameTargetToModel, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
CompoundNameValidator diagramNameValidator = new CompoundNameValidator(atomicValidatedDiagramName,
atomicValidatedModelName, atomicValidatedProjectName);
bindingContext.addValidationStatusProvider(diagramNameValidator);
IObservableValue<?> validatedDiagramName = diagramNameValidator
.observeValidatedValue(atomicValidatedDiagramName);
IObservableValue<?> validatedModelName = diagramNameValidator.observeValidatedValue(atomicValidatedModelName);
IObservableValue<?> validatedProjectName = diagramNameValidator
.observeValidatedValue(atomicValidatedProjectName);
@SuppressWarnings("unchecked")
IObservableValue<String> modelSelectedModelName = BeanProperties
.value(SelectedNamesDTO.class, "selectedModelName").observe(dto);
@SuppressWarnings("unchecked")
IObservableValue<String> modelSelectedDiagramName = BeanProperties
.value(SelectedNamesDTO.class, "selectedDiagramName").observe(dto);
@SuppressWarnings("unchecked")
IObservableValue<ProjectName> modelSelectedProjectName = BeanProperties
.value(SelectedNamesDTO.class, "selectedProjectName").observe(dto);
// Bind to the validated value, not the middle/target
bindingContext.bindValue(validatedDiagramName, modelSelectedDiagramName);
bindingContext.bindValue(validatedModelName, modelSelectedModelName);
bindingContext.bindValue(validatedProjectName, modelSelectedProjectName);
aggregatedStatus = new AggregateValidationStatus(bindingContext, AggregateValidationStatus.MAX_SEVERITY);
aggregatedStatus.addChangeListener(validatorStatusListener);
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:54,代码来源:ModelAndDiagramSelectionComposite.java