Last active
December 26, 2015 01:59
-
-
Save ulmangt/7075508 to your computer and use it in GitHub Desktop.
Demonstrates a possible approach to cloning timeline event rows so that they show the same set of events.
This file contains hidden or 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
| import com.metsci.glimpse.examples.Example; | |
| import com.metsci.glimpse.plot.timeline.StackedTimePlot2D; | |
| import com.metsci.glimpse.plot.timeline.event.EventPlotInfo; | |
| import com.metsci.glimpse.support.settings.OceanLookAndFeel; | |
| public class TimelineCloneEventRowExample extends CollapsibleTimelinePlotExample | |
| { | |
| public static void main( String[] args ) throws Exception | |
| { | |
| Example example = Example.showWithSwing( new TimelineCloneEventRowExample( ) ); | |
| // use the ocean look and feel | |
| example.getCanvas( ).setLookAndFeel( new OceanLookAndFeel( ) ); | |
| } | |
| @Override | |
| public StackedTimePlot2D getLayout( ) | |
| { | |
| StackedTimePlot2D plot = super.getLayout( ); | |
| // get a reference to one of the Event plots | |
| EventPlotInfo eventPlot = plot.getEventPlot( "event-2" ); | |
| // create a new Event plot | |
| EventPlotInfo newEventPlot = plot.createEventPlot( ); | |
| // Get the internal GlimpseLayout that Events are painted on from the first event plot and add it to the second | |
| // | |
| // Note, this call requires adding a method to EventPlotInfo: | |
| // | |
| // public GlimpseAxisLayout1D getEventLayout( ) | |
| // { | |
| // return layout1D; | |
| // } | |
| // | |
| // Further note, this isn't a 100% solution. For example, when dragging events, if one event is bumped up to | |
| // a second level, it will only affect the size of the original plot, not the second one. | |
| // | |
| newEventPlot.getEventLayout( ).addLayout( eventPlot.getEventLayout( ) ); | |
| return plot; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment