Af:TreeTable problem

Hello all!
(JDev 11 ADF BC)
I try to use af:Treetable component based on view.
In jsf page i have af:treetable and simple button. Button updating some info in my view. I need to refresh af:treetable component..I do this with partial trigger..All works fine but first level of the treetable dont refreshed...
How to do this or how to refresh af:treetable programmatically?

Hi,
I made a usecase, but everything works fine for me:
my untitled2.jspx :
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
  <jsp:directive.page contentType="text/html;charset=UTF-8"/>
  <f:view>
    <af:document>
      <af:messages/>
      <af:form>
        <af:panelGroupLayout partialTriggers="button1">
          <af:treeTable value="#{bindings.DeptView1.treeModel}" var="node"
                        selectionListener="#{bindings.DeptView1.treeModel.makeCurrent}"
                        rowSelection="single" width="503">
            <f:facet name="nodeStamp">
              <af:column>
                <af:outputText value="#{node}"/>
              </af:column>
            </f:facet>
            <f:facet name="pathStamp">
              <af:outputText value="#{node}"/>
            </f:facet>
          </af:treeTable>
        </af:panelGroupLayout>
        <af:commandButton text="commandButton 1" id="button1"
                          actionListener="#{myBB.doAction}"/>
      </af:form>
    </af:document>
  </f:view>
