Example usage for java.beans PropertyChangeListener PropertyChangeListener

List of usage examples for java.beans PropertyChangeListener PropertyChangeListener

Introduction

In this page you can find the example usage for java.beans PropertyChangeListener PropertyChangeListener.

Prototype

PropertyChangeListener

Source Link

Usage

From source file:com.jidesoft.spring.richclient.docking.JideApplicationPage.java

protected DockableFrame createDockableFrame(final PageComponent pageComponent,
        JideViewDescriptor viewDescriptor) {

    if (log.isInfoEnabled()) {
        log.info("Creating dockable frame for page component " + pageComponent.getId());
    }/* w ww. j  a v  a  2  s  .c  o  m*/
    Icon icon = pageComponent.getIcon();
    if (icon == null) {
        IconSource iconSource = (IconSource) ApplicationServicesLocator.services().getService(IconSource.class);
        icon = iconSource.getIcon("applicationInfo.image");
    }
    DockableFrame dockableFrame = new DockableFrame(pageComponent.getId(), icon);
    dockableFrame.setTitle(pageComponent.getDisplayName());
    dockableFrame.setTabTitle(pageComponent.getDisplayName());
    dockableFrame.setFrameIcon(icon);
    if (viewDescriptor != null) {
        dockableFrame.getContext().setInitMode(viewDescriptor.getInitMode());
        dockableFrame.getContext().setInitSide(viewDescriptor.getInitSide());
        dockableFrame.getContext().setInitIndex(viewDescriptor.getInitIndex());
    } else {
        dockableFrame.getContext().setInitMode(DockContext.STATE_FRAMEDOCKED);
        dockableFrame.getContext().setInitSide(DockContext.DOCK_SIDE_EAST);
        dockableFrame.getContext().setInitIndex(0);
    }
    dockableFrame.addDockableFrameListener(new DockableFrameAdapter() {

        @Override
        public void dockableFrameRemoved(DockableFrameEvent event) {
            if (log.isDebugEnabled()) {
                log.debug("Frame removed event on " + pageComponent.getId());
            }
            fireClosed(pageComponent);
        }

        @Override
        public void dockableFrameActivated(DockableFrameEvent e) {
            if (log.isDebugEnabled()) {
                log.debug("Frame activated event on " + pageComponent.getId());
            }
            fireFocusLost(JideApplicationPage.this.workspaceComponent);
            fireFocusGained(pageComponent);
        }

        @Override
        public void dockableFrameDeactivated(DockableFrameEvent e) {
            if (log.isDebugEnabled()) {
                log.debug("Frame deactivated event on " + pageComponent.getId());
            }
            fireFocusLost(pageComponent);
        }
    });

    dockableFrame.getContentPane().setLayout(new BorderLayout());
    dockableFrame.getContentPane().add(pageComponent.getControl());

    // This is where the view specific toolbar and menu bar get added. Note,
    // that this is different from the editors. With the views they are part
    // of the dockable frame, but with editors we add them to the editor
    // pane itself in EditorComponentPane
    if (pageComponent instanceof JideAbstractView) {
        JideAbstractView view = (JideAbstractView) pageComponent;
        dockableFrame.setTitleBarComponent(view.getViewToolBar());
        dockableFrame.setJMenuBar(view.getViewMenuBar());
        final DockableFrame ff = dockableFrame;
        view.getDescriptor().addPropertyChangeListener("title", new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                ff.setTitle(evt.getNewValue().toString());
                ff.setTabTitle(pageComponent.getDisplayName());
            }

        });
    }
    return dockableFrame;
}

From source file:org.isatools.isacreator.filechooser.FileChooserUI.java

