Search in sources :

Example 1 with IObservableValue

use of org.eclipse.core.databinding.observable.value.IObservableValue in project translationstudio8 by heartsome.

the class TermDbManagerDialog method initDataBindings.

/**
	 * 初始化数据绑定 将界面与<code>currServer</code>进行绑定
	 * @return ;
	 */
protected void initDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();
    IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(instanceText);
    final IObservableValue instanceModelValue = BeanProperties.value("instance").observe(currServer);
    bindingContext.bindValue(widgetValue, instanceModelValue, null, null);
    widgetValue = WidgetProperties.text(SWT.Modify).observe(hostText);
    final IObservableValue hostModelValue = BeanProperties.value("host").observe(currServer);
    bindingContext.bindValue(widgetValue, hostModelValue, null, null);
    widgetValue = WidgetProperties.text(SWT.Modify).observe(portText);
    final IObservableValue protModelValue = BeanProperties.value("port").observe(currServer);
    bindingContext.bindValue(widgetValue, protModelValue, null, null);
    widgetValue = WidgetProperties.text(SWT.Modify).observe(locationText);
    final IObservableValue locationModelValue = BeanProperties.value("itlDBLocation").observe(currServer);
    bindingContext.bindValue(widgetValue, locationModelValue, null, null);
    widgetValue = WidgetProperties.text(SWT.Modify).observe(usernameText);
    final IObservableValue usernameModelValue = BeanProperties.value("userName").observe(currServer);
    bindingContext.bindValue(widgetValue, usernameModelValue, null, null);
    widgetValue = WidgetProperties.text(SWT.Modify).observe(passwordText);
    final IObservableValue passwordModelValue = BeanProperties.value("password").observe(currServer);
    bindingContext.bindValue(widgetValue, passwordModelValue, null, null);
    ViewerSupport.bind(dbTableViewer, currServerdbListInput, BeanProperties.values(new String[] { "index", "dbName", "langs" }));
}
Also used : DataBindingContext(org.eclipse.core.databinding.DataBindingContext) IObservableValue(org.eclipse.core.databinding.observable.value.IObservableValue)

Example 2 with IObservableValue

use of org.eclipse.core.databinding.observable.value.IObservableValue in project translationstudio8 by heartsome.

the class TmDbManagerDialog method initDataBindings.

/**
	 * 初始化数据绑定 将界面与<code>currServer</code>进行绑定
	 * @return ;
	 */
protected void initDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();
    IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(instanceText);
    final IObservableValue instanceModelValue = BeanProperties.value("instance").observe(currServer);
    bindingContext.bindValue(widgetValue, instanceModelValue, null, null);
    widgetValue = WidgetProperties.text(SWT.Modify).observe(hostText);
    final IObservableValue hostModelValue = BeanProperties.value("host").observe(currServer);
    bindingContext.bindValue(widgetValue, hostModelValue, null, null);
    widgetValue = WidgetProperties.text(SWT.Modify).observe(portText);
    final IObservableValue protModelValue = BeanProperties.value("port").observe(currServer);
    bindingContext.bindValue(widgetValue, protModelValue, null, null);
    widgetValue = WidgetProperties.text(SWT.Modify).observe(locationText);
    final IObservableValue locationModelValue = BeanProperties.value("itlDBLocation").observe(currServer);
    bindingContext.bindValue(widgetValue, locationModelValue, null, null);
    widgetValue = WidgetProperties.text(SWT.Modify).observe(usernameText);
    final IObservableValue usernameModelValue = BeanProperties.value("userName").observe(currServer);
    bindingContext.bindValue(widgetValue, usernameModelValue, null, null);
    widgetValue = WidgetProperties.text(SWT.Modify).observe(passwordText);
    final IObservableValue passwordModelValue = BeanProperties.value("password").observe(currServer);
    bindingContext.bindValue(widgetValue, passwordModelValue, null, null);
    ViewerSupport.bind(dbTableViewer, currServerdbListInput, BeanProperties.values(new String[] { "index", "dbName", "langs" }));
}
Also used : DataBindingContext(org.eclipse.core.databinding.DataBindingContext) IObservableValue(org.eclipse.core.databinding.observable.value.IObservableValue)

Example 3 with IObservableValue

use of org.eclipse.core.databinding.observable.value.IObservableValue in project translationstudio8 by heartsome.

the class ProjectSettingLanguagePage method initDataBindings.

private void initDataBindings() {
    DataBindingContext ctx = new DataBindingContext();
    IObservableValue widgetValue = ViewersObservables.observeSingleSelection(srcLangComboViewer);
    IObservableValue modelValue = BeanProperties.value(ProjectInfoBean.class, "sourceLang").observe(projCfgBean);
    ctx.bindValue(widgetValue, modelValue, null, null);
}
Also used : ProjectInfoBean(net.heartsome.cat.common.bean.ProjectInfoBean) DataBindingContext(org.eclipse.core.databinding.DataBindingContext) IObservableValue(org.eclipse.core.databinding.observable.value.IObservableValue)

Example 4 with IObservableValue

use of org.eclipse.core.databinding.observable.value.IObservableValue 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);
}
Also used : DataBindingContext(org.eclipse.core.databinding.DataBindingContext) IObservableValue(org.eclipse.core.databinding.observable.value.IObservableValue) MultiValidator(org.eclipse.core.databinding.validation.MultiValidator)

Example 5 with IObservableValue

use of org.eclipse.core.databinding.observable.value.IObservableValue in project translationstudio8 by heartsome.

the class NewTmDbBaseInfoPage 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);
}
Also used : DataBindingContext(org.eclipse.core.databinding.DataBindingContext) IObservableValue(org.eclipse.core.databinding.observable.value.IObservableValue) MultiValidator(org.eclipse.core.databinding.validation.MultiValidator)

Aggregations

IObservableValue (org.eclipse.core.databinding.observable.value.IObservableValue)6 DataBindingContext (org.eclipse.core.databinding.DataBindingContext)5 MultiValidator (org.eclipse.core.databinding.validation.MultiValidator)2 ProjectInfoBean (net.heartsome.cat.common.bean.ProjectInfoBean)1 IViewerObservableValue (org.eclipse.jface.databinding.viewers.IViewerObservableValue)1 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 ViewerComparator (org.eclipse.jface.viewers.ViewerComparator)1