-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support categories in data analysis time-series viewer
- Loading branch information
yblanken
committed
Dec 14, 2023
1 parent
a7af499
commit 407b70f
Showing
16 changed files
with
556 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...ronizedtiming.ui/src/nl/esi/pps/common/emf/synchronizedtiming/jfree/ShowLegendAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package nl.esi.pps.common.emf.synchronizedtiming.jfree; | ||
|
||
|
||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.jface.action.Action; | ||
import org.eclipse.jface.action.IAction; | ||
import org.eclipse.jface.resource.ImageDescriptor; | ||
import org.eclipse.trace4cps.common.jfreechart.ui.widgets.ChartPanelComposite; | ||
import org.jfree.chart.JFreeChart; | ||
import org.jfree.chart.title.LegendTitle; | ||
import org.jfree.chart.title.Title; | ||
|
||
import nl.esi.pps.common.emf.synchronizedtiming.ui.Activator; | ||
|
||
public class ShowLegendAction extends Action { | ||
private @Nullable ChartPanelComposite chartPanelComposite; | ||
|
||
public ShowLegendAction() { | ||
this(null, Activator.getDescriptor(Activator.IMAGE_LEGEND_ONOFF)); | ||
} | ||
|
||
public ShowLegendAction(@Nullable ChartPanelComposite plotComposite) { | ||
this(plotComposite, Activator.getDescriptor(Activator.IMAGE_LEGEND_ONOFF)); | ||
} | ||
|
||
public ShowLegendAction(@Nullable ChartPanelComposite chartPanelComposite, @Nullable ImageDescriptor imageDescriptor) { | ||
super("Show Legend", IAction.AS_CHECK_BOX); | ||
setImageDescriptor(imageDescriptor); | ||
setToolTipText("If checked, this chart will show a legend."); | ||
setChartPanelComposite(chartPanelComposite); | ||
} | ||
|
||
public void setChartPanelComposite(@Nullable ChartPanelComposite plotComposite) { | ||
this.chartPanelComposite = plotComposite; | ||
update(); | ||
} | ||
|
||
protected @Nullable ChartPanelComposite getChartPanelComposite() { | ||
return chartPanelComposite; | ||
} | ||
|
||
public void update() { | ||
if (chartPanelComposite != null) { | ||
JFreeChart chart = chartPanelComposite.getChart(); | ||
LegendTitle legend = chart == null ? null : chart.getLegend(); | ||
if (legend != null) { | ||
setEnabled(true); | ||
setChecked(legend.isVisible()); | ||
return; | ||
} | ||
} | ||
setEnabled(false); | ||
setChecked(false); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
if (chartPanelComposite != null) { | ||
JFreeChart chart = chartPanelComposite.getChart(); | ||
if (chart == null) { | ||
return; | ||
} | ||
|
||
for (int i = 0; i < chart.getSubtitleCount(); i++) { | ||
Title subtitle = chart.getSubtitle(i); | ||
if (subtitle instanceof LegendTitle) { | ||
subtitle.setVisible(isChecked()); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...i/pps/tmsc/analysis/ui/dataanalysis/MetricActivityIsomorphismClassesContentProvider.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package nl.esi.pps.tmsc.analysis.ui.dataanalysis | ||
|
||
import nl.esi.pps.tmsc.ScopedTMSC | ||
import nl.esi.pps.tmsc.metric.MetricInstance | ||
import nl.esi.pps.tmsc.metric.provider.dataanalysis.MetricDataAnalysisItemContentProvider | ||
|
||
import static extension nl.esi.pps.tmsc.analysis.ui.handlers.CreateMetricActivityIsomorphismClassesHelper.* | ||
|
||
class MetricActivityIsomorphismClassesContentProvider extends MetricDataAnalysisItemContentProvider { | ||
override getConfigurations(Object object) { | ||
return object.metric.instances.flatMap[scopes].map[configuration].filterNull.toSet | ||
} | ||
|
||
override String getTitle(Object object, String configuration) { | ||
return object.metric.name + ' - ' + configuration | ||
} | ||
|
||
override isCategorized(Object object, String configuration) { | ||
return true | ||
} | ||
|
||
override getCategory(Object object, Object sibling, String configuration) { | ||
if (sibling instanceof MetricInstance) { | ||
val isomorphismClass = sibling.scopes.findFirst[s | s.configuration == configuration]?.isomorphismClass | ||
if (isomorphismClass !== null) { | ||
return 'Isomorphism class ' + isomorphismClass | ||
} | ||
} | ||
return super.getCategory(object, sibling, configuration) | ||
} | ||
|
||
protected def String getConfiguration(ScopedTMSC tmsc) { | ||
val isomorphismStage = tmsc.isomorphismStage | ||
if (isomorphismStage === null) { | ||
return null | ||
} | ||
val isomorphismType = tmsc.isomorphismType | ||
if (isomorphismType === null) { | ||
return null | ||
} | ||
return isomorphismStage + ' ' + isomorphismType | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.