private JPanel createTopPanel() {

    final JTextField uri = new RoundedJTextField(20);
    final JTextField username = new RoundedJTextField(20);
    final JPasswordField password = new RoundedJPasswordField(20);

    final JPanel topContainer = new JPanel();
    topContainer.setLayout(new BoxLayout(topContainer, BoxLayout.PAGE_AXIS));
    topContainer.setBackground(UIHelper.BG_COLOR);

    HUDTitleBar titlePanel = new HUDTitleBar(null, null, true);
    add(titlePanel, BorderLayout.NORTH);
    titlePanel.installListeners();//  ww  w  .  ja  v a2s .  c  o m

    topContainer.add(titlePanel);

    JPanel buttonPanel = new JPanel(new GridLayout(1, 1));
    buttonPanel.setOpaque(false);

    JPanel fileSystemPanel = new JPanel();
    fileSystemPanel.setLayout(new BoxLayout(fileSystemPanel, BoxLayout.LINE_AXIS));
    fileSystemPanel.setBackground(UIHelper.BG_COLOR);

    localFsChoice = new JLabel(localFileSystemIcon, JLabel.LEFT);
    localFsChoice.setBackground(UIHelper.BG_COLOR);
    localFsChoice.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent event) {

            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    localFsChoice.setIcon(localFileSystemIconOver);
                    remoteFsChoice.setIcon(remoteFileSystemIcon);
                    ftpConnectionContainer.setVisible(false);
                    topContainer.revalidate();
                    status.setText("");
                    fileBrowser = new LocalBrowser();
                    try {
                        updateTree(fileBrowser.getHomeDirectory());
                    } catch (IOException e) {
                        FileBrowserTreeNode defaultFTPNode = new FileBrowserTreeNode("problem occurred!", false,
                                FileBrowserTreeNode.DIRECTORY);
                        updateTree(defaultFTPNode);
                    }

                }
            });

        }
    });

    fileSystemPanel.add(localFsChoice);
    fileSystemPanel.add(Box.createHorizontalStrut(5));

    remoteFsChoice = new JLabel(remoteFileSystemIcon, JLabel.LEFT);
    remoteFsChoice.setBackground(UIHelper.BG_COLOR);
    remoteFsChoice.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent event) {

            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    localFsChoice.setIcon(localFileSystemIcon);
                    remoteFsChoice.setIcon(remoteFileSystemIconOver);
                    ftpConnectionContainer.setVisible(true);
                    topContainer.revalidate();
                }
            });
            // immediately try to call FTP manager to get last sessions details
            final FTPAuthentication lastSession;
            if ((lastSession = ftpManager.getLastSession()) != null) {
                Thread remoteConnector = new Thread(new Runnable() {
                    public void run() {
                        connectToFTP(lastSession.getUri(), lastSession.getUsername(),
                                lastSession.getPassword());
                    }
                });
                remoteConnector.start();
            } else {
                errorAction("no ftp location");
            }

        }
    });

    fileSystemPanel.add(remoteFsChoice);
    fileSystemPanel.add(Box.createHorizontalStrut(5));

    status = UIHelper.createLabel("", UIHelper.VER_10_BOLD, UIHelper.DARK_GREEN_COLOR);
    status.setHorizontalAlignment(JLabel.RIGHT);

    fileSystemPanel.add(status);

    buttonPanel.add(fileSystemPanel);

    topContainer.add(buttonPanel);

    // now create panel to configure the FTP site
    ftpConnectionContainer = new JPanel(new GridLayout(1, 1));
    ftpConnectionContainer.setBackground(UIHelper.BG_COLOR);

    JPanel userAuthFTP = new JPanel();
    userAuthFTP.setLayout(new BoxLayout(userAuthFTP, BoxLayout.LINE_AXIS));
    userAuthFTP.setOpaque(false);

    // add field to add URI
    JPanel uriPanel = new JPanel(new GridLayout(1, 2));
    uriPanel.setBackground(UIHelper.BG_COLOR);

    JLabel uriLab = UIHelper.createLabel("FTP URI: ", UIHelper.VER_10_BOLD, UIHelper.DARK_GREEN_COLOR);
    UIHelper.renderComponent(uri, UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR, false);

    uriPanel.add(uriLab);
    uriPanel.add(uri);

    userAuthFTP.add(uriPanel);

    // add field to add username
    JPanel usernamePanel = new JPanel(new GridLayout(1, 2));
    usernamePanel.setBackground(UIHelper.BG_COLOR);

    JLabel usernameLab = UIHelper.createLabel("Username: ", UIHelper.VER_10_BOLD, UIHelper.DARK_GREEN_COLOR);

    UIHelper.renderComponent(username, UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR, false);

    uriPanel.add(usernameLab);
    uriPanel.add(username);

    userAuthFTP.add(usernamePanel);

    // add field to add password
    JPanel passwordPanel = new JPanel(new GridLayout(1, 2));
    passwordPanel.setBackground(UIHelper.BG_COLOR);

    JLabel passwordLab = UIHelper.createLabel("Password: ", UIHelper.VER_10_BOLD, UIHelper.DARK_GREEN_COLOR);

    UIHelper.renderComponent(password, UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR, false);

    passwordPanel.add(passwordLab);
    passwordPanel.add(password);

    userAuthFTP.add(passwordPanel);

    JLabel connectLab = new JLabel(connectIcon);
    connectLab.setOpaque(false);
    connectLab.setToolTipText("<html><b>Connect</b><p>Connect to the FTP source defined!</p></html>");

    connectLab.addMouseListener(new CommonMouseAdapter() {
        public void mousePressed(MouseEvent event) {
            super.mousePressed(event);
            if (uri.getText() != null && !uri.getText().trim().equals("")) {
                String user = (username.getText() != null) ? username.getText() : "";
                String pass = (password.getPassword() != null) ? new String(password.getPassword()) : "";

                final FTPAuthentication newFTPLocation = new FTPAuthentication(uri.getText(), user, pass);

                Thread remoteConnector = new Thread(new Runnable() {
                    public void run() {
                        connectToFTP(newFTPLocation.getUri(), newFTPLocation.getUsername(),
                                newFTPLocation.getPassword());
                    }
                });
                remoteConnector.start();
            }
        }

    });

    userAuthFTP.add(connectLab);

    JLabel historyLab = new JLabel(viewHistoryIcon);
    historyLab.setOpaque(false);
    historyLab.setToolTipText(
            "<html><b>Search previously connected to FTP locations</b><p>Connect to a previously defined FTP location</p></html>");
    historyLab.addMouseListener(new CommonMouseAdapter() {

        public void mousePressed(MouseEvent event) {
            super.mousePressed(event);
            SelectFromFTPHistory selectFTP = new SelectFromFTPHistory();
            selectFTP.addPropertyChangeListener("locationSelected", new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent event) {

                    if (event.getNewValue() != null) {
                        final FTPAuthentication ftpRecord = ftpManager
                                .retrieveFTPAuthenticationObject(event.getNewValue().toString());
                        Thread remoteConnector = new Thread(new Runnable() {
                            public void run() {
                                connectToFTP(ftpRecord.getUri(), ftpRecord.getUsername(),
                                        ftpRecord.getPassword());
                            }
                        });
                        remoteConnector.start();
                    }

                }
            });
            selectFTP.createGUI();
            showJDialogAsSheet(selectFTP);
        }

    });

    userAuthFTP.add(historyLab);

    ftpConnectionContainer.add(userAuthFTP);

    ftpConnectionContainer.setVisible(false);

    topContainer.add(ftpConnectionContainer);

    return topContainer;
}

From source file:org.drugis.addis.presentation.wizard.NetworkMetaAnalysisWizardPM.java

private ObservableList<Study> createStudiesIndicationOutcome() {
    final FilteredObservableList<Study> studies = new FilteredObservableList<Study>(d_domain.getStudies(),
            getIndicationOutcomeFilter());
    PropertyChangeListener listener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            studies.setFilter(getIndicationOutcomeFilter());
        }//from   w w w  .j  a v  a 2  s .c o m
    };
    d_indicationHolder.addPropertyChangeListener(listener);
    d_outcomeHolder.addPropertyChangeListener(listener);
    return studies;
}

From source file:edu.uchc.octane.Palm.java

/**
 * Does most of the plotting work/*  w w w .jav a  2s .c  o  m*/
 * @param type The type of PALM image
 * @param selected Trajectories to be included in the PALM plot
 */
