|
17 | 17 | import javax.swing.*; |
18 | 18 | import java.awt.*; |
19 | 19 | import java.awt.event.ActionEvent; |
| 20 | +import java.awt.event.ActionListener; |
20 | 21 | import java.awt.event.KeyEvent; |
21 | 22 | import java.io.BufferedWriter; |
22 | 23 | import java.io.File; |
23 | 24 | import java.io.FileWriter; |
24 | 25 | import java.io.IOException; |
25 | 26 | import java.util.*; |
| 27 | +import javax.swing.Timer; |
26 | 28 |
|
27 | 29 | ///////// ++ UI ++ ///////// |
28 | 30 | ///////// ++ UI -- ///////// |
@@ -167,7 +169,8 @@ private void addKeyBindings() |
167 | 169 | final String DECREASE_RENDERER_Y_OFFSET = "decreaseRendererYOffset"; |
168 | 170 | final String MARK_AS_FIRST = "markAsFirst"; |
169 | 171 | final String MARK_AS_SECOND = "markAsSecond"; |
170 | | - final String TOGGLE_CHART_TYPE = "toggleChartType"; |
| 172 | + final String NEXT_CHART_TYPE = "nextChartType"; |
| 173 | + final String PREV_CHART_TYPE = "prevChartType"; |
171 | 174 | final String TOGGLE_COMMITS_BAR_TYPE = "toggleCommitsBarType"; |
172 | 175 | final String SHOW_ALL_FILES = "showAllFiles"; |
173 | 176 | final String SHOW_CHANGED_FILES = "showChangedFiles"; |
@@ -438,19 +441,34 @@ public void actionPerformed(ActionEvent e) |
438 | 441 | } |
439 | 442 | }); |
440 | 443 |
|
441 | | - thisComponent.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_C,0), TOGGLE_CHART_TYPE); |
442 | | - thisComponent.getActionMap().put(TOGGLE_CHART_TYPE, new AbstractAction() |
| 444 | + thisComponent.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_Z,0), PREV_CHART_TYPE); |
| 445 | + thisComponent.getActionMap().put(PREV_CHART_TYPE, new AbstractAction() |
| 446 | + { |
| 447 | + @Override |
| 448 | + public void actionPerformed(ActionEvent e) |
| 449 | + { |
| 450 | + CKNumberReader.MetricTypes[] allMetrics = CKNumberReader.MetricTypes.values(); |
| 451 | + int nextMetricIndex = (currentMetricType.ordinal()-1); |
| 452 | + if(nextMetricIndex<0) nextMetricIndex = allMetrics.length-1; |
| 453 | + currentMetricType = allMetrics[nextMetricIndex]; |
| 454 | + codeHistory3DView.displayMetric(currentMetricType); |
| 455 | + } |
| 456 | + }); |
| 457 | + |
| 458 | + thisComponent.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_X,0), NEXT_CHART_TYPE); |
| 459 | + thisComponent.getActionMap().put(NEXT_CHART_TYPE, new AbstractAction() |
443 | 460 | { |
444 | 461 | @Override |
445 | 462 | public void actionPerformed(ActionEvent e) |
446 | 463 | { |
447 | 464 | CKNumberReader.MetricTypes[] allMetrics = CKNumberReader.MetricTypes.values(); |
448 | 465 | int nextMetricIndex = (currentMetricType.ordinal()+1)%allMetrics.length; |
449 | 466 | currentMetricType = allMetrics[nextMetricIndex]; |
450 | | - codeHistory3DView.displatMetric(currentMetricType); |
| 467 | + codeHistory3DView.displayMetric(currentMetricType); |
451 | 468 | } |
452 | 469 | }); |
453 | 470 |
|
| 471 | + |
454 | 472 | thisComponent.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F,0), TOGGLE_COMMITS_BAR_TYPE); |
455 | 473 | thisComponent.getActionMap().put(TOGGLE_COMMITS_BAR_TYPE, new AbstractAction() |
456 | 474 | { |
|
0 commit comments