Author: julien(a)jboss.com
Date: 2007-03-29 16:04:41 -0400 (Thu, 29 Mar 2007)
New Revision: 6872
Added:
trunk/theme/src/main/org/jboss/portal/theme/Orientation.java
Removed:
trunk/theme/src/main/org/jboss/portal/theme/page/RegionOrientation.java
Modified:
trunk/theme/src/main/org/jboss/portal/theme/page/Region.java
trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
trunk/theme/src/main/org/jboss/portal/theme/tag/RegionTagHandler.java
Log:
made RegionOrientation class independant of the region concept as it is just an
orientation.
Copied: trunk/theme/src/main/org/jboss/portal/theme/Orientation.java (from rev 6867,
trunk/theme/src/main/org/jboss/portal/theme/page/RegionOrientation.java)
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/Orientation.java
(rev 0)
+++ trunk/theme/src/main/org/jboss/portal/theme/Orientation.java 2007-03-29 20:04:41 UTC
(rev 6872)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * 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.theme;
+
+/**
+ * Type safe enumeration of allowed orientations.
+ *
+ * @author <a href="mailto:mholzner@novell.com>Martin Holzner</a>
+ * @version $LastChangedRevision$, $LastChangedDate$
+ */
+public final class Orientation
+{
+
+ /** Vertical. */
+ public static final Orientation VERTICAL = new Orientation("vertical");
+
+ /** Horizontal. */
+ public static final Orientation HORIZONTAL = new Orientation("horizontal");
+
+ /** The default value which is vertical. */
+ public static final Orientation DEFAULT = VERTICAL;
+
+ /** The literal value. */
+ private final String value;
+
+ private Orientation(String value)
+ {
+ if (value == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.value = value;
+ }
+
+ public String toString()
+ {
+ return value;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o instanceof Orientation)
+ {
+ Orientation that = (Orientation)o;
+ return this.value.equals(that.value);
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return value.hashCode();
+ }
+
+ /**
+ * Parse a string representation of an orientation into a defined type.
+ *
+ * @param orientation the string representation of the orientation
+ * @return the defined type for the string
+ * @throws IllegalArgumentException if the provided orientation String is invalid
+ */
+ public static Orientation parse(String orientation)
+ {
+ if (orientation != null)
+ {
+ if (orientation.equalsIgnoreCase(VERTICAL.toString()))
+ {
+ return VERTICAL;
+ }
+ if (orientation.equalsIgnoreCase(HORIZONTAL.toString()))
+ {
+ return HORIZONTAL;
+ }
+ }
+
+ //
+ throw new IllegalArgumentException("Invalid orientation: " +
orientation);
+ }
+}
Property changes on: trunk/theme/src/main/org/jboss/portal/theme/Orientation.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/Region.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/Region.java 2007-03-29 20:00:51 UTC
(rev 6871)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/Region.java 2007-03-29 20:04:41 UTC
(rev 6872)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.theme.page;
+import org.jboss.portal.theme.Orientation;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -51,7 +53,7 @@
private String cssId;
/** . */
- private RegionOrientation orientation;
+ private Orientation orientation;
/** . */
private Map properties;
@@ -74,7 +76,7 @@
* @param cssId the id attribute value that can be used by css selectors to
identify this region
* @param orientation arrange portlet windows inside this region in this orientation
*/
- public Region(String name, String cssId, RegionOrientation orientation)
+ public Region(String name, String cssId, Orientation orientation)
{
if (name == null)
{
@@ -84,7 +86,7 @@
windows = new ArrayList();
sorted = false;
this.cssId = (cssId == null ? name : cssId);
- this.orientation = (orientation == null ? RegionOrientation.DEFAULT :
orientation);
+ this.orientation = (orientation == null ? Orientation.DEFAULT : orientation);
}
public String getProperty(String name)
@@ -121,7 +123,7 @@
}
/** @return the orientation of this region */
- public RegionOrientation getOrientation()
+ public Orientation getOrientation()
{
return orientation;
}
Deleted: trunk/theme/src/main/org/jboss/portal/theme/page/RegionOrientation.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/RegionOrientation.java 2007-03-29
20:00:51 UTC (rev 6871)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/RegionOrientation.java 2007-03-29
20:04:41 UTC (rev 6872)
@@ -1,104 +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.theme.page;
-
-/**
- * Type save enumeration of allowed region orientations.
- *
- * @author <a href="mailto:mholzner@novell.com>Martin Holzner</a>
- * @version $LastChangedRevision$, $LastChangedDate$
- * @see org.jboss.portal.theme.page.Region
- */
-public final class RegionOrientation
-{
-
- /** Place portlets in one region in vertical order. */
- public static final RegionOrientation VERTICAL = new
RegionOrientation("vertical");
-
- /** Place portlets in one region in horizontal order. */
- public static final RegionOrientation HORIZONTAL = new
RegionOrientation("horizontal");
-
- /** The default value which is vertical. */
- public static final RegionOrientation DEFAULT = VERTICAL;
-
- /** The literal value. */
- private final String value;
-
- private RegionOrientation(String value)
- {
- if (value == null)
- {
- throw new IllegalArgumentException();
- }
- this.value = value;
- }
-
- public String toString()
- {
- return value;
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
- if (o instanceof RegionOrientation)
- {
- RegionOrientation that = (RegionOrientation)o;
- return this.value.equals(that.value);
- }
- return false;
- }
-
- public int hashCode()
- {
- return value.hashCode();
- }
-
- /**
- * Parse a string representation of a region orientation into a defined type.
- *
- * @param orientation the string representation of the orientation
- * @return the defined type for the string
- * @throws IllegalArgumentException if the provided orientation String is invalid
- */
- public static RegionOrientation parse(String orientation)
- {
- if (orientation != null)
- {
- if (orientation.equalsIgnoreCase(VERTICAL.toString()))
- {
- return VERTICAL;
- }
- if (orientation.equalsIgnoreCase(HORIZONTAL.toString()))
- {
- return HORIZONTAL;
- }
- }
-
- //
- throw new IllegalArgumentException("Invalid orientation: " +
orientation);
- }
-}
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2007-03-29
20:00:51 UTC (rev 6871)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2007-03-29
20:04:41 UTC (rev 6872)
@@ -28,8 +28,8 @@
import org.jboss.portal.theme.LayoutInfo;
import org.jboss.portal.theme.PortalLayout;
import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.theme.Orientation;
import org.jboss.portal.theme.page.Region;
-import org.jboss.portal.theme.page.RegionOrientation;
import org.jboss.portal.theme.page.WindowContext;
import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.page.PageResult;
@@ -60,7 +60,7 @@
private PortalLayout layout;
private String regionCssId;
- private RegionOrientation orientation;
+ private Orientation orientation;
private StringBuffer markup;
private Object fragment;
@@ -142,7 +142,7 @@
* @param orientation the orintation of multiple windows in this region (arranged
horizontally or vertically)
* @return a new render context for the provided region
*/
- public RenderContext getContext(Region region, String cssId, RegionOrientation
orientation)
+ public RenderContext getContext(Region region, String cssId, Orientation orientation)
{
RenderContext context = new RenderContext(this.layout, region, this.markupInfo,
this.pageResult, this.request);
if (cssId != null)
@@ -187,7 +187,7 @@
}
/** @return the region orientation */
- public RegionOrientation getRegionOrientation()
+ public Orientation getRegionOrientation()
{
return orientation;
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/tag/RegionTagHandler.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/tag/RegionTagHandler.java 2007-03-29
20:00:51 UTC (rev 6871)
+++ trunk/theme/src/main/org/jboss/portal/theme/tag/RegionTagHandler.java 2007-03-29
20:04:41 UTC (rev 6872)
@@ -24,9 +24,9 @@
import org.jboss.logging.Logger;
import org.jboss.portal.theme.LayoutConstants;
+import org.jboss.portal.theme.Orientation;
import org.jboss.portal.theme.page.PageResult;
import org.jboss.portal.theme.page.Region;
-import org.jboss.portal.theme.page.RegionOrientation;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
@@ -52,7 +52,7 @@
{
private static Logger log = Logger.getLogger(RegionTagHandler.class);
//default to vertical
- private RegionOrientation orientation = RegionOrientation.DEFAULT;
+ private Orientation orientation = Orientation.DEFAULT;
private String regionName = null;
private String regionCssId = null;
@@ -87,7 +87,7 @@
if (page.getRegion(regionName) == null) // non-window display of content
{
// create a new region obj, based on region name
- Region newRegion = new Region(regionName, regionCssId,
RegionOrientation.DEFAULT);
+ Region newRegion = new Region(regionName, regionCssId, Orientation.DEFAULT);
RenderContext renderContext =
(RenderContext)request.getAttribute(LayoutConstants.ATTR_RENDERCONTEXT);
renderContext = renderContext.getContext(newRegion, regionCssId, orientation);
try
@@ -143,12 +143,12 @@
try
{
- this.orientation = RegionOrientation.parse(orientation);
+ this.orientation = Orientation.parse(orientation);
}
catch (IllegalArgumentException e)
{
log.error(e);
- this.orientation = RegionOrientation.DEFAULT;
+ this.orientation = Orientation.DEFAULT;
}
}