void doConstructPALM(final PalmType type, final int[] selected) {

    class MySwingWorker extends SwingWorker<ImagePlus, Void> {

        @Override
        public ImagePlus doInBackground() {
            ImagePlus imp = null;

            for (int i = 0; i < selected.length; i++) {
                Trajectory traj = dataset_.getTrajectoryByIndex(selected[i]);

                switch (type) {
                case HEAD:
                    renderGaussianSpot(traj.get(0));
                    nPlotted_++;
                    break;
                case TAIL:
                    renderGaussianSpot(traj.get(traj.size() - 1));
                    nPlotted_++;
                    break;
                case AVERAGE:
                    renderAverage(traj);
                    break;
                case ALLPOINTS:
                    renderAllPoints(traj);
                    break;
                case TIMELAPSE:
                    renderMovie(traj);
                    break;
                }

                firePropertyChange("Progress", (double) i / selected.length,
                        (double) (i + 1) / selected.length);
            }

            if (bRenderInColor_) {
                processColor();
            } else {
                for (int i = 0; i < ips_.length; i++) {
                    stack_.addSlice("" + i, ips_[i]);
                }
            }

            if (stack_.getSize() > 1) {
                imp = new ImagePlus("PALM-" + imp_.getTitle(), stack_);
            } else {
                imp = new ImagePlus("PALM-" + imp_.getTitle(), stack_.getProcessor(1));
            }

            return imp;

        }

        @Override
        public void done() {
            ImagePlus imp = null;
            try {
                imp = get();
            } catch (InterruptedException e) {
                System.err.println("PALM thread interrupted");
            } catch (ExecutionException e) {
                IJ.log("PALM rendering error:" + e.getCause().getMessage());
                e.printStackTrace();
            }
            if (imp != null) {
                imp.show();
            }

        }
    }

    MySwingWorker task = new MySwingWorker();

    task.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName() == "Progress") {
                IJ.showProgress((Double) evt.getNewValue());
            }
        }
    });

    task.execute();

}

From source file:org.tinymediamanager.ui.tvshows.TvShowExtendedSearchPanel.java

