Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

XmlValidatorFrame.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2004 French National Institute For Research In Computer
00004  * Science And Control (INRIA).
00005  * Contact: c-jdbc@objectweb.org
00006  * 
00007  * This library is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU Lesser General Public License as published by the
00009  * Free Software Foundation; either version 2.1 of the License, or any later
00010  * version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00015  * for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00020  *
00021  * Initial developer(s): Nicolas Modrzyk.
00022  * Contributor(s): ______________________.
00023  */
00024 
00025 package org.objectweb.cjdbc.console.wizard;
00026 
00027 import java.awt.Color;
00028 import java.awt.Font;
00029 import java.awt.HeadlessException;
00030 import java.io.IOException;
00031 
00032 import javax.swing.JFrame;
00033 import javax.swing.JTextArea;
00034 
00035 import org.objectweb.cjdbc.common.i18n.WizardTranslate;
00036 import org.objectweb.cjdbc.console.gui.constants.GuiConstants;
00037 import org.objectweb.cjdbc.console.gui.jtools.JTextAreaWriter;
00038 
00039 /**
00040  * Used to report results of validating a database xml configuration file. 
00041  * 
00042  * @author <a href="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>
00043  * @version 1.0
00044  */
00045 public class XmlValidatorFrame extends JFrame
00046 {
00047 
00048   final String    eol = System.getProperty("line.separator");
00049   JTextArea       report;
00050   JTextAreaWriter writer;
00051 
00052   /**
00053    * Creates a new <code>XmlValidatorFrame</code> object
00054    * 
00055    * @throws java.awt.HeadlessException
00056    */
00057   public XmlValidatorFrame(String fileName) throws HeadlessException
00058   {
00059     super(WizardTranslate.get("init.validator.frame"));
00060     GuiConstants.centerComponent(this, WizardConstants.VALIDATOR_WIDTH,
00061         WizardConstants.VALIDATOR_HEIGHT);
00062     this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
00063     report = new JTextArea();
00064     writer = new JTextAreaWriter(report);
00065     report.setForeground(new Color(9498256));
00066     this.getContentPane().add(report);
00067     this.pack();
00068     this.setVisible(true);
00069     writeLine(WizardTranslate.get("init.validator.echo", fileName));
00070   }
00071 
00072   /**
00073    * Append a line to the text area
00074    * 
00075    * @param s the string to append
00076    */
00077   public void writeLine(String s)
00078   {
00079     try
00080     {
00081       writer.write(s + eol);
00082       writer.flush();
00083       report.repaint();
00084     }
00085     catch (IOException e)
00086     {
00087       e.printStackTrace();
00088     }
00089   }
00090 
00091   public void setWarning()
00092   {
00093     Font font = report.getFont();
00094     report.setForeground(new Color(16758465));
00095   }
00096 
00097 }

Generated on Mon Apr 11 22:01:36 2005 for C-JDBC by  doxygen 1.3.9.1