paulsp 2002/08/03 08:24:25
Modified: docs/site changes.html
src/java/org/apache/jetspeed/modules/actions/controllers
MultiColumnControllerAction.java
src/java/org/apache/jetspeed/modules/localization
JetspeedLocalization_en.properties
src/java/org/apache/jetspeed/om/profile/psml
PsmlPortlets.java
webapp/WEB-INF/templates/vm/controllers/html
multicolumn-customize.vm
xdocs changes.xml
Log:
o Added ability to move and delete Reference portlets in the
MultiColumnController. Implementation in other controllers and
the creation of Reference portlets in the PSML will be added soon.
o The MultiColumnController now used PEID instead of position to identify
portlets.
o PsmlPortlet.addReference() now adds the reference to the list of references in the
class, this, not the one passed in.
o Housekeeping in PsmlPortlets as suggested by checkStlye
Revision Changes Path
1.39 +3 -0 jakarta-jetspeed/docs/site/changes.html
Index: changes.html
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/docs/site/changes.html,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- changes.html 2 Aug 2002 10:57:28 -0000 1.38
+++ changes.html 3 Aug 2002 15:24:25 -0000 1.39
@@ -130,6 +130,9 @@
-->
</ul>
<li>
+ Add - 2002/08/03 - Added ability to move and delete Reference portlets in the
MultiController
+</li>
+ <li>
Fix - 2002/07/30 - Bug #6426 - Entries in deleted columns are now placed at
then of the portlets list during customization. (PS)
</li>
1.15 +59 -19
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.java
Index: MultiColumnControllerAction.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- MultiColumnControllerAction.java 30 Jul 2002 17:31:41 -0000 1.14
+++ MultiColumnControllerAction.java 3 Aug 2002 15:24:25 -0000 1.15
@@ -57,11 +57,13 @@
// Jetspeed stuff
import org.apache.jetspeed.om.profile.Profile;
import org.apache.jetspeed.om.registry.PortletEntry;
-import org.apache.jetspeed.om.profile.Portlets;
+import org.apache.jetspeed.om.profile.IdentityElement;
import org.apache.jetspeed.om.profile.Entry;
import org.apache.jetspeed.om.profile.MetaInfo;
import org.apache.jetspeed.om.profile.Layout;
import org.apache.jetspeed.om.profile.Parameter;
+import org.apache.jetspeed.om.profile.Portlets;
+import org.apache.jetspeed.om.profile.Reference;
import org.apache.jetspeed.om.profile.psml.PsmlParameter;
import org.apache.jetspeed.om.profile.psml.PsmlLayout;
import org.apache.jetspeed.portal.Portlet;
@@ -76,6 +78,7 @@
import org.apache.jetspeed.util.template.JetspeedLinkFactory;
// Turbine stuff
+import org.apache.turbine.services.localization.Localization;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.StringUtils;
@@ -323,19 +326,36 @@
{
for(int row=0; row < columns[col].size(); row++)
{
- Entry entry = (Entry)columns[col].get(row);
- if
((entry.getMetaInfo()!=null)&&(entry.getMetaInfo().getTitle()!=null))
+ IdentityElement identityElement = (IdentityElement)
columns[col].get(row);
+ MetaInfo metaInfo = identityElement.getMetaInfo();
+ if ((metaInfo != null) && (metaInfo.getTitle() != null))
{
- titles.put(entry.getParent(),entry.getMetaInfo().getTitle());
+ titles.put(identityElement.getId(),metaInfo.getTitle());
+ continue;
}
- else
+
+ if (identityElement instanceof Entry)
{
+ Entry entry = (Entry) identityElement;
PortletEntry pentry =
(PortletEntry)Registry.getEntry(Registry.PORTLET,entry.getParent());
- if (pentry!=null)
+ if ((pentry != null) && (pentry.getTitle() != null))
{
- titles.put(entry.getParent(),pentry.getTitle());
+ titles.put(entry.getId(), pentry.getTitle());
+ continue;
}
+
+ titles.put(entry.getId(), entry.getParent());
+ continue;
+ }
+
+ if (identityElement instanceof Reference )
+ {
+ titles.put(identityElement.getId(),
Localization.getString("CUSTOMIZER_REF_DEFAULTTITLE"));
+ continue;
}
+
+ // Let's make sure their is a title
+ titles.put(identityElement.getId(),
Localization.getString("CUSTOMIZER_NOTITLESET"));
}
}
@@ -387,7 +407,7 @@
{
for(int row=0; row < columns[col].size(); row++)
{
- setPosition((Entry)columns[col].get(row),col,row);
+ setPosition((IdentityElement) columns[col].get(row), col, row);
}
}
@@ -423,19 +443,33 @@
{
try
{
- Entry entry = (Entry)columns[col].get(row);
+ IdentityElement identityElement = (IdentityElement)
columns[col].get(row);
columns[col].remove(row);
-
+
Portlets portlets = jdata.getProfile()
- .getDocument()
- .getPortletsById(customizedSet.getID());
+ .getDocument()
+ .getPortletsById(customizedSet.getID());
+
if (portlets != null)
{
- for (int i=0; i < portlets.getEntryCount(); i++)
+ if (identityElement instanceof Entry)
+ {
+ for (int i=0; i < portlets.getEntryCount(); i++)
+ {
+ if (portlets.getEntry(i) == identityElement)
+ {
+ portlets.removeEntry(i);
+ }
+ }
+ }
+ else if (identityElement instanceof Reference)
{
- if (portlets.getEntry(i)==entry)
+ for (int i=0; i < portlets.getReferenceCount(); i++)
{
- portlets.removeEntry(i);
+ if (portlets.getReference(i) == identityElement)
+ {
+ portlets.removeReference(i);
+ }
}
}
}
@@ -499,18 +533,18 @@
}
}
- protected static void setPosition(Entry entry, int col, int row)
+ protected static void setPosition(IdentityElement identityElement, int col, int
row)
{
boolean colFound=false,rowFound=false;
- if (entry!=null)
+ if (identityElement != null)
{
- Layout layout = entry.getLayout();
+ Layout layout = identityElement.getLayout();
if (layout==null)
{
layout = new PsmlLayout();
- entry.setLayout(layout);
+ identityElement.setLayout(layout);
}
for (int i=0; i < layout.getParameterCount(); i++)
@@ -692,6 +726,12 @@
}
work.add(entry);
}
+ }
+
+ // Add references
+ for (int i=0; i < set.getReferenceCount(); i++)
+ {
+ work.add( set.getReference(i));
}
//insert the unconstrained elements in the table
1.19 +3 -0
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/localization/JetspeedLocalization_en.properties
Index: JetspeedLocalization_en.properties
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/localization/JetspeedLocalization_en.properties,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- JetspeedLocalization_en.properties 23 Jul 2002 05:30:04 -0000 1.18
+++ JetspeedLocalization_en.properties 3 Aug 2002 15:24:25 -0000 1.19
@@ -160,9 +160,12 @@
CUSTOMIZER_NEWPANENAME=Type the name of the pane to add
CUSTOMIZER_NOTHINGDEFINED=No Portlets or Panes Defined
CUSTOMIZER_NOPARAMETERS=No customizeable parameters
+CUSTOMIZER_NOTITLESET=No title set
CUSTOMIZER_PANE=Pane
CUSTOMIZER_PORTLET=Portlet
CUSTOMIZER_PREVIOUSBTN=<< Previous
+CUSTOMIZER_REF_DEFAULTTITLE=Reference
+CUSTOMIZER_REF_PATH=Path
CUSTOMIZER_REMOVE=Remove
CUSTOMIZER_SAVE=Save
CUSTOMIZER_SAVEAPPLY=Save and Apply
1.6 +33 -14
jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/psml/PsmlPortlets.java
Index: PsmlPortlets.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/psml/PsmlPortlets.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PsmlPortlets.java 28 Jun 2002 05:37:30 -0000 1.5
+++ PsmlPortlets.java 3 Aug 2002 15:24:25 -0000 1.6
@@ -60,7 +60,11 @@
// Jetspeed imports
import org.apache.jetspeed.om.SecurityReference;
-import org.apache.jetspeed.om.profile.*;
+import org.apache.jetspeed.om.profile.Controller;
+import org.apache.jetspeed.om.profile.Entry;
+import org.apache.jetspeed.om.profile.Portlets;
+import org.apache.jetspeed.om.profile.Reference;
+import org.apache.jetspeed.om.profile.Security;
/**
* Base simple bean-like implementation of the Portlets interface
@@ -85,7 +89,7 @@
private SecurityReference securityRef = null;
public PsmlPortlets()
- {}
+ { }
public Controller getController()
{
@@ -117,14 +121,21 @@
this.entries = entries;
}
+ /**
+ * Return a list of portlet. Portlets that where added via a reference, see
+ * addReference(), are excluded.
+ *
+ * @return Vector of portlet
+ */
public Vector getPortlets()
{
Vector v = new Vector();
- for (int ix=0; ix < this.portlets.size(); ix++)
+ for (int ix = 0; ix < this.portlets.size(); ix++)
{
- Portlets p = (Portlets)this.portlets.get(ix);
+ Portlets p = (Portlets) this.portlets.get(ix);
if (p instanceof Reference)
{
+ // Do not want to include portlets that where added via reference
continue;
}
v.add(p);
@@ -149,14 +160,14 @@
public void addReference(PsmlReference ref)
{
- refs.addElement(ref);
+ this.refs.addElement(ref);
portlets.addElement(ref);
}
public void addReference(Reference ref)
throws java.lang.IndexOutOfBoundsException
{
- refs.addElement(ref);
+ this.refs.addElement(ref);
portlets.addElement(ref);
}
@@ -186,7 +197,9 @@
{
Object obj = portlets.elementAt(index);
if (null == obj)
- return (Portlets)obj;
+ {
+ return (Portlets) obj;
+ }
portlets.removeElementAt(index);
if (obj instanceof Reference)
@@ -209,7 +222,8 @@
throws java.lang.IndexOutOfBoundsException
{
//-- check bounds for index
- if ((index < 0) || (index > entries.size())) {
+ if ((index < 0) || (index > entries.size()))
+ {
throw new IndexOutOfBoundsException();
}
@@ -220,7 +234,8 @@
throws java.lang.IndexOutOfBoundsException
{
//-- check bounds for index
- if ((index < 0) || (index > portlets.size())) {
+ if ((index < 0) || (index > portlets.size()))
+ {
throw new IndexOutOfBoundsException();
}
@@ -230,7 +245,8 @@
public Reference getReference(int index)
throws java.lang.IndexOutOfBoundsException
{
- if ((index < 0) || (index > refs.size())) {
+ if ((index < 0) || (index > refs.size()))
+ {
throw new IndexOutOfBoundsException();
}
@@ -269,7 +285,8 @@
{
int size = entries.size();
Entry[] mArray = new Entry[size];
- for (int index = 0; index < size; index++) {
+ for (int index = 0; index < size; index++)
+ {
mArray[index] = (Entry) entries.elementAt(index);
}
return mArray;
@@ -279,7 +296,8 @@
{
int size = portlets.size();
Portlets[] mArray = new Portlets[size];
- for (int index = 0; index < size; index++) {
+ for (int index = 0; index < size; index++)
+ {
mArray[index] = (Portlets) portlets.elementAt(index);
}
return mArray;
@@ -289,7 +307,8 @@
{
int size = refs.size();
Reference[] mArray = new Reference[size];
- for (int index = 0; index < size; index++) {
+ for (int index = 0; index < size; index++)
+ {
mArray[index] = (Reference) refs.elementAt(index);
}
return mArray;
1.12 +12 -6
jakarta-jetspeed/webapp/WEB-INF/templates/vm/controllers/html/multicolumn-customize.vm
Index: multicolumn-customize.vm
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/vm/controllers/html/multicolumn-customize.vm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- multicolumn-customize.vm 23 Jul 2002 00:03:56 -0000 1.11
+++ multicolumn-customize.vm 3 Aug 2002 15:24:25 -0000 1.12
@@ -26,6 +26,7 @@
<form action="$jslink.Template" method="post">
#end
#if ($action) <input type="hidden" name="$jslink.ActionKey" value="$action" /> #end
+ <input type="hidden" name="id" value="$portlet.id" />
<input type="hidden" name="col" value="$col" />
<input type="hidden" name="row" value="$row" />
<table width="95%" cellpadding="1" cellspacing="0" #if(
${skin.PortletStyleClass}) class="$!{skin.PortletStyleClass}" #end
#if(${skin.TitleBackgroundColor}) style="background-color:
${skin.TitleBackgroundColor}" #end >
@@ -56,14 +57,9 @@
#end
</td>
</tr>
-#if ($titles.get($portlet.Parent))
- #set ($title = $titles.get($portlet.Parent) )
-#else
- #set ($title = $portlet.Parent)
-#end
<tr height="50">
<td height="50" valign="middle" #if(${skin.ContentStyleClass})
class="${skin.ContentStyleClass}" #end #if(${skin.BackgroundColor})
style="background-color: ${skin.BackgroundColor}" #end align="center">
- <b>$title</b>
+ <b>$titles.get($portlet.id)</b>
</td>
</tr>
<tr>
@@ -103,6 +99,16 @@
</table>
</td>
</tr>
+## Include path for references
+#if ($portlet.Path)
+ <tr>
+ <td#if(${skin.ContentStyleClass}) class="${skin.ContentStyleClass}"
#end #if(${skin.BackgroundColor}) style="background-color: ${skin.BackgroundColor}"
#end>
+ <table width="100%"> ## Including table to match alignment.
+ <tr><td>$l10n.CUSTOMIZER_REF_PATH : $portlet.Path</td></tr>
+ </table>
+ </td>
+ </tr>
+#end
</table>
</td></tr>
</table>
1.57 +4 -1 jakarta-jetspeed/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- changes.xml 30 Jul 2002 17:31:41 -0000 1.56
+++ changes.xml 3 Aug 2002 15:24:25 -0000 1.57
@@ -24,6 +24,9 @@
-->
</ul>
<li>
+ Add - 2002/08/03 - Added ability to move and delete Reference portlets in the
MultiController
+</li>
+<li>
Fix - 2002/07/30 - Bug #6426 - Entries in deleted columns are now placed at
then of the portlets list during customization. (PS)
</li>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>