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: * Paul Mahar
021: *
022: */
023: package org.enhydra.kelp.common.importer;
024:
025: // Kelp imports
026: import org.enhydra.kelp.common.ValidationException;
027: import org.enhydra.kelp.common.ValidationUtil;
028: import org.enhydra.kelp.common.importer.ImportPaths;
029:
030: // Standard imports
031: import javax.swing.*;
032: import javax.swing.border.*;
033: import java.awt.*;
034: import java.awt.event.ActionEvent;
035: import java.awt.event.ActionListener;
036: import java.beans.*;
037: import java.io.File;
038: import java.util.Properties;
039:
040: /**
041: * Panel for entering the default options: project name, package
042: * and destination.
043: *
044: * @author Paul Mahar
045: */
046: public class ImporterPanel extends JPanel {
047: transient private ImportPaths paths;
048:
049: // strings not to be resourced
050: private final String WRITE_OPTIONS_EXCEPTION = "writeOptions() not implemented"; // nores
051: private final String VALIDATE_OPTIONS_EXCEPTION = "validateOptions() not implemented"; // nores
052: private final String PAGE_TITLE = "PAGE TITLE"; // nores
053: private final String INSTRUCTIONS = "INSTRUCTIONS"; // nores
054:
055: public void setPaths(ImportPaths p) {
056: paths = p;
057: readOptions();
058: }
059:
060: public ImportPaths getPaths() {
061: return paths;
062: }
063:
064: public void activated() {
065: }
066:
067: public void checkPage() throws ValidationException {
068: writeOptions();
069: }
070:
071: /**
072: * Read project name, package and destination values from the
073: * option set into the swing controls.
074: *
075: * @exception GeneratorException
076: * Thrown if unable to update Swing controls with option set values.
077: */
078: public void readOptions() {
079: }
080:
081: /**
082: * Write project name, package and destination values from the
083: * swing controls into the option set.
084: *
085: * @exception GeneratorException
086: * Thrown if unable to update option set from Swing control values.
087: */
088: public void writeOptions() throws ValidationException {
089: throw new ValidationException(WRITE_OPTIONS_EXCEPTION);
090: }
091:
092: /**
093: * Validate project name, package and destination values
094: * in the swing controls.
095: *
096: * @exception ValidationException
097: * Thrown if swing control values are not valid for the
098: * current option set.
099: */
100: public void validateOptions() throws ValidationException {
101: throw new ValidationException(VALIDATE_OPTIONS_EXCEPTION);
102: }
103:
104: /**
105: * Get the title to use on the current page.
106: *
107: * @return
108: * A string to place at the top of a CodeGen wizard panel.
109: */
110: public String getPageTitle() {
111: return PAGE_TITLE;
112: }
113:
114: /**
115: * Get the instructions for entering option values for the
116: * current page.
117: *
118: * @return
119: * A string to place below the page title.
120: */
121: public String getInstructions() {
122: StringBuffer buf = new StringBuffer();
123:
124: buf.append(INSTRUCTIONS);
125: return buf.toString();
126: }
127:
128: }
|