summaryrefslogtreecommitdiff
path: root/java/src/IceGridGUI/LiveDeployment/WriteMessageDialog.java
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2014-10-20 11:40:05 -0230
committerMatthew Newhook <matthew@zeroc.com>2014-10-20 11:40:05 -0230
commitb51469b41167fb86ae2059a15cf0475c53fdda7b (patch)
treefc85d6ca2efd89c67e1e4e7438f437c3e08313f4 /java/src/IceGridGUI/LiveDeployment/WriteMessageDialog.java
parentFixed (ICE-5695) - IceSSL: misleading exception (diff)
downloadice-b51469b41167fb86ae2059a15cf0475c53fdda7b.tar.bz2
ice-b51469b41167fb86ae2059a15cf0475c53fdda7b.tar.xz
ice-b51469b41167fb86ae2059a15cf0475c53fdda7b.zip
Down with ant. From the gradle to the grave.
Diffstat (limited to 'java/src/IceGridGUI/LiveDeployment/WriteMessageDialog.java')
-rw-r--r--java/src/IceGridGUI/LiveDeployment/WriteMessageDialog.java197
1 files changed, 0 insertions, 197 deletions
diff --git a/java/src/IceGridGUI/LiveDeployment/WriteMessageDialog.java b/java/src/IceGridGUI/LiveDeployment/WriteMessageDialog.java
deleted file mode 100644
index 7645fb1435f..00000000000
--- a/java/src/IceGridGUI/LiveDeployment/WriteMessageDialog.java
+++ /dev/null
@@ -1,197 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package IceGridGUI.LiveDeployment;
-
-import java.awt.Container;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.ButtonGroup;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.ScrollPaneConstants;
-import javax.swing.SwingUtilities;
-import javax.swing.WindowConstants;
-
-import com.jgoodies.forms.builder.DefaultFormBuilder;
-import com.jgoodies.forms.builder.ButtonBarBuilder;
-import com.jgoodies.forms.factories.Borders;
-import com.jgoodies.forms.layout.FormLayout;
-import com.jgoodies.forms.util.LayoutStyle;
-
-import IceGrid.*;
-import IceGridGUI.*;
-
-class WriteMessageDialog extends JDialog
-{
- WriteMessageDialog(final Root root)
- {
- super(root.getCoordinator().getMainFrame(), "Write Message - IceGrid Admin", true);
- setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
-
- _mainFrame = root.getCoordinator().getMainFrame();
-
- _stdOut = new JRadioButton("Write to stdout");
- _stdOut.setSelected(true);
- JRadioButton stdErr = new JRadioButton("Write to stderr");
- ButtonGroup bg = new ButtonGroup();
- bg.add(_stdOut);
- bg.add(stdErr);
-
- JButton okButton = new JButton("OK");
- ActionListener okListener = new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- final Coordinator c = root.getCoordinator();
-
- AdminPrx admin = c.getAdmin();
- if(admin == null)
- {
- JOptionPane.showMessageDialog(
- _mainFrame,
- "No longer connected to IceGrid Registry",
- "Writing message to server '" + _target + "' failed",
- JOptionPane.ERROR_MESSAGE);
- }
- else
- {
-
- Ice.Identity adminId = new Ice.Identity(_target, c.getServerAdminCategory());
-
- final Ice.ProcessPrx process = Ice.ProcessPrxHelper.uncheckedCast(
- admin.ice_identity(adminId).ice_facet("Process"));
-
- final String prefix = "Writing message to server '" + _target + "'...";
- c.getStatusBar().setText(prefix);
-
- Ice.Callback_Process_writeMessage cb = new Ice.Callback_Process_writeMessage()
- {
- @Override
- public void response()
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- c.getStatusBar().setText(prefix + "done.");
- }
- });
- }
-
- @Override
- public void exception(final Ice.LocalException e)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- handleFailure("Communication exception: " + e.toString());
- }
- });
- }
-
- private void handleFailure(String message)
- {
- c.getStatusBar().setText(prefix + "failed!");
-
- JOptionPane.showMessageDialog(
- _mainFrame,
- message,
- "Writing message to server '" + process.ice_getIdentity().name + "' failed",
- JOptionPane.ERROR_MESSAGE);
- }
- };
-
- try
- {
- process.begin_writeMessage(_message.getText(), _stdOut.isSelected() ? 1 : 2, cb);
- }
- catch(Ice.LocalException ex)
- {
- c.getStatusBar().setText(prefix + "failed.");
- JOptionPane.showMessageDialog(
- _mainFrame,
- "Communication exception: " + ex.toString(),
- "Writing message to server '" + _target + "' failed",
- JOptionPane.ERROR_MESSAGE);
-
- return;
- }
- }
-
- setVisible(false);
- }
- };
- okButton.addActionListener(okListener);
- getRootPane().setDefaultButton(okButton);
-
- JButton cancelButton = new JButton("Cancel");
- ActionListener cancelListener = new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- setVisible(false);
- }
- };
- cancelButton.addActionListener(cancelListener);
-
- FormLayout layout = new FormLayout("left:pref, 3dlu, fill:pref:grow", "");
- DefaultFormBuilder builder = new DefaultFormBuilder(layout);
- builder.border(Borders.DIALOG);
- builder.rowGroupingEnabled(true);
- builder.lineGapSize(LayoutStyle.getCurrent().getLinePad());
-
- _message.setLineWrap(true);
- JScrollPane scrollPane = new JScrollPane(_message,
- ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
- ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
- builder.append(scrollPane, 3);
- builder.nextLine();
- builder.append(_stdOut);
- builder.append(stdErr);
- builder.nextLine();
-
- JComponent buttonBar = new ButtonBarBuilder().addGlue().addButton(okButton, cancelButton).build();
- buttonBar.setBorder(Borders.DIALOG);
-
- Container contentPane = getContentPane();
- contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
- contentPane.add(builder.getPanel());
- contentPane.add(buttonBar);
-
- pack();
- setResizable(false);
- }
-
- void showDialog(String serverId)
- {
- _target = serverId;
- _message.setText("");
- setLocationRelativeTo(_mainFrame);
- setVisible(true);
- }
-
- private JRadioButton _stdOut;
- private JTextArea _message = new JTextArea(3, 40);
- private String _target;
- private JFrame _mainFrame;
-}