This blog is mainly about Java...

Monday, October 13, 2008

No more Repetitive Strain Injury (RPI)

RPI or (musehånd) in Norwegian is something I have had problems with the last three years.
Read more about RPI here: RPI

Since I work as a developer and using a mouse every day, it has put a strain on my wrist. I have tried many different things throughout the years, like different types of mouse and such.
But I have finally found something that works! And that is the RollerMouse Pro 

This is how it looks like. The roller is used as a mouse. So you dont have to change position so much with your hands. And you use your thumbs to roll the mouse and clicking, instead of your point finger. Remember that when you buy the RollerMouse Pro it doesnt come with a keyboard. You can use your own keyboard with it. The RollerMouse Pro is quite expensive, but it was well worth the 2000kr I paid for it. It also works great on Linux.

I can warmly recommend this product.

Wednesday, October 1, 2008

Richfaces 3.2.x useful tips

Using <a4j:log>
To see this in action, you can use an <a4j:log>, which shows request
data, response data, DOM tree changes on update, and other useful debug
information. When placed on the page, the control doesn’t produce any
visible output, but after hitting Ctrl+Shift+L (the default register hotkey), a
debug window will open. If for some reason a debug log window doesn’t
open, change the hotkey by setting the hotkey attribute to a letter of your
choice, for example, <a4j:log hotkey="D"/>.


<h:inputText value="#{profile.age}">
<a4j:support event="onblur" reRender="userInfo"

is equivalent to this:

<h:inputText value=”#{profile.age}”>
<a4j:support event=”onblur” reRender=”userInfo”>

JavaScript Interactions
Although RichFaces shields you from writing JavaScript, sometimes you
might want to invoke a custom JavaScript function. Injecting custom
JavaScript is possible by using the following attributes on components that
initiate an Ajax request:
- onsubmit: Just before Ajax request is sent
- onbeforedomupdate: Before any DOM updates are processed
- oncomplete: After DOM updates have been processed

Using bypassUpdates
When just validating form values, set bypassUpdates="true". When set
to true, the Update Model and Invoke Application phases will not be
invoked, improving response time.
Using eventsQueue and requestDelay
Use the eventsQueue attribute when possible. When setting
eventsQueue, the next request will not be set until the previous request
comes back (the response). To further control the sending of requests, use
requestDelay to delay the sending of a request by some number of
Another attribute is data, which allows you to get any additional data from
the server during an Ajax request. The data attribute can simply point to a
bean property via EL, and the data will be serialized in JSON format and
available on the client side. Here’s an example:
<a4j:commandButton value="Submit" reRender="out"
where text is as follows:
private String text = "Nice, I can get any data from the server";
Notice that the event on which an
Ajax request is sent is onblur. The onblur event means the user has to tab
out of the current field or click somewhere else using the mouse.
To show a modal window with a status "Please wait" and block everything in the background, you can do something like this:
<a4j:commandButton actionListener="#{bean.calculate}"
<rich:modalPanel id="mp" style="text-align:center">
<h:outputText value="Please wait..."
186 Using RichFaces
<a4j:status id="actionStatus"
onstop="#{rich:component('mp')}.hide()" />