public void update() { if (updatesPaused) { log.debug("updates paused"); return; } context .getController() .invokeLater( new Runnable() { @Override public void run() { Collection<Integer> sequenceNumbers = context.getSequenceNumbers(); final List<SequenceInformation> rows = new ArrayList<SequenceInformation>(sequenceNumbers.size()); for (Integer sequenceNumber : sequenceNumbers) { JDinkSequence sequence = context.getSequence(sequenceNumber.intValue(), false); if (sequence != null) { rows.add(new SequenceInformation(sequenceNumber.intValue(), sequence)); } } SwingUtilities.invokeLater( new Runnable() { @Override public void run() { label.setText( "last updated: " + new SimpleDateFormat("HH:mm:ss").format(new Date())); model.setRows(new ArrayList<SequenceInformation>(rows)); } }); } }); }
@Override public void actionPerformed(ActionEvent e) { context.getController().setPaused(!context.getController().isPaused()); }