<?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>BlackBox &#187; portal</title>
	<atom:link href="http://www.warneronstine.com/tag/portal/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.warneronstine.com</link>
	<description>Where technology and art disappear</description>
	<lastBuildDate>Tue, 17 Nov 2009 00:05:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Portal/Portlet work continues</title>
		<link>http://www.warneronstine.com/2008/03/29/portal-portlet-work-continues/</link>
		<comments>http://www.warneronstine.com/2008/03/29/portal-portlet-work-continues/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 14:32:00 +0000</pubDate>
		<dc:creator>Warner Onstine</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[portal]]></category>
		<category><![CDATA[tapestry]]></category>

		<guid isPermaLink="false">urn:uuid:{a.guid}</guid>
		<description><![CDATA[So I thought I’d update everyone on my progress so far with the Portal/Portlet component I’ve been working on, as well as some of the issues I’ve run into.
Normally I would have posted this to my Tapestry 101 blog but I’m going to try and consolidate my blogs together and I’m extremely tired of JRoller’s [...]]]></description>
			<content:encoded><![CDATA[<p>So I thought I’d update everyone on my progress so far with the Portal/Portlet component I’ve been working on, as well as some of the issues I’ve run into.</p>
<p>Normally I would have posted this to my <a href="http://jroller.com/warneronstine/">Tapestry 101</a> blog but I’m going to try and consolidate my blogs together and I’m extremely tired of JRoller’s broken Textile formatting, such a pain in the ass (I have fallen in love with Markdown and code markup, it rocks!). I’ll be crossposting this, but soon I will stop updating the JRoller blog.</p>
<p>I now have a basic implementation of the Portal component complete and it consists of the following classes:</p>
<ul>
<li>Portal.java &#8211; Stores a TreeSet of columns</li>
<li>Portal.html &#8211; Adds in the portlet controls div and some custom CSS stuff (which I’ll talk about shortly)</li>
<li>PortalColumn &#8211; Stores a TreeSet of Portlets plus some configuration for viewing (width and background color)</li>
<li>Portlet &#8211; Stores the Portlet title, content and it’s location</li>
<li>portal/scripts/
<ul>
<li>Portal.script &#8211; includes all the JavaScript files and does some dynamic stuff (coming up shortly)</li>
<li>prototype/scriptaculous scripts</li>
<li>portal_hooks.js &#8211; the hooks for the portal actions (close, move, etc.)</li>
<li>portal.js &#8211; the actual JavaScript for the portal functionality that can be called by the portal_hooks.js file</li>
</ul>
</li>
<li>portal/css &#8211; portal.css</li>
<li>portal/images &#8211; all the images for the portal controls and rendering (rounded corners)</li>
</ul>
<p>Ok, so that’s the basics here are some of the specifics.</p>
<h2>Portal.script</h2>
<pre><code>&lt;input-symbol key="columns" required="yes" /&gt;
&lt;initialization&gt;
 function init() {
 portal = new Xilinus.Portal("#portal div", {onOverWidget: onOverWidget, onOutWidget: onOutWidget, onChange: onChange, onUpdate: onUpdate, removeEffect: Effect.SwitchOff});
   &lt;foreach key="column" expression="columns"&gt;
    &lt;foreach key="portlet" expression="column.portlets"&gt;
    portal.add(new Xilinus.Widget().setTitle('${portlet.title}').setContent('${portlet.content}'), ${column.index});
    &lt;/foreach&gt;
   &lt;/foreach&gt;
   // Add controls buttons
   portal.addWidgetControls("control_buttons");
 }
 Event.observe(window, "load", init);
&lt;/initialization&gt;
</code></pre>
<p>What I’m doing here is creating a new Portal (from Xilinus) and then I’m looping through each column and then each portlet inside of the column to add it’s content.</p>
<p>I dive into the hackish parts after the break.</p>
<h2>Portal.html</h2>
<p>This part contains some of the CSS hackish-ness I was hoping to avoid.</p>
<pre><code>&lt;span jwcid="@Script" script="Portal.script" columns="ognl:columns"/&gt;
&lt;div id="portal"&gt;
&lt;div jwcid="@For" value="ognl:column" source="ognl:columns"&gt;

    &lt;div jwcid="@Any" id="ognl:'widget_col_' + column.index" /&gt;
&lt;/div&gt;
&lt;/div&gt;
</code></pre>
<p>This first part just adds in the <code>Portal.script</code> and then declares the html <code>div</code> element we want to use (this element is used throughout the CSS and JavaScript files. The next piece loops over the <code>TreeSet</code> of columns and outputs one specially-named <code>div</code> for each column.</p>
<div id="control_buttons" style="display:none;float:left;"><a id="edit_button" href="#"></a><br />
<a id="delete_button" onclick="removeWidget(this); return false;" href="#"></a></p>
<div id="toggle"><a id="min_button" onclick="minimizeWidget(this);" href="#"><img src="ognl:minimizeButton" border="0" alt="Collapse Portlet" /></a></div>
</div>
<p>This just creates the HTML for the portlet controls (don’t know how customizable I’m going to make this yet).</p>
<p>Now comes the hack.</p>
<pre><code>&lt;style type="text/css"&gt;
&lt;span jwcid="@For" value="ognl:column" source="ognl:columns" renderTag="false"&gt;
#widget_col_&lt;span jwcid="@Insert" value="ognl:column.index"/&gt; {
  float:left;
  width: &lt;span jwcid="@Insert" value="ognl:column.width"/&gt;;
  background:&lt;span jwcid="@Insert" value="ognl:column.backgroundColor"/&gt;;
}
&lt;/span&gt;
#edit_button {
  background: url(&lt;span jwcid="@Insert" value="ognl:editButton.buildURL()"/&gt;);
}
#delete_button {
  background: url(&lt;span jwcid="@Insert" value="ognl:removeButton.buildURL()"/&gt;);
}
&lt;/style&gt;
</code></pre>
<p>Here you see I had to do some inline styles so that I could add in some new attributes for the columns, as well as images for the control buttons. I posted a query to the mailing list about 2 weeks ago, asking if there was anything like RCSS (Ruby CSS) where you could actually use Ruby to generate CSS stylesheets &#8211; which is exactly what I need here.</p>
<p>After talking with Howard there did not appear to be any good way of going about doing this. One solution discussed was to let the user drop in a replacement stylesheet, but to me this seems silly, they don’t need to recreate the whole style sheet.</p>
<p>Another solution was to create a Tapestry page that acted like a CSS file. This still holds some promise, but is technically going to be a bear to implement due to the fact that we have to change the mime-type. The kicker in all of this though is that this isn’t going to be easier in Tapestry 5, at least not right away.</p>
<p>The other issue that I have with implementing this is what a pain it is to work with JavaScript in this environment and now I completely understand why it wasn’t really worked with before. Customizing the JavaScript that I need to output is a truly a pain, using XML to do my looping for me feels…wrong. If there are two areas I would like to contribute to these are it &#8211; making JavaScript and CSS more first-class citizens. Outputting HTML isn’t everything you do in a Web application.</p>
<h2>What’s left?</h2>
<p>Not quite done with this yet. I still have the following items to clear up:</p>
<ul>
<li>Need to make the <code>Portal</code>, <code>Portlet</code>, and <code>PortalColumn</code> classes persistable</li>
<li>Once that’s done I need to modify the JavaScript hooks so that some kind of Ajax call happens whenever a user moves a portlet, adds or removes a portlet so that their selected portlets are saved in the database</li>
<li>Need a new Page so that a user can see all possible portlets to add to their custom page
<ul>
<li>For this page was kind of thinking of doing a slick sliding door effect, dunno yet</li>
</ul>
</li>
<li>Add in some further customizations</li>
<li>Replace default button images with ones that are easier to read/understand and fit with our internal scheme a bit better (these are customizable)</li>
</ul>
<p>I’m trying to get this code Open-Sourced, so it may take a little bit to get this code available but it shouldn’t be too much of a problem (and we have some other cool little items we’re going to release as well &#8211; just need to clean them up).</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.warneronstine.com%2F2008%2F03%2F29%2Fportal-portlet-work-continues%2F&amp;partner=sociable" title="Print"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.warneronstine.com%2F2008%2F03%2F29%2Fportal-portlet-work-continues%2F&amp;title=Portal%2FPortlet%20work%20continues&amp;bodytext=So%20I%20thought%20I%E2%80%99d%20update%20everyone%20on%20my%20progress%20so%20far%20with%20the%20Portal%2FPortlet%20component%20I%E2%80%99ve%20been%20working%20on%2C%20as%20well%20as%20some%20of%20the%20issues%20I%E2%80%99ve%20run%20into.%0D%0A%0D%0ANormally%20I%20would%20have%20posted%20this%20to%20my%20Tapestry%20101%20blog%20but%20I%E2%80%99m%20going%20to%20try%20and%20" title="Digg"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.warneronstine.com%2F2008%2F03%2F29%2Fportal-portlet-work-continues%2F&amp;title=Portal%2FPortlet%20work%20continues" title="Reddit"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.warneronstine.com%2F2008%2F03%2F29%2Fportal-portlet-work-continues%2F&amp;title=Portal%2FPortlet%20work%20continues&amp;notes=So%20I%20thought%20I%E2%80%99d%20update%20everyone%20on%20my%20progress%20so%20far%20with%20the%20Portal%2FPortlet%20component%20I%E2%80%99ve%20been%20working%20on%2C%20as%20well%20as%20some%20of%20the%20issues%20I%E2%80%99ve%20run%20into.%0D%0A%0D%0ANormally%20I%20would%20have%20posted%20this%20to%20my%20Tapestry%20101%20blog%20but%20I%E2%80%99m%20going%20to%20try%20and%20" title="del.icio.us"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://twitter.com/home?status=Portal%2FPortlet%20work%20continues%20-%20http%3A%2F%2Fwww.warneronstine.com%2F2008%2F03%2F29%2Fportal-portlet-work-continues%2F" title="Twitter"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.warneronstine.com%2F2008%2F03%2F29%2Fportal-portlet-work-continues%2F&amp;t=Portal%2FPortlet%20work%20continues" title="Facebook"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.warneronstine.com%2F2008%2F03%2F29%2Fportal-portlet-work-continues%2F&amp;title=Portal%2FPortlet%20work%20continues&amp;annotation=So%20I%20thought%20I%E2%80%99d%20update%20everyone%20on%20my%20progress%20so%20far%20with%20the%20Portal%2FPortlet%20component%20I%E2%80%99ve%20been%20working%20on%2C%20as%20well%20as%20some%20of%20the%20issues%20I%E2%80%99ve%20run%20into.%0D%0A%0D%0ANormally%20I%20would%20have%20posted%20this%20to%20my%20Tapestry%20101%20blog%20but%20I%E2%80%99m%20going%20to%20try%20and%20" title="Google Bookmarks"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.warneronstine.com%2F2008%2F03%2F29%2Fportal-portlet-work-continues%2F&amp;title=Portal%2FPortlet%20work%20continues" title="DZone"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.warneronstine.com/2008/03/29/portal-portlet-work-continues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
