From portal-commits at lists.jboss.org Wed Mar 7 10:40:17 2007 Content-Type: multipart/mixed; boundary="===============2541534350243945061==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r6575 - in trunk/widget/src/main/org/jboss/portal/widget/google: type and 1 other directory. Date: Wed, 07 Mar 2007 10:40:12 -0500 Message-ID: --===============2541534350243945061== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: julien(a)jboss.com Date: 2007-03-07 10:40:11 -0500 (Wed, 07 Mar 2007) New Revision: 6575 Added: trunk/widget/src/main/org/jboss/portal/widget/google/type/ trunk/widget/src/main/org/jboss/portal/widget/google/type/DataType.java Removed: trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetDataType.java Modified: trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetFactory.java trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetPreferenceIn= fo.java Log: moving type stuff to a type package Deleted: trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetDataTy= pe.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetDataType.ja= va 2007-03-07 15:28:28 UTC (rev 6574) +++ trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetDataType.ja= va 2007-03-07 15:40:11 UTC (rev 6575) @@ -1,111 +0,0 @@ -/*************************************************************************= ***** - * JBoss, a division of Red Hat = * - * Copyright 2006, Red Hat Middleware, LLC, and individual = * - * contributors as indicated by the @authors tag. See the = * - * copyright.txt in the distribution for a full listing of = * - * individual contributors. = * - * = * - * This is free software; you can redistribute it and/or modify it = * - * under the terms of the GNU Lesser General Public License as = * - * published by the Free Software Foundation; either version 2.1 of = * - * the License, or (at your option) any later version. = * - * = * - * This software 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 software; if not, write to the Free = * - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA = * - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. = * - *************************************************************************= *****/ -package org.jboss.portal.widget.google; - -/** - * @author Julien Viet - * @version $Revision: 1.1 $ - */ -public class GWidgetDataType -{ - - /** . */ - public static final int STRING =3D 0; - - /** . */ - public static final int BOOL =3D 1; - - /** . */ - public static final int ENUM =3D 2; - - /** . */ - public static final int HIDDEN =3D 3; - - /** . */ - public static final int LIST =3D 4; - - /** . */ - public static final int LOCATION =3D 5; - - /** . */ - public static final GWidgetDataType STRING_TYPE =3D new GWidgetDataType= (STRING); - - /** . */ - private final int value; - - /** . */ - private final Object object; - - public GWidgetDataType(int ordinal) - { - this(ordinal, null); - } - - public GWidgetDataType(int dataType, Object dataObject) - { - this.value =3D dataType; - this.object =3D dataObject; - } - - public int getValue() - { - return value; - } - - public Object getObject() - { - return object; - } - - public static int parseDataTypeLiteral(String literal) - { - if ("string".equals(literal)) - { - return STRING; - } - else if ("bool".equals(literal)) - { - return BOOL; - } - else if ("enum".equals(literal)) - { - return ENUM; - } - else if ("hidden".equals(literal)) - { - return HIDDEN; - } - else if ("list".equals(literal)) - { - return LIST; - } - else if ("location".equals(literal)) - { - return LOCATION; - } - else - { - throw new IllegalArgumentException("Cannot parse " + literal); - } - } -} Modified: trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetFacto= ry.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetFactory.jav= a 2007-03-07 15:28:28 UTC (rev 6574) +++ trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetFactory.jav= a 2007-03-07 15:40:11 UTC (rev 6575) @@ -24,6 +24,7 @@ = import org.jboss.portal.common.util.XML; import org.jboss.portal.common.util.LocalizedString; +import org.jboss.portal.widget.google.type.DataType; import org.w3c.dom.Document; import org.w3c.dom.Element; = @@ -86,11 +87,11 @@ } = // String is default type when not specified - GWidgetDataType dataType =3D GWidgetDataType.STRING_TYPE; + DataType dataType =3D DataType.STRING_TYPE; if (dataTypeAttr.length() > 0) { - int dataTypeValue =3D GWidgetDataType.parseDataTypeLiteral(dat= aTypeAttr); - dataType =3D new GWidgetDataType(dataTypeValue); + int dataTypeValue =3D DataType.parseDataTypeLiteral(dataTypeAt= tr); + dataType =3D new DataType(dataTypeValue); } = // Modified: trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetPrefe= renceInfo.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetPreferenceI= nfo.java 2007-03-07 15:28:28 UTC (rev 6574) +++ trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetPreferenceI= nfo.java 2007-03-07 15:40:11 UTC (rev 6575) @@ -22,6 +22,8 @@ *************************************************************************= *****/ package org.jboss.portal.widget.google; = +import org.jboss.portal.widget.google.type.DataType; + /** * @author Julien Viet * @version $Revision: 1.1 $ @@ -33,7 +35,7 @@ private final String name; = /** . */ - private final GWidgetDataType type; + private final DataType type; = /** . */ private final String displayName; @@ -44,7 +46,7 @@ /** . */ private final String defaultValue; = - protected GWidgetPreferenceInfo(String name, GWidgetDataType type, Stri= ng displayName, boolean required, String defaultValue) + protected GWidgetPreferenceInfo(String name, DataType type, String disp= layName, boolean required, String defaultValue) { this.name =3D name; this.type =3D type; @@ -58,7 +60,7 @@ return name; } = - public GWidgetDataType getType() + public DataType getType() { return type; } Copied: trunk/widget/src/main/org/jboss/portal/widget/google/type/DataType.= java (from rev 6574, trunk/widget/src/main/org/jboss/portal/widget/google/G= WidgetDataType.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/widget/src/main/org/jboss/portal/widget/google/type/DataType.java= (rev 0) +++ trunk/widget/src/main/org/jboss/portal/widget/google/type/DataType.java= 2007-03-07 15:40:11 UTC (rev 6575) @@ -0,0 +1,111 @@ +/*************************************************************************= ***** + * JBoss, a division of Red Hat = * + * Copyright 2006, Red Hat Middleware, LLC, and individual = * + * contributors as indicated by the @authors tag. See the = * + * copyright.txt in the distribution for a full listing of = * + * individual contributors. = * + * = * + * This is free software; you can redistribute it and/or modify it = * + * under the terms of the GNU Lesser General Public License as = * + * published by the Free Software Foundation; either version 2.1 of = * + * the License, or (at your option) any later version. = * + * = * + * This software 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 software; if not, write to the Free = * + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA = * + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. = * + *************************************************************************= *****/ +package org.jboss.portal.widget.google.type; + +/** + * @author Julien Viet + * @version $Revision: 1.1 $ + */ +public class DataType +{ + + /** . */ + public static final int STRING =3D 0; + + /** . */ + public static final int BOOL =3D 1; + + /** . */ + public static final int ENUM =3D 2; + + /** . */ + public static final int HIDDEN =3D 3; + + /** . */ + public static final int LIST =3D 4; + + /** . */ + public static final int LOCATION =3D 5; + + /** . */ + public static final DataType STRING_TYPE =3D new DataType(STRING); + + /** . */ + private final int value; + + /** . */ + private final Object object; + + public DataType(int ordinal) + { + this(ordinal, null); + } + + public DataType(int dataType, Object dataObject) + { + this.value =3D dataType; + this.object =3D dataObject; + } + + public int getValue() + { + return value; + } + + public Object getObject() + { + return object; + } + + public static int parseDataTypeLiteral(String literal) + { + if ("string".equals(literal)) + { + return STRING; + } + else if ("bool".equals(literal)) + { + return BOOL; + } + else if ("enum".equals(literal)) + { + return ENUM; + } + else if ("hidden".equals(literal)) + { + return HIDDEN; + } + else if ("list".equals(literal)) + { + return LIST; + } + else if ("location".equals(literal)) + { + return LOCATION; + } + else + { + throw new IllegalArgumentException("Cannot parse " + literal); + } + } +} --===============2541534350243945061==--