use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.StateItem in project tracecompass by tracecompass.
the class StateSystemPresentationProvider method getStateTable.
@Override
public StateItem[] getStateTable() {
if (STATE_TABLE[0] == null) {
List<@NonNull RGBAColor> colors = fPalette.get();
for (int i = 0; i < colors.size(); i++) {
RGBAColor rgbaColor = colors.get(i);
STATE_TABLE[i] = new StateItem(RGBAUtil.fromInt(rgbaColor.toInt()).rgb, rgbaColor.toString());
}
}
return STATE_TABLE;
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.StateItem in project tracecompass by tracecompass.
the class TimeChartAnalysisProvider method getEventStyle.
@Override
public Map<String, Object> getEventStyle(ITimeEvent event) {
StateItem stateItem = null;
int index = getStateTableIndex(event);
if (index == ColorSettingsManager.PRIORITY_NONE) {
return DEFAULT_STATE.getStyleMap();
}
StateItem[] stateTable = getStateTable();
if (index >= 0 && index < stateTable.length) {
stateItem = stateTable[index];
}
return stateItem == null ? Collections.emptyMap() : stateItem.getStyleMap();
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.StateItem in project tracecompass by tracecompass.
the class TimeChartAnalysisProvider method colorSettingsChanged.
@Override
public void colorSettingsChanged(ColorSetting[] settings) {
StateItem[] stateItems = new StateItem[settings.length];
for (int i = 0; i < settings.length; i++) {
stateItems[i] = new StateItem(settings[i].getTickColorRGB(), StateItem.UNDEFINED_STATE_NAME);
}
fStateTable = stateItems;
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.StateItem in project tracecompass by tracecompass.
the class FlameGraphPresentationProvider method getStateTable.
@Override
public StateItem[] getStateTable() {
if (fStateTable[1] == null) {
Map<@NonNull String, @NonNull OutputElementStyle> styles = FlameDefaultPalette.getStyles();
if (styles.isEmpty()) {
for (int i = 0; i < NUM_COLORS; i++) {
fStateTable[i + 1] = new StateItem(Collections.emptyMap());
}
return fStateTable;
}
int tableIndex = 1;
for (Entry<@NonNull String, @NonNull OutputElementStyle> styleEntry : styles.entrySet()) {
String styleKey = styleEntry.getKey();
fKeyToIndex.put(styleKey, tableIndex);
OutputElementStyle elementStyle = styleEntry.getValue();
Map<String, Object> styleMap = new HashMap<>();
RGBAColor bgColor = getColorStyle(elementStyle, StyleProperties.BACKGROUND_COLOR);
if (bgColor != null) {
RGB rgb = new RGB(bgColor.getRed(), bgColor.getGreen(), bgColor.getBlue());
styleMap.put(StyleProperties.BACKGROUND_COLOR, ColorUtils.toHexColor(rgb));
}
RGBAColor color = getColorStyle(elementStyle, StyleProperties.COLOR);
if (color != null) {
RGB rgb = new RGB(color.getRed(), color.getGreen(), color.getBlue());
styleMap.put(StyleProperties.COLOR, ColorUtils.toHexColor(rgb));
}
Object styleName = getStyle(elementStyle, StyleProperties.STYLE_NAME);
if (styleName instanceof String) {
styleMap.put(StyleProperties.STYLE_NAME, styleName);
} else {
styleMap.put(StyleProperties.STYLE_NAME, styleEntry.getKey());
}
Float height = getFloatStyle(elementStyle, StyleProperties.HEIGHT);
if (height != null) {
styleMap.put(StyleProperties.HEIGHT, height);
}
Float width = getFloatStyle(elementStyle, StyleProperties.WIDTH);
if (width != null) {
styleMap.put(StyleProperties.WIDTH, width.intValue());
}
Object symbolType = getStyle(elementStyle, StyleProperties.SYMBOL_TYPE);
if (symbolType instanceof String) {
styleMap.put(StyleProperties.SYMBOL_TYPE, symbolType);
}
Object styleGroup = getStyle(elementStyle, StyleProperties.STYLE_GROUP);
if (styleGroup != null) {
styleMap.put(StyleProperties.STYLE_GROUP, styleGroup);
}
fStateTable[tableIndex] = new StateItem(styleMap);
tableIndex++;
}
}
return fStateTable;
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.StateItem in project tracecompass by tracecompass.
the class XmlPresentationProvider method addOrUpdateState.
private synchronized void addOrUpdateState(int value, String name, String color) {
// FIXME Allow this case
if (value < 0) {
return;
}
final RGB colorRGB = (color.startsWith(TmfXmlStrings.COLOR_PREFIX)) ? parseColor(color) : calcColor(name);
StateItem item = new StateItem(colorRGB, name);
Integer index = stateIndex.get(value);
if (index == null) {
/* Add the new state value */
stateIndex.put(value, stateValues.size());
stateValues.add(item);
} else {
/* Override a previous state value */
stateValues.set(index, item);
}
stateTable = stateValues.toArray(new StateItem[stateValues.size()]);
}
Aggregations