s_log.error("Unexpected exception: "+dse.getMessage(), dse);
}
}
private JPanel buildMainPanel() {
SessionProperties props = this.getSession().getProperties();
JPanel panel = new JPanel();
GridBagLayout gridBag = new GridBagLayout();
panel.setLayout(gridBag);
_frequency = new JSlider();
_frequency.setMinimum(0);
_frequency.setMaximum(20);
_frequency.setValue(0); // by default, it is not running.
_frequency.setMajorTickSpacing(2);
_frequency.setMinorTickSpacing(1);
_frequency.setPaintLabels(true);
_frequency.setPaintTicks(true);
_frequency.setSnapToTicks(true);
_frequency.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
JSlider slider = (JSlider) e.getSource();
if (slider.getValue() == 0) {
// don't bother changing the delay, but stop it if it's running.
if (_refreshTimer.isRunning())
_refreshTimer.stop();
}
else {
// change the delay, and start it if it was stopped.
_refreshTimer.setDelay(slider.getValue() * 1000);
if (!_refreshTimer.isRunning())
_refreshTimer.start();
}
// i18n[mssql.delay={0}s delay]
slider.setToolTipText(s_stringMgr.getString("mssql.delay", Integer.valueOf(slider.getValue())));
}
});
addComponentToGridBag(0,0,1,1,0.0,0.0,GridBagConstraints.BOTH,gridBag,_frequency,panel);
// i18n[mssql.refreshNow=Refresh Now]
JButton refreshButton = new JButton(s_stringMgr.getString("mssql.refreshNow"));
refreshButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (!_haveSession)
return;
if (_inRefresh)
return;
_inRefresh = true;
refreshData();
_inRefresh = false;
}
});
addComponentToGridBag(GridBagConstraints.RELATIVE,0,1,1,0.0,0.0,GridBagConstraints.NONE,gridBag,refreshButton,panel);
_whoViewer = BaseDataSetViewerDestination.getInstance(props.getReadOnlySQLResultsOutputClassName(), null);
JScrollPane whoScroll = new JScrollPane(_whoViewer.getComponent());
// i18n[mssql.currentActivity=Current Activity]
whoScroll.setBorder(BorderFactory.createTitledBorder(s_stringMgr.getString("mssql.currentActivity")));
addComponentToGridBag(0,1,1,1,1.0,1.0,GridBagConstraints.BOTH,gridBag,whoScroll,panel);
_perfViewer = BaseDataSetViewerDestination.getInstance(props.getReadOnlySQLResultsOutputClassName(), null);
JScrollPane perfScroll = new JScrollPane(_perfViewer.getComponent());
// i18n[mssql.performace=Performance Counters]
perfScroll.setBorder(BorderFactory.createTitledBorder(s_stringMgr.getString("mssql.performace")));
addComponentToGridBag(GridBagConstraints.RELATIVE,1,1,1,1.0,1.0,GridBagConstraints.BOTH,gridBag,perfScroll,panel);