Author: chris.laprun(a)jboss.com
Date: 2007-03-18 19:12:54 -0400 (Sun, 18 Mar 2007)
New Revision: 6731
Modified:
trunk/api/src/main/org/jboss/portal/Mode.java
trunk/api/src/main/org/jboss/portal/WindowState.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
Log:
- JBPORTAL-1322: Fixed, the problem was that WindowState (and Mode, though it doesn't
matter) was converting to lowercase the passed String so created a case preserving version
of factory methods.
Modified: trunk/api/src/main/org/jboss/portal/Mode.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/Mode.java 2007-03-18 01:32:54 UTC (rev 6730)
+++ trunk/api/src/main/org/jboss/portal/Mode.java 2007-03-18 23:12:54 UTC (rev 6731)
@@ -52,13 +52,24 @@
public Mode(String name)
{
+ this(name, false);
+ }
+
+ /**
+ * @param name
+ * @param preserveCase
+ * @since 2.6
+ */
+ private Mode(String name, boolean preserveCase)
+ {
if (name == null)
{
throw new IllegalArgumentException("Mode cannot be null");
}
- this.name = name.toLowerCase(Locale.ENGLISH);
+ this.name = (preserveCase ? name : name.toLowerCase(Locale.ENGLISH));
}
+
public boolean equals(Object o)
{
if (o == this)
@@ -107,27 +118,38 @@
}
}
- public static Mode create(String s)
+ public static Mode create(String name)
{
- if (Mode.VIEW.name.equals(s))
+ return create(name, false);
+ }
+
+ /**
+ * @param name
+ * @param preserveCase
+ * @return
+ * @since 2.6
+ */
+ public static Mode create(String name, boolean preserveCase)
+ {
+ if (Mode.VIEW.name.equals(name))
{
return Mode.VIEW;
}
- else if (Mode.EDIT.name.equals(s))
+ else if (Mode.EDIT.name.equals(name))
{
return Mode.EDIT;
}
- else if (Mode.HELP.name.equals(s))
+ else if (Mode.HELP.name.equals(name))
{
return Mode.HELP;
}
- else if (Mode.EDIT_DEFAULTS.name.equals(s))
+ else if (Mode.EDIT_DEFAULTS.name.equals(name))
{
return Mode.VIEW;
}
else
{
- return new Mode(s);
+ return new Mode(name, preserveCase);
}
}
}
Modified: trunk/api/src/main/org/jboss/portal/WindowState.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/WindowState.java 2007-03-18 01:32:54 UTC (rev
6730)
+++ trunk/api/src/main/org/jboss/portal/WindowState.java 2007-03-18 23:12:54 UTC (rev
6731)
@@ -49,11 +49,22 @@
public WindowState(String name)
{
+ this(name, false);
+ }
+
+ /**
+ * @param name
+ * @param preserveCase
+ * @since 2.6
+ */
+ private WindowState(String name, boolean preserveCase)
+ {
if (name == null)
{
throw new IllegalArgumentException("Window state name cannot be
null");
}
- this.name = name.toLowerCase(Locale.ENGLISH);
+
+ this.name = (preserveCase ? name : name.toLowerCase(Locale.ENGLISH));
}
public boolean equals(Object o)
@@ -100,23 +111,28 @@
}
}
- public static WindowState create(String s)
+ public static WindowState create(String name)
{
- if (WindowState.NORMAL.name.equals(s))
+ return create(name, false);
+ }
+
+ public static WindowState create(String name, boolean preserveCase)
+ {
+ if (WindowState.NORMAL.name.equals(name))
{
return WindowState.NORMAL;
}
- else if (WindowState.MINIMIZED.name.equals(s))
+ else if (WindowState.MINIMIZED.name.equals(name))
{
return WindowState.MINIMIZED;
}
- else if (WindowState.MAXIMIZED.name.equals(s))
+ else if (WindowState.MAXIMIZED.name.equals(name))
{
return WindowState.MAXIMIZED;
}
else
{
- return new WindowState(s);
+ return new WindowState(name, preserveCase);
}
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2007-03-18 01:32:54 UTC
(rev 6730)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2007-03-18 23:12:54 UTC
(rev 6731)
@@ -573,12 +573,12 @@
public Mode getMode()
{
- return Mode.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN +
WSRPRewritingConstants.MODE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE);
+ return Mode.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN +
WSRPRewritingConstants.MODE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE, true);
}
public WindowState getWindowState()
{
- return WindowState.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN +
WSRPRewritingConstants.WINDOW_STATE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE);
+ return WindowState.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN +
WSRPRewritingConstants.WINDOW_STATE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE,
true);
}
};
@@ -591,12 +591,12 @@
public Mode getMode()
{
- return Mode.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN +
WSRPRewritingConstants.MODE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE);
+ return Mode.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN +
WSRPRewritingConstants.MODE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE, true);
}
public WindowState getWindowState()
{
- return WindowState.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN +
WSRPRewritingConstants.WINDOW_STATE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE);
+ return WindowState.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN +
WSRPRewritingConstants.WINDOW_STATE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE,
true);
}
};
Show replies by date