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()]);
}
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;
}
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]);
}
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;
}
Aggregations