Package org.rioproject.tools.ui.progresspanel

Examples of org.rioproject.tools.ui.progresspanel.WaitingDialog$DisplayDialogTask


                dialog.setVisible(true);
                final String name = u.getSelectedOpStringName();
                if(name==null)
                    return;
                final GraphNode node = graphView.getOpStringNode(name);
                final JDialog waitDialog = new WaitingDialog(frame, "Undeploying "+name+"...", 500);
                org.rioproject.tools.ui.util.SwingWorker worker = new org.rioproject.tools.ui.util.SwingWorker() {
                    public Object construct() {
                        try {
                            DeployAdmin dAdmin = (DeployAdmin)node.getProvisionMonitor().getAdmin();
                            dAdmin.undeploy(name);
                        } catch(OperationalStringException e) {
                            graphView.removeOpString(name);
                        } catch(Exception e) {
                            System.err.println("OUCH");
                            e.printStackTrace();
                        }
                        return null;
                    }

                    @Override
                    public void finished() {
                        waitDialog.dispose();
                    }
                };
                worker.start();
            }
        });
View Full Code Here


        for(OperationalString opString : opstrings) {
            if(opstringNames.length()>0)
                opstringNames.append(", ");
            opstringNames.append(opString.getName());
        }
        final JDialog dialog = new WaitingDialog(frame,
                                                 "Deploying "+opstringNames.toString()+"...",
                                                 500);
        SwingWorker worker = new SwingWorker() {
            public Object construct() {
                try {
                    ProvisionMonitor monitor = (ProvisionMonitor) item.service;
                    DeployAdmin dAdmin = (DeployAdmin) monitor.getAdmin();
                    for (OperationalString opString : opstrings) {
                        if (dAdmin.hasDeployed(opString.getName())) {
                            int result = JOptionPane.showConfirmDialog(frame,
                                                                       "The [" + opString.getName() + "] " +
                                                                       "is already deployed, " +
                                                                       "update the deployment?",
                                                                       "Update Deployed Application",
                                                                       JOptionPane.YES_NO_OPTION);
                            if (result == JOptionPane.YES_OPTION) {
                                dAdmin.getOperationalStringManager(opString.getName()).update(opString);
                            }
                        } else {
                            dAdmin.deploy(opString);
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    Util.showError(e, frame, "Failure trying to deploy " + deployName);
                }
                return null;
            }

            @Override
            public void finished() {
                dialog.dispose();
            }
        };
        worker.start();
    }
View Full Code Here

     * @param frame The UI's frame, used as the JOptionPane's parent if a confirm dialog or an error needs to be shown
     */
    public static void deploy(final String artifact,
                              final ServiceItem item,
                              final JFrame frame) {
        final JDialog dialog = new WaitingDialog(frame, "Deploying "+artifact+"...", 500);

        SwingWorker worker = new SwingWorker() {
            public Object construct() {
                try {
                    ProvisionMonitor monitor = (ProvisionMonitor) item.service;
                    DeployAdmin dAdmin = (DeployAdmin) monitor.getAdmin();
                    dAdmin.deploy(artifact);
                } catch (Exception e) {
                    e.printStackTrace();
                    Throwable cause = e.getCause();
                    if(cause != null) {
                        Throwable nested = cause.getCause();
                        Util.showError((nested==null?cause:nested),
                                       frame,
                                       "Failure trying to deploy artifact" + artifact);
                    } else {
                        Util.showError(e, frame, "Failure trying to deploy artifact" + artifact);
                    }
                }
                return null;
            }

            @Override
            public void finished() {
                dialog.dispose();
            }
        };
        worker.start();
    }
View Full Code Here

TOP

Related Classes of org.rioproject.tools.ui.progresspanel.WaitingDialog$DisplayDialogTask

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.