use of org.eclipse.scout.rt.platform.util.CompositeObject in project scout.rt by eclipse.
the class ColumnSet method calculateDisplayableIndexes.
private void calculateDisplayableIndexes() {
int viewIndex = 0;
Map<CompositeObject, Integer> displayableMap = new TreeMap<CompositeObject, Integer>();
for (int modelIndex = 0; modelIndex < getColumnCount(); modelIndex++) {
IColumn col = getColumn(modelIndex);
if (col.isDisplayable()) {
displayableMap.put(new CompositeObject(modelIndex), modelIndex);
}
}
m_displayableIndexes = new int[displayableMap.size()];
viewIndex = 0;
for (int modelIndex : displayableMap.values()) {
m_displayableIndexes[viewIndex++] = modelIndex;
}
}
use of org.eclipse.scout.rt.platform.util.CompositeObject in project scout.rt by eclipse.
the class ColumnSet method getAllColumnsInUserOrder.
public List<IColumn<?>> getAllColumnsInUserOrder() {
List<IColumn<?>> visibleCols = getVisibleColumns();
int counter = 0;
TreeMap<CompositeObject, IColumn<?>> sortMap = new TreeMap<CompositeObject, IColumn<?>>();
for (IColumn col : visibleCols) {
counter++;
sortMap.put(new CompositeObject(col.getVisibleColumnIndexHint(), counter), col);
}
for (IColumn<?> column : getColumns()) {
if (column.isDisplayable() && column.isVisible()) {
// already in map
} else {
counter++;
sortMap.put(new CompositeObject(column.getVisibleColumnIndexHint(), counter), column);
}
}
return CollectionUtility.arrayList(sortMap.values());
}
use of org.eclipse.scout.rt.platform.util.CompositeObject in project scout.rt by eclipse.
the class AbstractCalendar method updateComponentsInternal.
private void updateComponentsInternal(List<ICalendarItemProvider> changedProviders) {
Range<Date> d = getViewRange();
if (d.getFrom() != null && d.getTo() != null) {
for (ICalendarItemProvider p : changedProviders) {
LinkedList<CalendarComponent> components = new LinkedList<CalendarComponent>();
for (ICalendarItem item : p.getItems(d.getFrom(), d.getTo())) {
components.add(new CalendarComponent(this, p, item));
}
m_componentsByProvider.put(p.getClass(), components);
}
// filter and resolve item conflicts
Set<Class<? extends ICalendarItemProvider>> providerTypes = new HashSet<Class<? extends ICalendarItemProvider>>(changedProviders.size());
for (ICalendarItemProvider provider : changedProviders) {
providerTypes.add(provider.getClass());
}
interceptFilterCalendarItems(providerTypes, m_componentsByProvider);
// complete list
TreeMap<CompositeObject, CalendarComponent> sortMap = new TreeMap<CompositeObject, CalendarComponent>();
int index = 0;
for (Collection<CalendarComponent> c : m_componentsByProvider.values()) {
for (CalendarComponent comp : c) {
sortMap.put(new CompositeObject(comp.getFromDate(), index++), comp);
}
}
propertySupport.setPropertySet(PROP_COMPONENTS, CollectionUtility.hashSet(sortMap.values()));
// validate selection
setSelectedComponent(getSelectedComponent());
}
}
use of org.eclipse.scout.rt.platform.util.CompositeObject in project scout.rt by eclipse.
the class CompositeObjectTest method setUp.
@Before
public void setUp() {
m_compObjLongValue = new CompositeObject(1234L);
m_compObjDoubleValue = new CompositeObject(9876d);
m_compObjLongArray = new CompositeObject(1234L, 5678L, 8901L);
m_compObjDoubleArray = new CompositeObject(9876d, 5432d, 2109d);
}
use of org.eclipse.scout.rt.platform.util.CompositeObject in project scout.rt by eclipse.
the class CompositeObjectTest method testEqualsNotComparable.
@Test
public void testEqualsNotComparable() {
// not of type comparable -> uses toString()
CompositeObject a = new CompositeObject(new A(123456L));
CompositeObject b = new CompositeObject(new B(123456L));
CompositeObject c = new CompositeObject(new C(123456L));
CompositeObject c2 = new CompositeObject(new C(123456L));
assertTrue(a.equals(b));
assertTrue(b.equals(a));
assertTrue(a.equals(c));
assertFalse(c.equals(a));
assertTrue(b.equals(c));
assertFalse(c.equals(b));
assertFalse(c.equals(c2));
assertFalse(c2.equals(c));
}
Aggregations