alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.modules.vcs.advanced.wizard.mount;

import org.netbeans.modules.vcs.advanced.VcsCustomizer;
import org.netbeans.modules.vcscore.util.VariableInputValidator;
import org.openide.loaders.TemplateWizard;
import org.openide.util.NbBundle;

/**
 *
 * @author  Martin Entlicher
 */
public class ProfilePanel extends AbstractWizardPanel {

    private int index;
    private ProfilePanelUI panelUI;
    private boolean initialized = false;
    private boolean isFinish = true;
    private java.beans.PropertyChangeListener propL;
    
    MountWizardData data;
    
    private static final long serialVersionUID = 1184058637535734526L;
    
    /** Creates new form ProfilePanel */
    public ProfilePanel(int index) {
        this.index = index;
    }


    public org.openide.util.HelpCtx getHelp() {
        return null;
    }

    protected void readWizardSettings(MountWizardData data) {
        this.data = data;
        getPanelUI().putClientProperty ("WizardPanel_contentSelectedIndex", new Integer (index)); // NOI18N
        if (!initialized) {
            javax.swing.JPanel profilePanel = data.getProfilePanel (index);
            profilePanel.setBorder (new javax.swing.border.EmptyBorder (new java.awt.Insets (0, 0, 0, 0)));
            getPanelUI().add (profilePanel);
            initialized = true;
        }
        if (index == 0 && data.isNoneProfileSelected()) {            
            propL = new java.beans.PropertyChangeListener() {                
                public void propertyChange(java.beans.PropertyChangeEvent evt) {                    
                    if(evt.getPropertyName().equals(VcsCustomizer.PROP_PROFILE_SELECTION_CHANGED)){
                        fireChange();
                    }
                }
            };
            data.addPropertyChangeListener(propL);
        }
    }

    protected void storeWizardSettings(MountWizardData data) {
        if (propL != null) {
            data.removePropertyChangeListener(propL);
            propL = null;
        }
    }
    
    public boolean isValid() {
        if (data.isNoneProfileSelected()) {
            getWizard().putProperty("WizardPanel_errorMessage", NbBundle.getMessage(ProfilePanel.class, "MSG_NoProfileSelected")); //NOI18N
            return false;
        }
        VariableInputValidator validator = data.validateData();
        if (validator.isValid()) {
            validator = data.getCustomizer().validateConfigPanel(index);
        }
        if (validator != null && !validator.isValid()) {
            getWizard().putProperty("WizardPanel_errorMessage", validator.getMessage()); //NOI18N
            return false;
        } else {
            getWizard().putProperty("WizardPanel_errorMessage", ""); //NOI18N
            return true;
        }
    }
    
    
    /** Get the component displayed in this panel.
     *
     * Note; method can be called from any thread, but not concurrently
     * with other methods of this interface.
     *
     * @return the UI component of this wizard panel
     *
     */
    public java.awt.Component getComponent(){
        return getPanelUI();
    }
    
    private javax.swing.JPanel getPanelUI(){        
        if(panelUI == null)
            panelUI = new ProfilePanelUI(index, data);
        return panelUI;
    }
    
    public boolean isFinishPanel() {               
        return isFinish;
    }
    
    public void setFinish(boolean isFinish){
        this.isFinish = isFinish;
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.