- DataCollectionRenderer und CMSDataCollectionRenderer so angepasst, dass man über eine JSP einen anderen Kontext für den Traversaladapter setzen kann. Dies erlaubt
es in einer mit spezializierten Objekten einen anderen TraversalAdapter als für die Detailansicht zu verwenden. git-svn-id: https://svn.libreccm.org/ccm/trunk@667 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
418965d150
commit
1bb45012d2
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
package com.arsdigita.london.navigation;
|
||||
|
||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.persistence.DataAssociation;
|
||||
|
|
@ -54,6 +55,13 @@ public class DataCollectionRenderer extends LockableImpl {
|
|||
private ArrayList m_properties = new ArrayList();
|
||||
private int m_pageSize = 20;
|
||||
private boolean m_specializeObjects = false;
|
||||
/**
|
||||
* The traversal adapter context used if {@link #m_specializeObjects} is
|
||||
* <code>true</code>. Defaults to
|
||||
* {@link SimpleXMLGenerator.ADAPTER_CONTEXT}.
|
||||
*/
|
||||
private String m_specializeObjectsContext =
|
||||
SimpleXMLGenerator.ADAPTER_CONTEXT;
|
||||
private boolean m_wrapAttributes = false;
|
||||
private boolean m_navItems = true;
|
||||
|
||||
|
|
@ -91,6 +99,20 @@ public class DataCollectionRenderer extends LockableImpl {
|
|||
m_specializeObjects = specializeObjects;
|
||||
}
|
||||
|
||||
protected String getSpecializeObjectsContext() {
|
||||
return m_specializeObjectsContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the context of the traversal adapter used the render the objects
|
||||
* if {@link #m_specializeObjects} is set to <code>true</code>
|
||||
*
|
||||
* @param context The adapter context.
|
||||
*/
|
||||
public void setSpecializeObjectsContext(String context) {
|
||||
m_specializeObjectsContext = context;
|
||||
}
|
||||
|
||||
public void setWrapAttributes(boolean wrapAttributes) {
|
||||
Assert.isUnlocked(this);
|
||||
m_wrapAttributes = wrapAttributes;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,14 @@ public class CMSDataCollectionRenderer extends DataCollectionRenderer {
|
|||
renderer.setWrapAttributes(true);
|
||||
renderer.setWrapRoot(false);
|
||||
renderer.setWrapObjects(false);
|
||||
renderer.walk(obj, SimpleXMLGenerator.ADAPTER_CONTEXT);
|
||||
//renderer.walk(obj, SimpleXMLGenerator.ADAPTER_CONTEXT);
|
||||
/* jensp 2011-01-03:
|
||||
* I needed the option to use different traversal adapters for
|
||||
* the object in the detail view and the list view. It is now
|
||||
* possible to set the adapter context used from a JSP template,
|
||||
* using DataCollectionRenderer#setSpecializeObjectsContext(String).
|
||||
*/
|
||||
renderer.walk(obj, getSpecializeObjectsContext());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,24 +15,16 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
package com.arsdigita.london.navigation.ui.object;
|
||||
|
||||
import com.arsdigita.london.navigation.Navigation;
|
||||
import com.arsdigita.london.navigation.ui.AbstractObjectList;
|
||||
|
||||
|
||||
|
||||
|
||||
import com.arsdigita.xml.Element;
|
||||
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
/**
|
||||
* A object list
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -13,10 +13,21 @@
|
|||
<xrd:property name="/object/projectDescription"/>
|
||||
</xrd:attributes>
|
||||
<!--<xrd:associations rule="include">
|
||||
<xrd:property name="/object/addendum"/>
|
||||
<xrd:property name="/object/contacts"/>
|
||||
<xrd:property name="/object/persons"/>
|
||||
</xrd:associations>-->
|
||||
</xrd:adapter>
|
||||
</xrd:context>
|
||||
|
||||
<xrd:context name="sciProjectList">
|
||||
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.SciProject" extends="com.arsdigita.cms.ContentPage">
|
||||
<!--<xrd:attributes rule="exclude">
|
||||
<xrd:property name="/object/projectDescription"/>
|
||||
</xrd:attributes>-->
|
||||
<xrd:associations rule="include">
|
||||
<xrd:property name="/object/contacts"/>
|
||||
<xrd:property name="/object/persons"/>
|
||||
</xrd:associations>
|
||||
</xrd:adapter>
|
||||
</xrd:context>
|
||||
</xrd:adapters>
|
||||
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getRenderer().setPageSize(20);
|
||||
((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getRenderer().setSpecializeObjects(true);
|
||||
((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getRenderer().setSpecializeObjectsContext("sciProjectList");
|
||||
</jsp:scriptlet>
|
||||
|
||||
<define:component name="assignedTerms"
|
||||
|
|
|
|||
Loading…
Reference in New Issue