Author: thomas.heute(a)jboss.com
Date: 2007-10-09 08:24:48 -0400 (Tue, 09 Oct 2007)
New Revision: 8572
Added:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletIconInfoImpl.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/metadata/portlet/PortletIconMetaData.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/portlet/info/PortletIconInfo.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/portlet/info/PortletInfoInfo.java
Removed:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/portlet/info/PortletInfoInfo.java
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletInfoInfoImpl.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/metadata/portlet/PortletInfoMetaData.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
branches/JBoss_Portal_Branch_2_6/core/src/resources/test/deployment/jboss-portlet.xml
Log:
Align with something closer to web.xml syntax
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java 2007-10-09
10:00:46 UTC (rev 8571)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java 2007-10-09
12:24:48 UTC (rev 8572)
@@ -28,6 +28,7 @@
import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
import org.jboss.portal.core.metadata.portlet.ElementMetaData;
import org.jboss.portal.core.metadata.portlet.AjaxMetaData;
+import org.jboss.portal.core.metadata.portlet.PortletIconMetaData;
import org.jboss.portal.core.metadata.portlet.PortletInfoMetaData;
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
@@ -78,6 +79,13 @@
child = new PortletInfoMetaData();
}
}
+ else if (object instanceof PortletInfoMetaData)
+ {
+ if ("icon".equals(localName))
+ {
+ child = new PortletIconMetaData();
+ }
+ }
else if (object instanceof HeaderContentMetaData)
{
if ("link".equalsIgnoreCase(localName))
@@ -141,6 +149,12 @@
JBossPortletMetaData portlet = (JBossPortletMetaData)parent;
portlet.setPortletInfo(portletInfo);
}
+ else if (child instanceof PortletIconMetaData)
+ {
+ PortletIconMetaData portletIcon = (PortletIconMetaData)child;
+ PortletInfoMetaData portletInfo = (PortletInfoMetaData)parent;
+ portletInfo.setPortletIcon(portletIcon);
+ }
else if (child instanceof ElementMetaData)
{
ElementMetaData element = (ElementMetaData)child;
@@ -188,23 +202,18 @@
ajax.setPartialRefresh(Boolean.valueOf(value));
}
}
- else if (object instanceof PortletInfoMetaData)
+ else if (object instanceof PortletIconMetaData)
{
- if ("small-icon-location".equals(localName))
+ if ("small-icon".equals(localName))
{
- PortletInfoMetaData portletInfo = (PortletInfoMetaData)object;
- portletInfo.setIconLocation(value, PortletInfoMetaData.SMALL);
+ PortletIconMetaData portletIcon = (PortletIconMetaData)object;
+ portletIcon.setIconLocation(value, PortletIconMetaData.SMALL);
}
- else if ("medium-icon-location".equals(localName))
+ else if ("large-icon".equals(localName))
{
- PortletInfoMetaData portletInfo = (PortletInfoMetaData)object;
- portletInfo.setIconLocation(value, PortletInfoMetaData.MEDIUM);
+ PortletIconMetaData portletIcon = (PortletIconMetaData)object;
+ portletIcon.setIconLocation(value, PortletIconMetaData.LARGE);
}
- else if ("large-icon-location".equals(localName))
- {
- PortletInfoMetaData portletInfo = (PortletInfoMetaData)object;
- portletInfo.setIconLocation(value, PortletInfoMetaData.LARGE);
- }
}
else
{
Added:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletIconInfoImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletIconInfoImpl.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletIconInfoImpl.java 2007-10-09
12:24:48 UTC (rev 8572)
@@ -0,0 +1,51 @@
+/******************************************************************************
+ * 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.core.impl.portlet.info;
+
+import java.util.Map;
+
+import org.jboss.portal.core.metadata.portlet.PortletIconMetaData;
+import org.jboss.portal.core.portlet.info.PortletIconInfo;
+import org.jboss.portal.core.portlet.info.PortletInfoInfo;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class PortletIconInfoImpl implements PortletIconInfo
+{
+ /** . */
+ private Map icons;
+
+ public PortletIconInfoImpl(PortletIconMetaData portletIconMetaData)
+ {
+ icons = portletIconMetaData.getIcons();
+ }
+
+ public String getIconLocation(String size)
+ {
+ return (String)icons.get(size);
+ }
+
+}
+
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletInfoInfoImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletInfoInfoImpl.java 2007-10-09
10:00:46 UTC (rev 8571)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletInfoInfoImpl.java 2007-10-09
12:24:48 UTC (rev 8572)
@@ -22,9 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.impl.portlet.info;
-import java.util.Map;
-
import org.jboss.portal.core.metadata.portlet.PortletInfoMetaData;
+import org.jboss.portal.core.portlet.info.PortletIconInfo;
import org.jboss.portal.core.portlet.info.PortletInfoInfo;
/**
@@ -34,16 +33,16 @@
public class PortletInfoInfoImpl implements PortletInfoInfo
{
/** . */
- private Map icons;
+ private PortletInfoMetaData portletInfoMetaData;
public PortletInfoInfoImpl(PortletInfoMetaData portletInfoMetaData)
{
- icons = portletInfoMetaData.getIcons();
+ this.portletInfoMetaData = portletInfoMetaData;
}
- public String getIconLocation(String size)
+ public PortletIconInfo getPortletIconInfo()
{
- return (String)icons.get(size);
+ return new PortletIconInfoImpl(portletInfoMetaData.getPortletIcon());
}
}
Added:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/metadata/portlet/PortletIconMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/metadata/portlet/PortletIconMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/metadata/portlet/PortletIconMetaData.java 2007-10-09
12:24:48 UTC (rev 8572)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * 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.core.metadata.portlet;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class PortletIconMetaData
+{
+
+ /** . */
+ public static final String SMALL = "small";
+
+ /** . */
+ public static final String LARGE = "large";
+
+ /** . */
+ private Map icons;
+
+ public PortletIconMetaData()
+ {
+ icons = new HashMap();
+ }
+
+ public void setIconLocation(String iconLocation, String size)
+ {
+ icons.put(size, iconLocation);
+ }
+
+ public String getIconLocation(String size)
+ {
+ return (String)icons.get(size);
+ }
+
+ public Map getIcons()
+ {
+ return Collections.unmodifiableMap(icons);
+ }
+}
+
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/metadata/portlet/PortletInfoMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/metadata/portlet/PortletInfoMetaData.java 2007-10-09
10:00:46 UTC (rev 8571)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/metadata/portlet/PortletInfoMetaData.java 2007-10-09
12:24:48 UTC (rev 8572)
@@ -22,10 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.metadata.portlet;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @version $Revision$
@@ -34,35 +30,17 @@
{
/** . */
- public static final String SMALL = "small";
-
- /** . */
- public static final String MEDIUM = "medium";
+ private PortletIconMetaData portletIconMD;
- /** . */
- public static final String LARGE = "large";
-
- /** . */
- private Map icons;
-
- public PortletInfoMetaData()
+ public PortletIconMetaData getPortletIcon()
{
- icons = new HashMap();
+ return portletIconMD;
}
- public void setIconLocation(String iconLocation, String size)
+ public void setPortletIcon(PortletIconMetaData portletIconMD)
{
- icons.put(size, iconLocation);
+ this.portletIconMD = portletIconMD;
}
- public String getIconLocation(String size)
- {
- return (String)icons.get(size);
- }
-
- public Map getIcons()
- {
- return Collections.unmodifiableMap(icons);
- }
}
Added:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/portlet/info/PortletIconInfo.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/portlet/info/PortletIconInfo.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/portlet/info/PortletIconInfo.java 2007-10-09
12:24:48 UTC (rev 8572)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * 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.core.portlet.info;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface PortletIconInfo
+{
+ /** . */
+ public static final String SMALL = "small";
+
+ /** . */
+ public static final String LARGE = "large";
+
+ String getIconLocation(String size);
+}
+
Deleted:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/portlet/info/PortletInfoInfo.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/portlet/info/PortletInfoInfo.java 2007-10-09
10:00:46 UTC (rev 8571)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/portlet/info/PortletInfoInfo.java 2007-10-09
12:24:48 UTC (rev 8572)
@@ -1,42 +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.core.portlet.info;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public interface PortletInfoInfo
-{
- /** . */
- public static final String SMALL = "small";
-
- /** . */
- public static final String MEDIUM = "medium";
-
- /** . */
- public static final String LARGE = "large";
-
- String getIconLocation(String size);
-}
-
Added:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/portlet/info/PortletInfoInfo.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/portlet/info/PortletInfoInfo.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/portlet/info/PortletInfoInfo.java 2007-10-09
12:24:48 UTC (rev 8572)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * 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.core.portlet.info;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface PortletInfoInfo
+{
+
+ PortletIconInfo getPortletIconInfo();
+}
+
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java 2007-10-09
10:00:46 UTC (rev 8571)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java 2007-10-09
12:24:48 UTC (rev 8572)
@@ -31,6 +31,7 @@
import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
import org.jboss.portal.core.metadata.portlet.LinkElementMetaData;
import org.jboss.portal.core.metadata.portlet.NamedMetaElementMetaData;
+import org.jboss.portal.core.metadata.portlet.PortletIconMetaData;
import org.jboss.portal.core.metadata.portlet.PortletInfoMetaData;
import org.jboss.portal.core.metadata.portlet.ScriptElementMetaData;
import org.jboss.xb.binding.Unmarshaller;
@@ -157,7 +158,8 @@
assertEquals("Portlet4", portlet.getName());
PortletInfoMetaData portletInfo = (PortletInfoMetaData)portlet.getPortletInfo();
- assertEquals("/tmp/toto.png",
portletInfo.getIconLocation(PortletInfoMetaData.SMALL));
+ System.out.println(">>>" + portletInfo.getPortletIcon());
+ assertEquals("/tmp/toto.png",
portletInfo.getPortletIcon().getIconLocation(PortletIconMetaData.SMALL));
}
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2007-10-09
10:00:46 UTC (rev 8571)
+++
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2007-10-09
12:24:48 UTC (rev 8572)
@@ -94,12 +94,14 @@
-->
<!ELEMENT partial-refresh (#PCDATA)>
-<!ELEMENT portlet-info (small-icon-location?, medium-icon-location?,
large-icon-location?)>
+<!ELEMENT portlet-info (icon?)>
-<!ELEMENT small-icon-location (#PCDATA)>
-<!ELEMENT medium-icon-location (#PCDATA)>
-<!ELEMENT large-icon-location (#PCDATA)>
+<!ELEMENT icon (small-icon?, large-icon?)>
+<!ELEMENT small-icon (#PCDATA)>
+
+<!ELEMENT large-icon (#PCDATA)>
+
<!--
This element configure the portlet session of the portlet.
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/resources/test/deployment/jboss-portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/resources/test/deployment/jboss-portlet.xml 2007-10-09
10:00:46 UTC (rev 8571)
+++
branches/JBoss_Portal_Branch_2_6/core/src/resources/test/deployment/jboss-portlet.xml 2007-10-09
12:24:48 UTC (rev 8572)
@@ -46,7 +46,9 @@
<link rel="stylesheet" type="text/css"
href="test.css" media="screen" title="foo"/>
</header-content>
<portlet-info>
- <small-icon-location>/tmp/toto.png</small-icon-location>
+ <icon>
+ <small-icon>/tmp/toto.png</small-icon>
+ </icon>
</portlet-info>
</portlet>
</portlet-app>
\ No newline at end of file