|
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-2004 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.web.dd.wizards; import java.awt.Component; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; import org.openide.loaders.TemplateWizard; import org.netbeans.api.project.Project; import org.netbeans.api.project.Sources; import org.netbeans.api.project.SourceGroup; import org.netbeans.api.java.project.JavaProjectConstants; import org.netbeans.spi.project.ui.templates.support.Templates; import org.netbeans.modules.web.api.webmodule.WebModule; /** A single panel descriptor for a wizard. * You probably want to make a wizard iterator to hold it. * * @author Milan Kuchtiak */ public class ListenerPanel implements WizardDescriptor.Panel { /** The visual component that displays this panel. * If you need to access the component from this class, * just use getComponent(). */ private ListenerVisualPanel component; private transient TemplateWizard wizard; /** Create the wizard panel descriptor. */ public ListenerPanel(TemplateWizard wizard) { this.wizard=wizard; } // Get the visual component for the panel. In this template, the component // is kept separate. This can be more efficient: if the wizard is created // but never displayed, or not all panels are displayed, it is better to // create only those which really need to be visible. public Component getComponent() { if (component == null) { Project project = Templates.getProject( wizard ); Sources sources = (Sources)project.getLookup().lookup(Sources.class); SourceGroup[] groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); WebModule wm=null; String j2eeVersion = WebModule.J2EE_14_LEVEL; if (groups!=null && groups.length>0) { wm = WebModule.getWebModule(groups[0].getRootFolder());; } if (wm!=null) { j2eeVersion=wm.getJ2eePlatformVersion(); } component = new ListenerVisualPanel(this,j2eeVersion); } return component; } public HelpCtx getHelp() { return new HelpCtx(ListenerPanel.class); } /* public boolean isValid() { // If it is always OK to press Next or Finish, then: return true; // If it depends on some condition (form filled out...), then: // return someCondition (); // and when this condition changes (last form field filled in...) then: // fireChangeEvent (); // and uncomment the complicated stuff below. } */ public boolean isValid() { if(isListenerSelected()) { wizard.putProperty("WizardPanel_errorMessage", ""); //NOI18N return true; } wizard.putProperty("WizardPanel_errorMessage", //NOI18N org.openide.util.NbBundle.getMessage(ListenerPanel.class,"MSG_noListenerSelected")); return false; } //public final void addChangeListener(ChangeListener l) {} //public final void removeChangeListener(ChangeListener l) {} private final Set listeners = new HashSet (1); // Set |
... 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.