</jsp:root>my managed bean:
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import javax.faces.event.ActionEvent;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCControlBinding;
import oracle.binding.BindingContainer;
import oracle.jbo.ViewObject;
public class Class1 {
    public Class1() {
    public void doAction(ActionEvent actionEvent) {
        FacesContext ctx = FacesContext.getCurrentInstance();
        ValueBinding vb = ctx.getApplication().createValueBinding("#{data}");
        BindingContext bindingsCtx = (BindingContext) vb.getValue(ctx);
        BindingContainer bc = bindingsCtx.getCurrentBindingsEntry();
        DCControlBinding cb = (DCControlBinding)bc.get("DeptView1");
        ViewObject vo = cb.getViewObject();
        vo.setWhereClause("DEPTNO=10");
        vo.executeQuery();
}and adfc-config:
<?xml version="1.0" encoding="UTF-8" ?>
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
  <view id="untitled2">
    <page>/untitled2.jspx</page>
  </view>
  <managed-bean>
    <managed-bean-name>myBB</managed-bean-name>
    <managed-bean-class>brano.test1.view.Class1</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>
</adfc-config>I am using SCOTT schema.
After click on button I set where value for master view object and it is reflected.
hope it helps,
Branislav

Similar Messages

  • TreeTable - problem

    Hi,
    For people well know with JTreeTable
    I got a problem with a customized TreeTable.
    I use the code from the FileSystem-version
    [http://java.sun.com/products/jfc/tsc/articles/treetable2/index.html#source_code]
    There i use not FileNode, for the editing node but a Subclass from DefaultMutableTreeNode.
    The problem is the insertion and deletion of nodes.
    The insertion works but not so nice ... the deletion don't work.
    The code for insertion :
    // code from TaskModel -> FileSystemModel2 in original
    // same method as in the original, only modified to task node
    protected TaskNode[] getPathToRoot(TaskNode aNode, int depth) {
        TaskNode[] retNodes;
        if (aNode == null) {
          if (depth == 0) {
            return null;
          else {
            retNodes = new TaskNode[depth];
        else {
          depth++;
          retNodes = getPathToRoot(aNode.getParent(), depth);
          retNodes[retNodes.length - depth] = aNode;
        return retNodes;
    // TaskNode is a subclass of DefaultMutableTreeNode
    public void updateTreeStructure(TaskNode tn) {
        TaskNode[] ptr = getPathToRoot(tn, tn.getDepth());
        fireTreeStructureChanged(TaskModel.this, ptr, null,
                                 null);
    // add a new TaskNode, editingNode is the current selected node, editingPath the current editing path
    public void addTask(Object[] content) {
      editingNode.addTask(content);
      tree.expandPath(editingPath);
    }First question is :
    why only fireTreeStructureChanged() works?
    I try to use fireTreeNodesInserted() or fireTreeNodesChanged() but the table did not show the update!
    But all 4 methods do call
    protected void delayedFireTableDataChanged() {
         SwingUtilities.invokeLater(new Runnable() {
             public void run() {
              fireTableDataChanged();
        } ->
    // Install a TreeModelListener that can update the table when
         // tree changes. We use delayedFireTableDataChanged as we can
         // not be guaranteed the tree will have finished processing
         // the event before us.
         treeTableModel.addTreeModelListener(new TreeModelListener() {
             public void treeNodesChanged(TreeModelEvent e) {
              delayedFireTableDataChanged();
             public void treeNodesInserted(TreeModelEvent e) {
              delayedFireTableDataChanged();
             public void treeNodesRemoved(TreeModelEvent e) {
              delayedFireTableDataChanged();
             public void treeStructureChanged(TreeModelEvent e) {
              delayedFireTableDataChanged();
                    System.out.println("struktur ge�ndert");
         });So why only treeStructureChanged works?
    The other problem is that removing a node don't work at all.
    I use the add and remove-methods
    provided by DefaultMutableTreeNode.
    Insertion works like above but removing not.
    The table didn't show the changed tree, the
    display leave in the old state.
    Here the code of the constructor of TaskNode
    public TaskNode(Object[] content) {
          super(content);
          this.content = content;
          parent = (TaskNode)super.getParent();
          System.out.println("Parent : " + parent);
          children = getChildren();
        }strange is that the parent is always null ... but it is no problem to insert a node ...
    so can someone explain the functionality of fireBlaBla in detail or why it not work and
    the meaning of the parameter of the this functions.
    What is the meaning of the method getPathToRoot()?
    It is much to answer ... hope someone can help.
    regards.
    Olek
    updated

    hm nobody got an idea ...
    but anyway i solved it ;-)
    The main failure was the non understanding of
    fireTreeStructureChanged(TaskModel.this, ptr, null,
                                 null);now i can use
    fireTreeNodesInserted(Object source, TreePath[] path, int[] ind, Object[] nodes);The second problem was the wrong use of
    getPathToRoot(Node node, int depth);The depht must be 0... like it is in the original. To get the path from the editing node to the root.
    finally the getParent()-method of the TaskNode-class was wrong.
    Ok now it works :)
    Olek

  • Problem in running TreeTable component with Myfaces

    Hi,
    I am trying to run treeTable component of adf with Myfaces.
    The tag is rendered but not functioning properly.
    It shows one level expanded as mentioned below :
    > H1 // H1 has 2 related records
    +> H2 // H2 has 3 related records
    +> H3 //H3 has 1 related record
    but when I click on H2 then It is not expanding.
    Please Help.
    Regards,
    Sachin

    The treeTable component is working.
    The problem is due bcoz of following code::
    <!-- <af:column>
    <f:facet name="header">
    <h:outputText value="Map Link"/>
    </f:facet>
    <h:outputText id="button" value="Map" onclick="showOnMap(this);" />
         <h:inputHidden id="primary-key" value="#{foo.assetId}"/>
    <h:inputHidden id="assetType" value="#{foo.assetType}"/>
    </af:column>
    -->
    when I comment the above mentioned column the page is rendered and treeTabel is working properly.
    Can anybody help why the above mentioned tags are doing problem?
    Regards,
    Sachin

  • ADF treeTable element problem

    HI friends.
    I'm using now JDeveloper 11.1.1.2
    Can anybody help with a small trouble i faced as tried to fit an ADF treeTable element in my application.
    I've created a down-hierarchy tree which includes elements of two levels: parent elements and child elements.
    The source code of a tree model element in a respective page defenition file looks like this
    <tree IterBinding="CaptanView1Iterator" id="CaptanView1">
          <nodeDefinition DefName="minit.org.model.views.voc.CaptanView"
                          Name="CaptanView10"
                          TargetIterator="#{bindings.CaptanView1Iterator}">
            <AttrNames>
              <Item Value="fio"/>
            </AttrNames>
            <Accessors>
              <Item Value="CaptanHistoryView"/>
            </Accessors>
          </nodeDefinition>
          <nodeDefinition DefName="minit.org.model.views.voc.CaptanHistoryView"
                          Name="CaptanView11" TargetIterator="#{bindings.CaptanHistoryView1Iterator}">
            <AttrNames>
              <Item Value="violationdate"/>
              <Item Value="articles"/>
            </AttrNames>
          </nodeDefinition>
        </tree>i've also assosiated a navigation case action with a command link which in fact repesents the node of the tree.
    The problem is that for some nodes i have to click the mouse button twice to have the action handler trigger.
    A first click leads to what it seems like a simple repost and the second click works properly. By the way i occasionally get the following message as i click my tree-node links.
    <ActionListenerTag$BindingActionListener><processAction> JSF1043: ActionListener for component 'tt1:5:ot2' will not be processed - both binding and type are null.It's weird that the underlined message and wrong behavior take place not in a regular way, for some tree nodes only.
    Any help would be appreciated.
    Alex.

    Hi,
    the reason for not getting an answer is that you describe a problem that exists on the view layer and show th etree definition on the ADF binding layer.
    Frank

  • af:showPrintablePageBehavior problem against af:treetable on Popup window

    I just used <af:showPrintablePageBehavior> for <af:treetable>, but got a wrong printable page. I faced this problem on new popup window, which is a browser popup window rather than adf faces inline popup.
    After treating <af:treetable> using <af:showPrintablePageBehavior> in popup window, I just found all cells in the table was gone on the printable page while the table header was preserved. It seems like this:
    Item | Col1 | Col2 | Col3 | Col4 | Col5 |
    Rows 1-0 of 4
    Such effect is kinda like the situation when u configure *<output-mode>printable</output-mode> in trinidad-config.xml*, which simply truncates the treetable.
    Such effect is gone when you are not using popup window. In other words, you won't face this problem and will get a normal treetable with full data when using tab or browser window.
    But currently the requirement needs that this is be done in popup window.
    Anyone give me a hint on solving this?

    I am able to get the details by designing the screen in jsp page instead of jspx page.

  • af:showPrintablePageBehavior problem against af:treetable on Firefox

    I just used <af:showPrintablePageBehavior> for <af:treetable>, but got a incomplete printable page. I faced this problem on Firefox 2/3/3.5.
    Such treetable contains many rows of data, and its content cannot be printed just in one page (typically 3 pages or more) . What I mean incomplete is that, after treating <af:treetable> using <af:showPrintablePageBehavior> it seems all data displayed on the printable page, but after using print function of Firefox browser you can find out that not all rows of data is printed (just partial row data).
    This problem only occurs on Firefox, while it's gone on other browsers like IE7/IE8/GoogleChrome/Safari4.
    Other browsers take the printable source as several pages, you can see page numbers like 1 of 3, 2 of 3, 3 of 3...etc, while Firefox just simply takes the printable source as just one page where you can just get page number 1 of 1.
    I know this is not a typical problem, but still long for someone who can help me.

    Hi,
    not sure this is an issue with the showPrintablePageBehavior if IE shows all data in the browser after using this behavior. The print functionality is owned by the browser and obviously it doesn't get to all of the page content (which I think is out of the ADF Faces scope). You may try and file a Service Request with customer support for them to have a look. However, if the showPrintablePageBehavior properly displays the data, then I am not sure what we can do to make the browser native print functionality working
    Frank

  • Event problem in TreeTable

    Hello,
    I developed a TreeTable component using Sun's example code and adapting it to an existing framework. The TreeTable is working really well. But there is one problem I cannot solve: The upper tree nodes react properly to mouse clicks by expanding themselves. But beginning from a certain row, the nodes do not react that way anymore. By clicking, the row is selected as expected but the node is only expanded, if the cell above it is clicked at the position the node would be, if it was in this cell. The problem populates throughout the table: Beginning from a lower situated row I have to click the cell that is situated two rows above the cell containing the node I want to expand. Even lower I have to click three cells above it and so on.
    What is the problem here? What incorrectness multiplies the lower I go in the table?
    The tree lazily loads the children at the time a node is expanded. So when its model is updated, this model change is propagated to the table. If a row is selected, the tree's selction model and the table's selection controller correctly show the selected object. The row height in the tree and the table is exactly the same. The isCellEditable() method within the TreeTableCellEditor class is the same as in Sun's example, so the MouseEvent's y value is not changed before it is forwarded to the tree.
    Any help is appreciated!
    Thank you in advance!

    Hello again,
    the problem is solved. In opposition to the Sun example I have the table display the grid, so the table's row margin has to be considered when the tree's row height is set. So a by the table's row margin increased row height of the tree makes the tree table work perfectly.

  • Problem with treeTable

    Hello, and happy new year everybody,
    I'm working on treetable and I use TreeTable II.
    I want to hide the root node, with setRootVisible(false) in JTreeTable.
    But if I change the values of the tree (remove all current nodes and insert new ones), nothing appears on the screen.
    I searched why, and that's because after changing values, only the root is shown. And then, if I hide it, I can't access the children nodes.
    Does someone know how I could do ?
    Thanks a lot....
    I hope you will understand me, I don't speak (nor write) fluently english.

    is may be because you need to programatically expand the paths?
    you could try not hiding the root, and changing the values as before, but after that running some code that did something like called tree.expandRow(int row) on each row?
    asjf

  • Af:treeTable delete problem

    Hi all
    Hi have a web application using Oracle Business Components; in some page i am using an af:treeTable component
    So far, i have been successfuly using it for any processes i have to develop; but something happens when i try to delete the last element of the first level of the control
    Let me explain:
    The treeTable component has n levels; the first level is the one that you navigate using the dropdown control or the Previous or Next commandLinks
    Lets assume that i have 4 elements at that level; when i delete any element it works fine, but when i delete the last element i get this error
    500 Internal Server Error
    java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
         at java.util.ArrayList.RangeCheck(ArrayList.java:546)
         at java.util.ArrayList.get(ArrayList.java:321)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel._getRowData(FacesCtrlHierBinding.java:96)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.enterContainer(FacesCtrlHierBinding.java:191)
         at oracle.adf.view.faces.component.UIXHierarchy.enterContainer(UIXHierarchy.java:80)
         at oracle.adf.view.faces.component.UIXTreeTable.processFacetsAndChildren(UIXTreeTable.java:410)
         at oracle.adf.view.faces.component.UIXCollection.decodeChildrenImpl(UIXCollection.java:141)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:803)
         at oracle.adf.view.faces.component.UIXCollection.processDecodes(UIXCollection.java:136)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:818)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:803)
         at oracle.adf.view.faces.component.UIXComponentBase.processDecodes(UIXComponentBase.java:673)
         at javax.faces.component.UIForm.processDecodes(UIForm.java:144)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:818)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:803)
         at oracle.adf.view.faces.component.UIXComponentBase.processDecodes(UIXComponentBase.java:673)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:818)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:803)
         at oracle.adf.view.faces.component.UIXComponentBase.processDecodes(UIXComponentBase.java:673)
         at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
         at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:306)
         at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
         at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:332)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:627)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    How can i fix this ???

    Hi all
    Hi have a web application using Oracle Business Components; in some page i am using an af:treeTable component
    So far, i have been successfuly using it for any processes i have to develop; but something happens when i try to delete the last element of the first level of the control
    Let me explain:
    The treeTable component has n levels; the first level is the one that you navigate using the dropdown control or the Previous or Next commandLinks
    Lets assume that i have 4 elements at that level; when i delete any element it works fine, but when i delete the last element i get this error
    500 Internal Server Error
    java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
         at java.util.ArrayList.RangeCheck(ArrayList.java:546)
         at java.util.ArrayList.get(ArrayList.java:321)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel._getRowData(FacesCtrlHierBinding.java:96)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.enterContainer(FacesCtrlHierBinding.java:191)
         at oracle.adf.view.faces.component.UIXHierarchy.enterContainer(UIXHierarchy.java:80)
         at oracle.adf.view.faces.component.UIXTreeTable.processFacetsAndChildren(UIXTreeTable.java:410)
         at oracle.adf.view.faces.component.UIXCollection.decodeChildrenImpl(UIXCollection.java:141)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:803)
         at oracle.adf.view.faces.component.UIXCollection.processDecodes(UIXCollection.java:136)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:818)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:803)
         at oracle.adf.view.faces.component.UIXComponentBase.processDecodes(UIXComponentBase.java:673)
         at javax.faces.component.UIForm.processDecodes(UIForm.java:144)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:818)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:803)
         at oracle.adf.view.faces.component.UIXComponentBase.processDecodes(UIXComponentBase.java:673)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:818)
         at oracle.adf.view.faces.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:803)
         at oracle.adf.view.faces.component.UIXComponentBase.processDecodes(UIXComponentBase.java:673)
         at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
         at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:306)
         at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
         at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:332)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:627)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    How can i fix this ???

  • Tomahawk for jsf 1.2 problem with customizing treetable component

    hi,
    i've tried many times bu i've got no clue how to set custom icons in the tree. what i want to achieve is to display the server's local file system. however this component doesn't allow to explicit specify what the node type is (a directory or a file). as a result when it finds an empty directory entry, no icon is displayed. i googled a bit and i guess the project's documentation is not sufficient. any help appreciated. ofc if someone knows a better method (or a framework) to do the job, please let me know. thanks
    cheers

    r035198x wrote:
    You could store the value in the session and remove it when you need to use it.Thanks, r035198x. I tried that before and users from other Java forums suggest that I shouldn't do it this way as I am adding more codes than necessary to pass technically a value from one bean to another. Hence, I decided to follow their advice and went and created a generic bean that can be referenced by other beans for pages calculation. Some users also suggest using Dependency Injection (available for JSF 1.2) to try to accomplish the result I want. I've also read about this method in JSF 1.2 spec - but without much example, I'm pretty much in the dark as to how this work. Unfortunately, I've only been on JSF for the last 4 weeks so I'm still a newbie - please excuse any "dumb" questions I have asked on this forum so far...
    What I currently has working for me is moving the method to calculate the pages from mybean1 to mybean2. This means all I have to do now for the other beans (11 remaining) is passed a few parameters to mybean2's method that calculate pages.
    Edited by: icepax on 12/11/2009 18:27

  • JTree custom renderer setting selection background color problem

    Hi,
    I have a JTree with a custom icon renderer that displays an icon. The JTree is part of a TreeTable component. Iam having a problem setting the selection background uniformly for the entire row. There is no problem when there is no row selected in the JTable.
    My present code looks like this:
    Iam overriding paint in my renderer which extends DefaultCellRenderer.
           super.paint(g);
            Color bColor = null;
            if(!m_selected) {
                 if(currRow % 2 == 0) {
                      bColor = Color.WHITE;
                 } else {
                                                    bColor = backColor;
            } else {
                 bColor = table.getSelectionBackground();                  bColor = getRowSelectionColor();
         if(bColor != null) {
                           g.setColor(bColor);
             if(!m_selected) {
                   g.setXORMode(new Color(0xFF, 0xFF, 0xFF));
             } else {
                 g.setXORMode(new Color(0x00, 0x00, 0x00));
                  I have a color I arrive at using some algorithm that I want using method getRowSelectionColor(). The other cells in the row have this color. But the cell containing the tree node shows different color. Iam not able to arrive at the right combination of the color to set and the xor color so my tree node also looks like the other cells in the row.
    It is not a problem really as the table still looks good. Its just that the tree node looks like it has been highlighted and this might cause a problem when a table cell is highlighed later on in the application ( two cells in the row would be highlighted causing confusion).
    Any help would be appreciated.
    Regards,
    vidyut

    Hi Camickr,
    Thanks for the reply. Iam sorry I didn't include the sources the first time around. There were too many of them. I have created a small, self-contained, compilable program that demonstrates the problem and including it herewith. Still there's quite many files but they are all needed Iam afraid. The only one you will have to concern yourself fior this problem is the file IconRenderer.java. The treenode background and the other cells background are not in sync when table row is not selected in this example though. But they are in my real program. I just need them to be in sync i.e have the same background color when the row is selected.
    Your help would be very much appreciated.
    These are the files that are included below:
    1. AbstractTreeTableModel.java
    2. Bookmarks.java
    3. BookmarksModel.java
    4. DynamicTreeTableModel.java
    5. IconRenderer.java
    6. IndicatorRenderer.java
    7. JTreeTable.java
    8. TreeTableExample3.java (contains main)
    9. TreeTableModel.java
    10. TreeTableModelAdapter.java
    The copyright and javadocs information has been stripped for clarity.
    cheers,
    vidyut
    // AbstractTreeTableModel.java BEGIN
    import javax.swing.tree.*;
    import javax.swing.event.*;
    public abstract class AbstractTreeTableModel implements TreeTableModel {
        protected Object root;    
        protected EventListenerList listenerList = new EventListenerList();
        public AbstractTreeTableModel(Object root) {
            this.root = root;
        // Default implementations for methods in the TreeModel interface.
        public Object getRoot() {
            return root;
        public boolean isLeaf(Object node) {
            return getChildCount(node) == 0;
        public void valueForPathChanged(TreePath path, Object newValue) {}
        // This is not called in the JTree's default mode:
        // use a naive implementation.
        public int getIndexOfChild(Object parent, Object child) {
            for (int i = 0; i < getChildCount(parent); i++) {
             if (getChild(parent, i).equals(child)) {
                 return i;
         return -1;
        public void addTreeModelListener(TreeModelListener l) {
            listenerList.add(TreeModelListener.class, l);
        public void removeTreeModelListener(TreeModelListener l) {
            listenerList.remove(TreeModelListener.class, l);
        protected void fireTreeNodesChanged(Object source, Object[] path,
                                            int[] childIndices,
                                            Object[] children) {
            // Guaranteed to return a non-null array
            Object[] listeners = listenerList.getListenerList();
            TreeModelEvent e = null;
            // Process the listeners last to first, notifying
            // those that are interested in this event
            for (int i = listeners.length-2; i>=0; i-=2) {
                if (listeners==TreeModelListener.class) {
    // Lazily create the event:
    if (e == null)
    e = new TreeModelEvent(source, path,
    childIndices, children);
    ((TreeModelListener)listeners[i+1]).treeNodesChanged(e);
    protected void fireTreeNodesInserted(Object source, Object[] path,
    int[] childIndices,
    Object[] children) {
    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    TreeModelEvent e = null;
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
    if (listeners[i]==TreeModelListener.class) {
    // Lazily create the event:
    if (e == null)
    e = new TreeModelEvent(source, path,
    childIndices, children);
    ((TreeModelListener)listeners[i+1]).treeNodesInserted(e);
    protected void fireTreeNodesRemoved(Object source, Object[] path,
    int[] childIndices,
    Object[] children) {
    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    TreeModelEvent e = null;
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
    if (listeners[i]==TreeModelListener.class) {
    // Lazily create the event:
    if (e == null)
    e = new TreeModelEvent(source, path,
    childIndices, children);
    ((TreeModelListener)listeners[i+1]).treeNodesRemoved(e);
    protected void fireTreeStructureChanged(Object source, Object[] path,
    int[] childIndices,
    Object[] children) {
    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    TreeModelEvent e = null;
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
    if (listeners[i]==TreeModelListener.class) {
    // Lazily create the event:
    if (e == null)
    e = new TreeModelEvent(source, path,
    childIndices, children);
    ((TreeModelListener)listeners[i+1]).treeStructureChanged(e);
    // Default impelmentations for methods in the TreeTableModel interface.
    public Class getColumnClass(int column) { return Object.class; }
    public boolean isCellEditable(Object node, int column) {
    return getColumnClass(column) == TreeTableModel.class;
    public void setValueAt(Object aValue, Object node, int column) {}
    // Left to be implemented in the subclass:
    * public Object getChild(Object parent, int index)
    * public int getChildCount(Object parent)
    * public int getColumnCount()
    * public String getColumnName(Object node, int column)
    * public Object getValueAt(Object node, int column)
    // AbstractTreeTableModel.java END
    // Bookmarks.java BEGIN
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.text.*;
    import javax.swing.text.html.*;
    import javax.swing.text.html.parser.*;
    public class Bookmarks {
    /** The root node the bookmarks are added to. */
    private BookmarkDirectory root;
    * Creates a new Bookmarks object, with the entries coming from
    * <code>path</code>.
    public Bookmarks(String path) {
         root = new BookmarkDirectory("Bookmarks");
         if (path != null) {
         parse(path);
    * Returns the root of the bookmarks.
    public BookmarkDirectory getRoot() {
         return root;
    protected void parse(String path) {
         try {
         BufferedReader reader = new BufferedReader(new FileReader
                                       (path));
         new ParserDelegator().parse(reader, new CallbackHandler(), true);
         catch (IOException ioe) {
         System.out.println("IOE: " + ioe);
         JOptionPane.showMessageDialog(null, "Load Bookmarks",
                             "Unable to load bookmarks",
                             JOptionPane.ERROR_MESSAGE);
    private static final short NO_ENTRY = 0;
    private static final short BOOKMARK_ENTRY = 2;
    private static final short DIRECTORY_ENTRY = 3;
    private class CallbackHandler extends HTMLEditorKit.ParserCallback {
         /** Parent node that new entries are added to. */
         private BookmarkDirectory parent;
         /** The most recently parsed tag. */
         private HTML.Tag tag;
         /** The last tag encountered. */
         private HTML.Tag lastTag;
         * The state, will be one of NO_ENTRY, DIRECTORY_ENTRY,
    * or BOOKMARK_ENTRY.
         private short state;
         * Date for the next BookmarkDirectory node.
         private Date parentDate;
         * The values from the attributes are placed in here. When the
         * text is encountered this is added to the node hierarchy and a
    * new instance is created.
         private BookmarkEntry lastBookmark;
         * Creates the CallbackHandler.
         public CallbackHandler() {
         parent = root;
         lastBookmark = new BookmarkEntry();
         // HTMLEditorKit.ParserCallback methods
         * Invoked when text in the html document is encountered. Based on
         * the current state, this will either: do nothing
    * (state == NO_ENTRY),
         * create a new BookmarkEntry (state == BOOKMARK_ENTRY) or
    * create a new
         * BookmarkDirectory (state == DIRECTORY_ENTRY). If state is
    * != NO_ENTRY, it is reset to NO_ENTRY after this is
    * invoked.
    public void handleText(char[] data, int pos) {
         switch (state) {
         case NO_ENTRY:
              break;
         case BOOKMARK_ENTRY:
              // URL.
              lastBookmark.setName(new String(data));
    parent.add(lastBookmark);
    lastBookmark = new BookmarkEntry();
              break;
         case DIRECTORY_ENTRY:
              // directory.
              BookmarkDirectory newParent = new
                   BookmarkDirectory(new String(data));
              newParent.setCreated(parentDate);
              parent.add(newParent);
              parent = newParent;
              break;
         default:
              break;
    state = NO_ENTRY;
         * Invoked when a start tag is encountered. Based on the tag
         * this may update the BookmarkEntry and state, or update the
         * parentDate.
         public void handleStartTag(HTML.Tag t, MutableAttributeSet a,
                        int pos) {
         lastTag = tag;
         tag = t;
         if (t == HTML.Tag.A && lastTag == HTML.Tag.DT) {
    long lDate;
              // URL
              URL url;
              try {
              url = new URL((String)a.getAttribute(HTML.Attribute.HREF));
              } catch (MalformedURLException murle) {
              url = null;
              lastBookmark.setLocation(url);
              // created
              Date date;
              try {
    lDate = Long.parseLong((String)a.getAttribute("add_date"));
    if (lDate != 0l) {
    date = new Date(1000l * lDate);
    else {
    date = null;
              } catch (Exception ex) {
              date = null;
              lastBookmark.setCreated(date);
              // last visited
              try {
    lDate = Long.parseLong((String)a.
    getAttribute("last_visit"));
    if (lDate != 0l) {
    date = new Date(1000l * lDate);
    else {
    date = null;
              } catch (Exception ex) {
              date = null;
              lastBookmark.setLastVisited(date);
              state = BOOKMARK_ENTRY;
         else if (t == HTML.Tag.H3 && lastTag == HTML.Tag.DT) {
              // new node.
              try {
              parentDate = new Date(1000l * Long.parseLong((String)a.
                                  getAttribute("add_date")));
              } catch (Exception ex) {
              parentDate = null;
              state = DIRECTORY_ENTRY;
         * Invoked when the end of a tag is encountered. If the tag is
         * a DL, this will set the node that parents are added to the current
         * nodes parent.
         public void handleEndTag(HTML.Tag t, int pos) {
         if (t == HTML.Tag.DL && parent != null) {
              parent = (BookmarkDirectory)parent.getParent();
    public static class BookmarkDirectory extends DefaultMutableTreeNode {
         /** Dates created. */
         private Date created;
         public BookmarkDirectory(String name) {
         super(name);
         public void setName(String name) {
         setUserObject(name);
         public String getName() {
         return (String)getUserObject();
         public void setCreated(Date date) {
         this.created = date;
         public Date getCreated() {
         return created;
    public static class BookmarkEntry extends DefaultMutableTreeNode {
         /** User description of the string. */
         private String name;
         /** The URL the bookmark represents. */
         private URL location;
         /** Dates the URL was last visited. */
         private Date lastVisited;
         /** Date the URL was created. */
         private Date created;
         public void setName(String name) {
         this.name = name;
         public String getName() {
         return name;
         public void setLocation(URL location) {
         this.location = location;
         public URL getLocation() {
         return location;
         public void setLastVisited(Date date) {
         lastVisited = date;
         public Date getLastVisited() {
         return lastVisited;
         public void setCreated(Date date) {
         this.created = date;
         public Date getCreated() {
         return created;
         public String toString() {
         return getName();
    // Bookmarks.java END
    // BookmarksModel.java BEGIN
    import java.util.Date;
    public class BookmarksModel extends DynamicTreeTableModel {
    * Names of the columns.
    private static final String[] columnNames =
    { "Name", "Location", "Last Visited", "Created" };
    * Method names used to access the data to display.
    private static final String[] methodNames =
    { "getName", "getLocation", "getLastVisited","getCreated" };
    * Method names used to set the data.
    private static final String[] setterMethodNames =
    { "setName", "setLocation", "setLastVisited","setCreated" };
    private static final Class[] classes =
    { TreeTableModel.class, String.class, Date.class, Date.class };
    public BookmarksModel(Bookmarks.BookmarkDirectory root) {
         super(root, columnNames, methodNames, setterMethodNames, classes);
    public boolean isCellEditable(Object node, int column) {
         switch (column) {
         case 0:
         // Allow editing of the name, as long as not the root.
         return (node != getRoot());
         case 1:
         // Allow editing of the location, as long as not a
         // directory
         return (node instanceof Bookmarks.BookmarkEntry);
         default:
         // Don't allow editing of the date fields.
         return false;
    // BookmarksModel.java END
    // DynamicTreeTableModel.java BEGIN
    import java.lang.reflect.*;
    import javax.swing.tree.*;
    public class DynamicTreeTableModel extends AbstractTreeTableModel {
    /** Names of the columns, used for the TableModel getColumnName method. */
    private String[] columnNames;
    private String[] methodNames;
    private String[] setterMethodNames;
    /** Column classes, used for the TableModel method getColumnClass. */
    private Class[] cTypes;
    public DynamicTreeTableModel(TreeNode root, String[] columnNames,
                        String[] getterMethodNames,
                        String[] setterMethodNames,
                        Class[] cTypes) {
         super(root);
         this.columnNames = columnNames;
         this.methodNames = getterMethodNames;
         this.setterMethodNames = setterMethodNames;
         this.cTypes = cTypes;
    public int getChildCount(Object node) {
         return ((TreeNode)node).getChildCount();
    public Object getChild(Object node, int i) {
         return ((TreeNode)node).getChildAt(i);
    public boolean isLeaf(Object node) {
         return ((TreeNode)node).isLeaf();
    public int getColumnCount() {
         return columnNames.length;
    public String getColumnName(int column) {
         if (cTypes == null || column < 0 || column >= cTypes.length) {
         return null;
         return columnNames[column];
    public Class getColumnClass(int column) {
         if (cTypes == null || column < 0 || column >= cTypes.length) {
         return null;
         return cTypes[column];
    public Object getValueAt(Object node, int column) {
         try {
         Method method = node.getClass().getMethod(methodNames[column],
                                  null);
         if (method != null) {
              return method.invoke(node, null);
         catch (Throwable th) {}
         return null;
    * Returns true if there is a setter method name for column
    * <code>column</code>. This is set in the constructor.
    public boolean isCellEditable(Object node, int column) {
    return (setterMethodNames != null &&
         setterMethodNames[column] != null);
    // Note: This looks up the methods each time! This is rather inefficient;
    // it should really be changed to cache matching
    // methods/constructors
    // based on <code>node</code>'s class, and code>aValue</code>'s
    //class.
    public void setValueAt(Object aValue, Object node, int column) {
         boolean found = false;
         try {
         // We have to search through all the methods since the
         // types may not match up.
         Method[] methods = node.getClass().getMethods();
         for (int counter = methods.length - 1; counter >= 0; counter--) {
              if (methods[counter].getName().equals
              (setterMethodNames[column]) && methods[counter].
              getParameterTypes() != null && methods[counter].
              getParameterTypes().length == 1) {
              // We found a matching method
              Class param = methods[counter].getParameterTypes()[0];
              if (!param.isInstance(aValue)) {
                   // Yes, we can use the value passed in directly,
                   // no coercision is necessary!
                   if (aValue instanceof String &&
                   ((String)aValue).length() == 0) {
                   // Assume an empty string is null, this is
                   // probably bogus for here.
                   aValue = null;
                   else {
                   // Have to attempt some sort of coercision.
                   // See if the expected parameter type has
                   // a constructor that takes a String.
                   Constructor cs = param.getConstructor
                   (new Class[] { String.class });
                   if (cs != null) {
                        aValue = cs.newInstance(new Object[]
                                       { aValue });
                   else {
                        aValue = null;
              // null either means it was an empty string, or there
              // was no translation. Could potentially deal with these
              // differently.
              methods[counter].invoke(node, new Object[] { aValue });
              found = true;
              break;
         } catch (Throwable th) {
         System.out.println("exception: " + th);
         if (found) {
         // The value changed, fire an event to notify listeners.
         TreeNode parent = ((TreeNode)node).getParent();
         fireTreeNodesChanged(this, getPathToRoot(parent),
                        new int[] { getIndexOfChild(parent, node) },
                        new Object[] { node });
    public TreeNode[] getPathToRoot(TreeNode aNode) {
    return getPathToRoot(aNode, 0);
    private TreeNode[] getPathToRoot(TreeNode aNode, int depth) {
    TreeNode[] retNodes;
         // This method recurses, traversing towards the root in order
         // size the array. On the way back, it fills in the nodes,
         // starting from the root and working back to the original node.
    /* Check for null, in case someone passed in a null node, or
    they passed in an element that isn't rooted at root. */
    if(aNode == null) {
    if(depth == 0)
    return null;
    else
    retNodes = new TreeNode[depth];
    else {
    depth++;
    if(aNode == root)
    retNodes = new TreeNode[depth];
    else
    retNodes = getPathToRoot(aNode.getParent(), depth);
    retNodes[retNodes.length - depth] = aNode;
    return retNodes;
    // DynamicTreeTableModel.java END
    // IconRenderer.java BEGIN
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.plaf.basic.BasicTreeUI;
    class IconRenderer extends DefaultTreeCellRenderer
    // Color backColor = new Color(0xD0, 0xCC, 0xFF);
    Color backColor = new Color(0xF0, 0xF0, 0xE0);
    String tipText = "";
    JTree tree;
    int currRow = 0;
    boolean m_selected;
    JTable table;
    public IconRenderer(JTree tree, JTable table) {
    this.table = table;
    // setBackground(backColor);
    setBackground(Color.GREEN);
    setForeground(Color.black);
         this.tree = tree;
    public Component getTreeCellRendererComponent(JTree tree, Object value,
    boolean selected,
    boolean expanded, boolean leaf,
    int row, boolean hasFocus) {
         Object node = null;
         super.getTreeCellRendererComponent(
    tree, value, selected,
    expanded, leaf, row,
    hasFocus);
         TreePath treePath = tree.getPathForRow(row);
    if(treePath != null)
              node = treePath.getLastPathComponent();
    currRow = row;
    m_selected = selected;
    DefaultMutableTreeNode itc = null;
    if (node instanceof DefaultMutableTreeNode) {
    itc = (DefaultMutableTreeNode)node;
         setClosedIcon(closedIcon);
    setOpenIcon(openIcon);
    return this;
    /* Override the default to send back different strings for folders and leaves. */
    public String getToolTipText() {
    return tipText;
    * Paints the value. The background is filled based on selected.
    public void paint(Graphics g) {
         super.paint(g);
         Color bColor = null;
         if(!m_selected) {
              System.out.println(" iconren not sel currRow " + currRow);
              if(currRow % 2 == 0) {
                   bColor = Color.WHITE;
              } else {
              bColor = backColor;
         } else {
              bColor = table.getSelectionBackground();
              System.out.println("in else selbg = " + bColor);           
              bColor = new Color(0xF0, 0xCC, 0x92);
              System.out.println(" bColor aft = " + bColor);           
         int imageOffset = -1;
         if(bColor != null) {
         imageOffset = getLabelStart();
         g.setColor(bColor);
         if(!m_selected) {
              System.out.println(" not sel setting white ");
              g.setXORMode(new Color(0xFF, 0xFF, 0xFF));
         } else {
    //          g.setXORMode(new Color(0xCC, 0xCC, 0x9F));
              g.setXORMode(new Color(0x00, 0x00, 0x00));
              System.out.println(" using color = " + g.getColor());           
         if(getComponentOrientation().isLeftToRight()) {
         g.fillRect(imageOffset, 0, getWidth() - 1 - imageOffset,
                   getHeight());
         } else {
         g.fillRect(0, 0, getWidth() - 1 - imageOffset,
                   getHeight());
    private int getLabelStart() {
         Icon currentI = getIcon();
         if(currentI != null && getText() != null) {
         return currentI.getIconWidth() + Math.max(0, getIconTextGap() - 1);
         return 0;
    // IconRenderer.java END
    // IndicatorRenderer.java BEGIN
    // import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    import javax.swing.table.*;
    import javax.swing.table.*;
    import javax.swing.plaf.basic.*;
    import java.awt.event.*;
    import java.util.EventObject;
    import java.text.NumberFormat;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.StringTokenizer;
    import java.util.Arrays;
    class IndicatorRenderer extends DefaultTableCellRenderer {
    /** Makes sure the number of displayed in an internationalized
    * manner. */
    protected NumberFormat formatter;
    /** Row that is currently being painted. */
    protected int lastRow;
    protected int reloadRow;
    protected int reloadCounter;
    protected TreeTableModel treeTableModel;
    protected TreeTableModelAdapter treeTblAdapter;
    protected JTable table;
    Component renderer = null;
    Color backColor = new Color(0xF0, 0xF0, 0xE0);
    IndicatorRenderer(TreeTableModelAdapter treeTblAdapter, TreeTableModel treeTableModel) {
         setHorizontalAlignment(JLabel.RIGHT);
         setFont(new Font("serif", Font.BOLD, 12));
         this.treeTableModel = treeTableModel;
         this.treeTblAdapter = treeTblAdapter;
    * Invoked as part of DefaultTableCellRenderers implemention. Sets
    * the text of the label.
    public void setValue(Object value) {
    /* setText((value == null) ? "---" : formatter.format(value)); */
         setText((value == null) ? "---" : (String) value.toString());
    * Returns this.
    public Component getTableCellRendererComponent(JTable table,
    Object value, boolean isSelected, boolean hasFocus,
    int row, int column) {
         renderer = super.getTableCellRendererComponent(table, value, isSelected,
    hasFocus, row, column);
         lastRow = row;
         this.table = table;
              if(isSelected) {
                   doMask(hasFocus, isSelected);
              } else
              setBackground(table.getBackground());
    return renderer;
    * If the row being painted is also being reloaded this will draw
    * a little indicator.
    public void paint(Graphics g) {
         super.paint(g);
    private void doMask(boolean hasFocus, boolean selected) {
              maskBackground(hasFocus, selected);
    private void maskBackground(boolean hasFocus, boolean selected) {
              Color seed = null;
              seed = table.getSelectionBackground();
              Color color = seed;
              if (color != null) {
                   setBackground(
    new Color(0xF0, 0xCC, 0x92));
    // IndicatorRenderer.java END
    // JTreeTable.java BEGIN
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    import javax.swing.table.*;
    import java.awt.event.*;
    import java.util.EventObject;
    public class JTreeTable extends JTable {
    /** A subclass of JTree. */
    protected TreeTableCellRenderer tree;
    protected IndicatorRenderer indicatorRenderer = null;
    public JTreeTable(TreeTableModel treeTableModel) {
         super();
         // Creates the tree. It will be used as a renderer and editor.
         tree = new TreeTableCellRenderer(treeTableModel);
         TreeTableModelAdapter tdap = new TreeTableModelAdapter(treeTableModel, tree);
         // Installs a tableModel representing the visible rows in the tree.
         super.setModel(tdap);
         // Forces the JTable and JTree to share their row selection models.
         ListToTreeSelectionModelWrapper selectionWrapper = new
         ListToTreeSelectionModelWrapper();
         tree.setSelectionModel(selectionWrapper);
         setSelectionModel(selectionWrapper.getListSelectionModel());
         // Installs the tree editor renderer and editor.
         setDefaultRenderer(TreeTableModel.class, tree);
         setDefaultEditor(TreeTableModel.class, new TreeTableCellEditor());
         indicatorRenderer = new IndicatorRenderer(tdap, treeTableModel);     
         // No grid.
         setShowGrid(false);
         // No intercell spacing
         setIntercellSpacing(new Dimension(0, 0));     
         // And update the height of the trees row to match that of
         // the table.
         //if (tree.getRowHeight() < 1) {
         // Metal looks better like this.
         setRowHeight(20);
    public TableCellRenderer getCellRenderer(int row, int col) {
              if(col == 0)
              return tree;
              else
              return indicatorRenderer;     
    public void updateUI() {
         super.updateUI();
         if(tree != null) {
         tree.updateUI();
         // Do this so that the editor is referencing the current renderer
         // from the tree. The renderer can potentially change each time
         // laf changes.
         setDefaultEditor(TreeTableModel.class, new TreeTableCellEditor());
         // Use the tree's default foreground and background colors in the
         // table.
    LookAndFeel.installColorsAndFont(this, "Tree.background",
    "Tree.foreground", "Tree.font");
    public int getEditingRow() {
    return (getColumnClass(editingColumn) == TreeTableModel.class) ? -1 :
         editingRow;
    private int realEditingRow() {
         return editingRow;
    public void sizeColumnsToFit(int resizingColumn) {
         super.sizeColumnsToFit(resizingColumn);
         if (getEditingColumn() != -1 && getColumnClass(editingColumn) ==
         TreeTableModel.class) {
         Rectangle cellRect = getCellRect(realEditingRow(),
                             getEditingColumn(), false);
    Component component = getEditorComponent();
         component.setBounds(cellRect);
    component.validate();
    public void setRowHeight(int rowHeight) {
    super.setRowHeight(rowHeight);
         if (tree != null && tree.getRowHeight() != rowHeight) {
    tree.setRowHeight(getRowHeight());
    public JTree getTree() {
         return tree;
    public boolean editCellAt(int row, int column, EventObject e){
         boolean retValue = super.editCellAt(row, column, e);
         if (retValue && getColumnClass(column) == TreeTableModel.class) {
         repaint(getCellRect(row, column, false));
         return retValue;
    public class TreeTableCellRenderer extends JTree implements
         TableCellRenderer {
         /** Last table/tree row asked to renderer. */
         protected int visibleRow;
         /** Border to draw around the tree, if this is non-null, it will
         * be painted. */
         protected Border highlightBorder;
         public TreeTableCellRenderer(Tr

  • ADF TreeTable One row data to create a master-detail parent-child relation

    I want to display an editable detail table on a page. The problem is the detail table has many fields so that the screen scrolls horizontally. I need my page to just fit on one page without scrolling.
    now my idea is to use a TreeTable. A lot of fields on the detail table will act as children of the main node so I can fit the table onto one screen without scrolling.
    So there is really no master detail relationship because Im referring to the same row data.
    Not the usual use case of using a Tree Table but just wondering if this is possible. I posted this hoping that anyone could shed a light on this.
    regards,
    Anton

    You can do that like in this example:
    http://apex.oracle.com/pls/apex/f?p=31517:278
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • 11g: treeTable child record selection

    Hi,
    I have a (pseudo) model, where entity A is self-referenced and also parent of B, so:
    A 1 - * A
    A 1 - * B
    I'd like to load all As into treeTable, which is not a ploblem. When a record in the treeTable is selected, I need to load detail Bs in a seperate panelFormLayout.
    The problem is, the panelFormLayout only reloads when one of the first level As is selected, but selection of child As has no effect.
    Setting target data source to the same iterator solves the problem with selection, but introduces another one: selected detail is appended to the end of the tree table.
    Any ideas how to do it properly?
    Thanks

    No matter what I tried I just couldn't get it work with business components, so I've taken another approach:
    I create a TreeModel copy of data in A dataView and bind treeView to generated TreeModel. I had to write some snchronization code (currentRow, selection etc.), but so far it seems to work.

  • Sorting of nodes in a treeTable

    hi,
    i got a problem like that how to make sorting in JtreeTable model.the problem is i am passing i am constructin the JtreeTable model by passing DefaultMutableTreeNode object.which contains Nodename and value.I need to sort only by name.
    for example DefaultmutableTreeNode object contains nodename as B,D,F,T and nodevalue is 8,8,6,5
    i am displaying this in table as a two columns.
    nodename value
    --A               8
    B 8
    C 6
    +D               5
    I need sorting by nodenames.
    one importent thing is am constructing a wholedata in to a DefaultMutableTreeNode and i am passing to a TreeTable model.Any java swing expert please help me with a solution.
    samplecode:
    for example i am constructing the DefaulrmutableTreeNodeobject like this.
    data = new MainData(nodeName,nodevalue);
    l_childNode = new DefaultMutableTreeNode(data);
    l_childNode.setUserObject(data)
    l_rootNode.add(l_childNode);
    finally i am constructing a treeTable Model by using this l_rootNode.
    Please help me how can make soritng in the treeTable model.
    please post any similar examples..
    waiting for replay.

    Moin David,
    ja, die Sortierung wird tatsächlich z.Zt. nicht unterstützt:
    Hello @all,
    The SAP support has confirmed that sorting in grid with collapseLevel is not supported at this time.
    I've opened a new thread in the "SAP Business One Product Development Collaboration "-area.
    As I understand the chance of impementing this feature raises the more users support this request there.
    So I would like to invite you to answer this thread if you agree that the sorting feature should be implemented:
    Thanks!
    As a workaround I have added a new column in the SELECT (and DataTable and Grid). This column contains a "composite key" of the CollapseLevel-Cols PLUS(!) the failed sorting column and is named "Collapse4" in this example.
    U_Col04 was the column of the grid leafes where the sorting has failed before.
    The CollapseLevel must be incremented by 1:
    SELECT
    U_Col01 AS 'Collapse1',
    U_Col02 AS 'Collapse2',
    U_Col03 AS 'Collapse3',
    U_Col01 + '-' + U_Col02 + '-' + U_Col03 + '-' + U_Col04 AS 'Collapse4'
    FROM
    etc....
    There is nothing to expand in Collapse4 than always ONE row. But Collapse4 is sorted now.
    Roland
    Edited by: Roland Toschek on Sep 3, 2008 12:32 PM

  • Issue with child node edit on TreeTable

    Hello,
    I have a treeTable which is based on single VO. My problem is such that, when i select the child node and click on edit, i get values of it's parent :( ....
    but when i have once  edit on any node (either rollback/commit) and hit the browser refresh button now it works as expected and no more issue....
    what the heck is that. I have used backingBean scope and i have jdev 11.1.1.3.0
    Thanks
    Raj

    Hello Frank,
    Thank you so much for the help.. I have 2 iterator as explained in http://www.oracle.com/technetwork/developer-tools/adf/learnmore/sept2011-otn-harvest-508189.pdf .
    As my treeTable is based on single VO , whenever i select a child node and hit the toolbar edit and/or context menu edit, i get parent node info in the edit form. and this happens until i hitting browser refresh. after that it works as expected....
    when selection is made and edit button is clicked i call the managed bean method to call service operation as:
    public void onTreeTableEditClicked(ActionEvent actionEvent)
    Number id = getSelectedIdFromTree(); // my problem is here ... i am getting parent id until once edit is done(either rollback/commit) and browser refresh is hit. after that i am getting selected it.
    if (id!= null)
    OperationBinding opr =
    ADFBindingUtils.getDCBindingContainer().getOperationBinding("selectMyMethod");
    opr.getParamsMap().put("id", id);
    opr.execute();
    _showPopup(getEditPopup());*
    else
    // show warning.
    public Number getSelectedIdFromTree()
    RowKeySet rks2 = myTreeTable.getSelectedRowKeys();
    Iterator rksIterator = rks2.iterator();
    if (rksIterator.hasNext())
    List<Key> list = (List<Key>) rksIterator.next();
    return ((DBSequence) (list.get(list.size() -
    1).getKeyValues()[0])).getSequenceNumber();
    return null;
    // in the application Module
    public void selectMyMethod(Number id)
    MYVOImpl pvo = getEditMyVOImpl();
    MYVORowImpl row =
    (MYVORowImpl ) pvo.findByKey(new Key(new Object[]
    { new DBSequence(id) }), 1)[0];
    pvo.setCurrentRow(row);
    and the edit popup has value referenced by editIterator...
    Please let me know where i am wrong, or is there something i am missing.
    Thank you
    Edited by: MavenDev on Nov 8, 2011 8:34 AM

Maybe you are looking for

  • Can I use iTunes match from both my house in Canada and my cottage in the States?

    I have a Canadian Apple account and a cottage across the border in Vermont.  Will I be able to access my stuff in the cloud, including iTunes match, from th USA?

  • Corruption problems in iTunes 8.1.1

    Ever since updating to iTunes 8.1.1 i have a few problems with the check boxes and with the title menu bars. I can re-size the columns when viewing in list view but i can't sort the columns when i click on the titles. Also the little check boxes next

  • Error while updating data in DB2

    Hi, I am working on SOA 11 g.Trying to update data in table of DB2 by using DB adapter. But I am getting following error, *[OWLS][DB2 JDBC Driver][DB2]Character data, right truncation occurred; for example, an update or insert value is a string that

  • Group by only one column

    Hi friends, I have a create table script as below: CREATE TABLE GROUPBY_TEST ( NAME VARCHAR2(5), HIREDATE DATE, DEPARTMENT VARCHAR2(5), SALARY NUMBER(5) Insert script : INSERT INTO GROUPBY_TEST VALUES ('A','1-JAN-2000','XYZ',1000); INSERT INTO GROUPB

  • IDisk icon suddenly appearing on desktop

    Something annoying happened. I like to keep my desktop clean. Then I had some friends over, they were playing with the iMac, and now the iDisk icon is randomly appearing during use; usually when i explore the Finder folder. I eject it, and when I reb