Saturday, October 13, 2007

Lime Green Mens Shirt For Wedding

Portlets in Sun Java Studio Creator 2

recently became interested in a bit more serious subject portals - after hearing with a few free solutions, I decided that in the longer journey I will use Liferay due to its stability, maturity and high performance and compatibility with the JSR 168

Due to the fact that I'm a developer mainly focused my attention on writing portlet and that JSP and Servlets are very close to my soul, writing them was not a problem at all for me - turned out to be a pleasant occupation, easy and pleasant, until ...

just the time when I thought it worthwhile to take advantage of a framework (or even more - the development environment), but this would be where a lot of components at a relatively high level of abstraction, graphical development environment for designing Web pages such as the Sun Java Studio Creator 2 . (Let me remind you that this tool has a graphical editor for building JSF pages.)

Before this proceeded I have read a bit more with the JSR 168 specification . Particularly interested in me, part CSS Style Definitions , are included in the all standard CSS, which should be used in portlets. Why should it be? Well, so that each portlet look the same in terms of color and design, which dictates that the user selects the configuration available in the portal. After all, how cruel it would be torture for obiorcy if he saw several different portlets on one page in a completely different color, which does nothing match with the whole, and yet here the consistency of it.

decided to check how it is in practice and I wrote some code in the JSF (using the standard implementation in accordance with MyFaces JSF 1.2 ). Why I chose JSF because I've already had time to figure that the technology is most appropriate when it comes to writing portlets - this results from the reviews circulating on the Internet.

Below is an example in JSF written in accordance with Chapter CSS Style Definitions :
  \u0026lt;h:form id="edit" styleClass="portlet-font"> 

\u0026lt;h1 style = "portlet-section- header ">
<h:outputText value="#{text['formtitle']}" />
</h1>

<h:messages globalOnly="true" showDetail="true"
infoClass="portlet-msg-info"
warnClass="portlet-msg-alert"
errorClass="portlet-msg-error"
fatalClass="portlet-msg-fatal" />

<h:panelGrid columns="2"
footerClass="portlet-section-footer"
headerClass="portlet-section-header"
styleClass="portlet-section-body">

<h:outputLabel for="name"
styleClass="portlet-form-field-label">#{text['name']}</h:outputLabel>

<h:inputText id="name"
value="#{formbean.form.creator.name}"
required="true"
styleClass="portlet-form-input-field"/>
</h:panelGrid>

<h:commandButton id="submit"
value="#{text['submit']}"
action="#{formbean.doSave}"
styleClass="portlet-form-button"/>

<h:commandButton id="cancel"
value="#{text['cancel']}"
action = "# {formbean.doCancel}"
Immediate = "true"
styleClass = "portlet-form-button" />
\u0026lt;/ h: form>
is easy to see that a programmer in the code above has focused this to use a standard CSS style specification JSR 168 And it used to be beautiful, almost idyllic ... Until it was time for rehearsal of the Sun Java Studio Creator 2, development environment, which allows the programmer in a few minutes (maybe hours) wyklikać almost the entire application - you can see on presentation Java Studio Creator 2 in Action . (Mention only that such presentations to managers make a great impression and it is not always easy to explain to them that such a solution also has some drawbacks, and make a perfect match to the reality of companies).

JSF page created and used by a number of available components: a table, a button, etc. Given that the Sun generates for its own komponetów your CSS, I decided in one of the key to redefine them in a style consistent with the specification JSR 168:
  \u0026lt;ui : button id = "NextStep" 
action = "# {Buy.nextStep_action}
binding = "# {Buy.nextStep}"
text = "NEXT STEP"
styleClass = "portlet-form-button" />
Imagine my surprise when, after running the portlet this amendment was successful. In desperation, I looked into the source of generated HTML in a web browser. Here are results:
  \u0026lt;input type="button" value="NEXT STEP" 
class="btn2 portlet-form-button" />
As it turned out, the component generates a CSS class my portlet-form-button but previously interceded your btn2 - a custom which is contrary CSS styles defined for the portal, and that the class was btn2 -define a lot of CSS attributes to my poor class portlet-form-button could small przedefinować here. It was wrong, but whether it can be even worse, it turns out that, yes. Well, I started to look where is the CSS file, which I find unfortunate is the definition of btn2 , because maybe that gave him zwariantować separately for each subject portal. Wprowadziłbym separate file to a separate definition of CSS and placed in each subject. After some time, was unfortunate in one of bilbiliotek Sun packed into spring. How it works: when the portlet is loaded dynamically, this collection is drawn from such a spring and attached to it. The result is that each portlet has its own definition of CSS, which does not fully congruent to the standard JSR 168

There are also other problems with what I wrote above. If we run two portlets written in the development environment is the Sun from two independent suppliers, each of which applied different styles such as CSS and gray.css blue.css. It was then adopted by the two portlets on the portlet styles, which run The last - that we are dealing with a kind of lottery, because the user can decide the order of their occurrence (the deployment of portlets on the page).
This problem can be solved by using a workaround suggested on the blog Sun employee Conflicting Themes Creator Portlets al. He proposes adding a CSS style once again in a footnote, that the two portlets will have three style definitions and the definitions of the standard for the portal.

summarize all the old proverb: not all gold that shines - despite the fact that the development environment Sun Java Studio Creator 2 at first glance really offer much of a serious design errors disqualify them from use in building portlets.

What to write portlets that case, since the standard implementation of JSF 1.2 is not enough, because the expectations are greater (eg table with paging, sorting, etc.) can use Tomahawk components in conjunction with ajax4jsf ? Some people's precisely this combination puts Interview with Max Katz .

encourage you to discuss What to write portlets (JSR-168) in an efficient manner, but i zgodny ze sztuką?

0 comments:

Post a Comment