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

Java Open Source » J2EE » enhydra 
enhydra » org » enhydra » tool » codegen » wizard » CodeGenPage.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.ToolBoxInfo;
import org.enhydra.tool.common.Browser;
import org.enhydra.tool.common.wizard.TBWizardPage;
import org.enhydra.tool.codegen.GeneratorException;
import org.enhydra.tool.codegen.ValidationException;

// Standard imports
import java.awt.*;
import java.beans.*;
import java.io.File;
import javax.swing.*;

/**
 * The CodeGenPage is a panel that you can add to a WizardDialog. It displays
 * a page title, instructions and a CodeGenPanel.
 * <P><I>
 * This class is used when creating a standalone wizard. Use the
 * OpenTools BasicWizardPage when developing JBuilder add-ins.
 * </I></P>
 */
public class CodeGenPage extends TBWizardPage {
    /**
     * Create a CodeGenPage.
     */
    public CodeGenPage() {
        super();
    }

    private CodeGenPanel getCodeGenPanel() {
      return (CodeGenPanel) getWizardPanel();
    }


    /**
     * Read option set into swing controls.
     *
     * @exception GeneratorException
     * Thrown if unable to set controls to option values.
     */
    public void readOptionSet() throws GeneratorException {
        getCodeGenPanel().readOptionSet();
    }

    /**
     * Write option values from Swing controls into the
     * current option set.
     *
     * @exception GeneratorException
     * Thrown if unable to write a value from a Swing component
     * into the current option set.
     */
    public void writeOptionSet() throws GeneratorException {
        getCodeGenPanel().writeOptionSet();
    }

    /**
     * Check to see if the option values in the Swing controls
     * are valid for the given option set. Call this when user
     * attempts to navigate between pages.
     *
     * @exception ValidationException
     * Thrown if a Swing control contains a invalid value. The messge
     * of the exception can be used to provide feedback to the user.
     */
    public void validateOptionSet() throws ValidationException {
        getCodeGenPanel().validateOptionSet();
    }

    public void help() {
      Browser browser = new Browser();
      StringBuffer buf = new StringBuffer();
      browser.setOwner(getTopLevelAncestor());
      buf.append(ToolBoxInfo.getEnhydraRoot());
      buf.append(File.separatorChar);
      buf.append("doc"); // nores
      buf.append(File.separatorChar);
      buf.append("index.html"); // nores
      browser.open(buf.toString());
    }
}
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.