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


Java ISWTObservableValue类代码示例

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


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


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