Search in sources :

Example 26 with CompositeObject

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

the class SessionsView method getSortedSessions.

protected SessionInspector[] getSortedSessions() {
    SessionInspector[] sessionInspectors = ProcessInspector.instance().getSessionInspectors();
    TreeMap<CompositeObject, SessionInspector> userAndTimeToSessions = new TreeMap<CompositeObject, SessionInspector>();
    for (int i = 0; i < sessionInspectors.length; i++) {
        String user = sessionInspectors[i].getInfo().getUserId();
        long lastAccess = NumberUtility.nvl(sessionInspectors[i].getInfo().getLastAccessedTime(), 0L);
        userAndTimeToSessions.put(new CompositeObject(lastAccess, user, i), sessionInspectors[i]);
    }
    return userAndTimeToSessions.values().toArray(new SessionInspector[userAndTimeToSessions.size()]);
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) TreeMap(java.util.TreeMap) SessionInspector(org.eclipse.scout.rt.server.admin.inspector.SessionInspector)

Example 27 with CompositeObject

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

the class HtmlTable method getSortedRows.

private VirtualRow[] getSortedRows() {
    TreeMap<CompositeObject, VirtualRow> sortMap = new TreeMap<CompositeObject, VirtualRow>();
    int rowIndex = 0;
    for (VirtualRow row : m_rows) {
        sortMap.put(new CompositeObject(row.getCellAt(m_sortInfo.getColumnIndex()), rowIndex), row);
        rowIndex++;
    }
    VirtualRow[] result = new VirtualRow[m_rows.size()];
    if (m_sortInfo.getColumnIndex() >= 0 && !m_sortInfo.isAscending()) {
        // reverse
        int i = m_rows.size() - 1;
        for (VirtualRow row : sortMap.values()) {
            result[i] = row;
            i--;
        }
    } else {
        // forward
        int i = 0;
        for (VirtualRow row : sortMap.values()) {
            result[i] = row;
            i++;
        }
    }
    return result;
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) TreeMap(java.util.TreeMap)

Example 28 with CompositeObject

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

the class ReflectServiceInventory method getOperations.

public Method[] getOperations() {
    TreeMap<CompositeObject, Method> sortMap = new TreeMap<CompositeObject, Method>();
    int index = 0;
    for (Method m : m_operations) {
        if ("getInventory".equals(m.getName())) {
        // ignore
        } else {
            if (m.getName().startsWith("exec")) {
                sortMap.put(new CompositeObject(1, m.getName(), index), m);
            } else {
                sortMap.put(new CompositeObject(2, m.getName(), index), m);
            }
        }
        index++;
    }
    return sortMap.values().toArray(new Method[0]);
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) Method(java.lang.reflect.Method) TreeMap(java.util.TreeMap)

Example 29 with CompositeObject

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

the class FindFieldByXmlIdsVisitor method visitField.

@Override
public boolean visitField(IFormField field, int level, int fieldIndex) {
    int fieldIdRank = getFieldIdRank(field);
    if (fieldIdRank > 0) {
        int enclosingFieldPathRank = getEnclosingFieldPathRank(field);
        CompositeObject key;
        if (field instanceof IValueField) {
            key = new CompositeObject(fieldIdRank, enclosingFieldPathRank, 2);
        } else if (!(field instanceof ICompositeField)) {
            key = new CompositeObject(fieldIdRank, enclosingFieldPathRank, 1);
        } else {
            key = new CompositeObject(fieldIdRank, enclosingFieldPathRank, 0);
        }
        if (m_prioMap.containsKey(key)) {
            m_ambiguousFieldKeys.add(key);
        } else {
            m_prioMap.put(key, field);
        }
    }
    return true;
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) ICompositeField(org.eclipse.scout.rt.client.ui.form.fields.ICompositeField) IValueField(org.eclipse.scout.rt.client.ui.form.fields.IValueField)

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