CodeGenPanel.java :  » J2EE » enhydra » org » enhydra » tool » codegen » wizard » Java Open Source

Java Open Source » J2EE » enhydra 
enhydra » org » enhydra » tool » codegen » wizard » CodeGenPanel.java

/*
 * Enhydra Java Application Server Project
 *
 * The contents of this file are subject to the Enhydra Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License on
 * the Enhydra web site ( http://www.enhydra.org/ ).
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific terms governing rights and limitations
 * under the License.
 *
 * The Initial Developer of the Enhydra Application Server is Lutris
 * Technologies, Inc. The Enhydra Application Server and portions created
 * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
 * All Rights Reserved.
 *
 * Contributor(s):
 *
 */
package org.enhydra.tool.codegen.wizard;

// ToolBox imports
import org.enhydra.tool.common.PathHandle;
import org.enhydra.tool.common.wizard.TBWizardPanel;
import org.enhydra.tool.codegen.OptionSet;
import org.enhydra.tool.codegen.GeneratorException;
import org.enhydra.tool.codegen.ValidationException;

// Standard imports
import javax.swing.JPanel;
import java.io.File;
import java.util.ResourceBundle;

/**
 * This class defines the type of panel you can add to an
 * OpenTool's BasicWizardPage or an CodeGenPage. Do to limitations
 * in the JBuilder UI designer, this class and some of it's methods
 * are not left as abstract.
 */
public class CodeGenPanel extends TBWizardPanel {
    static ResourceBundle res = ResourceBundle.getBundle("org.enhydra.tool.codegen.Res");
    //
    transient private OptionSet optionSet = null;

    /**
     * Create an CodeGenPanel for use in an OpenTool BasicWizardPage
     * or an CodeGenPage.
     */
    public CodeGenPanel() {}

    /**
     * Set the options to use for reading and writing
     * Swing controls values.
     *
     * @param optionSet
     * A set of generator options for the currently selected
     * generator.
     */
    public void setOptionSet(OptionSet optionSet) {
        this.optionSet = optionSet;
    }

    /**
     * Get the options used for reading and writing
     * Swing control values.
     *
     * @return
     * A set of generator options for the currently selected
     * generator.
     */
    public OptionSet getOptionSet() {
        return optionSet;
    }

    /**
     * Get the title to use on the current page. Override this
     * to set a custom title.
     *
     * @return
     * A string to place at the top of a CodeGen wizard panel.
     */
    public String getPageTitle() {
        return res.getString("Generation_Options");
    }


    /**
     * Populate the Swing control values from the option array.
     * Not abstract due to limitation of JBuilder designer.
     *
     * @exception GeneratorException
     * Thrown if not child class did not override.
     */
    public void readOptionSet() throws GeneratorException {
        throw new GeneratorException("CodeGenPanel::readOptionSet()"); // nores
    }

    /**
     * Write values from the swing controls into the option array.
     * Not abstract due to limitation of JBuilder designer.
     *
     * @exception GeneratorException
     * Thrown if not child class did not override.
     */
    public void writeOptionSet() throws GeneratorException {
        throw new GeneratorException("CodeGenPanel::writeOptionSet()");  // nores
    }

    /**
     * Validate values in the swing controls.
     * Not abstract due to limitation of JBuilder designer.
     *
     * @exception ValidationException
     * Thrown if not child class did not override.
     */
    public void validateOptionSet() throws ValidationException {
        throw new ValidationException("CodeGenPanel::validateOptionSet()"); // nores
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.