Author: chris.laprun(a)jboss.com
Date: 2008-03-20 13:39:47 -0400 (Thu, 20 Mar 2008)
New Revision: 10353
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerCapabilitiesInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerModeInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerWindowStateInfo.java
Log:
- Added Locale.ENGLISH to supported locales by default.
- Added equals and hashCode methods so that ModeInfo and WindowStateInfo are not added
several times in ContainerCapabilitiesInfo.
- This should be tested but the tests are not currently run...
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerCapabilitiesInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerCapabilitiesInfo.java 2008-03-20
17:07:39 UTC (rev 10352)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerCapabilitiesInfo.java 2008-03-20
17:39:47 UTC (rev 10353)
@@ -22,17 +22,18 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.info;
+import org.apache.log4j.Logger;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.net.media.MediaTypeMapImpl;
-import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
import org.jboss.portal.portlet.info.ModeInfo;
import org.jboss.portal.portlet.info.WindowStateInfo;
import java.util.HashSet;
+import java.util.Locale;
import java.util.Set;
-import java.util.Locale;
/**
* This object holds the content type and mode capabilities.
@@ -45,6 +46,7 @@
*/
public class ContainerCapabilitiesInfo implements CapabilitiesInfo
{
+ private final static Logger log = Logger.getLogger(ContainerCapabilitiesInfo.class);
/** . */
private final MediaTypeMapImpl<ModeInfo> supportedModes;
@@ -68,6 +70,8 @@
//
this.supportedLocales = new HashSet<Locale>();
+ this.supportedLocales.add(Locale.ENGLISH);
+
this.supportedModes = supportedModes;
this.supportedWindowStates = supportedWindowStates;
}
@@ -88,7 +92,7 @@
e.printStackTrace();
//
- System.out.println("'" + contentType + "' is not a valid
MIME type: ignoring!");
+ log.debug("'" + contentType + "' is not a valid MIME
type: ignoring!");
}
}
@@ -103,7 +107,7 @@
e.printStackTrace();
//
- System.out.println("'" + contentType + "' is not a valid
MIME type: ignoring!");
+ log.debug("'" + contentType + "' is not a valid MIME
type: ignoring!");
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerModeInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerModeInfo.java 2008-03-20
17:07:39 UTC (rev 10352)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerModeInfo.java 2008-03-20
17:39:47 UTC (rev 10353)
@@ -43,11 +43,32 @@
/** . */
private final Mode mode;
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ ContainerModeInfo that = (ContainerModeInfo)o;
+
+ return mode.equals(that.mode);
+ }
+
+ public int hashCode()
+ {
+ return mode.hashCode();
+ }
+
public ContainerModeInfo(Mode mode)
{
if (mode == null)
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Specified mode cannot be null!");
}
this.mode = mode;
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerWindowStateInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerWindowStateInfo.java 2008-03-20
17:07:39 UTC (rev 10352)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerWindowStateInfo.java 2008-03-20
17:39:47 UTC (rev 10353)
@@ -43,11 +43,33 @@
/** . */
private final WindowState windowState;
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ ContainerWindowStateInfo that = (ContainerWindowStateInfo)o;
+
+ return windowState.equals(that.windowState);
+
+ }
+
+ public int hashCode()
+ {
+ return windowState.hashCode();
+ }
+
public ContainerWindowStateInfo(WindowState windowState)
{
if (windowState == null)
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Specified window state cannot be
null!");
}
this.windowState = windowState;
}
Show replies by date