public TvShowExtendedSearchPanel(TvShowTreeModel model, JTree tree) {
    super();/*from   w w  w.  j a  v  a2 s.  c  o  m*/
    setOpaque(false);
    shadowAlpha = 100;
    arcs = new Dimension(10, 10);

    this.tvShowTreeModel = model;
    this.tree = tree;

    // add a dummy mouse listener to prevent clicking through
    addMouseListener(new MouseAdapter() {
    });

    listCheckListener = new ListCheckListener() {
        @Override
        public void removeCheck(ListEvent event) {
            actionFilter.actionPerformed(new ActionEvent(event.getSource(), 1, "checked"));
        }

        @Override
        public void addCheck(ListEvent event) {
            actionFilter.actionPerformed(new ActionEvent(event.getSource(), 1, "checked"));
        }
    };

    setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
            FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC,
            ColumnSpec.decode("default:grow"), FormSpecs.UNRELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.UNRELATED_GAP_ROWSPEC, }));

    JLabel lblFilterBy = new JLabel(BUNDLE.getString("movieextendedsearch.filterby")); //$NON-NLS-1$
    setComponentFont(lblFilterBy);
    add(lblFilterBy, "2, 2, 3, 1");

    cbFilterNewEpisodes = new JCheckBox("");
    cbFilterNewEpisodes.setAction(actionFilter);
    add(cbFilterNewEpisodes, "2, 4");

    JLabel lblNewEpisodes = new JLabel(BUNDLE.getString("movieextendedsearch.newepisodes")); //$NON-NLS-1$
    setComponentFont(lblNewEpisodes);
    add(lblNewEpisodes, "4, 4, right, default");

    cbFilterWatched = new JCheckBox("");
    cbFilterWatched.setAction(actionFilter);
    cbFilterWatched.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterWatched, "2, 5");

    JLabel lblWatched = new JLabel(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$
    setComponentFont(lblWatched);
    add(lblWatched, "4, 5, right, default");

    cbWatched = new SmallComboBox(WatchedFlag.values());
    setComponentFont(cbWatched);
    cbWatched.setAction(actionFilter);
    add(cbWatched, "6, 5, fill, default");

    cbFilterGenres = new JCheckBox("");
    cbFilterGenres.setAction(actionFilter);
    cbFilterGenres.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterGenres, "2, 6");

    JLabel lblGenres = new JLabel(BUNDLE.getString("metatag.genre")); //$NON-NLS-1$
    setComponentFont(lblGenres);
    add(lblGenres, "4, 6, right, default");

    cbGenres = new SmallComboBox(MediaGenres.values());
    setComponentFont(cbGenres);
    cbGenres.setAction(actionFilter);
    add(cbGenres, "6, 6, fill, default");

    cbFilterCast = new JCheckBox("");
    cbFilterCast.setAction(actionFilter);
    cbFilterCast.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterCast, "2, 7");

    JLabel lblCastMember = new JLabel(BUNDLE.getString("movieextendedsearch.cast")); //$NON-NLS-1$
    setComponentFont(lblCastMember);
    add(lblCastMember, "4, 7, right, default");

    tfCastMember = new JTextField();
    setComponentFont(tfCastMember);
    tfCastMember.setBorder(new SmallTextFieldBorder());
    add(tfCastMember, "6, 7, fill, default");
    tfCastMember.setColumns(10);
    tfCastMember.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void changedUpdate(DocumentEvent e) {
            actionFilter.actionPerformed(null);
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            actionFilter.actionPerformed(null);
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            actionFilter.actionPerformed(null);
        }
    });

    cbFilterTag = new JCheckBox("");
    cbFilterTag.setAction(actionFilter);
    cbFilterTag.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterTag, "2, 8");

    JLabel lblTag = new JLabel(BUNDLE.getString("movieextendedsearch.tag")); //$NON-NLS-1$
    setComponentFont(lblTag);
    add(lblTag, "4, 8, right, default");

    cbTag = new SmallCheckComboBox();
    cbTag.setTextFor(CheckComboBox.NONE, BUNDLE.getString("movieextendedsearch.tags.selected.none")); //$NON-NLS-1$
    cbTag.setTextFor(CheckComboBox.MULTIPLE, BUNDLE.getString("movieextendedsearch.tags.selected.multiple")); //$NON-NLS-1$
    cbTag.setTextFor(CheckComboBox.ALL, BUNDLE.getString("movieextendedsearch.tags.selected.all")); //$NON-NLS-1$
    cbTag.getModel().addListCheckListener(listCheckListener);
    add(cbTag, "6, 8, fill, default");

    cbFilterVideoFormat = new JCheckBox("");
    cbFilterVideoFormat.setUI(CHECKBOX_UI); // $hide$
    cbFilterVideoFormat.setAction(actionFilter);
    add(cbFilterVideoFormat, "2, 9");

    JLabel lblVideoFormat = new JLabel(BUNDLE.getString("metatag.resolution")); //$NON-NLS-1$
    setComponentFont(lblVideoFormat);
    add(lblVideoFormat, "4, 9, right, default");

    cbVideoFormat = new SmallComboBox(getVideoFormats());
    setComponentFont(cbVideoFormat);
    cbVideoFormat.setAction(actionFilter);
    add(cbVideoFormat, "6, 9, fill, default");

    cbFilterVideoCodec = new JCheckBox("");
    cbFilterVideoCodec.setAction(actionFilter);
    cbFilterVideoCodec.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterVideoCodec, "2, 10");

    JLabel lblVideoCodec = new JLabel(BUNDLE.getString("metatag.videocodec")); //$NON-NLS-1$
    setComponentFont(lblVideoCodec);
    add(lblVideoCodec, "4, 10, right, default");

    cbVideoCodec = new SmallComboBox();
    setComponentFont(cbVideoCodec);
    cbVideoCodec.setAction(actionFilter);
    add(cbVideoCodec, "6, 10, fill, default");

    cbFilterAudioCodec = new JCheckBox("");
    cbFilterAudioCodec.setAction(actionFilter);
    cbFilterAudioCodec.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterAudioCodec, "2, 11");

    JLabel lblAudioCodec = new JLabel(BUNDLE.getString("metatag.audiocodec")); //$NON-NLS-1$
    setComponentFont(lblAudioCodec);
    add(lblAudioCodec, "4, 11, right, default");

    cbAudioCodec = new SmallComboBox();
    setComponentFont(cbAudioCodec);
    cbAudioCodec.setAction(actionFilter);
    add(cbAudioCodec, "6, 11, fill, default");

    cbFilterDatasource = new JCheckBox("");
    cbFilterDatasource.setAction(actionFilter);
    cbFilterDatasource.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterDatasource, "2, 12");

    JLabel lblDatasource = new JLabel(BUNDLE.getString("metatag.datasource")); //$NON-NLS-1$
    setComponentFont(lblDatasource);
    add(lblDatasource, "4, 12, right, default");

    cbDatasource = new SmallCheckComboBox();
    cbDatasource.setTextFor(CheckComboBox.NONE, BUNDLE.getString("checkcombobox.selected.none")); //$NON-NLS-1$
    cbDatasource.setTextFor(CheckComboBox.MULTIPLE, BUNDLE.getString("checkcombobox.selected.multiple")); //$NON-NLS-1$
    cbDatasource.setTextFor(CheckComboBox.ALL, BUNDLE.getString("checkcombobox.selected.all")); //$NON-NLS-1$
    cbDatasource.getModel().addListCheckListener(listCheckListener);
    add(cbDatasource, "6, 12, fill, default");

    cbFilterMediaSource = new JCheckBox("");
    cbFilterMediaSource.setAction(actionFilter);
    cbFilterMediaSource.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterMediaSource, "2, 13");

    lblMediaSource = new JLabel(BUNDLE.getString("metatag.source")); //$NON-NLS-1$
    setComponentFont(lblMediaSource);
    add(lblMediaSource, "4, 13, right, default");

    cbMediaSource = new SmallComboBox(MediaSource.values());
    setComponentFont(cbMediaSource);
    cbMediaSource.setAction(actionFilter);
    add(cbMediaSource, "6, 13, fill, default");

    cbFilterMissingMetadata = new JCheckBox("");
    cbFilterMissingMetadata.setAction(actionFilter);
    cbFilterMissingMetadata.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterMissingMetadata, "2, 14");

    JLabel lblMissingMetadata = new JLabel(BUNDLE.getString("movieextendedsearch.missingmetadata")); //$NON-NLS-1$
    setComponentFont(lblMissingMetadata);
    add(lblMissingMetadata, "4, 14, right, default");

    cbFilterMissingArtwork = new JCheckBox("");
    cbFilterMissingArtwork.setAction(actionFilter);
    cbFilterMissingArtwork.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterMissingArtwork, "2, 15");

    JLabel lblMissingArtwork = new JLabel(BUNDLE.getString("movieextendedsearch.missingartwork")); //$NON-NLS-1$
    setComponentFont(lblMissingArtwork);
    add(lblMissingArtwork, "4, 15, right, default");

    cbFilterMissingSubtitles = new JCheckBox("");
    cbFilterMissingSubtitles.setAction(actionFilter);
    cbFilterMissingSubtitles.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterMissingSubtitles, "2, 16");

    JLabel lblMissingSubtitles = new JLabel(BUNDLE.getString("movieextendedsearch.missingsubtitles")); //$NON-NLS-1$
    setComponentFont(lblMissingSubtitles);
    add(lblMissingSubtitles, "4, 16, right, default");
    cbFilterNewEpisodes.setUI(CHECKBOX_UI); // $hide$

    PropertyChangeListener propertyChangeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getSource() instanceof TvShowSettings && "tvShowDataSource".equals(evt.getPropertyName())) {
                buildAndInstallDatasourceArray();
            }
            if (evt.getSource() instanceof TvShowList && "tag".equals(evt.getPropertyName())) {
                buildAndInstallTagsArray();
            }
            if (evt.getSource() instanceof TvShowList && ("audioCodec".equals(evt.getPropertyName())
                    || "videoCodec".equals(evt.getPropertyName()))) {
                buildAndInstallCodecArray();
            }
        }
    };
    tvShowList.addPropertyChangeListener(propertyChangeListener);
    TvShowModuleManager.SETTINGS.addPropertyChangeListener(propertyChangeListener);

    buildAndInstallDatasourceArray();
    buildAndInstallTagsArray();
    buildAndInstallCodecArray();
}

