|
What this is
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-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.openide.loaders; import javax.swing.event.*; import org.openide.WizardDescriptor; /** Implementation of template wizard's iterator that allows to * delegate all functionality to another wizard. * * @author Jaroslav Tulach */ final class TemplateWizardIterImpl extends Object implements WizardDescriptor.Iterator, ChangeListener { /** iterator to delegate to */ private TemplateWizard.Iterator iterator; /** bridge */ private ChangeListener iteratorListener; /** is currently panel displayed? */ private boolean showingPanel = true; /** Utility field used by event firing mechanism. */ private javax.swing.event.EventListenerList listenerList = null; /** Instance of the template wizard that uses this Iterator. */ private TemplateWizard wizardInstance; /** */ private boolean iteratorInitialized = false; /** Getter for the first panel. * @return the first and default panel */ private WizardDescriptor.Panel firstPanel () { return wizardInstance.templateChooser(); } /** Resets the iterator to first screen. */ public void first () { showingPanel = true; fireStateChanged (); } /** Change the additional iterator. */ public void setIterator (TemplateWizard.Iterator it, boolean notify) { if ((this.iterator != null) && (iteratorInitialized)) { this.iterator.removeChangeListener(iteratorListener); this.iterator.uninitialize(wizardInstance); } it.initialize(wizardInstance); iteratorListener = new ChangeListener() { public void stateChanged(ChangeEvent e) { TemplateWizardIterImpl.this.stateChanged(e); } }; it.addChangeListener(iteratorListener); iteratorInitialized = true; iterator = it; if (notify) { showingPanel = false; fireStateChanged (); } } /** Getter for current iterator. */ public TemplateWizard.Iterator getIterator () { if (iterator == null) { // first of all initialize the default iterator setIterator (wizardInstance.defaultIterator (), false); } if (!iteratorInitialized) { if (iterator != null) { iterator.initialize(wizardInstance); iteratorInitialized = true; } } return iterator; } /** Get the current panel. * @return the panel */ public WizardDescriptor.Panel current() { return showingPanel ? firstPanel () : getIterator ().current (); } /** Get the name of the current panel. * @return the name */ public String name() { return showingPanel ? "" : getIterator ().name (); // NOI18N } /** Test whether there is a next panel. * @return
|
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
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.