Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -641,13 +641,12 @@ public static IXDataRenderer buildSpanRenderer(IItemCollection pathItems, IColor

public static boolean addEndTimeLines(
XYDataRenderer renderer, IItemCollection items, boolean fill, Stream<IAttribute<IQuantity>> yAttributes) {
// FIXME: JMC-4520 - Handle multiple item iterables
Iterator<IItemIterable> ii = items.iterator();
if (ii.hasNext()) {
IItemIterable itemStream = ii.next();
IType<IItem> type = itemStream.getType();
// FIXME: A better way to ensure sorting by endTime
return yAttributes.peek(a -> addEndTimeLine(renderer, itemStream.iterator(), type, a, fill))
if (items.hasItems()) {
Iterator<IItemIterable> ii = items.iterator();
IType<IItem> type = ii.hasNext() ? ii.next().getType() : null;
List<IItem> allItems = new ArrayList<>();
items.forEach(itemStream -> itemStream.forEach(allItems::add));
return yAttributes.peek(a -> addEndTimeLine(renderer, allItems.iterator(), type, a, fill))
.mapToLong(a -> 1L).sum() > 0;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
package org.openjdk.jmc.flightrecorder.ui.pages.itemhandler;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

Expand Down Expand Up @@ -73,7 +72,7 @@ public AttributeComponentConfiguration(IItemCollection items) {
uncommonChartableAttributes = new HashMap<>();
lineChartableAttributes = new HashMap<>();
forEachType(items);
populateAttributeMaps(isSuitableForLineCharts(items, allTypes));
populateAttributeMaps(isSuitableForLineCharts(allTypes));
}

@SuppressWarnings("deprecation")
Expand Down Expand Up @@ -117,16 +116,8 @@ private void populateAttributeMaps(boolean allowLineCharts) {
}
}

private static boolean isSuitableForLineCharts(IItemCollection items, Map<String, IType<?>> types) {
// NOTE: JMC-4520 - Only allowing line charts for one event type, which only has one event array.
if (types.values().size() == 1) {
Iterator<IItemIterable> iterator = items.iterator();
if (iterator.hasNext()) {
iterator.next();
return !iterator.hasNext();
}
}
return false;
private static boolean isSuitableForLineCharts(Map<String, IType<?>> types) {
return types.values().size() == 1;
}

public Map<String, IAttribute<?>> getAllAttributes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import org.openjdk.jmc.common.item.Aggregators;
import org.openjdk.jmc.common.item.IAggregator;
import org.openjdk.jmc.common.item.IAttribute;
import org.openjdk.jmc.common.item.IItem;
import org.openjdk.jmc.common.item.IItemCollection;
import org.openjdk.jmc.common.item.IItemIterable;
import org.openjdk.jmc.common.item.IType;
Expand Down Expand Up @@ -540,19 +541,18 @@ private Collection<ItemRow> updateLineChart(IItemCollection itemsToChart) {
description);
for (IAttribute<?> attribute : attributes) {
// TODO: something other than time on x-axis?
Iterator<IItemIterable> chartItemsWithAttributeSomeType = itemsToChart
.apply(ItemFilters.hasAttribute(attribute)).iterator();
if (chartItemsWithAttributeSomeType.hasNext()
&& attribute.getContentType() instanceof LinearKindOfQuantity) {
IItemIterable is = chartItemsWithAttributeSomeType.next();
if (chartItemsWithAttributeSomeType.hasNext()) {
// FIXME: JMC-4520 - Add support for multiple item iterables
FlightRecorderUI.getDefault().getLogger().log(Level.INFO,
"Only charting a subset of the events!"); //$NON-NLS-1$
if (attribute.getContentType() instanceof LinearKindOfQuantity) {
IItemCollection itemsWithAttributeSomeType = itemsToChart
.apply(ItemFilters.hasAttribute(attribute));
if (itemsWithAttributeSomeType.hasItems()) {
Iterator<IItemIterable> iterator = itemsWithAttributeSomeType.iterator();
IType<IItem> type = iterator.hasNext() ? iterator.next().getType() : null;
List<IItem> allItems = new ArrayList<>();
itemsWithAttributeSomeType.forEach(itemStream -> itemStream.forEach(allItems::add));
@SuppressWarnings("unchecked")
IAttribute<IQuantity> qAttribute = (IAttribute<IQuantity>) attribute;
DataPageToolkit.addEndTimeLine(xyRenderer, allItems.iterator(), type, qAttribute, fill);
}
@SuppressWarnings("unchecked")
IAttribute<IQuantity> qAttribute = (IAttribute<IQuantity>) attribute;
DataPageToolkit.addEndTimeLine(xyRenderer, is.iterator(), is.getType(), qAttribute, fill);
}
}
rows.add(new ItemRow(name, description, xyRenderer, itemsToChart));
Expand Down