From source file:edu.ku.brc.specify.config.SpecifyGUIDGeneratorFactory.java

/**
 * @param pcl//from  w  w  w. jav  a  2s  .c  o  m
 * @param classes
 */
public static void buildAllGUIDsAynch(final PropertyChangeListener pcl, final ArrayList<Class<?>> classes) {
    final String COUNT = "COUNT";

    final GhostGlassPane glassPane = UIRegistry.writeGlassPaneMsg(getResourceString("SETTING_GUIDS"),
            UIRegistry.STD_FONT_SIZE);
    glassPane.setProgress(0);

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            if (SubPaneMgr.getInstance().aboutToShutdown()) {
                Taskable task = TaskMgr.getTask("Startup");
                if (task != null) {
                    SubPaneIFace splash = edu.ku.brc.specify.tasks.StartUpTask
                            .createFullImageSplashPanel(task.getTitle(), task);
                    SubPaneMgr.getInstance().addPane(splash);
                    SubPaneMgr.getInstance().showPane(splash);
                }

                final GUIDWorker worker = new GUIDWorker() {
                    protected Integer doInBackground() throws Exception {
                        if (getInstance() instanceof SpecifyGUIDGeneratorFactory) {
                            SpecifyGUIDGeneratorFactory guidGen = (SpecifyGUIDGeneratorFactory) getInstance();
                            guidGen.buildGUIDs(this);
                        }
                        return null;
                    }

                    @Override
                    public void propertyChange(PropertyChangeEvent evt) {
                        if (evt.getPropertyName().equals("COUNT")) {
                            firePropertyChange("COUNT", 0, evt.getNewValue());
                        }
                    }

                    @Override
                    protected void done() {
                        glassPane.setProgress(100);
                        UIRegistry.clearGlassPaneMsg();
                        if (pcl != null) {
                            pcl.propertyChange(new PropertyChangeEvent(this, "complete", "true", "true"));
                        }
                    }
                };

                worker.addPropertyChangeListener(new PropertyChangeListener() {
                    public void propertyChange(final PropertyChangeEvent evt) {
                        if (COUNT.equals(evt.getPropertyName())) {
                            glassPane.setProgress((int) (((Integer) evt.getNewValue() * 100.0)
                                    / (double) CATEGORY_TYPE.values().length));
                        }
                    }
                });
                worker.execute();
            }
        }
    });

}

From source file:net.grinder.SingleConsole.java

/**
 * Distribute files on agents.// www .j a  va  2s .  c  om
 *
 * @param listener listener
 * @param safe     safe mode
 */
public void distributeFiles(ListenerSupport<FileDistributionListener> listener, final boolean safe) {
    final FileDistribution fileDistribution = getConsoleComponent(FileDistribution.class);
    final AgentCacheState agentCacheState = fileDistribution.getAgentCacheState();
    final Condition cacheStateCondition = new Condition();
    agentCacheState.addListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent ignored) {
            synchronized (cacheStateCondition) {
                cacheStateCondition.notifyAll();
            }
        }
    });
    final MutableBoolean safeDist = new MutableBoolean(safe);
    ConsoleProperties consoleComponent = getConsoleComponent(ConsoleProperties.class);
    final File file = consoleComponent.getDistributionDirectory().getFile();
    if (listener != null) {
        listener.apply(new Informer<FileDistributionListener>() {
            @Override
            public void inform(FileDistributionListener listener) {
                safeDist.setValue(listener.start(file, safe));
            }
        });
    }
    final FileDistributionHandler distributionHandler = fileDistribution.getHandler();
    // When cancel is called.. stop processing.
    int fileCount = 0;
    while (!cancel) {
        try {
            final FileDistributionHandler.Result result = distributionHandler.sendNextFile();
            fileCount++;
            if (result == null) {
                break;
            }
            if (listener != null) {
                listener.apply(new Informer<FileDistributionListener>() {
                    @Override
                    public void inform(FileDistributionListener listener) {
                        listener.distributed(result.getFileName());
                    }
                });
            }

            if (safeDist.isTrue()) {
                // The cache status is updated asynchronously by agent
                // reports. If the listener is registered, this waits for up
                // to five seconds for
                // all agents to indicate that they are up to date.
                checkSafetyWithCacheState(fileDistribution, cacheStateCondition, 1);
            }
        } catch (FileContents.FileContentsException e) {
            throw processException("Error while distribute files for " + getConsolePort());
        }
    }
    if (safeDist.isFalse()) {
        ThreadUtils.sleep(1000);
        checkSafetyWithCacheState(fileDistribution, cacheStateCondition, fileCount);
    }
}

From source file:org.squidy.designer.zoom.ContainerShape.java

