Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 29820 invoked from network); 14 Nov 2005 12:22:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Nov 2005 12:22:47 -0000 Received: (qmail 40133 invoked by uid 500); 14 Nov 2005 12:22:46 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 40078 invoked by uid 500); 14 Nov 2005 12:22:45 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 40065 invoked by uid 99); 14 Nov 2005 12:22:45 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 14 Nov 2005 04:22:44 -0800 Received: (qmail 29642 invoked by uid 65534); 14 Nov 2005 12:22:24 -0000 Message-ID: <20051114122224.29636.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r344108 - in /cocoon/blocks: portal-sample/trunk/samples/profiles/copletdata/ portal/trunk/java/org/apache/cocoon/portal/coplet/ portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/ portal/trunk/java/org/apache/cocoon/portal/even... Date: Mon, 14 Nov 2005 12:22:22 -0000 To: cvs@cocoon.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: cziegeler Date: Mon Nov 14 04:22:10 2005 New Revision: 344108 URL: http://svn.apache.org/viewcvs?rev=344108&view=rev Log: Fix gallery coplet and add new caching options Modified: cocoon/blocks/portal-sample/trunk/samples/profiles/copletdata/portal.xml cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceDataFeatures.java cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java Modified: cocoon/blocks/portal-sample/trunk/samples/profiles/copletdata/portal.xml URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal-sample/trunk/samples/profiles/copletdata/portal.xml?rev=344108&r1=344107&r2=344108&view=diff ============================================================================== --- cocoon/blocks/portal-sample/trunk/samples/profiles/copletdata/portal.xml (original) +++ cocoon/blocks/portal-sample/trunk/samples/profiles/copletdata/portal.xml Mon Nov 14 04:22:10 2005 @@ -233,6 +233,14 @@ image-uri-prefix coplets/gallery/images + + ignore-sizing-events + false + + + ignore-simple-sizing-events + true + Gallery Viewer Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceDataFeatures.java URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceDataFeatures.java?rev=344108&r1=344107&r2=344108&view=diff ============================================================================== --- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceDataFeatures.java (original) +++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceDataFeatures.java Mon Nov 14 04:22:10 2005 @@ -55,6 +55,22 @@ } /** + * Get the new size of the sizing event. + */ + public static int getSize(CopletInstanceEvent cie) { + if ( cie instanceof CopletInstanceSizingEvent ) { + return ((CopletInstanceSizingEvent)cie).getSize(); + } + if ( cie instanceof CopletJXPathEvent ) { + CopletJXPathEvent e = (CopletJXPathEvent)cie; + if ( "size".equals(e.getPath()) && e.getValue() != null ) { + return Integer.valueOf(e.getValue().toString()).intValue(); + } + } + return -1; + } + + /** * Search for a layout containing the coplet instance data. */ public static CopletLayout searchLayout(String copletId, Layout rootLayout) { Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java?rev=344108&r1=344107&r2=344108&view=diff ============================================================================== --- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java (original) +++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java Mon Nov 14 04:22:10 2005 @@ -63,9 +63,12 @@ * for the global cache. */ public static final String CONFIGURATION_CACHE_GLOBAL_USE_ATTRIBUTES= "cache-global-use-attributes"; - /** The configuration name for ignoring sizing events to clear the cache. */ + /** The configuration name for ignoring all sizing events to clear the cache. */ public static final String CONFIGURATION_IGNORE_SIZING_EVENTS = "ignore-sizing-events"; + /** The configuration name for ignoring just min/normal sizing events to clear the cache. */ + public static final String CONFIGURATION_IGNORE_SIMPLE_SIZING_EVENTS = "ignore-simple-sizing-events"; + /** The temporary attribute name for the storing the cached coplet content. */ public static final String CACHE = "cacheData"; @@ -193,14 +196,26 @@ boolean ignoreSizing = ((Boolean)this.getConfiguration(coplet, CONFIGURATION_IGNORE_SIZING_EVENTS, Boolean.TRUE)).booleanValue(); if ( !ignoreSizing || !CopletInstanceDataFeatures.isSizingEvent(event)) { - // do we cache globally? - boolean cacheGlobal = ((Boolean)this.getConfiguration(coplet, CONFIGURATION_CACHE_GLOBAL, Boolean.FALSE)).booleanValue(); - if ( cacheGlobal ) { - final String key = this.getCacheKey(coplet, - (String) coplet.getCopletData().getAttribute("uri")); - this.cache.remove(key); - } else { - coplet.removeTemporaryAttribute(CACHE); + boolean cleanupCache = true; + boolean ignoreSimpleSizing = ((Boolean)this.getConfiguration(coplet, CONFIGURATION_IGNORE_SIMPLE_SIZING_EVENTS, Boolean.FALSE)).booleanValue(); + if ( ignoreSimpleSizing && CopletInstanceDataFeatures.isSizingEvent(event) ) { + int newSize = CopletInstanceDataFeatures.getSize(event); + int oldSize = coplet.getSize(); + if ( (oldSize == CopletInstanceData.SIZE_NORMAL || oldSize == CopletInstanceData.SIZE_MINIMIZED ) + && (newSize == CopletInstanceData.SIZE_NORMAL || newSize == CopletInstanceData.SIZE_MINIMIZED )) { + cleanupCache = false; + } + } + if ( cleanupCache ) { + // do we cache globally? + boolean cacheGlobal = ((Boolean)this.getConfiguration(coplet, CONFIGURATION_CACHE_GLOBAL, Boolean.FALSE)).booleanValue(); + if ( cacheGlobal ) { + final String key = this.getCacheKey(coplet, + (String) coplet.getCopletData().getAttribute("uri")); + this.cache.remove(key); + } else { + coplet.removeTemporaryAttribute(CACHE); + } } } } Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java?rev=344108&r1=344107&r2=344108&view=diff ============================================================================== --- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java (original) +++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java Mon Nov 14 04:22:10 2005 @@ -202,6 +202,14 @@ } protected void send(Event event, HierarchyInfo hierarchy, boolean recursive) { + // first call listeners for parents + if ( recursive ) { + final Iterator parentIterator = hierarchy.getParents().iterator(); + while ( parentIterator.hasNext() ) { + final HierarchyInfo current = (HierarchyInfo)parentIterator.next(); + this.send(event, current, false); + } + } final List receiverInfos = hierarchy.getReceiverInfos(); int index = 0; // we don't use an iterator to avoid problems if a receiver is added while we're sending @@ -218,14 +226,6 @@ +" and event " + event, ignore); } index++; - } - // now call listeners for parents - if ( recursive ) { - final Iterator parentIterator = hierarchy.getParents().iterator(); - while ( parentIterator.hasNext() ) { - final HierarchyInfo current = (HierarchyInfo)parentIterator.next(); - this.send(event, current, false); - } } }