Search in sources :

Example 1 with CompositeObject

use of org.eclipse.scout.rt.platform.util.CompositeObject in project scout.rt by eclipse.

the class PlannerContextMenu method handleOwnerValueChanged.

protected void handleOwnerValueChanged() {
    IPlanner<?, ?> container = getContainer();
    if (container != null) {
        final CompositeObject ownerValue = new CompositeObject(container.getSelectedResources(), container.getSelectedActivity(), container.getSelectionRange());
        setCurrentMenuTypes(MenuUtility.getMenuTypesForPlannerSelection(container.getSelectedResources(), container.getSelectedActivity(), container.getSelectionRange()));
        acceptVisitor(new MenuOwnerChangedVisitor(ownerValue, getCurrentMenuTypes()));
        calculateLocalVisibility();
    }
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject)

Example 2 with CompositeObject

use of org.eclipse.scout.rt.platform.util.CompositeObject in project scout.rt by eclipse.

the class AbstractTable method discardDeletedRows.

@Override
public void discardDeletedRows(Collection<? extends ITableRow> deletedRows) {
    if (deletedRows != null) {
        for (ITableRow row : deletedRows) {
            m_deletedRows.remove(new CompositeObject(getRowKeys(row)));
            ((InternalTableRow) row).setTableInternal(null);
        }
    }
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) InternalTableRow(org.eclipse.scout.rt.client.ui.basic.table.internal.InternalTableRow)

Example 3 with CompositeObject

use of org.eclipse.scout.rt.platform.util.CompositeObject in project scout.rt by eclipse.

the class AbstractTable method restoreSelection.

private void restoreSelection(List<CompositeObject> selectedKeys) {
    ArrayList<ITableRow> selectedRows = new ArrayList<ITableRow>();
    if (selectedKeys.size() > 0) {
        for (ITableRow r : m_rows) {
            if (selectedKeys.remove(new CompositeObject(getRowKeys(r)))) {
                selectedRows.add(r);
                if (selectedKeys.size() == 0) {
                    break;
                }
            }
        }
    }
    selectRows(selectedRows, false);
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) ArrayList(java.util.ArrayList)

Example 4 with CompositeObject

use of org.eclipse.scout.rt.platform.util.CompositeObject in project scout.rt by eclipse.

the class ColumnSet method initialize.

public void initialize() {
    ClientUIPreferences prefs = ClientUIPreferences.getInstance();
    // clean up visible column index hints, make as permutation of model indices
    int n = getColumnCount();
    TreeMap<CompositeObject, IColumn> sortMap = new TreeMap<CompositeObject, IColumn>();
    int viewIndex = 0;
    for (int modelIndex = 0; modelIndex < n; modelIndex++) {
        IColumn col = getColumn(modelIndex);
        double viewHint = col.getVisibleColumnIndexHint();
        if (viewHint < 0) {
            viewHint = col.getOrder();
        }
        if (viewHint < 0) {
            viewHint = viewIndex;
        }
        sortMap.put(new CompositeObject(viewHint, viewIndex), col);
        // next
        viewIndex++;
    }
    viewIndex = 0;
    for (Map.Entry<CompositeObject, IColumn> e : sortMap.entrySet()) {
        e.getValue().setVisibleColumnIndexHint(viewIndex);
        viewIndex++;
    }
    reorganizeIndexes();
    applySortingAndGrouping(null);
    /*
     * ticket 93309
     * sanity check: when there is no visible column at all, reset visibilities to model init defaults
     */
    if (getVisibleColumnCount() == 0) {
        viewIndex = 0;
        for (IColumn c : getColumns()) {
            if (c.isDisplayable() && c.isInitialVisible()) {
                c.setVisible(true);
            } else {
                c.setVisible(false);
            }
            c.setWidth(c.getInitialWidth());
            c.setVisibleColumnIndexHint(viewIndex);
            prefs.removeAllTableColumnPreferences(c, null, true);
            // next
            viewIndex++;
        }
        reorganizeIndexes();
    }
    checkMultiline();
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) ClientUIPreferences(org.eclipse.scout.rt.client.ui.ClientUIPreferences) TreeMap(java.util.TreeMap) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap) Map(java.util.Map)

Example 5 with CompositeObject

use of org.eclipse.scout.rt.platform.util.CompositeObject in project scout.rt by eclipse.

the class ColumnSet method calculateVisibleIndexes.

private void calculateVisibleIndexes() {
    int viewIndex = 0;
    Map<CompositeObject, Integer> visibleMap = new TreeMap<CompositeObject, Integer>();
    for (int modelIndex = 0; modelIndex < getColumnCount(); modelIndex++) {
        IColumn col = getColumn(modelIndex);
        if (col.isDisplayable() && col.isVisible()) {
            double viewHint = col.getVisibleColumnIndexHint();
            if (viewHint < 0) {
                viewHint = col.getOrder();
            }
            if (viewHint < 0) {
                viewHint = viewIndex;
            }
            visibleMap.put(new CompositeObject(viewHint, viewIndex), modelIndex);
            viewIndex++;
        }
    }
    m_visibleIndexes = new int[visibleMap.size()];
    viewIndex = 0;
    for (int modelIndex : visibleMap.values()) {
        m_visibleIndexes[viewIndex++] = modelIndex;
    }
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) TreeMap(java.util.TreeMap)

Aggregations

CompositeObject (org.eclipse.scout.rt.platform.util.CompositeObject)29 TreeMap (java.util.TreeMap)16 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)7 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 IBookmarkAdapter (org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkAdapter)2 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)2 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)2 INumberColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.INumberColumn)2 IForm (org.eclipse.scout.rt.client.ui.form.IForm)2 ICompositeField (org.eclipse.scout.rt.client.ui.form.fields.ICompositeField)2 IValueField (org.eclipse.scout.rt.client.ui.form.fields.IValueField)2 Test (org.junit.Test)2 PropertyDescriptor (java.beans.PropertyDescriptor)1 Method (java.lang.reflect.Method)1 Collection (java.util.Collection)1 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1