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/GWidgetPreferenceInfo.java
Log:
moving type stuff to a type package
Deleted: trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetDataType.java
===================================================================
--- trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetDataType.java 2007-03-07
15:28:28 UTC (rev 6574)
+++ trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetDataType.java 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 <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class GWidgetDataType
-{
-
- /** . */
- public static final int STRING = 0;
-
- /** . */
- public static final int BOOL = 1;
-
- /** . */
- public static final int ENUM = 2;
-
- /** . */
- public static final int HIDDEN = 3;
-
- /** . */
- public static final int LIST = 4;
-
- /** . */
- public static final int LOCATION = 5;
-
- /** . */
- public static final GWidgetDataType STRING_TYPE = 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 = dataType;
- this.object = 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/GWidgetFactory.java
===================================================================
--- trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetFactory.java 2007-03-07
15:28:28 UTC (rev 6574)
+++ trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetFactory.java 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 = GWidgetDataType.STRING_TYPE;
+ DataType dataType = DataType.STRING_TYPE;
if (dataTypeAttr.length() > 0)
{
- int dataTypeValue = GWidgetDataType.parseDataTypeLiteral(dataTypeAttr);
- dataType = new GWidgetDataType(dataTypeValue);
+ int dataTypeValue = DataType.parseDataTypeLiteral(dataTypeAttr);
+ dataType = new DataType(dataTypeValue);
}
//
Modified: trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetPreferenceInfo.java
===================================================================
---
trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetPreferenceInfo.java 2007-03-07
15:28:28 UTC (rev 6574)
+++
trunk/widget/src/main/org/jboss/portal/widget/google/GWidgetPreferenceInfo.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 <a href="mailto:julien@jboss.org">Julien Viet</a>
* @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, String displayName,
boolean required, String defaultValue)
+ protected GWidgetPreferenceInfo(String name, DataType type, String displayName,
boolean required, String defaultValue)
{
this.name = name;
this.type = 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/GWidgetDataType.java)
===================================================================
--- 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 <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class DataType
+{
+
+ /** . */
+ public static final int STRING = 0;
+
+ /** . */
+ public static final int BOOL = 1;
+
+ /** . */
+ public static final int ENUM = 2;
+
+ /** . */
+ public static final int HIDDEN = 3;
+
+ /** . */
+ public static final int LIST = 4;
+
+ /** . */
+ public static final int LOCATION = 5;
+
+ /** . */
+ public static final DataType STRING_TYPE = 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 = dataType;
+ this.object = 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);
+ }
+ }
+}