private void showTimeIntervalSelectorDialog(final String logName) { if (fLogOne.equals(logName)) { if (fTimeIntervalOne != null) { TimeIntervalSelectorDialog dlg = new TimeIntervalSelectorDialog(fViewContainer, fTimeIntervalOne); UIUtils.centerDialogAndShow(fViewContainer.getAppFrame(), dlg); BoundedTimeInterval ti = dlg.getResult(); if (ti != null) { fTimeIntervalOne = ti; } } } }
/** * @param logName * @param scanEndCallback */ private void runScanJob(final String logName, final ScanEndCallback scanEndCallback) { fViewContainer .getAppWorker() .runJob( new UIWorkerJobDefaultCancelable( this, Cursor.WAIT_CURSOR, MessageRepository.get(Msg.TEXT_SCANNING_LOG)) { private DataLogScanningService.ScanListener listener = new DataLogScanningService.ScanListener() { public void fatalScanError(LogRepositoryInfo rep, Exception e) { wakeUp(); } public void finishedScanningLog(LogRepositoryInfo rep, BoundedTimeInterval ti) { handleFinishedScanning(rep, ti); wakeUp(); } public void newAgent(LogRepositoryInfo rep, HostId host, AgentDescriptor ad) {} public void newEntity( LogRepositoryInfo rep, HostId host, AgentId aid, EntityDescriptor ed) {} }; public void cancel() { super.cancel(); try { fScanningService.stopScanning(); } catch (DataLogException e) { UIExceptionMgr.userException(e); } } public void work() throws Throwable { fScanningService.addScanListener(listener); fScanningService.startScanning(new LogRepositoryInfo(fRepositoryType, logName)); hold(); } public void finished(Throwable ex) { fScanningService.removeScanListener(listener); if (!canceled()) { scanEndCallback.finishedScanning(ex); } } }); }
/** @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int) */ public void setValueAt(final Object aValue, final int rowIndex, final int columnIndex) { try { if (columnIndex != 0) { return; } this.fViewContainer .getAppWorker() .runJobSynch( new UIWorkerJobDefault(fViewContainer.getAppFrame(), Cursor.WAIT_CURSOR, "") { public void work() throws Exception { setArtefactEnabled(rowIndex, ((Boolean) aValue).booleanValue()); // this will trigger a refresh on the entire row fireTableRowsUpdated(rowIndex, rowIndex); } public void finished(Throwable ex) {} }); } catch (Exception e) { // this will trigger a refresh on the entire row // before the exception is displayed fireTableRowsUpdated(rowIndex, rowIndex); UIExceptionMgr.userException(e); } }
/** * @param parent * @param conf * @param rep */ @SuppressWarnings("serial") public DataLogReplayConfigurationDialog(RMSViewContainer container) { super(container.getAppFrame(), VERTICAL); setModal(true); setTitle(MessageRepository.get(Msg.TITLE_REPLAY_CONFIGURATION)); fViewContainer = container; fEventHandler = new EventHandler(); fForm = new FormPanel(FormPanel.VERTICAL1); fTextFieldAggStep = UIFactoryMgr.createTextField(); fTextFieldLogOne = UIFactoryMgr.createTextField(); fCheckBoxNoAgg = UIFactoryMgr.createCheckBox(); fCheckBoxNoAgg.setText(MessageRepository.get(Msg.TEXT_NO_AGGREGATION)); fPaneSelectTimeIntervalOne = UIFactoryMgr.createHtmlPane(); fPaneSelectTimeIntervalOne.setPreferredSize(new Dimension(300, 20)); fPaneSelectTimeIntervalOne.setText( "<html><a href='#'>" + MessageRepository.get(Msg.LINK_SETUP_TIME_INTERVAL) + "</a></html>"); fPaneSelectTimeIntervalOne.addHyperlinkListener(fEventHandler); fButtonBrowseOne = UIFactoryMgr.createButton( new ActionBrowse() { public void actionPerformed(ActionEvent e) { handleBrowseOne(); } }); Box box1 = new Box(BoxLayout.Y_AXIS); box1.add(fTextFieldLogOne); box1.add(Box.createHorizontalStrut(UIConfiguration.getPanelPadding())); box1.add(fPaneSelectTimeIntervalOne); Box box11 = new Box(BoxLayout.X_AXIS); box11.add(box1); box11.add(Box.createHorizontalStrut(UIConfiguration.getPanelPadding())); box11.add(fButtonBrowseOne); Box box3 = new Box(BoxLayout.X_AXIS); box3.add(fTextFieldAggStep); box3.add(Box.createHorizontalStrut(UIConfiguration.getPanelPadding())); box3.add(fCheckBoxNoAgg); fForm.addPairs( new String[] { MessageRepository.get(Msg.LABEL_LOG), MessageRepository.get(Msg.LABEL_AGGREGATION_STEP) }, new Component[] {box11, box3}); int aggStep; aggStep = ConfigurationMgr.getInt( LogComponent.NAME, LogConfigurationConstants.LOG_AGGREGATION_PERIOD); fTextFieldAggStep.setText(String.valueOf(aggStep)); if (aggStep == 0) { fCheckBoxNoAgg.setSelected(true); } else { fCheckBoxNoAgg.setSelected(false); } fActionOk = new ActionOk() { public void actionPerformed(ActionEvent e) { handleOk(); } }; fActionOk.setEnabled(false); fTextFieldLogOne.setEnabled(false); fCheckBoxNoAgg.addItemListener(fEventHandler); fTextFieldLogOne.getDocument().addDocumentListener(fEventHandler); fScanningService = RMS.getDataLogScanning(); buildContentPane(); }