本文整理汇总了Java中org.eclipse.jface.databinding.viewers.IViewerObservableValue类的典型用法代码示例。如果您正苦于以下问题:Java IViewerObservableValue类的具体用法?Java IViewerObservableValue怎么用?Java IViewerObservableValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IViewerObservableValue类属于org.eclipse.jface.databinding.viewers包,在下文中一共展示了IViewerObservableValue类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupProjectSelectorDataBinding
import org.eclipse.jface.databinding.viewers.IViewerObservableValue; //导入依赖的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
示例2: ProjectSelectionValidator
import org.eclipse.jface.databinding.viewers.IViewerObservableValue; //导入依赖的package包/类
private ProjectSelectionValidator(IViewerObservableValue projectInput,
IViewerObservableValue projectSelection,
boolean requireValues) {
this.projectInput = projectInput;
this.projectSelection = projectSelection;
this.requireValues = requireValues;
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:8,代码来源:AppEngineDeployPreferencesPanel.java
示例3: bind
import org.eclipse.jface.databinding.viewers.IViewerObservableValue; //导入依赖的package包/类
private void bind(IViewerValueProperty prop, String expr) {
Object dataContext = findTagged(DATA_CONTEXT, null);
Binder dbc = findTagged(Binder.class);
IViewerObservableValue observeValue = prop.observe(viewer);
org.eclipse.core.databinding.Binding binding = dbc.bind(observeValue, dataContext, expr);
if (binding == null) {
// no observables have been parsed, just use the value
prop.setValue(viewer, expr);
}
}
示例4: createIntervalCombo
import org.eclipse.jface.databinding.viewers.IViewerObservableValue; //导入依赖的package包/类
private void createIntervalCombo() {
final ComboViewer intervalComboViewer = new ComboViewer(this, SWT.NONE);
intervalComboViewer.setContentProvider(ArrayContentProvider.getInstance());
intervalComboViewer.setInput(TimeRange.values());
final IViewerObservableValue intervalComboViewerObservable = ViewersObservables.observeSingleSelection(intervalComboViewer);
DataBindings.createBinding(intervalComboViewerObservable, viewModel.getVisibleRange(), VisibleRangeViewModel.PROPERTY__RANGE);
}
示例5: bindValue
import org.eclipse.jface.databinding.viewers.IViewerObservableValue; //导入依赖的package包/类
/**
* 对下拉列表和转换器列表进行绑定
* @param context
* @param comboViewer
* @param model
* ;
*/
public static void bindValue(DataBindingContext context, ComboViewer comboViewer, ConverterViewModel model) {
// ViewerSupport.bind(comboViewer, BeansObservables.observeList(
// model, "supportTypes", String.class),
// Properties.selfValue(String.class));
//
//
// context.bindValue(ViewersObservables
// .observeSingleSelection(comboViewer), BeansObservables
// .observeValue(model,
// "selectedType"));
// ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setComparator(new ViewerComparator());
// IObservableMap[] attributeMaps = BeansObservables.observeMaps(
// viewerContentProvider.getKnownElements(),
// ConverterBean.class, new String[] { "description" });
// comboViewer.setLabelProvider(new ObservableMapLabelProvider(
// attributeMaps));
// comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));
comboViewer.setInput(model.getSupportTypes());
IViewerObservableValue selection = ViewersObservables.observeSingleSelection(comboViewer);
IObservableValue observableValue = BeansObservables.observeDetailValue(selection, PROPERTIES_NAME, null);
context.bindValue(observableValue, BeansObservables.observeValue(model, PROPERTIES_SELECTED_TYPE));
}
示例6: bindValue
import org.eclipse.jface.databinding.viewers.IViewerObservableValue; //导入依赖的package包/类
public static void bindValue(DataBindingContext context,ComboViewer comboViewer,
ConverterViewModel model) {
// ViewerSupport.bind(comboViewer, BeansObservables.observeList(
// model, "supportTypes", String.class),
// Properties.selfValue(String.class));
//
//
// context.bindValue(ViewersObservables
// .observeSingleSelection(comboViewer), BeansObservables
// .observeValue(model,
// "selectedType"));
// ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setComparator(new ViewerComparator());
// IObservableMap[] attributeMaps = BeansObservables.observeMaps(
// viewerContentProvider.getKnownElements(),
// ConverterBean.class, new String[] { "description" });
// comboViewer.setLabelProvider(new ObservableMapLabelProvider(
// attributeMaps));
// comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));
comboViewer.setInput(model.getSupportTypes());
IViewerObservableValue selection=ViewersObservables.observeSingleSelection(comboViewer);
IObservableValue observableValue=BeansObservables.observeDetailValue(selection, "name", ConverterBean.class);
context.bindValue(observableValue, BeansObservables
.observeValue(model,
"selectedType"));
}
示例7: bindObjectToCCombo
import org.eclipse.jface.databinding.viewers.IViewerObservableValue; //导入依赖的package包/类
/**
* creates a binding for a combo
*
* @param combo
* widget that displays the information to the user
* @param entity
* class that holds the model information
* @param entityClass
* class of entity
* @param propertyName
* name of the property that should be binded
* @param propertyClass
* class of the property that should be binded
* @param values
* all values of the property
* @param bindingContext
* context of the binding
* @param labelProvider
* the label provider that will be used to display the state in
* the combo. can be <code>null</code>
* @param isRequired
* should the field be filled by the user?
* @return binding
*/
public static <E, T> Binding bindObjectToCCombo(final CCombo combo, final IObservableValue inputObservable,
final Class<E> entityClass, final String propertyName, final Class<T> propertyClass,
final Collection<T> values, final IBaseLabelProvider labelProvider, final DataBindingContext bindingContext,
final boolean isRequired) {
final ComboViewer comboViewer = new ComboViewer(combo);
comboViewer.setContentProvider(ArrayContentProvider.getInstance());
comboViewer.setLabelProvider(labelProvider);
comboViewer.setInput(values);
final IViewerObservableValue targetObservable = ViewersObservables.observeSingleSelection(comboViewer);
final IObservableValue modelObservable = BeansObservables.observeDetailValue(inputObservable, propertyName,
entityClass);
final UpdateValueStrategy targetToModel = isRequired
? new UpdateValueStrategy().setAfterConvertValidator(new NotEmptyValue()) : null;
final Binding binding = bindingContext.bindValue(targetObservable, modelObservable, targetToModel, null);
// TODO add required binding
return binding;
}
示例8: initDataBindings
import org.eclipse.jface.databinding.viewers.IViewerObservableValue; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void initDataBindings(){
DataBindingContext bindingContext = new DataBindingContext();
UpdateValueStrategy strategyUpdateProductChilds = new UpdateValueStrategy() {
@Override
protected IStatus doSet(IObservableValue observableValue, Object value){
IStatus status = super.doSet(observableValue, value);
Eigenartikel.copyProductAttributesToArticleSetAsChild(getProductArtikel(), null);
ElexisEventDispatcher.update(getProductArtikel());
return status;
}
};
//
ISWTObservableValue observeTextTxtProductNameObserveWidget =
WidgetProperties.text(SWT.Modify).observeDelayed(300, txtProductName);
IObservableValue<String> productEigenartikelNameObserveDetailValue = PojoProperties
.value(Eigenartikel.class, "name", String.class).observeDetail(productEigenartikel);
bindingContext.bindValue(observeTextTxtProductNameObserveWidget,
productEigenartikelNameObserveDetailValue, strategyUpdateProductChilds, null);
observeTextTxtProductNameObserveWidget.addValueChangeListener(new IValueChangeListener() {
@Override
public void handleValueChange(ValueChangeEvent event){
if (productEigenartikel.getValue() != null) {
if (event.diff.getOldValue() != null
&& !event.diff.getOldValue().toString().isEmpty()) {
ElexisEventDispatcher
.update((PersistentObject) productEigenartikel.getValue());
}
}
}
});
//
IViewerObservableValue observeSingleSelectionComboViewerProductType =
ViewerProperties.singleSelection().observe(comboViewerProductType);
IObservableValue<Eigenartikel> productEigenartikelTypObserveDetailValue =
PojoProperties.value(Eigenartikel.class, "typ", EigenartikelTyp.class)
.observeDetail(productEigenartikel);
bindingContext.bindValue(observeSingleSelectionComboViewerProductType,
productEigenartikelTypObserveDetailValue, null, null);
//
ISWTObservableValue observeTextTxtAtcCodeObserveWidget =
WidgetProperties.text(SWT.Modify).observeDelayed(300, txtAtcCode);
IObservableValue<String> productEigenartikelATC_codeObserveDetailValue = PojoProperties
.value(Eigenartikel.class, "ATC_code", String.class).observeDetail(productEigenartikel);
bindingContext.bindValue(observeTextTxtAtcCodeObserveWidget,
productEigenartikelATC_codeObserveDetailValue, strategyUpdateProductChilds, null);
}