@Override
public void initializeLayout() {
    super.initializeLayout();

    final ImageButton startProcessing = new ImageButton(
            ActionShape.class.getResource("/images/24x24/media_play_green.png"), "Start");
    final ImageButton stopProcessing = new ImageButton(
            ActionShape.class.getResource("/images/24x24/media_stop_red.png"), "Stop");
    stopProcessing.setEnabled(false);//from   w w w .j av  a 2s.  c o m

    startProcessing.addZoomActionListener(new ZoomActionListener() {

        /**
         * @param e
         */
        public void actionPerformed(ZoomActionEvent e) {

            new Thread() {

                /*
                 * (non-Javadoc)
                 * 
                 * @see java.lang.Thread#run()
                 */
                @Override
                public void run() {
                    if (!getProcessable().isProcessing()) {
                        startProcessing.setEnabled(false);
                        stopProcessing.setEnabled(true);
                        invalidatePaint();
                        ContainerShape.this.start();
                        ContainerShape.this.doStart();

                        Manager.get().notify(getProcessable(), Action.START);
                    }
                }
            }.start();
        }
    });

    stopProcessing.addZoomActionListener(new ZoomActionListener() {

        /**
         * @param e
         */
        public void actionPerformed(ZoomActionEvent e) {
            new Thread() {

                /*
                 * (non-Javadoc)
                 * 
                 * @see java.lang.Thread#run()
                 */
                @Override
                public void run() {
                    // if (getProcessable().isProcessing()) {
                    startProcessing.setEnabled(true);
                    stopProcessing.setEnabled(false);
                    invalidatePaint();
                    ContainerShape.this.stop();
                    ContainerShape.this.doStop();
                    // }

                    Manager.get().notify(getProcessable(), Action.STOP);
                }
            }.start();
        }
    });

    ImageButton delete = new ImageButton(ActionShape.class.getResource("/images/24x24/delete2.png"), "Delete");
    delete.addZoomActionListener(new ZoomActionListener() {

        /*
         * (non-Javadoc)
         * 
         * @see
         * org.squidy.designer.event.ZoomActionListener#actionPerformed
         * (org.squidy.designer.event.ZoomActionEvent)
         */
        public void actionPerformed(ZoomActionEvent e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Pressed delete on " + getBreadcrumb());
            }

            int option = JOptionPane.showConfirmDialog(Designer.getInstance(),
                    "Would you like to delete " + getTitle() + "?", "Delete?", JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.QUESTION_MESSAGE,
                    new ImageIcon(ActionShape.class.getResource("/images/delete.png")));

            if (option == JOptionPane.OK_OPTION) {
                ZoomShape<?> zoomShape = null;
                if (currentZoomState == ZoomState.ZOOM_IN && getParent() instanceof ZoomShape<?>) {
                    zoomShape = (ZoomShape<?>) getParent();
                }
                delete();
                if (zoomShape != null) {
                    zoomShape.animateToCenterView(e.getCamera());

                    // Set pipe shapes visible and pickable.
                    for (Object child : zoomShape.getChildrenReference()) {
                        if (child instanceof PipeShape) {
                            ShapeUtils.setApparent((PipeShape) child, true);
                        }
                    }
                }

                Manager.get().notify(getProcessable(), Action.DELETE);
            }
        }
    });

    ImageButton duplicate = new ImageButton(ActionShape.class.getResource("/images/24x24/copy.png"),
            "Duplicate");
    duplicate.addZoomActionListener(new ZoomActionListener() {

        /*
         * (non-Javadoc)
         * 
         * @see
         * org.squidy.designer.event.ZoomActionListener#actionPerformed
         * (org.squidy.designer.event.ZoomActionEvent)
         */
        public void actionPerformed(ZoomActionEvent e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Duplicate has been pressed for " + getBreadcrumb());
            }

            Manager.get().notify(getProcessable(), Action.DUPLICATE);
        }
    });
    duplicate.setEnabled(false);

    ImageButton publish = new ImageButton(ActionShape.class.getResource("/images/24x24/export2.png"),
            "Publish");
    publish.addZoomActionListener(new ZoomActionListener() {

        /*
         * (non-Javadoc)
         * 
         * @see
         * org.squidy.designer.event.ZoomActionListener#actionPerformed
         * (org.squidy.designer.event.ZoomActionEvent)
         */
        public void actionPerformed(ZoomActionEvent e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Publish has been pressed for " + getBreadcrumb());
            }

            Storable storable = ShapeUtils.getObjectInHierarchy(Storable.class, ContainerShape.this);
            if (storable != null) {
                storable.store();
            }
        }
    });
    publish.setEnabled(false);

    ImageButton update = new ImageButton(ActionShape.class.getResource("/images/24x24/import1.png"), "Update");
    update.addZoomActionListener(new ZoomActionListener() {

        /*
         * (non-Javadoc)
         * 
         * @see
         * org.squidy.designer.event.ZoomActionListener#actionPerformed
         * (org.squidy.designer.event.ZoomActionEvent)
         */
        public void actionPerformed(ZoomActionEvent e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Update has been pressed for " + getBreadcrumb());
            }
        }
    });
    update.setEnabled(false);

    addPropertyChangeListener(Processable.PROPERTY_PROCESSING, new PropertyChangeListener() {

        /*
        * (non-Javadoc)
        * 
        * 
        * 
        * @seejava.beans.PropertyChangeListener#propertyChange(java.
        * beans. PropertyChangeEvent)
        */
        public void propertyChange(PropertyChangeEvent evt) {
            startProcessing.setEnabled(!(Boolean) evt.getNewValue());
            stopProcessing.setEnabled((Boolean) evt.getNewValue());

            if ((Boolean) evt.getNewValue())
                doStart();
            else
                doStop();
        }
    });

    //      addPropertyChangeListener(Processable.PROPERTY_PROCESSING_STOP,
    //            new PropertyChangeListener() {
    //
    //               /*
    //                * (non-Javadoc)
    //                * 
    //                * 
    //                * 
    //                * @seejava.beans.PropertyChangeListener#propertyChange(java.
    //                * beans. PropertyChangeEvent)
    //                */
    //               public void propertyChange(PropertyChangeEvent evt) {
    //                  // startProcessing.setToggleState(ZoomToggle.RELEASED);
    //                  // stopProcessing.setToggleState(ZoomToggle.PRESSED);
    //                  startProcessing.setEnabled(true);
    //                  stopProcessing.setEnabled(false);
    //                  doStop();
    //               }
    //            });

    ShapeUtils.setApparent(startProcessing, false);
    ShapeUtils.setApparent(stopProcessing, false);
    if (!(this instanceof WorkspaceShape)) {
        ShapeUtils.setApparent(delete, false);
        ShapeUtils.setApparent(duplicate, false);
        ShapeUtils.setApparent(publish, false);
        ShapeUtils.setApparent(update, false);
    }

    addAction(startProcessing);
    addAction(stopProcessing);
    if (!(this instanceof WorkspaceShape)) {
        addAction(delete);
        addAction(duplicate);
        addAction(publish);
        addAction(update);
    }
}

From source file:edu.ku.brc.specify.web.HttpLargeFileTransfer.java

/**
 * @param fileName/*w w  w.  j  av  a2  s  . c  o m*/
 * @param urlStr
 * @param isSiteFile
 * @param propChgListener
 */
