7

i've been looking for every corner of internet this question, and i didn't have success to find a solution, i made some examples with RichPanelAccordion but i haven't find some equivalent

This is my code for RichPanelAccordion

I create the Header of panel

List<UIComponent> child = getPh3().getChildren();
RichPanelAccordion GCHeader = new RichPanelAccordion();
GCHeader.setId("PanelMenuHeader");
GCHeader.setStyleClass("HeaderGCMenu");
GCHeader.setShortDesc("Menu");
GCHeader.setChildCreation("immediate");

Then add nodes or childs to the Header

RichShowDetailItem PBR = new RichShowDetailItem();
PBR.setText("Child Node");
PBR.setIcon("/Images/config_icon.png");
PBR.setStyleClass("ChildGCMenu");
GCHeader.getChildren().add(PBR);

How can i do this with RichTree instead?

RichTree rt = new RichTree();

Im using JDeveloper

TheVicShow
  • 83
  • 6

2 Answers2

1

To programmatically add data to ADF tree widget, you will fist have to prepare your own instance of

org.apache.myfaces.trinidad.model.ChildPropertyTreeModel

Here's the constructor documentation

  /**
   * Creates a TreeModel
   * @param instance The Collection of root nodes of this tree.
   * This can be a List or array of beans (or Maps).
   * This instance is first converted into a CollectionModel (see
   * {@link ModelUtils#toCollectionModel}).
   * @param childProperty This property will be used to get at the child Lists
   * from each bean (or Map). Bean rules will be used to find a getter method
   * that matches this property. If each node is a Map, this property will be
   * passed in to the Map's get method to get the child List. 
   */
  public ChildPropertyTreeModel(Object instance, String childProperty)

Once you have populated your TreeModel, you just have to setValue this on the RichTree instance.

The documentation for ChildPropertyTreeModel has some useful tips on how to construct a tree model using simple POJO's

Ashwin Prabhu
  • 9,285
  • 5
  • 49
  • 82
0

For RichTree UIComponent you can add a column as a child.

  RichTree rt = new RichTree();

  RichColumn column1= new RichColumn();
  column1.setDisplayIndex(0);
  column1.setFilterable(false);      
  column1.setHeaderText("Column Header");
  column1.setSortable(true);

  RichOutputText op1 = new RichOutputText();
  op1.setValue("value123");

  column.getChildren().add(op1); 
  rt.getChildren().add(column1);

There are many more attributes, components that you can add to your column component. Hope this answer can act as a pointer.

https://docs.oracle.com/cd/E68505_01/adf/api-reference-faces/oracle/adf/view/rich/component/rich/data/RichTree.html

https://docs.oracle.com/middleware/12211/adf/api-reference-faces/oracle/adf/view/rich/component/rich/data/RichColumn.html

ragilr
  • 11