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


Java BeansObservables.observeDetailValue方法代码示例

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


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

示例1: initBinding

import org.eclipse.core.databinding.beans.BeansObservables; //导入方法依赖的package包/类
@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,代码行数:29,代码来源:RegisterCopyView.java

示例2: bindValue

import org.eclipse.core.databinding.beans.BeansObservables; //导入方法依赖的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));
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:34,代码来源:ConverterUtil.java

示例3: bindValue

import org.eclipse.core.databinding.beans.BeansObservables; //导入方法依赖的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"));
	}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:30,代码来源:ConverterUtil.java

示例4: bindValue

import org.eclipse.core.databinding.beans.BeansObservables; //导入方法依赖的package包/类
void bindValue(Text text, String property, DataBindingContext bindingContext){
	IObservableValue textObserveWidget =
		SWTObservables.observeDelayedValue(5, SWTObservables.observeText(text, SWT.Modify));
	IObservableValue observeValue =
		BeansObservables.observeDetailValue(contactObservable, property, String.class);
	bindingContext.bindValue(textObserveWidget, observeValue, null, null);
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:8,代码来源:AbstractComposite.java

示例5: bindObjectToCCombo

import org.eclipse.core.databinding.beans.BeansObservables; //导入方法依赖的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;

}
 
开发者ID:FI13,项目名称:afbb-bibo,代码行数:48,代码来源:BindingHelper.java


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