Author: julien(a)jboss.com
Date: 2007-03-09 17:40:11 -0500 (Fri, 09 Mar 2007)
New Revision: 6620
Added:
trunk/widget/src/main/org/jboss/portal/widget/google/GGWidgetCategoryInfo.java
Modified:
trunk/widget/src/main/org/jboss/portal/widget/WidgetPortlet.java
trunk/widget/src/main/org/jboss/portal/widget/google/provider/GGProvider.java
Log:
added query support and cat support in the UI
Modified: trunk/widget/src/main/org/jboss/portal/widget/WidgetPortlet.java
===================================================================
--- trunk/widget/src/main/org/jboss/portal/widget/WidgetPortlet.java 2007-03-09 22:04:30
UTC (rev 6619)
+++ trunk/widget/src/main/org/jboss/portal/widget/WidgetPortlet.java 2007-03-09 22:40:11
UTC (rev 6620)
@@ -23,24 +23,19 @@
package org.jboss.portal.widget;
import org.jboss.portal.widget.google.GGWidget;
-import org.jboss.portal.widget.google.GGPreferenceInfo;
import org.jboss.portal.widget.google.provider.GGProvider;
-import org.jboss.portal.widget.google.provider.GGQueryResult;
-import org.jboss.portal.widget.google.type.DataType;
+import org.jboss.portal.widget.google.provider.GGQuery;
import javax.portlet.GenericPortlet;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.PortletException;
import javax.portlet.PortletSecurityException;
-import javax.portlet.PortletURL;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletRequestDispatcher;
import java.io.IOException;
import java.io.PrintWriter;
-import java.util.Collection;
-import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Added: trunk/widget/src/main/org/jboss/portal/widget/google/GGWidgetCategoryInfo.java
===================================================================
--- trunk/widget/src/main/org/jboss/portal/widget/google/GGWidgetCategoryInfo.java
(rev 0)
+++
trunk/widget/src/main/org/jboss/portal/widget/google/GGWidgetCategoryInfo.java 2007-03-09
22:40:11 UTC (rev 6620)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * 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 GGWidgetCategoryInfo
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final String displayName;
+
+
+ public GGWidgetCategoryInfo(String name, String displayName)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (displayName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.name = name;
+ this.displayName = displayName;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getDisplayName()
+ {
+ return displayName;
+ }
+}
Modified: trunk/widget/src/main/org/jboss/portal/widget/google/provider/GGProvider.java
===================================================================
---
trunk/widget/src/main/org/jboss/portal/widget/google/provider/GGProvider.java 2007-03-09
22:04:30 UTC (rev 6619)
+++
trunk/widget/src/main/org/jboss/portal/widget/google/provider/GGProvider.java 2007-03-09
22:40:11 UTC (rev 6620)
@@ -34,9 +34,11 @@
import java.net.URL;
import java.net.MalformedURLException;
import java.util.Collections;
+import java.util.Collection;
import org.jboss.portal.widget.google.GGWidget;
-import org.jboss.portal.widget.google.provider.GGWidgetBuilder;
+import org.jboss.portal.widget.google.GGWidgetCategoryInfo;
+import org.jboss.portal.common.util.CollectionBuilder;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -60,6 +62,19 @@
/** . */
private ExecutorService executor;
+ /** . */
+ private static final Collection CATEGORIES = Collections.unmodifiableList(new
CollectionBuilder()
+ .add(new GGWidgetCategoryInfo("all", "Popular"))
+ .add(new GGWidgetCategoryInfo("news", "News"))
+ .add(new GGWidgetCategoryInfo("communication",
"Communication"))
+ .add(new GGWidgetCategoryInfo("funandgames", "Fun &
Games"))
+ .add(new GGWidgetCategoryInfo("finance", "Finance"))
+ .add(new GGWidgetCategoryInfo("sports", "Sports"))
+ .add(new GGWidgetCategoryInfo("lifestyle", "Lifestyle"))
+ .add(new GGWidgetCategoryInfo("technology", "Technology"))
+ .add(new GGWidgetCategoryInfo("new", "New stuff"))
+ .toArrayList());
+
public void start()
{
executor = new ThreadPoolExecutor(4, 4, 0, TimeUnit.SECONDS, new
LinkedBlockingDeque());
@@ -71,6 +86,11 @@
executor = null;
}
+ public Collection getCategories()
+ {
+ return CATEGORIES;
+ }
+
public GGWidget getWidget(String id)
{
if (id == null)