Matthias Wessendorf’s Weblog

Entries from February 2009

Doing Enums in JavaScrip

February 6, 2009 · Leave a Comment

Enums where added to Java in its version 1.5 and it is straightforward to use the:

public enum ChannelStates
{
  CONNECTED,
  CONNECTING,
  DISCONNECTED,
  RECONNECTING
}

Since JavaScript is becoming more and more important, at least when you are building a pretty rich ui framework, like ADF Faces,  you may run into the situation where you want the same in JavaScript. It isn’t really that hard at all. Take a look at the following JS/JSON object:

ChannelStates = {
  CONNECTED : 0,
  CONNECTING : 1,
  DISCONNECTED : 2,
  RECONNECTING : 3
};

That’s all you need. However, usually, you want this object, or “enum”, to be available as a global JS object, e.g:

...
ConnectionChannel.ChannelStates = {
  CONNECTED : 0,
  CONNECTING : 1,
  DISCONNECTED : 2,
  RECONNECTING : 3
};
...
ConnectionChannel.prototype.getChannelState = function()
...

This now did make the enum part of the “ConnectionChannel” class. The usage of this enum is simple too:

...
var myChannelObject = ...
if(channelObject.getChannelState() == ConnectionChannel.ChannelStates.CONNECTED)
{
  // do some work here...
}
else
...

Categories: Oracle ADF Faces · adf · ajax · java · javascript · web²

Replacing Woodstock’s JSF components with ADF Faces

February 4, 2009 · Leave a Comment

I didn’t notice that SUN plans to no longer support their Woodstock components, perhaps b/c I don’t follow this project close enough.

Some of my colleagues at Oracle was putting together a pretty nice overview on how to replace that component set with ADF Faces.

You can find the matrix here:

http://www.oracle.com/technology/products/adf/adffaces/woodstock2adfMatix.html

UPDATE:

Shay did another entry based on this topic, see here.

Categories: Oracle ADF Faces · adf · ajax · java · jdeveloper · jsf · oracle · web²