Wednesday Dec 13, 2006
Wednesday Dec 13, 2006
Note: See Using jMaki 9.3 With the NetBeans Visual Web Pack or the Sun Java Studio Creator IDE for updated instructions on how to add jMaki to a project.
jMaki beta is out and there is a wonderful NetBeans plug in that works with the NetBeans standard web application project. You can use this plug in with a Visual Web application, but it takes a little more work. Work is in progress for a plug in that facilitates the use of jMaki widgets in a Visual Web application. In the meantime, here are some steps to illustrate how to use jMaki technology.
In this example you add a Spry Accordian widget to a sidebar page fragment. The following steps are similar to a jMaki sample project for the Sun Java Studio Creator IDE.
Note: I modified this a bit on 12/15 based on feedback from Craig, Ken, and Greg. Most notably, you do not need to use the f:verbatim tag if you are using the jmaki-jsf tag library. Also, because this sample modifies the templates, I added steps to create a new namespace for the widget so that you don't have to modify the original templates.
Warning: jMaki APIs are still being refined, so it's "use at your own risk".
StdjMaki/Web Pages/resources to VWjMaki/Web Pages/resources.
To be honest, I don't if all of the files are required.
StdjMaki/Web Pages/libs/spry to VWjMaki/Web Pages/libs/spry. StdjMaki/Web Pages/resources/spry/plainAccordion to VWjMaki/Web Pages/resources/spry/plainAccordion.
myAccordion.
xmlns:a="http://java.sun.com/jmaki-jsf" to
the top-level <div> tag.
<webuijsf:panelGroup binding="#{Sidebar.groupPanel1}"
id="groupPanel1"
style=
"height: 382px; left: 0px; top: 0px; position: absolute; width:190px">
<a:ajax type="spry" name="spry.myAccordion" />
</webuijsf:panelGroup>
resources/spry/myAccordion/components.css.
This is to make the accordion resize to the section's content.
The samples that you get when you download the components from Adobe come with
an AquaAccordion style that does not set a section height.
.AquaAccordion {
border-left: solid 1px gray;
border-right: solid 1px black;
border-bottom: solid 1px gray;
overflow: hidden;
font-family: "Times New Roman", Times, serif;
font-size: 16px;
}
.AquaAccordion .Tab {
height: 24px;
background-image: url(images/aqua-gradient.gif);
background-repeat: repeat-x;
background-color: #6dc1fc;
border-top: solid 1px black;
border-bottom: solid 1px gray;
margin: 0px;
padding: 2px;
cursor: pointer;
-moz-user-select: none;
-khtml-user-select: none;
text-align: center;
}
.AquaAccordion .Content {
overflow: auto;
margin: 0px;
padding: 0px;
background-image: url(images/gray-gradient.gif);
background-repeat: repeat-x;
}
.AquaAccordion .hover {
background-image: none;
background-color: #33CCFF;
}
resources/spry/myAccordion/components.htm with the following.
<div id="${uuid}" class="AquaAccordion" tabindex="0">
<div class="Panel">
<div class="Tab">
<div class="Label">Fruit</div>
</div>
<div class="Content">
<a href="faces/FoodDetail.jsp?name=banana">Banana</a><br/>
<a href="faces/FoodDetail.jsp?name=papaya">Papaya</a><br/>
<a href="faces/FoodDetail.jsp?name=grapes">Grapes</a><br/>
</div>
</div>
<div class="Panel">
<div class="Tab">
<div class="Label">Vegetables</div>
</div>
<div class="Content">
<a href="faces/FoodDetail.jsp?name=avocado">Avocado</a><br/>
<a href="faces/FoodDetail.jsp?name=sprouts">Brussel Sprouts</a><br/>
<a href="faces/FoodDetail.jsp?name=asparagus">Asparagus</a><br/>
<a href="faces/FoodDetail.jsp?name=onion">Onion</a><br/>
</div>
</div>
<div class="Panel">
<div class="Tab">
<div class="Label">Grains and Cereal</div>
</div>
<div class="Content">
<a href="faces/FoodDetail.jsp?name=rice">Rice</a><br/>
<a href="faces/FoodDetail.jsp?name=macaroni">Macaroni</a><br/>
</div>
</div>
</div>
component.js as follows to turn off the animation. This makes the
content sections shrink to fit the content:var acc1 = new Spry.Widget.Accordion(widget.uuid, { enableAnimation: false });
If you want to play around some more, look at this blog on using the dojo ComboBox. It was written for the Sun Java Studio Creator IDE, but once you do the setup as above, the steps are pretty much the same.
Posted by Ken Paulsen on December 14, 2006 at 05:11 PM PST #
Posted by Greg Murray on December 15, 2006 at 02:29 AM PST #
Posted by Doris Chen on January 12, 2007 at 09:19 PM PST #
Nonetheless, changing back to the 'regular' srpy.accordion works fine...
Alfred
Posted by Couder on March 12, 2007 at 03:46 AM PDT #