/** Play button action of ImageExplorer */ public void play() { boolean isPaused = playback.isPaused(); btnPlay.setImage(imgStill); playback.start(); if (!isPaused) { playback.setSelection(getSelection()); playback.setDelay(getPreferenceTimeDelay()); playback.setStepping(getPreferencePlaybackRate()); execSvc.execute(playback); } }
@Override public void widgetSelected(SelectionEvent e) { if (e.getSource().equals(cmbDirectoryLocation)) { final String newDirectory = cmbDirectoryLocation.getItem(cmbDirectoryLocation.getSelectionIndex()); if (newDirectory != null && newDirectory.length() > 0) { addToHistory(); resetHistory(); resetPlaying(true); spawnLoadJob(newDirectory); currentDir = newDirectory; } } else if (e.getSource().equals(btnHistoryBack)) { String newDir = history.get(historyPointer); btnHistoryForw.setEnabled(true); cmbDirectoryLocation.setText(newDir); resetPlaying(true); spawnLoadJob(newDir); historyPointer++; if (historyPointer >= history.size()) { btnHistoryBack.setEnabled(false); historyPointer = history.size() - 1; } if (firstBack) { addToHistory(); firstBack = false; historyPointer++; } } else if (e.getSource().equals(btnHistoryForw)) { historyPointer--; String newDir = history.get(historyPointer); resetPlaying(true); spawnLoadJob(newDir); cmbDirectoryLocation.setText(newDir); btnHistoryBack.setEnabled(true); if (historyPointer <= 0) { btnHistoryForw.setEnabled(false); historyPointer = 1; } } else if (e.getSource().equals(btnPlay)) { if (btnPlay.getSelection()) { boolean isPaused = playback.isPaused(); btnPlay.setImage(imgStill); playback.start(); if (!isPaused) { playback.setSelection(getSelection()); playback.setDelay(getPreferenceTimeDelay()); playback.setStepping(getPreferencePlaybackRate()); execSvc.execute(playback); } } else { playback.pause(); btnPlay.setImage(imgPlay); } } else if (e.getSource().equals(btnStop)) { sldProgress.setSelection(0); curPosition = -1; btnPlay.setSelection(false); btnPlay.setImage(imgPlay); playback.stop(); } else if (e.getSource().equals(btnRewind)) { sldProgress.setSelection(0); curPosition = -1; playback.rewind(); } else if (e.getSource().equals(btnForward)) { sldProgress.setSelection(sldProgress.getMaximum()); playback.forward(); } else if (e.getSource().equals(sldProgress)) { int p = sldProgress.getSelection(); if (p != curPosition) { playback.setPlayPos(p); curPosition = p; } } else if (e.getSource().equals(btnPlayLoop)) { playback.setAutoRewind(btnPlayLoop.getSelection()); } }