Search in sources :

Example 1 with ModelChartImpl

use of com.tagtraum.perf.gcviewer.view.ModelChartImpl in project GCViewer by chewiebug.

the class GCDocumentController method addGCResource.

public void addGCResource(GCModelLoader loader, ViewMenuController viewMenuController) {
    ChartPanelView chartPanelView = new ChartPanelView(gcDocument.getPreferences(), loader.getGcResource());
    ((ModelChartImpl) chartPanelView.getModelChart()).addPropertyChangeListener(viewMenuController);
    ((ModelChartImpl) chartPanelView.getModelChart()).addTimeOffsetChangeListener(new TimeOffsetPanelController(gcDocument));
    gcDocument.addChartPanelView(chartPanelView);
    loader.addPropertyChangeListener(this);
    loader.addPropertyChangeListener(chartPanelView.getModelLoaderView());
}
Also used : ChartPanelView(com.tagtraum.perf.gcviewer.view.ChartPanelView) ModelChartImpl(com.tagtraum.perf.gcviewer.view.ModelChartImpl)

Example 2 with ModelChartImpl

use of com.tagtraum.perf.gcviewer.view.ModelChartImpl in project GCViewer by chewiebug.

the class ModelChartImplTest method shouldShowOrNotDateStampAccordingToModelAndSettings.

@Theory
public void shouldShowOrNotDateStampAccordingToModelAndSettings(TestCase testCase) throws Exception {
    //given
    ModelChartImpl modelChart = new ModelChartImpl();
    GCPreferences preferences = new GCPreferences();
    GCModel gcModel = Mockito.mock(GCModel.class);
    Mockito.when(gcModel.hasDateStamp()).thenReturn(testCase.hasDateStamp());
    Mockito.when(gcModel.getFirstDateStamp()).thenReturn(ZonedDateTime.now());
    Mockito.when(gcModel.getPause()).thenReturn(new DoubleData());
    preferences.setShowDateStamp(testCase.isShowDateStamp());
    //when
    modelChart.setModel(gcModel, preferences);
    //then
    assertThat(modelChart.isShowDateStamp(), equalTo(testCase.isExpectedShowDateStamp()));
}
Also used : GCPreferences(com.tagtraum.perf.gcviewer.view.model.GCPreferences) ModelChartImpl(com.tagtraum.perf.gcviewer.view.ModelChartImpl) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) DoubleData(com.tagtraum.perf.gcviewer.math.DoubleData) Theory(org.junit.experimental.theories.Theory)

Aggregations

ModelChartImpl (com.tagtraum.perf.gcviewer.view.ModelChartImpl)2 DoubleData (com.tagtraum.perf.gcviewer.math.DoubleData)1 GCModel (com.tagtraum.perf.gcviewer.model.GCModel)1 ChartPanelView (com.tagtraum.perf.gcviewer.view.ChartPanelView)1 GCPreferences (com.tagtraum.perf.gcviewer.view.model.GCPreferences)1 Theory (org.junit.experimental.theories.Theory)1