Search in sources :

Example 1 with ColumnBindingInfo

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

the class JTableColumnContainerUiContentProvider method updateFromObject.

// //////////////////////////////////////////////////////////////////////////
// 
// Update
// 
// //////////////////////////////////////////////////////////////////////////
public void updateFromObject() throws Exception {
    List<IUiContentProvider> providers = Lists.newArrayList();
    for (ColumnBindingInfo binding : m_binding.getColumns()) {
        providers.add(new UIContentContainer<ColumnBindingInfo>(binding, m_bindings, Messages.JTableColumnContainerUiContentProvider_column, m_provider));
    }
    updateFromObject(providers);
}
Also used : ColumnBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.ColumnBindingInfo) IUiContentProvider(org.eclipse.wb.internal.core.databinding.ui.editor.IUiContentProvider)

Example 2 with ColumnBindingInfo

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

the class JTableColumnContainerUiContentProvider method saveToObject.

@Override
@SuppressWarnings("unchecked")
protected void saveToObject(List<IUiContentProvider> providers) throws Exception {
    List<ColumnBindingInfo> columns = Lists.newArrayList();
    for (IUiContentProvider provider : providers) {
        UIContentContainer<ColumnBindingInfo> container = (UIContentContainer<ColumnBindingInfo>) provider;
        columns.add(container.getBinding());
    }
    m_binding.setColumns(columns, m_bindings);
}
Also used : ColumnBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.ColumnBindingInfo) IUiContentProvider(org.eclipse.wb.internal.core.databinding.ui.editor.IUiContentProvider)

Example 3 with ColumnBindingInfo

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

the class DatabindingsProvider method configureMoveUpDown.

private int configureMoveUpDown(IBindingInfo binding, int sourceIndex, int targetIndex) {
    if (!(binding instanceof ColumnBindingInfo)) {
        List<IBindingInfo> bindings = getBindings();
        IBindingInfo target = bindings.get(targetIndex);
        boolean up = sourceIndex > targetIndex;
        // configure target index
        if (target instanceof ColumnBindingInfo) {
            ColumnBindingInfo column = (ColumnBindingInfo) target;
            // calculate column index
            if (up) {
                targetIndex = bindings.indexOf(column.getJTableBinding());
            } else {
                // skip all columns
                targetIndex += column.getJTableBinding().getColumns().size();
                // 
                target = bindings.get(targetIndex);
                if (target instanceof JTableBindingInfo) {
                    // skip all columns
                    JTableBindingInfo tableBinding = (JTableBindingInfo) target;
                    targetIndex += tableBinding.getColumns().size();
                } else if (target instanceof JListBindingInfo) {
                    // skip detail binding
                    targetIndex++;
                }
            }
        } else if (target instanceof DetailBindingInfo) {
            if (up) {
                DetailBindingInfo detail = (DetailBindingInfo) target;
                targetIndex = bindings.indexOf(detail.getJListBinding());
            } else {
                // skip detail binding
                targetIndex++;
                // 
                target = bindings.get(targetIndex);
                if (target instanceof JTableBindingInfo) {
                    // skip all columns
                    JTableBindingInfo tableBinding = (JTableBindingInfo) target;
                    targetIndex += tableBinding.getColumns().size();
                } else if (target instanceof JListBindingInfo) {
                    // skip detail binding
                    targetIndex++;
                }
            }
        } else if (target instanceof JTableBindingInfo && !up) {
            // skip all columns
            JTableBindingInfo tableBinding = (JTableBindingInfo) target;
            targetIndex += tableBinding.getColumns().size();
        } else if (target instanceof JListBindingInfo && !up) {
            // skip detail binding
            targetIndex++;
        }
    }
    return targetIndex;
}
Also used : IBindingInfo(org.eclipse.wb.internal.core.databinding.model.IBindingInfo) DetailBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.DetailBindingInfo) ColumnBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.ColumnBindingInfo) JTableBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.JTableBindingInfo) JListBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.JListBindingInfo)

Aggregations

ColumnBindingInfo (org.eclipse.wb.internal.swing.databinding.model.bindings.ColumnBindingInfo)3 IUiContentProvider (org.eclipse.wb.internal.core.databinding.ui.editor.IUiContentProvider)2 IBindingInfo (org.eclipse.wb.internal.core.databinding.model.IBindingInfo)1 DetailBindingInfo (org.eclipse.wb.internal.swing.databinding.model.bindings.DetailBindingInfo)1 JListBindingInfo (org.eclipse.wb.internal.swing.databinding.model.bindings.JListBindingInfo)1 JTableBindingInfo (org.eclipse.wb.internal.swing.databinding.model.bindings.JTableBindingInfo)1