public void transferFile(final String fileName, final String urlStr, final boolean isSiteFile,
        final PropertyChangeListener propChgListener) {

    final String prgName = HttpLargeFileTransfer.class.toString();

    final File file = new File(fileName);
    if (file.exists()) {
        final long fileSize = file.length();
        if (fileSize > 0) {
            SwingWorker<Integer, Integer> backupWorker = new SwingWorker<Integer, Integer>() {
                protected String errorMsg = null;
                protected FileInputStream fis = null;
                protected OutputStream fos = null;
                protected int nChunks = 0;

                /* (non-Javadoc)
                 * @see javax.swing.SwingWorker#doInBackground()
                 */
                @Override
                protected Integer doInBackground() throws Exception {
                    try {
                        Thread.sleep(100);
                        fis = new FileInputStream(file);

                        nChunks = (int) (fileSize / MAX_CHUNK_SIZE);
                        if (fileSize % MAX_CHUNK_SIZE > 0) {
                            nChunks++;
                        }

                        byte[] buf = new byte[BUFFER_SIZE];
                        long bytesRemaining = fileSize;

                        String clientID = String.valueOf((long) (Long.MIN_VALUE * Math.random()));

                        URL url = new URL(urlStr);

                        UIRegistry.getStatusBar().setProgressRange(prgName, 0, nChunks);

                        for (int i = 0; i < nChunks; i++) {
                            firePropertyChange(prgName, i - 1, i == nChunks - 1 ? Integer.MAX_VALUE : i);
                            if (i == nChunks - 1) {
                                Thread.sleep(500);
                                int x = 0;
                                x++;
                            }

                            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                            conn.setRequestMethod("PUT");
                            conn.setDoOutput(true);
                            conn.setDoInput(true);
                            conn.setUseCaches(false);

                            int chunkSize = (int) ((bytesRemaining > MAX_CHUNK_SIZE) ? MAX_CHUNK_SIZE
                                    : bytesRemaining);
                            bytesRemaining -= chunkSize;

                            conn.setRequestProperty("Content-Type", "application/octet-stream");
                            conn.setRequestProperty("Content-Length", String.valueOf(chunkSize));

                            conn.setRequestProperty(CLIENT_ID_HEADER, clientID);
                            conn.setRequestProperty(FILE_NAME_HEADER, fileName);
                            conn.setRequestProperty(FILE_CHUNK_COUNT_HEADER, String.valueOf(nChunks));
                            conn.setRequestProperty(FILE_CHUNK_HEADER, String.valueOf(i));
                            conn.setRequestProperty(SERVICE_NUMBER, "10");
                            conn.setRequestProperty(IS_SITE_FILE, Boolean.toString(isSiteFile));

                            fos = conn.getOutputStream();

                            //UIRegistry.getStatusBar().setProgressRange(prgName, 0, (int)((double)chunkSize / BUFFER_SIZE));
                            int cnt = 0;
                            int bytesRead = 0;
                            while (bytesRead < chunkSize) {
                                int read = fis.read(buf);
                                if (read == -1) {
                                    break;

                                } else if (read > 0) {
                                    bytesRead += read;
                                    fos.write(buf, 0, read);
                                }
                                cnt++;
                                //firePropertyChange(prgName, cnt-1, cnt);
                            }
                            fos.close();

                            if (conn.getResponseCode() != HttpServletResponse.SC_OK) {
                                System.err.println(
                                        conn.getResponseMessage() + " " + conn.getResponseCode() + " ");
                                BufferedReader in = new BufferedReader(
                                        new InputStreamReader(conn.getErrorStream()));
                                String line = null;
                                StringBuilder sb = new StringBuilder();
                                while ((line = in.readLine()) != null) {
                                    sb.append(line);
                                    sb.append("\n");
                                }
                                System.out.println(sb.toString());
                                in.close();

                            } else {
                                System.err.println("OK");
                            }
                            //UIRegistry.getStatusBar().setProgressRange(prgName, 0, nChunks);
                            firePropertyChange(prgName, i - 1, i == nChunks - 1 ? Integer.MAX_VALUE : i);
                        }

                    } catch (IOException ex) {
                        errorMsg = ex.toString();
                    }

                    //firePropertyChange(prgName, 0, 100);
                    return null;
                }

                @Override
                protected void done() {
                    super.done();

                    UIRegistry.getStatusBar().setProgressDone(prgName);

                    UIRegistry.clearSimpleGlassPaneMsg();

                    if (StringUtils.isNotEmpty(errorMsg)) {
                        UIRegistry.showError(errorMsg);
                    }

                    if (propChgListener != null) {
                        propChgListener.propertyChange(
                                new PropertyChangeEvent(HttpLargeFileTransfer.this, "Done", 0, 1));
                    }
                }
            };

            final JStatusBar statusBar = UIRegistry.getStatusBar();
            statusBar.setIndeterminate(HttpLargeFileTransfer.class.toString(), true);

            UIRegistry.writeSimpleGlassPaneMsg(getLocalizedMessage("Transmitting..."), 24);

            backupWorker.addPropertyChangeListener(new PropertyChangeListener() {
                public void propertyChange(final PropertyChangeEvent evt) {
                    System.out.println(evt.getPropertyName() + "  " + evt.getNewValue());
                    if (prgName.equals(evt.getPropertyName())) {
                        Integer value = (Integer) evt.getNewValue();
                        if (value == Integer.MAX_VALUE) {
                            statusBar.setIndeterminate(prgName, true);
                            UIRegistry.writeSimpleGlassPaneMsg(
                                    getLocalizedMessage("Transfering data into the database."), 24);

                        } else {
                            statusBar.setValue(prgName, value);
                        }
                    }
                }
            });
            backupWorker.execute();

        } else {
            // file doesn't exist
        }
    } else {
        // file doesn't exist
    }
}

From source file:edu.ku.brc.af.core.db.MySQLBackupService.java

/**
 * Does the backup on a SwingWorker Thread.
 * @param isMonthly whether it is a monthly backup
 * @param doSendAppExit requests sending an application exit command when done
 * @return true if the prefs are set up and there were no errors before the SwingWorker thread was started
 */// www .  j a  va  2  s  .  c  o m
