• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ISWTObservableValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createComposite

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
@PostConstruct
public void createComposite(Composite parent) {
	GridLayoutFactory.fillDefaults().applyTo(parent);
	Checkbox checkbox = new Checkbox(parent, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(checkbox);
	checkbox.setSelection(true);
	checkbox.setText("Custom checkbox with databinding");
	
	Label label = new Label(parent, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(label);
	
	DataBindingContext dbc = new DataBindingContext();
	
	IObservableValue checkboxProperty = CustomWidgetProperties.selection().observe(checkbox);
	ISWTObservableValue labelProperty = WidgetProperties.text().observe(label);
	
	dbc.bindValue(labelProperty, checkboxProperty);
	
	Button checkButton = new Button(parent, SWT.CHECK);
	checkButton.setSelection(true);
	checkButton.setText("Usual SWT check button");
}
 
开发者ID:vogellacompany,项目名称:swt-custom-widgets,代码行数:23,代码来源:DatabindingCustomWidgetPart.java


示例2: bind

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
private void bind(IWidgetValueProperty prop, String expr) {
	Object dataContext = findTagged(DATA_CONTEXT, null);
	Binder dbc = findTagged(Binder.class);
	ISWTObservableValue observableValue = prop.observe(control());
	org.eclipse.core.databinding.Binding binding = dbc.bind(observableValue, dataContext, expr);

	if (binding == null) {
		// no observables have been parsed, just use the value
		prop.setValue(control(), expr);
	} else {
		// set non editable if this was a multi binding
		if (binding.getModel() instanceof ComputedValue) {
			try {
				WidgetProperties.editable().setValue(control(), false);
			} catch (Exception e) {
				// ignore, not a supported editable widget
			}
		}
	}
}
 
开发者ID:erdalkaraca,项目名称:lambda-ui,代码行数:21,代码来源:SwtUI.java


示例3: bindEditabilityAndCalculatedVariable

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的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


示例4: createBasicControl

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
private void createBasicControl(Composite container) {
	GridLayout layout = new GridLayout();
	container.setLayout(layout);
	layout.numColumns = 6;
	layout.verticalSpacing = 10;
	layout.marginTop = 10;
	layout.marginWidth = 10;
	createErrorLabel(container);
	createColumnInfoControl(container);
	final ISWTObservableValue observableValue = SWTObservables.observeText(errorLabel);
	errorLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
	dataBindingContext.bindValue(observableValue, new AggregateValidationStatus(dataBindingContext.getBindings(),
			AggregateValidationStatus.MAX_SEVERITY), null, null);
	observableValue.addChangeListener(new IChangeListener() {
		public void handleChange(ChangeEvent event) {
			if (observableValue.getValue().equals("OK")) {
				errorLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
				errorLabel.setText(DIALOG_MESSAGE);
				buttonOk.setEnabled(true);
			} else {
				errorLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
				buttonOk.setEnabled(false);
			}
		}
	});

}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:28,代码来源:ColumnDialog.java


示例5: setupPossiblyUnvalidatedTextFieldDataBinding

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
/**
 * Binds a {@link Text} field with a property of the {@link DeployPreferences deploy
 * preferences model} given to the panel. This method honors the panel's validation mode (set
 * through the {@code requireValues} parameter when this panel was instantiated) such that {@code
 * validator} is ignored if {@code requireValues} is {@code false}.
 *
 * @see #AppEngineDeployPreferencesPanel
 */
protected void setupPossiblyUnvalidatedTextFieldDataBinding(Text text, String modelPropertyName,
    ValidationStatusProvider validator) {
  ISWTObservableValue textValue = WidgetProperties.text(SWT.Modify).observe(text);
  IObservableValue modelValue = PojoProperties.value(modelPropertyName).observe(model);

  bindingContext.bindValue(textValue, modelValue);
  if (requireValues) {
    bindingContext.addValidationStatusProvider(validator);
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:19,代码来源:AppEngineDeployPreferencesPanel.java


示例6: setupTextFieldDataBinding

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
/**
 * Binds a {@link Text} field with a property of the {@link DeployPreferences deploy
 * preferences model} given to the panel.
 *
 * Unlike {@link #setupFileFieldDataBinding}, {@code setAfterGetValidator} is always enforced
 * regardless of the panel's validation mode.
 *
 * @see #setupTextFieldDataBinding
 */
private void setupTextFieldDataBinding(Text text, String modelPropertyName,
    IValidator afterGetValidator) {
  ISWTObservableValue textValue = WidgetProperties.text(SWT.Modify).observe(text);
  IObservableValue modelValue = PojoProperties.value(modelPropertyName).observe(model);

  bindingContext.bindValue(textValue, modelValue,
      new UpdateValueStrategy().setAfterGetValidator(afterGetValidator),
      new UpdateValueStrategy().setAfterGetValidator(afterGetValidator));
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:19,代码来源:AppEngineDeployPreferencesPanel.java


示例7: bindModel

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
@Override
public void bindModel(EMFDataBindingContext context) {
	IEMFValueProperty property = EMFEditProperties.value(
			TransactionUtil.getEditingDomain(eObject),
			BasePackage.Literals.NAMED_ELEMENT__NAME);
	ISWTObservableValue observe = WidgetProperties.text(new int[]{SWT.FocusOut, SWT.DefaultSelection})
			.observe(nameText);
	context.bindValue(observe, property.observe(eObject));
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:10,代码来源:ExitPropertySection.java


示例8: bindNameControl

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
private void bindNameControl(EMFDataBindingContext context) {
	IEMFValueProperty property = EMFEditProperties.value(
			TransactionUtil.getEditingDomain(eObject),
			BasePackage.Literals.NAMED_ELEMENT__NAME);
	ISWTObservableValue observe = WidgetProperties.text(new int[]{SWT.FocusOut, SWT.DefaultSelection})
			.observe(nameText);
	context.bindValue(observe, property.observe(eObject));
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:9,代码来源:EntryPropertySection.java


示例9: bindDocumentationControl

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
protected void bindDocumentationControl(EMFDataBindingContext context) {
	IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject),
			BasePackage.Literals.DOCUMENTED_ELEMENT__DOCUMENTATION);
	ISWTObservableValue observe = WidgetProperties.text(new int[] { SWT.FocusOut, SWT.DefaultSelection })
			.observe(documentation);
	context.bindValue(observe, property.observe(eObject));
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:8,代码来源:StatePropertySection.java


示例10: bindNameControl

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
protected void bindNameControl(EMFDataBindingContext context) {
	IEMFValueProperty nameProperty = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject),
			BasePackage.Literals.NAMED_ELEMENT__NAME);
	ISWTObservableValue nameTextProperty = WidgetProperties.text(new int[] { SWT.FocusOut, SWT.DefaultSelection })
			.observe(txtName);
	context.bindValue(nameTextProperty, nameProperty.observe(eObject));
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:8,代码来源:StatePropertySection.java


示例11: bindDocumentationControl

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
protected void bindDocumentationControl(EMFDataBindingContext context) {
	IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject),
			BasePackage.Literals.DOCUMENTED_ELEMENT__DOCUMENTATION);
	ISWTObservableValue observe = WidgetProperties.text(new int[]{SWT.FocusOut, SWT.DefaultSelection})
			.observe(documentation);
	context.bindValue(observe, property.observe(eObject));
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:8,代码来源:StatechartPropertySection.java


示例12: bindNameControl

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
protected void bindNameControl(EMFDataBindingContext context) {
	IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject),
			BasePackage.Literals.NAMED_ELEMENT__NAME);
	ISWTObservableValue observe = WidgetProperties.text(new int[]{SWT.FocusOut, SWT.DefaultSelection})
			.observe(txtName);
	context.bindValue(observe, property.observe(eObject));
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:8,代码来源:StatechartPropertySection.java


示例13: observeStatechartName

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
protected void observeStatechartName(Text statechartNameLabel) {
	if (getContextObject() instanceof Statechart) {
		ValidatingEMFDatabindingContext context = new ValidatingEMFDatabindingContext(this,
				this.getSite().getShell());
		IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(getContextObject()),
				BasePackage.Literals.NAMED_ELEMENT__NAME);
		ISWTObservableValue observe = WidgetProperties.text(new int[]{SWT.FocusOut, SWT.DefaultSelection})
				.observe(statechartNameLabel);
		context.bindValue(observe, property.observe(this.getContextObject()));
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:12,代码来源:StatechartDiagramEditor.java


示例14: bindStringToTextField

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
public static Binding bindStringToTextField(final Text textField, final IObservableValue modelObservable,
		final DataBindingContext bindingContext, final boolean isRequired) {
	final ISWTObservableValue targetObservable = SWTObservables.observeText(textField, SWT.Modify);
	final UpdateValueStrategy targetToModel = isRequired
			? new UpdateValueStrategy().setAfterConvertValidator(new NotEmptyValue()) : null;

	final Binding binding = bindingContext.bindValue(targetObservable, modelObservable, targetToModel, null);

	if (isRequired) {
		createControlDecoration(textField, NotEmptyValue.MSG, isRequired);
	}

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


示例15: bindDate

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
public static <E> Binding bindDate(final DateTime dateTime, final E entity, final Class<E> entityClass,
		final String propertyName, final DataBindingContext bindingContext) {
	// FIXME problem with null value
	final ISWTObservableValue targetObservable = SWTObservables.observeSelection(dateTime);
	final IObservableValue modelObservable = BeanProperties.value(entityClass, propertyName).observe(entity);
	final Binding binding = bindingContext.bindValue(targetObservable, modelObservable);
	return binding;
}
 
开发者ID:FI13,项目名称:afbb-bibo,代码行数:9,代码来源:BindingHelper.java


示例16: aggregateValidationStatus

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
/**
 * aggregates the validation status for given {@link DataBindingContext}
 *
 * @param bindingContext
 * @return
 */
public static AggregateValidationStatus aggregateValidationStatus(final DataBindingContext bindingContext) {
	final AggregateValidationStatus aggregateStatus = new AggregateValidationStatus(bindingContext,
			AggregateValidationStatus.MAX_SEVERITY);
	aggregateStatus.addChangeListener(new IChangeListener() {

		@Override
		public void handleChange(final ChangeEvent event) {
			// TODO refactor - can lead to StackOverflowError
			for (final Object o : bindingContext.getBindings()) {
				final Binding binding = (Binding) o;
				final IStatus status = (IStatus) binding.getValidationStatus().getValue();

				Control control = null;
				if (binding.getTarget() instanceof ISWTObservableValue) {
					final ISWTObservableValue swtObservableValue = (ISWTObservableValue) binding.getTarget();
					control = (Control) swtObservableValue.getWidget();
				}
				final ControlDecoration decoration = decorations.get(control);
				if (decoration != null && !control.isDisposed()) {
					if (status.isOK()) {
						decoration.hide();
					} else {
						decoration.setDescriptionText(status.getMessage());
						decoration.show();
					}
				}
			}
		}
	});
	return aggregateStatus;

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


示例17: createBinding

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
@Override
public Binding createBinding(DetailProviderParameter p) {
	FormToolkit toolkit = p.getDetailFormToolkit();
	Composite parent = p.getParent();
	final EObject target = p.getTarget();
	IItemPropertyDescriptor pd = p.getPropertyDescriptor();
	boolean isEditable = pd.canSetProperty(target);
	final EStructuralFeature feature = (EStructuralFeature) pd.getFeature(target);
	
	String shortDescription = EMFUtils.getAnnotation(feature, EMFDetailUtils.ANNOTATION_SOURCE_DETAIL, EMFDetailUtils.ANNOTATION_DETAIL_SHORT_DESCRIPTION);
	EMFDetailUtils.createLabel(parent, toolkit, target, pd);
	Composite composite = createEditorComposite(toolkit, parent, (shortDescription == null) ? 1 : 2);
	final Button button = toolkit.createButton(composite, "", SWT.CHECK | SWT.FLAT);
	button.setEnabled(isEditable);
	button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
	if (shortDescription != null) {
		Label label = new Label(composite, SWT.NONE);
		label.setText(shortDescription);
	}

	toolkit.adapt(button, true, true);
	EMFDetailUtils.bindValidatorDecoration(p, button);
	EMFDetailUtils.bindControlViability(p, new Control[] {button});

	WidgetTriStateValueProperty valueProperty = new WidgetTriStateValueProperty();
	ISWTObservableValue observable = valueProperty.observe(button);	
	return EMFDetailUtils.bindEMFUndoable(p, observable,
			new EMFUpdateValueStrategy(), new EMFUpdateValueStrategy());
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:30,代码来源:BooleanBindingFactory.java


示例18: observe

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
@Override
public ISWTObservableValue observe(Widget widget) {
	return super.observe(((BrowseDirText)widget).text);
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:5,代码来源:BrowseDirText.java


示例19: setupCheckBoxDataBinding

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
protected void setupCheckBoxDataBinding(Button button, String modelPropertyName) {
  ISWTObservableValue buttonValue = WidgetProperties.selection().observe(button);
  IObservableValue modelValue = PojoProperties.value(modelPropertyName).observe(model);
  bindingContext.bindValue(buttonValue, modelValue);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:6,代码来源:AppEngineDeployPreferencesPanel.java


示例20: createBinding

import org.eclipse.jface.databinding.swt.ISWTObservableValue; //导入依赖的package包/类
@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,代码行数:42,代码来源:URLBindingFactory.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AnnotationExpr类代码示例发布时间:2022-05-22
下一篇:
Java UsbDeviceDescriptor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap