use of org.eclipse.core.databinding.DataBindingContext in project translationstudio8 by heartsome.
the class ConversionWizardPage method bindValue.
/**
* 对 UI 和 View Model 进行绑定 ;
*/
private void bindValue() {
DataBindingContext dbc = new DataBindingContext();
WizardPageSupport.create(this, dbc);
ConversionConfigBean configBean = conversionConfigBeans.get(0);
// bind the format
//$NON-NLS-1$
dbc.bindList(SWTObservables.observeItems(formatCombo), BeansObservables.observeList(configBean, "fileFormats"));
// final IObservableValue format = BeansObservables.observeValue(selectedModel, "selectedType");
// dbc.bindValue(SWTObservables.observeSelection(formatCombo), format);
// bind the source encoding
//$NON-NLS-1$
dbc.bindList(SWTObservables.observeItems(srcEncCombo), BeansObservables.observeList(configBean, "pageEncoding"));
}
use of org.eclipse.core.databinding.DataBindingContext in project translationstudio8 by heartsome.
the class ReverseConversionWizardPage method bindValue.
/**
* 对 UI 和 View Model 进行绑定 ;
*/
private void bindValue() {
DataBindingContext dbc = new DataBindingContext();
WizardPageSupport.create(this, dbc);
ConversionConfigBean configBean = conversionConfigBeans.get(0);
// bind the target encoding
//$NON-NLS-1$
dbc.bindList(SWTObservables.observeItems(tgtEncCombo), BeansObservables.observeList(configBean, "pageEncoding"));
}
use of org.eclipse.core.databinding.DataBindingContext in project meclipse by flaper87.
the class ConnectionWizardPage method createControl.
/**
* @see IDialogPage#createControl(Composite)
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
layout.numColumns = 3;
layout.verticalSpacing = 9;
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint = 250;
Label label;
label = new Label(container, SWT.NULL);
label.setText(getCaption("connectionWizard.label.name"));
connName = new Text(container, SWT.BORDER | SWT.SINGLE);
connName.setLayoutData(gd);
label = new Label(container, SWT.NULL);
label.setImage(help);
label.setToolTipText(getCaption("connectionWizard.tooltip.name"));
label = new Label(container, SWT.NULL);
label.setText(getCaption("connectionWizard.label.host"));
host = new Text(container, SWT.BORDER | SWT.SINGLE);
host.setLayoutData(gd);
label = new Label(container, SWT.NULL);
label.setImage(help);
label.setToolTipText(getCaption("connectionWizard.tooltip.host"));
label = new Label(container, SWT.NULL);
label.setText(getCaption("connectionWizard.label.port"));
port = new Text(container, SWT.BORDER | SWT.SINGLE);
port.setLayoutData(gd);
port.setText("27017");
label = new Label(container, SWT.NULL);
label.setImage(help);
label.setToolTipText(getCaption("connectionWizard.tooltip.port"));
/*
* label = new Label(container, SWT.NULL); label.setText("&Username:");
* username= new Text(container, SWT.BORDER | SWT.SINGLE);
* username.setLayoutData(gd);
*/
/*
* label = new Label(container, SWT.NULL); label.setText("Passwo&rd:");
* password = new Text(container, SWT.BORDER | SWT.SINGLE);
* password.setLayoutData(gd);
*/
label = new Label(container, SWT.NULL);
label.setText("Auth not supported yet...");
// add WizardPage validators
DataBindingContext dbc = new DataBindingContext();
WizardPageSupport.create(this, dbc);
dbc.bindValue(SWTObservables.observeText(connName, SWT.Modify), nameValue, new UpdateValueStrategy().setBeforeSetValidator(new NameValidator()), null);
dbc.bindValue(SWTObservables.observeText(host, SWT.Modify), hostValue, new UpdateValueStrategy().setBeforeSetValidator(new HostNameValidator()), null);
dbc.bindValue(SWTObservables.observeText(port, SWT.Modify), portValue, new UpdateValueStrategy().setBeforeSetValidator(new PortValidator()), null);
initialize();
setControl(container);
// disable Save until everything matches
setPageComplete(false);
}
use of org.eclipse.core.databinding.DataBindingContext in project meclipse by flaper87.
the class FilterWizardPage method createControl.
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.FILL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
layout.numColumns = 3;
layout.verticalSpacing = 9;
GridData gd = new GridData(SWT.FILL);
gd.widthHint = 250;
Label label;
label = new Label(container, SWT.NULL);
label.setText(getCaption("filterWizard.label.name"));
nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
nameText.setLayoutData(gd);
label = new Label(container, SWT.NULL);
label.setImage(help);
label.setToolTipText(getCaption("filterWizard.tooltip.name"));
label = new Label(container, SWT.NULL);
label.setText(getCaption("filterWizard.label.query"));
queryText = new Text(container, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.FILL);
queryText.setLayoutData(gd);
label = new Label(container, SWT.NULL);
label.setToolTipText(getCaption("filterWizard.tooltip.query"));
label.setImage(help);
// add WizardPage validators
DataBindingContext dbc = new DataBindingContext();
WizardPageSupport.create(this, dbc);
dbc.bindValue(SWTObservables.observeText(nameText, SWT.Modify), nameValue, new UpdateValueStrategy().setBeforeSetValidator(new FilterNameValidator()), null);
dbc.bindValue(SWTObservables.observeText(queryText, SWT.Modify), queryValue, new UpdateValueStrategy().setBeforeSetValidator(new JSONValidator()), null);
setControl(container);
// disable save until everything matches
setPageComplete(false);
}
use of org.eclipse.core.databinding.DataBindingContext in project translationstudio8 by heartsome.
the class NewTermDbBaseInfoPage method initDataBindings.
protected void initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
WizardPageSupport.create(this, bindingContext);
IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(dbNameText);
final IObservableValue dbNameModelValue = BeanProperties.value("dbName").observe(dbModel);
bindingContext.bindValue(widgetValue, dbNameModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(instanceText);
final IObservableValue instanceModelValue = BeanProperties.value("instance").observe(dbModel);
bindingContext.bindValue(widgetValue, instanceModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(hostText);
final IObservableValue hostModelValue = BeanProperties.value("host").observe(dbModel);
bindingContext.bindValue(widgetValue, hostModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(portText);
final IObservableValue protModelValue = BeanProperties.value("port").observe(dbModel);
bindingContext.bindValue(widgetValue, protModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(locationText);
final IObservableValue locationModelValue = BeanProperties.value("itlDBLocation").observe(dbModel);
bindingContext.bindValue(widgetValue, locationModelValue, null, null);
//
widgetValue = WidgetProperties.text(SWT.Modify).observe(usernameText);
final IObservableValue usernameModelValue = BeanProperties.value("userName").observe(dbModel);
bindingContext.bindValue(widgetValue, usernameModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(passwordText);
final IObservableValue passwordModelValue = BeanProperties.value("password").observe(dbModel);
bindingContext.bindValue(widgetValue, passwordModelValue, null, null);
MultiValidator myValidator = new MultiValidator() {
@Override
protected IStatus validate() {
dbNameModelValue.getValue();
instanceModelValue.getValue();
hostModelValue.getValue();
protModelValue.getValue();
locationModelValue.getValue();
usernameModelValue.getValue();
passwordModelValue.getValue();
return validator();
}
};
bindingContext.addValidationStatusProvider(myValidator);
}
Aggregations