Search in sources :

Example 1 with VirtualBindingInfo

use of org.eclipse.wb.internal.swing.databinding.model.bindings.VirtualBindingInfo in project windowbuilder by eclipse.

the class DatabindingsProvider method createBinding.

public IBindingInfo createBinding(IObserveInfo target, IObserveInfo targetProperty, IObserveInfo model, IObserveInfo modelProperty) throws Exception {
    // prepare ObserveInfo's
    ObserveInfo targetObserve = (ObserveInfo) target;
    ObserveInfo targetPropertyObserve = (ObserveInfo) targetProperty;
    ObserveInfo modelObserve = (ObserveInfo) model;
    ObserveInfo modelPropertyObserve = (ObserveInfo) modelProperty;
    // check virtual bindings
    if (targetObserve.getCreationType() == ObserveCreationType.VirtualBinding || modelObserve.getCreationType() == ObserveCreationType.VirtualBinding) {
        return new VirtualBindingInfo(targetObserve, targetPropertyObserve, createProperty(targetObserve, targetPropertyObserve), modelObserve, modelPropertyObserve, createProperty(modelObserve, modelPropertyObserve));
    }
    // check swing bindings
    if (targetObserve.getCreationType() != ObserveCreationType.AutoBinding) {
        IBindingInfo binding = createSwingBinding(targetObserve, targetPropertyObserve, modelObserve, modelPropertyObserve);
        if (binding != null) {
            return binding;
        }
    }
    if (modelObserve.getCreationType() != ObserveCreationType.AutoBinding) {
        IBindingInfo binding = createSwingBinding(modelObserve, modelPropertyObserve, targetObserve, targetPropertyObserve);
        if (binding != null) {
            return binding;
        }
    }
    // auto bindings
    UpdateStrategyInfo strategy = new UpdateStrategyInfo(UpdateStrategyInfo.Value.READ);
    PropertyInfo targetAstProperty = createProperty(targetObserve, targetPropertyObserve);
    PropertyInfo modelAstProperty = createProperty(modelObserve, modelPropertyObserve);
    // 
    return new AutoBindingInfo(strategy, targetObserve, targetPropertyObserve, targetAstProperty, modelObserve, modelPropertyObserve, modelAstProperty);
}
Also used : UpdateStrategyInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.UpdateStrategyInfo) ObserveInfo(org.eclipse.wb.internal.swing.databinding.model.ObserveInfo) IObserveInfo(org.eclipse.wb.internal.core.databinding.model.IObserveInfo) IBindingInfo(org.eclipse.wb.internal.core.databinding.model.IBindingInfo) AutoBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.AutoBindingInfo) PropertyInfo(org.eclipse.wb.internal.swing.databinding.model.properties.PropertyInfo) VirtualBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.VirtualBindingInfo)

Aggregations

IBindingInfo (org.eclipse.wb.internal.core.databinding.model.IBindingInfo)1 IObserveInfo (org.eclipse.wb.internal.core.databinding.model.IObserveInfo)1 ObserveInfo (org.eclipse.wb.internal.swing.databinding.model.ObserveInfo)1 AutoBindingInfo (org.eclipse.wb.internal.swing.databinding.model.bindings.AutoBindingInfo)1 UpdateStrategyInfo (org.eclipse.wb.internal.swing.databinding.model.bindings.UpdateStrategyInfo)1 VirtualBindingInfo (org.eclipse.wb.internal.swing.databinding.model.bindings.VirtualBindingInfo)1 PropertyInfo (org.eclipse.wb.internal.swing.databinding.model.properties.PropertyInfo)1