001: /*
002: * Enhydra Java Application Server Project
003: *
004: * The contents of this file are subject to the Enhydra Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License on
007: * the Enhydra web site ( http://www.enhydra.org/ ).
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011: * the License for the specific terms governing rights and limitations
012: * under the License.
013: *
014: * The Initial Developer of the Enhydra Application Server is Lutris
015: * Technologies, Inc. The Enhydra Application Server and portions created
016: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017: * All Rights Reserved.
018: *
019: * Contributor(s):
020: *
021: */
022:
023: package org.enhydra.tool.codegen.wizard;
024:
025: // ToolBox imports
026: import org.enhydra.tool.ToolBoxInfo;
027: import org.enhydra.tool.common.Browser;
028: import org.enhydra.tool.common.wizard.TBWizardPage;
029: import org.enhydra.tool.codegen.GeneratorException;
030: import org.enhydra.tool.codegen.ValidationException;
031:
032: // Standard imports
033: import java.awt.*;
034: import java.beans.*;
035: import java.io.File;
036: import javax.swing.*;
037:
038: /**
039: * The CodeGenPage is a panel that you can add to a WizardDialog. It displays
040: * a page title, instructions and a CodeGenPanel.
041: * <P><I>
042: * This class is used when creating a standalone wizard. Use the
043: * OpenTools BasicWizardPage when developing JBuilder add-ins.
044: * </I></P>
045: */
046: public class CodeGenPage extends TBWizardPage {
047: /**
048: * Create a CodeGenPage.
049: */
050: public CodeGenPage() {
051: super ();
052: }
053:
054: private CodeGenPanel getCodeGenPanel() {
055: return (CodeGenPanel) getWizardPanel();
056: }
057:
058: /**
059: * Read option set into swing controls.
060: *
061: * @exception GeneratorException
062: * Thrown if unable to set controls to option values.
063: */
064: public void readOptionSet() throws GeneratorException {
065: getCodeGenPanel().readOptionSet();
066: }
067:
068: /**
069: * Write option values from Swing controls into the
070: * current option set.
071: *
072: * @exception GeneratorException
073: * Thrown if unable to write a value from a Swing component
074: * into the current option set.
075: */
076: public void writeOptionSet() throws GeneratorException {
077: getCodeGenPanel().writeOptionSet();
078: }
079:
080: /**
081: * Check to see if the option values in the Swing controls
082: * are valid for the given option set. Call this when user
083: * attempts to navigate between pages.
084: *
085: * @exception ValidationException
086: * Thrown if a Swing control contains a invalid value. The messge
087: * of the exception can be used to provide feedback to the user.
088: */
089: public void validateOptionSet() throws ValidationException {
090: getCodeGenPanel().validateOptionSet();
091: }
092:
093: public void help() {
094: Browser browser = new Browser();
095: StringBuffer buf = new StringBuffer();
096: browser.setOwner(getTopLevelAncestor());
097: buf.append(ToolBoxInfo.getEnhydraRoot());
098: buf.append(File.separatorChar);
099: buf.append("doc"); // nores
100: buf.append(File.separatorChar);
101: buf.append("index.html"); // nores
102: browser.open(buf.toString());
103: }
104: }
|