Changeset 53 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/gui/panels/ScriptBuilderTimelinePanel.java
- Timestamp:
- 08/09/2017 10:03:37 AM (9 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/panels/ScriptBuilderTimelinePanel.java
r49 r53 29 29 * @version 2017/06/30 30 30 */ 31 public class IncidentTimelinePanel extends JPanel31 public class ScriptBuilderTimelinePanel extends JPanel 32 32 { 33 33 … … 39 39 * If true, this panel is in its minimized state. 40 40 */ 41 boolean collapsed;41 //boolean collapsed; 42 42 /** 43 43 * If false, this panel won't be drawn. … … 198 198 lastSlice = newSlice; 199 199 String newToolTip; 200 if (collapsed) 201 { 202 newToolTip = incident.slices.get(newSlice).toString(); 203 } 204 else 205 { 206 newToolTip = incident.slices.get(newSlice).getToolTipText(y); 207 } 200 201 newToolTip = incident.slices.get(newSlice).toString(); 202 208 203 setToolTipText((newToolTip == null || newToolTip.equals("")) 209 204 ? null : newToolTip); … … 218 213 * Constructor. Generates a HashMap of all possible event types. 219 214 */ 220 public IncidentTimelinePanel()215 public ScriptBuilderTimelinePanel() 221 216 { 222 217 super(); … … 258 253 { 259 254 this.incident = incident; 260 if (incident != null)261 {262 this.collapsed = incident.collapsed;263 }264 255 this.visible = incident != null; 265 256 … … 267 258 if (visible) 268 259 { 269 if (collapsed) 270 { 271 newSize = new Dimension((incident.length + incident.offset) 272 / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION 273 * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK, 274 ScriptBuilderGuiConstants.TIMELINE_COLLAPSED_HEIGHT); 275 } 276 else 277 { 278 int mostEvents = 0; 279 for (TimeSlice slice : incident.getSlices()) 280 { 281 if (slice.events.size() > mostEvents) 282 { 283 mostEvents = slice.events.size(); 284 } 285 } 286 287 newSize = new Dimension((ScriptBuilderGuiConstants.MAX_SIMULATION_LENGTH) 288 / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION 289 * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK, 290 ScriptBuilderGuiConstants.TIMELINE_COLLAPSED_HEIGHT 291 + ScriptBuilderGuiConstants.SCRIPT_EVENT_ICON_STEP * (mostEvents + 1)); 292 } 260 261 newSize = new Dimension(((incident.length + incident.offset) 262 / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION 263 * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK) 264 + ScriptBuilderGuiConstants.EVENT_ICON_WIDTH, 265 ScriptBuilderGuiConstants.TIMELINE_COLLAPSED_HEIGHT 266 + ScriptBuilderGuiConstants.SCRIPT_EVENT_ICON_STEP * 2); 267 293 268 } 294 269 else … … 319 294 320 295 Graphics2D g2d = (Graphics2D) g; 321 IncidentTimelineDrawer.Draw IncidentTimeline(g2d, incident, collapsed);296 IncidentTimelineDrawer.DrawScriptBuilderTimeline(g2d, incident); 322 297 323 298 if (focused)
Note: See TracChangeset
for help on using the changeset viewer.
