Package org.openide

Examples of org.openide.NotificationLineSupport


            if (nbInfoForeground == null) {
                nbInfoForeground = UIManager.getColor("Label.foreground"); //NOI18N
            }

            notificationLine = new FixedHeightLabel();
            NotificationLineSupport nls = nd.getNotificationLineSupport();
            if (nls.getInformationMessage() != null) {
                updateNotificationLine(this, MSG_TYPE_INFO, nls.getInformationMessage());
            } else if (nls.getWarningMessage() != null) {
                updateNotificationLine(this, MSG_TYPE_WARNING, nls.getWarningMessage());
            } else if (nls.getErrorMessage() != null) {
                updateNotificationLine(this, MSG_TYPE_ERROR, nls.getErrorMessage());
            }
            toAdd.add(notificationLine, BorderLayout.SOUTH);
            messageComponent = toAdd;
        }
        getContentPane().add(messageComponent, BorderLayout.CENTER);
View Full Code Here


        ok.setDefaultCapable(true);
        NotifyDescriptor d = new NotifyDescriptor(this,
                NbBundle.getMessage(MasterPasswordPanel.class, "MasterPasswordPanel.enter_master_password"),
                NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.PLAIN_MESSAGE,
                new Object[] {ok, NotifyDescriptor.CANCEL_OPTION}, ok);
        final NotificationLineSupport notification = d.createNotificationLineSupport();
        setNewBox.setEnabled(!fresh);
        final Runnable update = new Runnable() {
            public void run() {
                if (masterPasswordField.getPassword().length == 0) {
                    notification.setInformationMessage(NbBundle.getMessage(MasterPasswordPanel.class, "MasterPasswordPanel.enter_password"));
                    ok.setEnabled(false);
                    return;
                }
                boolean changing = setNewBox.isSelected();
                newLabel1.setEnabled(changing);
                newField1.setEnabled(changing);
                newLabel2.setEnabled(changing);
                newField2.setEnabled(changing);
                if (changing) {
                    if (newField1.getPassword().length == 0) {
                        notification.setInformationMessage(NbBundle.getMessage(MasterPasswordPanel.class, "MasterPasswordPanel.enter_new_password"));
                        ok.setEnabled(false);
                        return;
                    }
                    // XXX issue warning in case non-ASCII characters encountered
                    if (!Arrays.equals(newField1.getPassword(), newField2.getPassword())) {
                        notification.setInformationMessage(NbBundle.getMessage(MasterPasswordPanel.class, "MasterPasswordPanel.password_mismatch"));
                        ok.setEnabled(false);
                        return;
                    }
                }
                notification.clearMessages();
                ok.setEnabled(true);
            }
        };
        DocumentListener listener = new DocumentListener() {
            public void insertUpdate(DocumentEvent e) {
View Full Code Here

            if (nbInfoForeground == null) {
                nbInfoForeground = UIManager.getColor("Label.foreground"); //NOI18N
            }

            notificationLine = new FixedHeightLabel();
            NotificationLineSupport nls = nd.getNotificationLineSupport();
            if (nls.getInformationMessage() != null) {
                updateNotificationLine(this, MSG_TYPE_INFO, nls.getInformationMessage());
            } else if (nls.getWarningMessage() != null) {
                updateNotificationLine(this, MSG_TYPE_WARNING, nls.getWarningMessage());
            } else if (nls.getErrorMessage() != null) {
                updateNotificationLine(this, MSG_TYPE_ERROR, nls.getErrorMessage());
            }
            toAdd.add(notificationLine, BorderLayout.SOUTH);
            messageComponent = toAdd;
        }
        getContentPane().add(messageComponent, BorderLayout.CENTER);
View Full Code Here

                        new HelpCtx(ClonePathsWizardPanel.class.getName()
                                    + ".change"),                       //NOI18N
                        null);                          //action listener
        dialogDescriptor.setClosingOptions(new Object[] {clear, CANCEL_OPTION});

        final NotificationLineSupport notificationLineSupport
                = dialogDescriptor.createNotificationLineSupport();

        class RepositoryChangeListener implements ChangeListener, ActionListener {
            private Dialog dialog;
            public void setDialog(Dialog dialog) {
                this.dialog = dialog;
            }
            public void stateChanged(ChangeEvent e) {
                assert e.getSource() == repository;
                boolean isValid = repository.isValid();
                dialogDescriptor.setValid(isValid);
                set.setEnabled(isValid);
                if (isValid) {
                    notificationLineSupport.clearMessages();
                } else {
                    String errMsg = repository.getMessage();
                    if ((errMsg != null) && (errMsg.length() != 0)) {
                        notificationLineSupport.setErrorMessage(errMsg);
                    } else {
                        notificationLineSupport.clearMessages();
                    }
                }
            }
            public void actionPerformed(ActionEvent e) {
                if (e.getSource() != set) {
                    return;
                }

                try {
                    //remember the selected URL:
                    dialogDescriptor.setValue(repository.getUrl());

                    /*
                     * option "set" is not closing so we must handle closing
                     * of the dialog explictly here:
                     */
                    dialog.setVisible(false);
                    dialog.dispose();
                } catch (MalformedURLException ex) {
                    repository.setInvalid();
                    notificationLineSupport.setErrorMessage(ex.getMessage());
                } catch (URISyntaxException ex) {
                    repository.setInvalid();
                    notificationLineSupport.setErrorMessage(ex.getMessage());
                }
            }
        }

        RepositoryChangeListener optionListener = new RepositoryChangeListener();
View Full Code Here

TOP

Related Classes of org.openide.NotificationLineSupport

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.