GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(5,5,5,5);
// Exit Button
exitButton = new Button("Exit");
class BeepListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
toolkit.beep();
if (clientQuery != null)
clientQuery.logout();
//unregisterLogEvents();
log.info("Good bye!");
System.exit(0);
}
}
exitButton.addActionListener(new BeepListener());
gbc.gridx=0; gbc.gridy=0; gbc.gridwidth=1; gbc.gridheight=1;
gbc.weightx = gbc.weighty = 0.0;
add(exitButton, gbc);
// Hide Button
hideButton = new Button("Hide Window");
class HideListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
hideWindow();
}
}
hideButton.addActionListener(new HideListener());
gbc.gridx=1; gbc.gridy=0; gbc.gridwidth=1; gbc.gridheight=1;
gbc.weightx = gbc.weighty = 0.0;
add(hideButton, gbc);
// Statistic display with fill level bars
int offset = 0;
gbc.gridx=offset; gbc.gridy=1; gbc.gridwidth=1; gbc.gridheight=1;
gbc.weightx = gbc.weighty = 0.0;
createBarPanel(publishedMessagesBar, publishedLabel, "Published", gbc, offset++);
createBarPanel(sentMessagesBar, sentLabel, "Update", gbc, offset++);
createBarPanel(getMessagesBar, getLabel, "Get", gbc, offset++);
{ // XPath query GUI
Panel panel = new Panel();
panel.setName("QueryPanel");
panel.setLayout(new BorderLayout());
panel.setBackground(java.awt.SystemColor.control);
{ // Field to enter XPath text
Panel inputPanel = new Panel();
inputPanel.setLayout(new BorderLayout());
Label inputLabel = new Label("XPath query: ");
inputPanel.add("West", inputLabel);
inputTextField.setText("//key");
inputPanel.add("Center", inputTextField);
inputTextField.addKeyListener(new XPathKeyListener());
panel.add("North", inputPanel);
}
{ // TextArea to show query results
queryOutput = new TextArea();
queryOutput.setEditable(false);
panel.add("South", queryOutput);
}
gbc.gridx=offset; gbc.gridy=1; gbc.gridwidth=3; gbc.gridheight=1;
add(panel, gbc);
}
// Checkboxes for log levels
gbc.gridx=0; gbc.gridy=2; gbc.gridwidth=1; gbc.gridheight=1;
add(new Label("Choose Logging Level: "), gbc);
gbc.gridx=1; gbc.gridwidth=3; gbc.gridheight=1;
add(createLogLevelBoxes(), gbc);
// Clear logging output - Button
clearLogButton = new Button("Clear Log Window");
class ClearListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
logOutput.setText("");
}
}
clearLogButton.addActionListener(new ClearListener());
gbc.gridx=4; gbc.gridy=2; gbc.gridwidth=1; gbc.gridheight=1;
gbc.weightx = gbc.weighty = 0.0;
add(clearLogButton, gbc);
// Dump internal state - Button
dumpButton = new Button("Dump State");
class DumpListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
// logOutput.setText(""); // clear log window
try {
log.info("Dump start");