private void handleChangeInLogNameTextField(Document document) { if (document == fTextFieldLogOne.getDocument()) { String txt = fTextFieldLogOne.getText().trim(); if (!Utils.isEmptyString(txt)) { fLogOne = txt; fActionOk.setEnabled(true); } else { fActionOk.setEnabled(false); } } }
private void handleOk() { try { String aggStepString = fTextFieldAggStep.getText().trim(); int aggStep = 0; try { aggStep = Integer.parseInt(aggStepString); } catch (NumberFormatException e) { throw new RMSException("The aggregation step must be an integer"); } if (fCheckBoxNoAgg.isSelected()) { aggStep = 0; } fActionOk.setEnabled(false); final int faggStep = aggStep; if (fTimeIntervalOne == null) { runScanJob( fLogOne, new ScanEndCallback() { public void finishedScanning(Throwable err) { try { if (err == null) { fResult = new DataLogCompareAndReplayConfiguration( new DataLogCompareAndReplayConfiguration.LogRepositoryReplayConfig( new LogRepositoryInfo(fRepositoryType, fLogOne), fTimeIntervalOne), faggStep); dispose(); } } catch (Exception e) { UIExceptionMgr.userException(e); } } }); } } catch (Exception e) { 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(); }