<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blogg - Athega AB &#187; Escenic</title>
	<atom:link href="http://blogg.athega.se/kategori/escenic/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogg.athega.se</link>
	<description>...</description>
	<lastBuildDate>Thu, 18 Nov 2010 22:17:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Athega på Escenicutbildning i Oslo</title>
		<link>http://blogg.athega.se/2009/11/09/athega-pa-escenicutbildning-i-oslo/</link>
		<comments>http://blogg.athega.se/2009/11/09/athega-pa-escenicutbildning-i-oslo/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 12:41:56 +0000</pubDate>
		<dc:creator>Mikael Forsberg</dc:creator>
				<category><![CDATA[Escenic]]></category>
		<category><![CDATA[Utbildning]]></category>

		<guid isPermaLink="false">http://blogg.athega.se/?p=508</guid>
		<description><![CDATA[Förra veckan var några av oss på Athega i Oslo. Det handlade om Escenic-utbildning anordnad av Escenic. Aktiviteten är en del av Athegas utbildningsplan för att möta våra kunders behov av duktiga Java-konsulter som även kan och har dokumenterad utbildning av Escenic. Vi fick bland annat lära oss Escenic &#8221;best practices&#8221; och hur man på [...]]]></description>
			<content:encoded><![CDATA[<p>Förra veckan var några av oss på Athega i Oslo. Det handlade om Escenic-utbildning anordnad av <a href="http://www.escenic.com/">Escenic</a>. Aktiviteten är en del av Athegas utbildningsplan för att möta våra kunders behov av duktiga Java-konsulter som även kan och har dokumenterad utbildning av Escenic.</p>
<p>Vi fick bland annat lära oss Escenic &#8221;best practices&#8221; och hur man på bästa sätt strukturerar och sätter upp en bra mallstruktur. Utöver kursen fick vi även en genomgång av Escenics nya produkt <a href="http://www.escenic.com/products/roadmap/article6647.ece">Escenic Widget Framework</a> vilket ska underlätta för en kund att snabbt komma upp med Escenic-site.</p>
<p>Det var tre givande dagar och vi kom tillbaka till Stockholm med mycket ny kunskap som förhoppningsvis även våra kunder kommer dra stor nytta av.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogg.athega.se/2009/11/09/athega-pa-escenicutbildning-i-oslo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lär dig leva utan ancestorView</title>
		<link>http://blogg.athega.se/2009/07/02/lar-dig-leva-utan-ancestorview/</link>
		<comments>http://blogg.athega.se/2009/07/02/lar-dig-leva-utan-ancestorview/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 12:04:38 +0000</pubDate>
		<dc:creator>Christian Lizell</dc:creator>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[Escenic]]></category>
		<category><![CDATA[Kod]]></category>
		<category><![CDATA[Prestanda]]></category>
		<category><![CDATA[Webbutveckling]]></category>
		<category><![CDATA[ancestorView]]></category>

		<guid isPermaLink="false">http://blogg.athega.se/?p=255</guid>
		<description><![CDATA[Under våren har jag jobbat med att trimma en webbapplikation som levererar nätupplagan av en av Sveriges större tidningar. CMS-verktyget som används är Escenic i version 4.x och det kommer med en rad egna JSP-tagar. En av dom ska man dock akta sig för – &#60;section:ancestorView&#62;. Den är faktiskt inte så svår att leva utan [...]]]></description>
			<content:encoded><![CDATA[<p>Under våren har jag jobbat med att trimma en webbapplikation som levererar nätupplagan av en av Sveriges större tidningar. CMS-verktyget som används är <a href="http://www.escenic.com">Escenic</a> i version 4.x och det kommer med en rad egna JSP-tagar. En av dom ska man dock akta sig för – <code>&lt;section:ancestorView&gt;</code>. Den är faktiskt inte så svår att leva utan heller. I den här artikeln visar jag hur.</p>
<div id="attachment_256" class="wp-caption aligncenter" style="width: 625px"><img class="size-full wp-image-256 " title="Responstid" src="http://blogg.athega.se/wp-content/uploads/2009/07/response_time.jpg" alt="Responstid före och efter jag bytt ut &lt;section:ancerstorView&gt;" width="615" height="276" /><p class="wp-caption-text">Responstid före och efter jag bytt ut ancerstorview-taggen</p></div>
<h2>Vad är ancestorView?</h2>
<p><code>ancestorView</code> används för att skapa en hierarkisk vy av sektioner utgående från den sektion du anger. Inget speciellt avancerat eller konstigt. Det borde inte heller vara jobbigt för systemet att skapa vyn, tyvärr sker något under ytan som ställer till det. Berätta gärna vad i kommentarerna. <img src='http://blogg.athega.se/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h2>Hur det kan se ut (före)</h2>
<p>Ett vanligt sätt att använda sig av <code>ancestorView</code> är för att exempelvis bygga en sökväg till en navigering:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;section:ancestorView</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;sectionView&quot;</span> <span style="color: #000066;">section</span>=<span style="color: #ff0000;">&quot;${article.homeSection}&quot;</span> <span style="color: #000066;">includeRoot</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;menu:use</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;navigation&quot;</span> <span style="color: #000066;">treeName</span>=<span style="color: #ff0000;">&quot;myMenuName&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:set</span> <span style="color: #000066;">var</span>=<span style="color: #ff0000;">&quot;count&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;view:iterate</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;item&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;sectionView&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;menu:item</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;current&quot;</span> <span style="color: #000066;">sectionId</span>=<span style="color: #ff0000;">&quot;${item.id}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:choose<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:when</span> <span style="color: #000066;">test</span>=<span style="color: #ff0000;">&quot;${count eq 1}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:set</span> <span style="color: #000066;">var</span>=<span style="color: #ff0000;">&quot;sectionPath&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${current.text}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/c:when<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:otherwise<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:set</span> <span style="color: #000066;">var</span>=<span style="color: #ff0000;">&quot;sectionPath&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${sectionPath}/${current.text}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/c:otherwise<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/c:choose<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:set</span> <span style="color: #000066;">var</span>=<span style="color: #ff0000;">&quot;count&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${count+1}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/view:iterate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/menu:use<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h2>Skapa en lättviktig ersättning till <code>ancestorView</code></h2>
<p>En enkel väg till ett liv utan <code>ancestorView</code>-taggar är att skapa en mycket enkel custom tag. Nedanstående implementation har inte stöd för precis allt du kan göra med Escenics variant, men den gör jobbet för de flesta användningsfallen. Jag döpte den till <code>ancestors.tag</code> och la den i <code>/WEB-INF/lib/tags/section</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@tag body-content=<span style="color: #0000ff;">&quot;empty&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@tag <span style="color: #000000; font-weight: bold;">import</span>=<span style="color: #0000ff;">&quot;neo.xredsys.api.Section, java.util.ArrayList&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@attribute name=<span style="color: #0000ff;">&quot;id&quot;</span> required=<span style="color: #0000ff;">&quot;true&quot;</span> rtexprvalue=<span style="color: #0000ff;">&quot;false&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@attribute name=<span style="color: #0000ff;">&quot;section&quot;</span> type=<span style="color: #0000ff;">&quot;neo.xredsys.api.Section&quot;</span> required=<span style="color: #0000ff;">&quot;true&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@attribute name=<span style="color: #0000ff;">&quot;includeRoot&quot;</span> type=<span style="color: #0000ff;">&quot;java.lang.String&quot;</span> required=<span style="color: #0000ff;">&quot;false&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@variable name-from-attribute=<span style="color: #0000ff;">&quot;id&quot;</span> alias=<span style="color: #0000ff;">&quot;sectionPath&quot;</span> scope=<span style="color: #0000ff;">&quot;AT_END&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>
	<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399; font-weight: bold;">ArrayList</span> sections = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000;  font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>section <span style="color: #339933;">!</span>= <span style="color: #006600; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000;  font-weight: bold;">do</span> <span style="color: #009900;">&#123;</span>
			sections.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, section<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			section = section.<span style="color: #006633;">getParent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000;  font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>section <span style="color: #339933;">!</span>= <span style="color: #006600; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;true&quot;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>includeRoot<span style="color: #009900;">&#41;</span> || section.<span style="color: #006633;">getParent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!</span>= <span style="color: #006600; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	jspContext.<span style="color: #006633;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sectionPath&quot;</span>, sections<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">%&gt;</span></pre></div></div>

<p>Det enda som egentligen sker här är att jag bygger upp en lista med föräldrasektioner i omvänd ordning genom att anropa Escenics API. Detta går av någon anledning massor med gånger snabbare.</p>
<h2>Hur det kan se ut utan <code>ancestorView</code (efter)</h2>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;">&lt;%@ taglib <span style="color: #000066;">prefix</span>=<span style="color: #ff0000;">&quot;sec&quot;</span> <span style="color: #000066;">tagdir</span>=<span style="color: #ff0000;">&quot;/WEB-INF/tags/section&quot;</span> %<span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sec:ancestors</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;sectionView&quot;</span> <span style="color: #000066;">section</span>=<span style="color: #ff0000;">&quot;${article.homeSection}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;menu:use</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;navigation&quot;</span> <span style="color: #000066;">treeName</span>=<span style="color: #ff0000;">&quot;myMenuName&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:forEach</span> <span style="color: #000066;">var</span>=<span style="color: #ff0000;">&quot;item&quot;</span> <span style="color: #000066;">items</span>=<span style="color: #ff0000;">&quot;${sectionView}&quot;</span> <span style="color: #000066;">varStatus</span>=<span style="color: #ff0000;">&quot;itemStat&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;menu:item</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;current&quot;</span> <span style="color: #000066;">sectionId</span>=<span style="color: #ff0000;">&quot;${item.id}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:choose<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:when</span> <span style="color: #000066;">test</span>=<span style="color: #ff0000;">&quot;${itemStat.first}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:set</span> <span style="color: #000066;">var</span>=<span style="color: #ff0000;">&quot;sectionPath&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${current.text}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/c:when<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:otherwise<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:set</span> <span style="color: #000066;">var</span>=<span style="color: #ff0000;">&quot;sectionPath&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${sectionPath}/${current.text}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/c:otherwise<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/c:choose<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/c:forEach<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/menu:use<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Eftersom jag inte längre arbetar med en vy av sektioner, kan jag iterera över listan med föräldrasektioner med en vanlig <code>c:foreach</code> med fördelar som <code>varStatus</code>, mm.</p>
<h2>Slutsats</h2>
<p>Om du använder Escenic i någon 4.x-version och om du får några träffar när du söker på ancestorView i din kodbas, finns all anledning att se över ett byte!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogg.athega.se/2009/07/02/lar-dig-leva-utan-ancestorview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

