1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 /* 23 * InstallationPathDescriptor.java 24 * 25 * Created on February 12, 2003 26 */ 27 28 package org.openoffice.netbeans.modules.office.wizard; 29 30 import java.awt.Dimension; 31 import java.awt.Toolkit; 32 import java.net.URL; 33 import java.net.MalformedURLException; 34 35 import org.openide.TopManager; 36 import org.openide.WizardDescriptor; 37 import org.openide.util.NbBundle; 38 39 /** A wizard descriptor. 40 * 41 * @author tomaso 42 */ 43 public class InstallationPathDescriptor extends WizardDescriptor { 44 45 private final InstallationPathIterator iterator; 46 public static final String PROP_INSTALLPATH = "INSTALLPATH"; 47 48 /** Make a descriptor suited to use InstallationPathIterator. 49 * Sets up various wizard properties to follow recommended 50 * style guidelines. 51 */ InstallationPathDescriptor()52 public InstallationPathDescriptor() { 53 this(new InstallationPathIterator()); 54 } InstallationPathDescriptor(InstallationPathIterator iterator)55 private InstallationPathDescriptor(InstallationPathIterator iterator) { 56 super(iterator); 57 this.iterator = iterator; 58 // Set title for the dialog: 59 setTitle(NbBundle.getMessage(InstallationPathDescriptor.class, "TITLE_wizard")); 60 // Make the left pane appear: 61 putProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); // NOI18N 62 // Make the left pane show list of steps etc.: 63 putProperty("WizardPanel_contentDisplayed", Boolean.TRUE); // NOI18N 64 // Number the steps. 65 // putProperty("WizardPanel_contentNumbered", Boolean.TRUE); // NOI18N 66 /* 67 // Optional: make nonmodal. 68 setModal(false); 69 // (If you make the wizard nonmodal, you will call it differently; 70 // see InstallationPathAction for instructions.) 71 // Optional: show a help tab with special info about the pane: 72 putProperty("WizardPanel_helpDisplayed", Boolean.TRUE); // NOI18N 73 // Optional: set the size of the left pane explicitly: 74 putProperty("WizardPanel_leftDimension", new Dimension(100, 400)); // NOI18N 75 // Optional: if you want a special background image for the left pane: 76 try { 77 putProperty("WizardPanel_image", // NOI18N 78 Toolkit.getDefaultToolkit().getImage 79 (new URL("nbresloc:/org/openoffice/netbeans/modules/office/wizard/InstallationPathImage.gif"))); // NOI18N 80 } catch (MalformedURLException mfue) { 81 throw new IllegalStateException(mfue.toString()); 82 } 83 */ 84 } 85 86 // Called when user moves forward or backward etc.: updateState()87 protected void updateState() { 88 super.updateState(); 89 putProperty("WizardPanel_contentData", iterator.getSteps()); // NOI18N 90 putProperty("WizardPanel_contentSelectedIndex", new Integer(iterator.getIndex())); // NOI18N 91 } 92 93 } 94