Apache Wicket javascript integration

9 09 2008

This article will give some general pointers on howto do javascript integration, it’ll give some tip on how to make it easier to for you. And also a recommended way on project structuring.

Howto do it:

Javascript bridge

If you need a javascript bridge between the javascript library and wicket a very nice way are todo it like this:
https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicket-contrib-openlayers/src/main/java/org/wicketstuff/openlayers/wicket-openlayersmap.js

Use the wicket namespace for a cleaner approach(like above), and remember to place your data in an array, so you can have multiple of the same components on the same page. Like so:


var Wicket;
if (!Wicket) {
Wicket = {};
} else {
if (typeof Wicket != "object") {
throw new Error("Wicket already exists and is not an object");
}
}
Wicket.omaps = {};
function WicketOMap(id, options) {
Wicket.omaps[id] = this;
}

Lots of dynamic stuff?

If you have lots of dynamic stuff you can use a texttemplate to interpolate your variables with it works really smooth, heres an example:


...
HashMap variables = new HashMap();
variables.put("alert", "helloworld");
TextTemplate textTemplate=new TextTemplate();
textTemplate.interpolate(variables);
String js= textTemplate.asString();

corrosponding java script, notice the template signature ${…}

alert("${alert}");

So above code will produce a javascript string ‘alert(“hello world”)’ very useful.

Using a behaviour

Behaviours are nice if you need some special that modifies the component you want to add too. It’s an easy way of getting information like markupid etc. Its good because you can access the component that you bind to, so you may put in javascript, add attributemodifiers etc for it.

Virtual tour of Mootips

Heres a virtual tour of Mootips javascript integration

go here for the minis wiki





Screencast: introducing Wicketstuff Iolite

4 09 2008

So without further delay watch the screencast below:





Doing Screen casts

3 09 2008

Doing a screen cast aren’t that hard, theres a lot of software out there, but you have to pay for it. For around 90$ you can get Screenflow, mac only for less you can get snapzshots which are both for mac and windows. Just remember to clean up your desktop, or use an extra monitor to record from.

However an really really important thing to note are whats the purpose of your screencast, do you need people to actually see what you are doing on screen like and command prompt etc? How will you share the screencast, there are lots of ways like google, youtube etc.. But they all convert your screencast into a lowever resolution. And in my case I need people to actually be able to see what I am doing. So how does one solve this? Well two ways, either record your screencast in a resolution closer to what it gets converted to, or host the screencast yourself.. Vimeo actually offers a hd solution for videos, it might be an option to preserve your screen cast at optimal resolution.

This is just some notes:

http://www.ffmpegx.com/flv.html

http://www.ffmpegx.com/video.html

http://www.ambrosiasw.com/forums/lofiversion/index.php/t60248.html

http://lists.apple.com/archives/QuickTime-Users/2005/Apr/msg00274.html

http://www.reelsmart.com/2008/02/14/vara-releases-screenflow-for-leopard/

http://www.macnn.com/articles/08/02/29/first.look.screenflow/

http://www.flip4mac.com/screenflow_features.htm





Wicket Iolite 0.3

3 09 2008

So it’s out just waiting to get built on the wicketstuff teamcity server, and be made public available from there.

Wicket Iolite are a Wicketstuff project, and it’s all about making development really easy for you. It’s a archetype that setups a project for you with a two module struture web and core. In core you will find JPA entities, and in wicket you’ll find the counter wicket part.

Changes(lots):

  • Depends on domdridges project
  • Real maven archetype
  • Lots of cleaning
  • Even more simple than before

Read more here:

http://wicketstuff.org/confluence/display/STUFFWIKI/Wicket-Iolite





Making a Maven Archetype

3 09 2008

So I want to create a maven archetype. My first run at this were a couple of months ago, it were pretty hard but then again I built the archetype from scratch.

I use userlist’s a lot so and though that it were very awkward how I did the previous archetype. So I wrote maven user list asking and theres actually a maven goal for it. So you can create an archetype in 6 steps:

  1. Build a project that will act as a template for the archetype
  2. run mvn archetype:create-from-project , from the project folder
  3. Edit the generated archetype ( placed in target/generated-sources/archetype ), it might not pickup on everything that needs to be substituted.
  4. From target/generated-sources/archetype of the project template run mvn install
  5. Try the archetype yourself by running mvn archetype:generate -DarchetypeCatalog=local from a fresh directory
  6. Repeat the process until satisfied

Now this also works for projects consistent of modules, a project structure like below:

Root
|-Core
|-Web

Happy Archetyping:)