ADF Faces af:tree

Does anyone know where to find an example of a data bound tree?
The static one here(http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/tree.html) isn't very helpful.
Thanks.

if you're redisplaying the same page, then the tree
will automatically remember the expansion state.
however, if you are returning to the page from some other page, then the tree would have reset.
in order to preserve the expansion state of the tree, you need to use a managed-bean. set
<tree binding="#{mybean.myTree}" ..>
now, the setMyTree(UIComponent tree) method will be called
on your bean.
get the treeState from that:
tree.getTreeState()
and save it on your class.
then you can set it on the tree on subsequent requests.
make sure the scope of your managed bean is
session

Similar Messages

  • ADF Faces - af:tree - updating nodeStamp components

    My tree's nodeStamp is an af:selectBooleanCheckbox which maps to a hierarchy of items of indeterminate depth. There are usually at least 3 levels however. If I toggle a parent checkbox then all the child checkboxes must also toggle to match. That is the whole point of the parents in this tree is to be able to turn on or off sets of children, grand-children etc. This should be a pretty standard thing to do with trees. However, I have a bit of a dilemma and I'm hoping that someone out there can help me.
    When I toggle a parent checkbox the ThemeTree.valueChangeListener does a getModel().getRowData() to return the current row. I can then traverse the model tree from that instance to toggle all the children to match the state of the parent. From the model perspective everything works fine.
    However, if the tree is expanded when the parent state is changed, the visual state of the children do not change! The parent Checkbox is unchecked but the child Checkboxes remain checked :(or visa versa):
    Now to make things even more weird. If I close the parent tree and reopen it the children remain out of sync with the parent; even though the backing code model data is properly set.
    Even weirder. If the parent Checkbox is not expanded and I change the state and then I open the parent all the child Checkboxes are CORRRECTLY set.
    My jsp code looks as follows.
    <af:panelGroup partialTriggers="theme_display">
    <af:tree id="theme_tree" var="theme"
           binding="#{ThemeTree.tree}"
           value="#{ThemeTree.model}"
           partialTriggers="theme_display">
    <f:facet name="nodeStamp">
      <af:panelGroup layout="horizontal">
        <af:objectImage source="#{theme.graphic}"
                        rendered="#{theme.graphic != null}"
                        align="right"/>
        <af:objectSpacer width="3"
                         rendered="#{theme.graphic != null}"/>
        <af:selectBooleanCheckbox id="theme_tree_row"
                                  value="#{theme.display}"
                                  text="#{theme.displayName}"
                                  shortDesc="#{theme.shortDesc}"
                                  autoSubmit="true" immediate="true"
                                  valueChangeListener="#{ThemeTree.valueChangeListener}"/>
      </af:panelGroup>
    </f:facet>
    </af:tree>
    ....My ValueChangeListener looks like this.
        public void valueChangeListener(ValueChangeEvent vce) {
            if (tree != null) {
                setTreeChangeHappening(true);
                ThemeTreeBean currentTheme = (ThemeTreeBean)treeModel.getRowData();
                if (currentTheme.getChild() != null) {
                    boolean display = ((Boolean)vce.getNewValue()).booleanValue();
                    currentTheme.setDisplayAll(display);
                //TODO: is this doing what I think it is doing?  I'm starting to think not.
                AdfFacesContext afc = AdfFacesContext.getCurrentInstance();
                UIComponent checkBox = vce.getComponent();
                String id = checkBox.getId();
                int i = treeModel.getRowIndex();
                while (treeModel.isRowAvailable()) {
                    ThemeTreeBean themeBean = (ThemeTreeBean)treeModel.getRowData();
                    String x = themeBean.getName(); // used for debugging
                    String y = themeBean.getDisplayName(); // used for debuggin
                    afc.addPartialTarget(checkBox); // this might do something if we could get the instance of the UIComponent from the treeModel
                    afc.partialUpdateNotify(checkBox);
                    treeModel.setRowIndex(++i);
        }List of things that I've tried
    (a) I know how to AdfFacesContext.getCurrentInstance().addPartialTarget(vce.getComponent()) and ...partialUpdateNotify(same) but I haven't figured out how to get a handle on the UIComponent instances of the child Checkboxes. The components inside a nodeStamp facet seem to live an arms-length existance. I tried binding the selectBooleanCheckbox to a CoreSelectBooleanCheckbox property in my var class (theme) but this just doesn't work: ADF does not appear to allow it.
    (b) I tried various combinations using partialTriggers (no luck there).
    (c) The id cannot be a JSF expression (even though the JDeveloper tip claims it can; the ADF documentation says no) so I cannot get the id to find the UIComponent of the children. (Are there UIComponents of the children?)
    (d) I tried traversing the treeModel using the setRowIndex(int) method but this only stepped me through the parent level, it did no return the children. Even if it did I'm not sure how I would force the visual update of the child.
    The long and short of it is that the behaviour of components inside the nodeStamp is different and it makes for a real problem. I'm about to abandon the af:tree and see if there is anything in myfaces that might help. But before I give up altogether, I thought that I'd ask one more time to see if anyone out there could give me a hint for anything else to try.
    Thanks in advance, Mark

    More information: You cannot use the var attribute to bind the SelectBooleanCheckbox because it is not a managed bean and you can only bind to managed beans. So I created a CoreSelectBooleanCheckbox property in the ThemeTreeTree class (which is a managed bean) with the intent of matching references to the checkBox property as it rippled through the list.
    BUT...it doesn't ripple through the list. There is only one instance of the CoreSelectBooleanCheckbox which appears to be shared by all the visible components.
    So ... I'm still stumped.

  • ADF Faces af:tree expand/collapse node

    Any help appreciated. Is there a way to specify in the tree model if you want a node expanded or collapsed? I am using the ChildPropertyTreeModel and TreeNodeImpl as the nodes. Can I add an additional property to the Tree Node?
    Thanks

    There isn't anything in the framework that lets you specify tree expansion state in the model. The frameword tries to preserve the abstraction between the model (which should only contain data) and the UI component (which handles expansion state).
    You can build a custom renderer for the tree where you can remember which paths from your model are expanded, and then set the expansion state of the tree programmatically by calling the UIXTree.setTreeState() method. It takes a set of paths, with each path corresponding to a path you want to be expanded.

  • ADF Faces: Update Tree Contents

    Does anyone know how to update the contents of a Tree component.

    To be more specific, I want to be able to refresh the tree contents CRUD (Create, Read, Update, Delete) operations are performed on the tree nodes.
    Currently I provide a tree model by extending ChildPropertyTreeModel.
    On every CRUD operation I create a new model, but the tree does reflect the contents of the new model.
    How do can I make the tree refresh it's contents?

  • How to generate ADF Faces Tree from table ?

    Hi,
    i want to create menu for my application using ADF Faces af:tree component.i have one table containing : menu_id and parent_id , which use for describing relationship between menu ( parent/child ).
    Fact : i've already know how to create adf faces af:tree component from master/detail relationship tables.
    The question : how to create adf faces af:tree component from recursive master/detail relationship in one table ?
    to clearer understand my question,this is my MENU_DATA table script :
    CREATE TABLE MENU_DATA
    MENU_ID VARCHAR2(5 BYTE),
    DESCRIPTION VARCHAR2(50 BYTE),
    OPENLINK VARCHAR2(200 BYTE),
    PARENT_ID VARCHAR2(5 BYTE)
    this is what i mean recursive master/detail relationship ...
    ALTER TABLE MENU_DATA ADD (
    CONSTRAINT FK_PARENT_MENU_ID
    FOREIGN KEY (PARENT_ID)
    REFERENCES MENU_DATA (MENU_ID));
    Thanks a lot for help gurus...
    Ricky HP

    I have the same question on my mind...
    Without creating n (same number of level depth) VO, how can I build a recursive ADF Faces Tree ???

  • ADF Faces setParent() method

    Hi,
    I'm trying to build an ADF Faces component tree dynamically. In particular, I'm trying to add an HtmlRowLayout to an HtmlTableLayout.
    Although my code appears to run without throwing errors, the <TABLE> tag that gets generated is empty. I'm not sure, but I think it might have something to do with my mechanism of adding one component to the other.
    I've been calling
    myHtmlRowLayout.setParent(myHtmlTableLayout);Which sort of looks like it's working. The _parent property of myHtmlRowLayout is indeed getting changed. But it doesn't look like this actually adds the HtmlRowLayout to the HtmlTableLayout's _children list.
    Is there some method I have to call to "close up" the tree this way? I'd sort of expected that any process that would make X Y's parent would also make Y X's child.
    Edit:
    OK, I figured this out. It's not sufficient to call setParent() on the child, you have to explicitly add the child to the parent's list of children:
    myHtmlTableLayout.getChildren().add(myHtmlRowLayout);So, question: What does setParent() do? THis makes it look like you could have weird asymmetric parent/child relationships: Where the child of X is Y, but the parent of Y is not X. To be on the safe side, in my code I'm calling both, but is there a use case for calling one but not the other? If not, an ER: Could setParent() do everything required to set up a parent-child relationship between two components?
    Message was edited by:
    Avrom

    setParent() is a method from the JSF UIComponent class; if you want to find out what it does, check the Javadoc for JSF, which says:
    Set the parent UIComponent of this UIComponent. This method must never be called by developers; a UIComponent's internal implementation will call it as components are added to or removed from a parent's child List or facet Map.
    Always, just call getChildren().add() or getFacets().put(). NEVER call setParent().

  • How do I create multiple types of child nodes in ADF  Faces Tree Component

    Hi,
    I am trying to construct a tree using ADF Faces. The tree I am trying to develop should look something like:
    - Departments
    + Dept 10
    + Dept 20
    + Dept 30
    + Dept 40
    - Employees
    + SCOTT
    +ALLEN
    + BLAKE
    The nodes shown at the top level should serve as labels, indicating the various types of nodes available.
    I have created the top level RootLabelsViewObj, with a SQL clause:
    select rn, node_label
    from (
    select 1 rn
    , 'Employees' node_label
    from dual
    union all
    select 2 rn
    , 'Departments' node_label
    from dual
    union all
    select 3 rn
    , 'Bonusplans' node_label
    from dual
    I have created ViewLinks between the RootLabelsViewObj and the DeptView and EmpView respectively (created on top of DEPT and EMP table in SCOTT schema), based on the LABEL attribute in the RootLabelsViewObj and with ViewLink SQL specified like:
    :Bind_NodeLabel = 'Departments' for the link with DeptView and :Bind_NodeLabel = 'Employees' for the link with EmpView.
    In the ADF BC Application Module Tester, I get exactly what I want.
    However, when I create a JSF JSPX page and drag the RootLabelsViewObj from the Data Control Panel to the page as ADF Tree, I run into a little issue: it seems like I cannot create a second Branch Accessor rule for the RootLabelsViewObj1: I have created a first Branch Accessor Rule referring to DeptView and now try to create a second one for EmpView, to allow Employees to be displayed under the root label "Employees" - but I cannot.
    The PageDefinition looks like:
    <tree id="RootLabelsViewObj1" IterBinding="RootLabelsViewObj1Iterator">
    <AttrNames>
    <Item Value="Rn"/>
    <Item Value="NodeLabel"/>
    </AttrNames>
    <nodeDefinition DefName="model.RootLabelsViewObj"
    id="RootLabelsViewObjNode">
    <AttrNames>
    <Item Value="NodeLabel"/>
    </AttrNames>
    <Accessors>
    <Item Value="DeptView"/>
    </Accessors>
    </nodeDefinition>
    <nodeDefinition DefName="model.EmpView" id="EmpViewNode">
    <AttrNames>
    <Item Value="Ename"/>
    </AttrNames>
    </nodeDefinition>
    <nodeDefinition DefName="model.DeptView" id="DeptViewNode">
    <AttrNames>
    <Item Value="Deptno"/>
    </AttrNames>
    </nodeDefinition>
    </tree>
    Does anyone know:
    - whether it is possible (intended) to have more than one branch accessor per node (i.e. more than one type of child under a node in the tree)
    - if so, how this can be achieved?
    Right now it looks like I am limited to each node in the tree having only one type of child node.
    Please tell me I am wrong.
    best regards,
    Lucas

    Give this a shot mate
    event.getNativeEventTarget();That will allow you to access the DOM object directly
    Id can be retrieved via
    event.getNativeEventTarget().id;

  • Drag andn Drop facility in af:tree in ADF Faces

    Hi,
    I am exploring on the possibilities to get drag and drop feature working in an ADF Faces Tree element. Basically, I want to drag the nodes in the tree under other nodes within the same tree.
    I tried using some Javascript libraries to achieve the same.
    http://ajaxpatterns.org/Drag-And-Drop#In_A_Blink
    But it seems that ADF Faces generate the "Id" of the nodes of the tree by prepending some string like "_id1:" to the ID provided in the Property Inspector for the node stamp of the tree element. So, we cannot use those libraries either which rely on the node id of the elements.
    Does ADF Faces plan to introduce this drag and drop feature in the af:tree element.
    Any help will be highy useful.
    Thanks,
    Ankit Goel

    Hi Frank,
    Can we know as to when ADF is planning to bring the drag and drop feature in ADF Tree component. Also, we would want to get a handle to the node ids of the tree. We need this to implement some right click features on the tree nodes. Is this also considered in the new UI features project.
    Can we know of any page where all new upcoming features are listed, or we can request for any desired UI features. Please help.
    Thanks,
    Ankit

  • ADF Faces:  Tree & NodeStamp

    Hi,
    I would like to know what components are supported by faces "nodeStamp"
    in ADF Faces Tree?
    Thanks,
    A

    More information: You cannot use the var attribute to bind the SelectBooleanCheckbox because it is not a managed bean and you can only bind to managed beans. So I created a CoreSelectBooleanCheckbox property in the ThemeTreeTree class (which is a managed bean) with the intent of matching references to the checkBox property as it rippled through the list.
    BUT...it doesn't ripple through the list. There is only one instance of the CoreSelectBooleanCheckbox which appears to be shared by all the visible components.
    So ... I'm still stumped.

  • Customizing the Tree Component inn ADF Faces..

    HI,
    I am using the ADF Faces Tree Component and was wondering wheteher we
    can use a specific theme instead of the default one..
    The scenario's i am looking at are
    1) Changing the Style of the Selected Node
    2) Programatically can i assign a different styling for a Specific
    Node (Previously Selected) in the Tree ??
    3) And any info reg Enabling the Drag and Drop functionality ?? As of
    now i don't think it is supported. Are there any plans of it being
    supported in the furture releases??
    Thanks
    Sateesh

    Hi,
    1) See tree skin selectors: http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/skin-selectors.html
    2) You can reference a managed bean for providing the inline style sheet on a component. This however only works when the tree is re-drawn and not dynamically
    3) Drag and drop doesn't work in 10.1.3.x. In 11 this may work - havent tested yet - using a client listener component
    Frank

  • Unable to implement Programmatic ADF Faces Tree component in jdev 11g

    I have referred to the posts " [Back to programming: Programmatic ADF Faces Tree component|http://one-size-doesnt-fit-all.blogspot.com/2007/05/back-to-programming-programmatic-adf.html] " and " [Follow-up: Programmatic ADF Faces Tree in JDev 11g|http://one-size-doesnt-fit-all.blogspot.com/2007/05/follow-up-programmatic-adf-faces-tree.html] ",
    The first post showed how to construct the elements in the tree programmatically rather than relying on bindings (in JDeveloper 10.1.3)
    and the second post tells the only difference in 11g .
    I am trying to implement the elements of the tree programatically in Jdev 11g(specifically 11.1.1.0.2) but no result is coming .
    There is no compilation/run time error , its just that the tree is not visible.
    Can anyone suggest any key points which should be focussed during this implementation?

    Hi,
    follow the description
    http://www.oracle.com/technology/products/adf/adffaces/11/doc/demo/adf_faces_rc_demo.html
    to install the ADF Faces RC component demo in JDeveloper. It has a tree example. Have a look at their implementation and dapt it to your needs
    Frank

  • Customizing ADF Faces Look & Feel. Some questions & suggestions

    Hi everybody,
    We are developing an application with ADF Faces using JHeadStart. For the moment, I am studying the way we must modify the JHS templates to adapt each element to our needs.
    As it's told in the JHeadStart Developer's Guide, there are two ways to customize Look & Feel:
    1) Modifying the templates
    2) ADF Skinning
    I'm using both methods, but I feel that thay are not good enough to adapt the L&F to our customer requirements.
    My main problem now is in the ADF Table customization. I want to use ADF Table because it offers us a lot of features that are not in the jsf table (the selection column, the table overflow...), and is very usefull combined with the generated JHS code. But at the same time, it doesn't offer a lot of functionality in the look & feel customization. Using JSF Table, I can set the CSS style for headers, rows, columns, the table, I can set the border, cellspacing and cellpadding. But I cannot do
    any of these thing (or at least, I don't see how) with the ADF Table.
    Our customer (a government) have a strict definition of the look & feel of his web applications. They want we use their CSS styles definition file, so they can modify at once the Look & Feel of all their applications. Modifying the L&F through skinning generate other styles, not use the style classes in our CSS (o so I think).
    So, the questions:
    1) There is any way to set the suitable styles for the ADF Table components (headers, rows)?
    1bis) Why, If I have defined a new skin, with only just a few selectors, some styles from oracle are applied? Maybe because the render kit in the 'adf-skins.xml' is "oracle.adf.desktop"? If it is true, how can I make that they are not used, I must implement a render kit or can I use another existent?
    2) Can I decide how looks the select column (for example a button instead of a radio button)? Can I decide where does it goes (right or left)?
    3) There is any way to hidden the text Show/Hide of the showDetail in the table (the tableOverflow), as I can change the icons through skinning? If it is not possible, How can I overwrite the text. I need it in Catalan, but it is shown in English for this locale. Where is the message bundle I should overwrite?
    4) There is any way to force a tree to start fully expanded?
    5) There is anywhere documentation about the javascript functions used in ADF and their meaning? I think for example in the previous question. If I knew which javascript function I should call for expand the tree and its parameters, I could put the call in the onload event of the body.
    6) I use a selectInputDate. I have skinned the launch-icon, and I would like to do a similar thing in the chooseDate that is opened in a new window. But It seems not to be affected for my skinning directives (if I put a chooseDate in the same page, its L&F follow the skinning rules I've defined). I don't know if this dialog is an ADF feature or a JHS generated feature.
    7) There is any way to keep unmodified the id I've choosed for a component? (I mean, an inputText with id="hello" in a form with id="form" will have in the HTML an id = "form:hello", but I would like it to be simply 'hello')
    8) How can I control the position and the size of a dialog (the chooseDate dialog or a dialog I've created)? In the cases I've been testing, it seems the dialog is forced to resize depending on the content. I would like to know if I can establish a fixed size.
    9) There is any way to open a non-modal dialog? (which I could keep open at the same time that another instance of the same dialog)
    For the moment, I think I have no more question. But give me time.... :-D
    The suggestion I've to do is basically more flexible components for a better customization (for example, the styles settings I've talked about previously). ADF components are nice and powerful, but I think they should generate pages that follow the tendencies in the web development: tableless pages (I cannot understand the utility of the objectSpacer existing the margins), use of CSS for layout...
    Any answer, comment or suggestion will be welcome.
    Carles.
    Message was edited by:
    cbios

    I have been able to make the UIX 2.2 and ADF Faces LAF look near identical by updating the oracle-desktop.xss file within UIX 2.2 as follows
    <!-- Change the accent color ramp to tan -->
    <style name="DarkAccentBackground">
    <!--<property name="background-color">#cccc99</property>-->
    <property name="background-color">#d2d8b0</property>
    </style>
    There are still some differences:
    1) A black line appears on the ADF Faces on the 'menu1' facet selected tab below the text. DON'T KNOW HOW TO REMOVE THIS FROM ADF Faces or add it to UIX 2.2!!!
    2) In UIX 2.2 a bulleted list uses the HTML <li> tag. In ADF Faces it doesn't use the HTML <li> tag rather it constructs the bulleted list using lower level HTML tags with the 'bullet' becoming an image, in my browser this means the disc is smaller in Faces. The motivation for this change I think is explained via this post. Since I have no control over how this specific HTML tag is rendered it forces me to replace the /adf/images/bltdscn.gif file in adf-faces-impl.jar with a larger disc!
    http://www.thescripts.com/forum/thread96839.html
    May update this again if there are other things I notice.

  • ADF Faces - indenting text in table column.

    Is there a way to indent text in an ADF Faces coreColumn component? I'm trying to represent a recursive tree structure in a CoreTable. I've tried inserting object spacers depending on the depth of each node in the tree, but Faces then wraps the text after the spacers, even when I specify no wrap for the column.
    Better yet, is there a way I could do this with a tree component? I've tried separating the different levels into different collections with separate custom methods, but I don't know how to specify the master/detail relationships between them.
    Any suggestions gratefully received.
    Brian Spear.

    Thanks, Frank. I don't think a tree table is the answer; it has the same requirements as the tree (or so I understand) with regards to populating each level from a different collection, and foreign key relationships. Not suitable for recursive relationships. Furthermore it only shows a small part of the tree at a time. I've got as far as returning a list of nodes within a structure, and I can display the structure, with icons for expanding and collapsing the nodes. All I need now is a way to indent the levels so the structure is more visible. The best I've managed so far is by inserting ". . ." in the text itself on each lower level, to make the left-justified text look indented. Obviously, I'd like a better way, that can be implemented in the view layer.
    Is there maybe a way of nesting objects within an outputText component so that it doesn't wrap? Must look into that.
    Thanks again.
    Brian Spear.

  • Can't find Javadoc for ADF Faces components

    I have tried to locate javadoc documentation for ADF Faces Java classes, but am not able to find anything. For example, the ADF Faces tag documentation for af:convertNumber has the following comment:
    "Further more information see javadoc for oracle.adf.view.faces.converter.NumberConverter"
    But I cannot find this javadoc anywhere on the OTN documentation site.

    Pls Check this link
    http://download.oracle.com/docs/cd/B25221_05/web.1013/e18745/apidocs/overview-tree.html

  • ADF Faces not found at Component Palette..

    I am a Tertiary Student currently doing a project using Jdeveloper 11G version 11.1.1.3.0 . I am currently doing a project on Login.jspx. I am unable to select the ADF Faces page from the Component Palette and unable to Locate the Panel Header component in the Layout layer of the Component Palette. May I know is there any other way to be able to locate the ADF Faces Page or the panel header?
    Thanks.

    Make sure you have the 'ADF Faces' and ADF Page Flow' technologies selected to your project.
    Open the ViewController project properties and select the last node in the tree ('Technology Scope'). The two mentioned scopes should be on the selected side to see the stuff you are looking for in the component palette.
    Timo

Maybe you are looking for