Showing posts with label ADF Faces 10g. Show all posts
Showing posts with label ADF Faces 10g. Show all posts

Thursday, March 25, 2010

ADF dialog framework simplified?

If you can overcome about any (needless) fear you might have about implementing a custom JSF NavigationHandler, you can actually open up your applications for many new possibilities.

The focus of this blog post is not how to create custom JSF framework extensions.  It is just this:  every time you use ADF's dialog framework (where you create an navigation outcome of the form "dialog:...", set useWindow in the af:commandButton/Link to true, partialSubmit to true) it is possible to create a bit of custom NavigationHandler code that simply launches a dialog window programatically instead of doing the normal navigation function. 

I tried this out because I was "forced to" due to a quirk of af:commandButton/Link which somehow has useWindow property ignored when inside of an af:iterator.  So I tried to think of the spot where it made the most sense to programmatically call up the dialog...duh!  The NavigationHandler of course.

Wednesday, January 13, 2010

Tomahawk Popup loss of focus

A while back I realized that when using the tomahawk popup component (t:popup) in my ADF faces page that I was having a problem: whenever I had a field (like an af:inputText) inside the popped-up region along with something else, I would get some behaviour I did not want: as soon as my cursor left the field (but stayed within the popup region) focus would leave the input field. This made it awkward when I wanted to have a search field in the popup. But I found a simple solution: in the inputText's onblur property, put the following code: try{ this.focus(); } catch(e){}

What this does is keep it there rather than lose focus. I would really like to know what code is making this field lose focus. I did some searching, but it was very slow going for me, and I needed a quick fix.

Tuesday, August 11, 2009

af:treeTable: getting at a clicked node

Hi.

I was working with an af:treeTable and its accompanying tree binding. I wanted to click a node to open it (if that node had sub nodes) and then automatically do something with the data in that node. I did not want to have to click on a link in the tree to identify the node.

Here is what I came up with:

public void onDisclosure(DisclosureEvent disclosureEvent) {
CoreTreeTable cmt = (CoreTreeTable)disclosureEvent.getSource();
PathSet ps = cmt.getTreeState();
Set ks = ps.getKeySet();
//ks.clear();
// The key-set is the set of addresses of keys that are open.
// Clearing it closes all that are open.

List rwKey = (List)cmt.getRowKey();
// The row-key is the address of the row that was just disclosed/clicked.
// It is a list of Strings, which contain 0-based numbers.
int depth = 0;
for (Object o1 : rwKey) {
ArrayList pathToAdd = new ArrayList();
for (int i = 0; i < depth + 1; i++) {
pathToAdd.add(rwKey.get(i));
}
//ks.add((Object)pathToAdd);
depth++;
}
// This for loop just added the address of the node clicked,
// to the set of "open" nodes. Along the way it also enters
// all the parent node addresses as well, creating a new
// array list to store the address for each ancestor as well as
// the node clicked.

// I want to get the node that was clicked. I should be able to
// use the row-key to traverse the tree model to get the node I want.
TreeModel lTreeModel = (TreeModel)cmt.getValue();
Object lRowData = null;
for (Object lRowKeyIndexObject : rwKey) {
// Can I assume I start out with the tree model looking at root
// node?
String lRowKeyIndexString = (String)lRowKeyIndexObject;
int lIndex = Integer.parseInt(lRowKeyIndexString);
if (lTreeModel.isRowAvailable(lIndex)) {
lRowData = lTreeModel.getRowData(lIndex);// JUCtrlHierNodeBinding
lTreeModel.setRowIndex(lIndex);
}
if (lTreeModel.isContainer()) {
lTreeModel.enterContainer();
}
}
// When the loop is over the tree model should be
// set to the level and row that was clicked.
// Also lRowData should be the row we care about...the
// clicked row.

// We do not have to reset. I think each request the tree model
// resets. Traversing the tree model does not affect the way
// the tree table renders or looks.

JUCtrlHierNodeBinding lNodeBinding = (JUCtrlHierNodeBinding)lRowData;
String lNodeContents = (String)lNodeBinding.getAttribute(1);
// Display the found node.
this.setLSelectedNodeString(lNodeContents);

// Next experiment. Create binding in query
// and a field that allows you to set this binding.
// See if when you open a node if it affects any others nodes
// or not.
}

Friday, April 17, 2009

ADF 10g interfacing with Pentaho

Pentaho is an open-source reporting tool that has a Discoverer-like metadata store for ad-hoc querying; I am alternately battling with that getting my ADF interface to it implemented.

Yesterday I went down a path I had probably been down before but forgotten.

I used a tree binding on a table to have a table in the details facet of an af:table. This worked reasonably well until I tried to update the child table data. At that point all kinds of strange things started to happen. The rows would get mixed up as to who their parent was, I think there might have been some errors....at any rate I backed out of that and went another route because that one was proving somewhat unstable.

Things are starting to get green here in Virginia!