@Override public void update(Delta<VisualItem> delta, LightweightCollection<Slot> updatedSlots) { // TODO pull up if (!timelineWidget.isAttached()) { return; } LightweightCollection<VisualItem> addedVisualItems = delta.getAddedElements(); if (!addedVisualItems.isEmpty()) { createTimeLineItems(addedVisualItems); addEventsToTimeline(addedVisualItems); updateStatusStyling(addedVisualItems); } LightweightCollection<VisualItem> updatedVisualItems = delta.getUpdatedElements(); if (!updatedVisualItems.isEmpty()) { updateStatusStyling(updatedVisualItems); } LightweightCollection<VisualItem> removedVisualItems = delta.getRemovedElements(); if (!removedVisualItems.isEmpty()) { removeEventsFromTimeline(removedVisualItems); } // TODO refactor if (!updatedSlots.isEmpty()) { for (VisualItem visualItem : getVisualItems()) { TimeLineItem timelineItem = (TimeLineItem) visualItem.getDisplayObject(); for (Slot slot : updatedSlots) { if (slot.equals(BORDER_COLOR)) { timelineItem.updateBorderColor(); } else if (slot.equals(COLOR)) { timelineItem.updateColor(); } } } } }
private VisualItemValueResolver getSlotResolver( DataTypeLists<String> propertiesByDataType, Slot slot) { DataType dataType = slot.getDataType(); LightweightList<String> properties = propertiesByDataType.get(dataType); // fallback to default values if there are no corresponding slots if (properties.isEmpty()) { return getFixedResolver(dataType); } assert !properties.isEmpty(); // dynamic resolution String firstProperty = properties.get(0); if (!propertyResolverFactories.containsKey(dataType)) { throw new UnableToInitializeSlotException(slot); } return createPropertyResolver(dataType, firstProperty); }