1 2 /* 3 * Enhydra Java Application Server Project 4 * 5 * The contents of this file are subject to the Enhydra Public License 6 * Version 1.1 (the "License"); you may not use this file except in 7 * compliance with the License. You may obtain a copy of the License on 8 * the Enhydra web site ( http://www.enhydra.org/ ). 9 * 10 * Software distributed under the License is distributed on an "AS IS" 11 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 12 * the License for the specific terms governing rights and limitations 13 * under the License. 14 * 15 * The Initial Developer of the Enhydra Application Server is Lutris 16 * Technologies, Inc. The Enhydra Application Server and portions created 17 * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc. 18 * All Rights Reserved. 19 * 20 * Contributor(s): 21 * 22 */ 23 package org.enhydra.tool.codegen.wizard; 24 25 // ToolBox imports 26 import org.enhydra.tool.common.PathHandle; 27 import org.enhydra.tool.common.wizard.TBWizardPanel; 28 import org.enhydra.tool.codegen.OptionSet; 29 import org.enhydra.tool.codegen.GeneratorException; 30 import org.enhydra.tool.codegen.ValidationException; 31 32 // Standard imports 33 import javax.swing.JPanel; 34 import java.io.File; 35 import java.util.ResourceBundle; 36 37 /** 38 * This class defines the type of panel you can add to an 39 * OpenTool's BasicWizardPage or an CodeGenPage. Do to limitations 40 * in the JBuilder UI designer, this class and some of it's methods 41 * are not left as abstract. 42 */ 43 public class CodeGenPanel extends TBWizardPanel { 44 static ResourceBundle res = ResourceBundle.getBundle("org.enhydra.tool.codegen.Res"); 45 // 46 transient private OptionSet optionSet = null; 47 48 /** 49 * Create an CodeGenPanel for use in an OpenTool BasicWizardPage 50 * or an CodeGenPage. 51 */ 52 public CodeGenPanel() {} 53 54 /** 55 * Set the options to use for reading and writing 56 * Swing controls values. 57 * 58 * @param optionSet 59 * A set of generator options for the currently selected 60 * generator. 61 */ 62 public void setOptionSet(OptionSet optionSet) { 63 this.optionSet = optionSet; 64 } 65 66 /** 67 * Get the options used for reading and writing 68 * Swing control values. 69 * 70 * @return 71 * A set of generator options for the currently selected 72 * generator. 73 */ 74 public OptionSet getOptionSet() { 75 return optionSet; 76 } 77 78 /** 79 * Get the title to use on the current page. Override this 80 * to set a custom title. 81 * 82 * @return 83 * A string to place at the top of a CodeGen wizard panel. 84 */ 85 public String getPageTitle() { 86 return res.getString("Generation_Options"); 87 } 88 89 90 /** 91 * Populate the Swing control values from the option array. 92 * Not abstract due to limitation of JBuilder designer. 93 * 94 * @exception GeneratorException 95 * Thrown if not child class did not override. 96 */ 97 public void readOptionSet() throws GeneratorException { 98 throw new GeneratorException("CodeGenPanel::readOptionSet()"); // nores 99 } 100 101 /** 102 * Write values from the swing controls into the option array. 103 * Not abstract due to limitation of JBuilder designer. 104 * 105 * @exception GeneratorException 106 * Thrown if not child class did not override. 107 */ 108 public void writeOptionSet() throws GeneratorException { 109 throw new GeneratorException("CodeGenPanel::writeOptionSet()"); // nores 110 } 111 112 /** 113 * Validate values in the swing controls. 114 * Not abstract due to limitation of JBuilder designer. 115 * 116 * @exception ValidationException 117 * Thrown if not child class did not override. 118 */ 119 public void validateOptionSet() throws ValidationException { 120 throw new ValidationException("CodeGenPanel::validateOptionSet()"); // nores 121 } 122 123 } 124