本文整理汇总了Java中org.eclipse.jface.databinding.swt.SWTObservables.observeText方法的典型用法代码示例。如果您正苦于以下问题:Java SWTObservables.observeText方法的具体用法?Java SWTObservables.observeText怎么用?Java SWTObservables.observeText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.databinding.swt.SWTObservables
的用法示例。
在下文中一共展示了SWTObservables.observeText方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initDataBinding
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的package包/类
private void initDataBinding(){
transientCodingValue = new WritableValue();
DataBindingContext bindingContext = new DataBindingContext();
IObservableValue targetObservable = SWTObservables.observeText(codeTxt, SWT.Modify);
IObservableValue modelObservable = PojoObservables.observeDetailValue(transientCodingValue,
"code", TransientCoding.class);
bindingContext.bindValue(targetObservable, modelObservable);
targetObservable = SWTObservables.observeText(displayTxt, SWT.Modify);
modelObservable = PojoObservables.observeDetailValue(transientCodingValue, "display",
TransientCoding.class);
bindingContext.bindValue(targetObservable, modelObservable);
setCoding(null);
}
示例2: createBasicControl
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的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);
}
}
});
}
示例3: bindStringToTextField
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的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;
}
示例4: initDataBindings
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的package包/类
protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
//
IObservableValue lblOFFLINENACHSIGNATURENObserveTextObserveWidget = SWTObservables.observeText(lblOFFLINENACHSIGNATUREN);
IObservableValue kseStatusNumberOfflineNachsignaturenObserveValue = BeansObservables.observeValue(kseStatus, "numberOfflineNachsignaturen");
bindingContext.bindValue(lblOFFLINENACHSIGNATURENObserveTextObserveWidget, kseStatusNumberOfflineNachsignaturenObserveValue, null, null);
//
IObservableValue lblGESPEICHERTEKONSULTATIONENObserveTextObserveWidget = SWTObservables.observeText(lblGESPEICHERTEKONSULTATIONEN);
IObservableValue kseStatusNumberOfflineKonsultationenObserveValue = BeansObservables.observeValue(kseStatus, "numberOfflineKonsultationen");
bindingContext.bindValue(lblGESPEICHERTEKONSULTATIONENObserveTextObserveWidget, kseStatusNumberOfflineKonsultationenObserveValue, null, null);
//
return bindingContext;
}
示例5: initDataBinding
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的package包/类
private void initDataBinding(){
transientConditionValue = new WritableValue();
DataBindingContext bindingContext = new DataBindingContext();
IObservableValue targetObservable =
ViewersObservables.observeSingleSelection(statusViewer);
IObservableValue modelObservable = PojoObservables
.observeDetailValue(transientConditionValue, "status", TransientCondition.class);
bindingContext.bindValue(targetObservable, modelObservable);
targetObservable = SWTObservables.observeText(startTxt, SWT.Modify);
modelObservable = PojoObservables.observeDetailValue(transientConditionValue, "start",
TransientCondition.class);
bindingContext.bindValue(targetObservable, modelObservable);
targetObservable = SWTObservables.observeText(endTxt, SWT.Modify);
modelObservable = PojoObservables.observeDetailValue(transientConditionValue, "end",
TransientCondition.class);
bindingContext.bindValue(targetObservable, modelObservable);
targetObservable = SWTObservables.observeText(textTxt, SWT.Modify);
modelObservable =
PojoObservables.observeDetailValue(transientConditionValue, "text",
TransientCondition.class);
bindingContext.bindValue(targetObservable, modelObservable);
setCondition(null);
}
示例6: initDataBindings
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的package包/类
private DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
IObservableValue nameTextObserveWidget = SWTObservables
.observeText(commandText, SWT.Modify);
IObservableValue personNameObserveValue = BeansObservables.observeValue(
commandEntryPresenter, "command");
bindingContext.bindValue(nameTextObserveWidget, personNameObserveValue,
new UpdateValueStrategy().setAfterConvertValidator(validator), null);
return bindingContext;
}
示例7: bindMapValue
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的package包/类
private void bindMapValue(Text text, int feldkennung,
DataBindingContext bindingContext,
IObservableMap gdt6302ValuesObserveMap) {
IObservableValue textObserveWidget = SWTObservables.observeText(text,
SWT.Modify);
IObservableValue observableMapValue = Observables.observeMapEntry(
gdt6302ValuesObserveMap, feldkennung, String.class);
bindingContext.bindValue(textObserveWidget, observableMapValue);
}
示例8: bindText
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的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);
}
示例9: bindBeanToWidgetText
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的package包/类
public Binding bindBeanToWidgetText(String property, Object bean, Text t) {
IObservableValue v1 = BeanProperties.value(property).observe(bean);
IObservableValue v2 = SWTObservables.observeText(t, SWT.Modify);
return ctx.bindValue(v2, v1);
}
示例10: createBinding
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的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;
}
示例11: createBinding
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的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 = "";
}
uriConverter = target.eResource().getResourceSet().getURIConverter();
projectUriStringfier = new URIStrigifier(uriConverter);
EMFDetailUtils.createLabel(parent, toolkit, target, pd);
Composite rootComposite = createRootComposite(toolkit, parent);
Composite hyperlinkAndBrowseComposite = hyperlinkAndBrowseComposite(rootComposite);
Text hyperlinkTextField = createHyperlinkTextField(hyperlinkAndBrowseComposite, propertyValue);
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 ProjectUrlUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
StringifierUpdateValueStrategy modelToTarget = new ProjectUrlUpdateValueStrategy(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;
}
示例12: observeText
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的package包/类
/**
* This is its own method so that a 3.5-based subclass can override it to use the version of observeText which takes an array of event types.
*/
protected IObservableValue observeText(Control control) {
return SWTObservables.observeText(control, new int[] { SWT.FocusOut, SWT.DefaultSelection });
}
示例13: bindObjectToTextField
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的package包/类
/**
* one-way databinding to display the content of an object in a text field
*
* @param textField
* widget for input
* @param entity
* class that holds the model information
* @param entityClass
* class of entity
* @param propertyName
* name of the property that should be binded
* @param bindingContext
* context of the binding
* @return
*/
public static Binding bindObjectToTextField(final Text textField, final IObservableValue modelObservable,
final DataBindingContext bindingContext) {
final ISWTObservableValue targetObservable = SWTObservables.observeText(textField, SWT.Modify);
final UpdateValueStrategy modelToTarget = new UpdateValueStrategy();
modelToTarget.setConverter(new ObjectToStringConverter());
final Binding binding = bindingContext.bindValue(targetObservable, modelObservable,
new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), modelToTarget);
return binding;
}
示例14: observeText
import org.eclipse.jface.databinding.swt.SWTObservables; //导入方法依赖的package包/类
/**
* This is its own method so that a 3.5-based subclass can override it to
* use the version of observeText which takes an array of event types.
*/
protected IObservableValue observeText(Control control) {
return SWTObservables.observeText(control, new int[] {SWT.FocusOut, SWT.DefaultSelection});
}