Author: alevkovsky
Date: 2008-11-05 10:25:10 -0500 (Wed, 05 Nov 2008)
New Revision: 11030
Added:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/
trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/SeamTextConverter.java
Removed:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/SeamTextConverter.java
Modified:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java
Log:
Move SeamTextConverter to convert package
Deleted:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/SeamTextConverter.java
===================================================================
---
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/SeamTextConverter.java 2008-11-05
15:18:00 UTC (rev 11029)
+++
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/SeamTextConverter.java 2008-11-05
15:25:10 UTC (rev 11030)
@@ -1,128 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * SeamTextConverter.java Date created: 26.09.2008
- * Last modified by: $Author$
- * $Revision$ $Date$
- */
-
-package org.richfaces.component;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.lang.reflect.Constructor;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.seam.text.SeamTextLexer;
-import org.jboss.seam.text.SeamTextParser;
-import org.richfaces.antlr.HtmlSeamTextLexer;
-import org.richfaces.antlr.HtmlSeamTextParser;
-
-import antlr.ANTLRException;
-import antlr.RecognitionException;
-import antlr.TokenStream;
-
-/**
- * TODO Class description goes here.
- *
- * @author Alexandr Levkovsky
- *
- */
-public class SeamTextConverter implements Converter {
-
- private static final Log _log = LogFactory.getLog(SeamTextConverter.class);
-
- /**
- * <p>
- * The standard converter id for this converter.
- * </p>
- */
- public static final String CONVERTER_ID = SeamTextConverter.class.getName();
-
- /**
- * @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent, java.lang.String)
- */
- @SuppressWarnings("unchecked")
- public Object getAsObject(FacesContext context, UIComponent component,
- String value) {
- try {
- Reader r = new StringReader(value);
- HtmlSeamTextLexer lexer = new HtmlSeamTextLexer(r);
- HtmlSeamTextParser parser = new HtmlSeamTextParser(lexer);
- parser.startRule();
- return parser.toString();
- } catch (RecognitionException rex) {
- // Log a nice message for any lexer/parser errors, users can disable
- // this if they want to
- _log.warn("Seam Text parse error: " + rex.getMessage());
- } catch (ANTLRException ex) {
- // All other errors are fatal;
- throw new RuntimeException(ex);
- }
- return null;
- }
-
- /**
- * @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent, java.lang.Object)
- */
- @SuppressWarnings("unchecked")
- public String getAsString(FacesContext context, UIComponent component,
- Object value) {
- if (value == null) {
- return "";
- }
-
- SeamTextParser parser = null;
-
- try {
-
- Reader r = new StringReader(value.toString());
- Class seamTextLexerClass =
Class.forName("org.jboss.seam.text.SeamTextLexer");
- Class seamTextParserClass =
Class.forName("org.jboss.seam.text.SeamTextParser");
- Constructor seamTextLexerConstructor =
seamTextLexerClass.getConstructor(Reader.class);
- SeamTextLexer lexer = (SeamTextLexer) seamTextLexerConstructor.newInstance(new
Object[] { r });
- Constructor seamTextParserConstructor =
seamTextParserClass.getConstructor(TokenStream.class);
- parser = (SeamTextParser) seamTextParserConstructor.newInstance(new Object[] { lexer
});
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- try {
- parser.startRule();
- } catch (RecognitionException rex) {
- // Log a nice message for any lexer/parser errors, users can disable
- // this if they want to
- _log.warn("Seam Text parse error: " + rex.getMessage());
- } catch (ANTLRException ex) {
- // All other errors are fatal;
- throw new RuntimeException(ex);
- }
- return parser.toString();
- }
-
-}
Modified: trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java
===================================================================
--- trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java 2008-11-05
15:18:00 UTC (rev 11029)
+++ trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java 2008-11-05
15:25:10 UTC (rev 11030)
@@ -30,6 +30,8 @@
import javax.faces.component.UIInput;
import javax.faces.convert.Converter;
+import org.richfaces.convert.SeamTextConverter;
+
/**
* JSF component class
* @author Alexandr Levkovsky
Copied: trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/SeamTextConverter.java
(from rev 11028,
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/SeamTextConverter.java)
===================================================================
--- trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/SeamTextConverter.java
(rev 0)
+++
trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/SeamTextConverter.java 2008-11-05
15:25:10 UTC (rev 11030)
@@ -0,0 +1,128 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * SeamTextConverter.java Date created: 26.09.2008
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.convert;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.lang.reflect.Constructor;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.text.SeamTextLexer;
+import org.jboss.seam.text.SeamTextParser;
+import org.richfaces.antlr.HtmlSeamTextLexer;
+import org.richfaces.antlr.HtmlSeamTextParser;
+
+import antlr.ANTLRException;
+import antlr.RecognitionException;
+import antlr.TokenStream;
+
+/**
+ * Seam Text Converter
+ *
+ * @author Alexandr Levkovsky
+ *
+ */
+public class SeamTextConverter implements Converter {
+
+ private static final Log _log = LogFactory.getLog(SeamTextConverter.class);
+
+ /**
+ * <p>
+ * The standard converter id for this converter.
+ * </p>
+ */
+ public static final String CONVERTER_ID = SeamTextConverter.class.getName();
+
+ /**
+ * @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent, java.lang.String)
+ */
+ @SuppressWarnings("unchecked")
+ public Object getAsObject(FacesContext context, UIComponent component,
+ String value) {
+ try {
+ Reader r = new StringReader(value);
+ HtmlSeamTextLexer lexer = new HtmlSeamTextLexer(r);
+ HtmlSeamTextParser parser = new HtmlSeamTextParser(lexer);
+ parser.startRule();
+ return parser.toString();
+ } catch (RecognitionException rex) {
+ // Log a nice message for any lexer/parser errors, users can disable
+ // this if they want to
+ _log.warn("Seam Text parse error: " + rex.getMessage());
+ } catch (ANTLRException ex) {
+ // All other errors are fatal;
+ throw new RuntimeException(ex);
+ }
+ return null;
+ }
+
+ /**
+ * @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent, java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) {
+ if (value == null) {
+ return "";
+ }
+
+ SeamTextParser parser = null;
+
+ try {
+
+ Reader r = new StringReader(value.toString());
+ Class seamTextLexerClass =
Class.forName("org.jboss.seam.text.SeamTextLexer");
+ Class seamTextParserClass =
Class.forName("org.jboss.seam.text.SeamTextParser");
+ Constructor seamTextLexerConstructor =
seamTextLexerClass.getConstructor(Reader.class);
+ SeamTextLexer lexer = (SeamTextLexer) seamTextLexerConstructor.newInstance(new
Object[] { r });
+ Constructor seamTextParserConstructor =
seamTextParserClass.getConstructor(TokenStream.class);
+ parser = (SeamTextParser) seamTextParserConstructor.newInstance(new Object[] { lexer
});
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ try {
+ parser.startRule();
+ } catch (RecognitionException rex) {
+ // Log a nice message for any lexer/parser errors, users can disable
+ // this if they want to
+ _log.warn("Seam Text parse error: " + rex.getMessage());
+ } catch (ANTLRException ex) {
+ // All other errors are fatal;
+ throw new RuntimeException(ex);
+ }
+ return parser.toString();
+ }
+
+}
Show replies by date