private boolean doBackUp(final boolean isMonthly, final boolean doSendAppExit,
        final PropertyChangeListener propChgListener) {
    AppPreferences remotePrefs = AppPreferences.getLocalPrefs();

    final String mysqldumpLoc = remotePrefs.get(MYSQLDUMP_LOC, getDefaultMySQLDumpLoc());
    final String backupLoc = remotePrefs.get(MYSQLBCK_LOC, getDefaultBackupLoc());

    if (!(new File(mysqldumpLoc)).exists()) {
        UIRegistry.showLocalizedError("MySQLBackupService.MYSQL_NO_DUMP", mysqldumpLoc);
        if (propChgListener != null) {
            propChgListener.propertyChange(new PropertyChangeEvent(MySQLBackupService.this, ERROR, 0, 1));
        }
        return false;
    }

    File backupDir = new File(backupLoc);
    if (!backupDir.exists()) {
        if (!backupDir.mkdir()) {
            UIRegistry.showLocalizedError("MySQLBackupService.MYSQL_NO_BK_DIR", backupDir.getAbsoluteFile());
            if (propChgListener != null) {
                propChgListener.propertyChange(new PropertyChangeEvent(MySQLBackupService.this, ERROR, 0, 1));
            }
            return false;
        }
    }

    errorMsg = null;

    final String databaseName = DBConnection.getInstance().getDatabaseName();

    getNumberofTables();

    SwingWorker<Integer, Integer> backupWorker = new SwingWorker<Integer, Integer>() {
        protected String fullPath = null;

        /* (non-Javadoc)
         * @see javax.swing.SwingWorker#doInBackground()
         */
        @Override
        protected Integer doInBackground() throws Exception {
            FileOutputStream backupOut = null;
            try {
                Thread.sleep(100);

                // Create output file
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd_kk_mm_ss");
                String fileName = sdf.format(Calendar.getInstance().getTime()) + (isMonthly ? "_monthly" : "")
                        + ".sql";

                fullPath = backupLoc + File.separator + fileName;

                File file = new File(fullPath);
                backupOut = new FileOutputStream(file);

                writeStats(getCollectionStats(getTableNames()), getStatsName(fullPath));

                String userName = DBConnection.getInstance().getUserName();
                String password = DBConnection.getInstance().getPassword();

                if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password)) {
                    Pair<String, String> up = UserAndMasterPasswordMgr.getInstance().getUserNamePasswordForDB();
                    if (up != null && up.first != null && up.second != null) {
                        userName = up.first;
                        password = up.second;
                    }
                }

                String port = DatabaseDriverInfo.getDriver(DBConnection.getInstance().getDriverName())
                        .getPort();
                String server = DBConnection.getInstance().getServerName();

                Vector<String> args = new Vector<String>();
                args.add(mysqldumpLoc);
                args.add("--user=" + userName);
                args.add("--password=" + password);
                args.add("--host=" + server);
                if (port != null) {
                    args.add("--port=" + port);
                }
                args.add(databaseName);
                Process process = Runtime.getRuntime().exec(args.toArray(new String[0]));

                InputStream input = process.getInputStream();
                byte[] bytes = new byte[8192 * 2];

                double oneMeg = (1024.0 * 1024.0);
                long dspMegs = 0;
                long totalBytes = 0;

                do {
                    int numBytes = input.read(bytes, 0, bytes.length);
                    totalBytes += numBytes;
                    if (numBytes > 0) {
                        long megs = (long) (totalBytes / oneMeg);
                        if (megs != dspMegs) {
                            dspMegs = megs;
                            long megsWithTenths = (long) ((totalBytes * 10.0) / oneMeg);
                            firePropertyChange(MEGS, 0, megsWithTenths);
                        }

                        backupOut.write(bytes, 0, numBytes);

                    } else {
                        break;
                    }

                } while (true);

                StringBuilder sb = new StringBuilder();

                String line;
                BufferedReader errIn = new BufferedReader(new InputStreamReader(process.getErrorStream()));
                while ((line = errIn.readLine()) != null) {
                    //System.err.println(line);
                    if (line.startsWith("ERR") || StringUtils.contains(line, "Got error")) {
                        sb.append(line);
                        sb.append("\n");

                        if (StringUtils.contains(line, "1044") && StringUtils.contains(line, "LOCK TABLES")) {
                            sb.append("\n");
                            sb.append(UIRegistry.getResourceString("MySQLBackupService.LCK_TBL_ERR"));
                            sb.append("\n");
                        }
                    }
                }
                errorMsg = sb.toString();

            } catch (Exception ex) {
                ex.printStackTrace();
                errorMsg = ex.toString();
                UIRegistry.showLocalizedError("MySQLBackupService.EXCP_BK");

            } finally {
                if (backupOut != null) {
                    try {
                        backupOut.flush();
                        backupOut.close();

                    } catch (IOException ex) {
                        ex.printStackTrace();
                        errorMsg = ex.toString();
                    }
                }
            }

            return null;
        }

        @Override
        protected void done() {
            super.done();

            UIRegistry.getStatusBar().setProgressDone(STATUSBAR_NAME);

            UIRegistry.clearSimpleGlassPaneMsg();

            if (StringUtils.isNotEmpty(errorMsg)) {
                UIRegistry.showError(errorMsg);
            }

            if (doSendAppExit) {
                CommandDispatcher.dispatch(new CommandAction("App", "AppReqExit"));
            }

            if (propChgListener != null) {
                propChgListener
                        .propertyChange(new PropertyChangeEvent(MySQLBackupService.this, DONE, null, fullPath));
            }
        }
    };

    final JStatusBar statusBar = UIRegistry.getStatusBar();
    statusBar.setIndeterminate(STATUSBAR_NAME, true);

    UIRegistry.writeSimpleGlassPaneMsg(getLocalizedMessage("MySQLBackupService.BACKINGUP", databaseName), 24);

    backupWorker.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(final PropertyChangeEvent evt) {
            if (MEGS.equals(evt.getPropertyName())) {
                long value = (Long) evt.getNewValue();
                double val = value / 10.0;
                statusBar.setText(UIRegistry.getLocalizedMessage("MySQLBackupService.BACKUP_MEGS", val));
            }
        }
    });
    backupWorker.execute();

    return true;
}