RichFaces
  1. RichFaces
  2. RF-12325

Literal value does not work for expanded attribute of rich:treeNode

    Details

    • Type: Bug Bug
    • Status: Open Open (View Workflow)
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.2.2.Final
    • Fix Version/s: 5-Tracking
    • Component/s: component-tree
    • Security Level: Public (Everyone can see)
    • Labels:
      None
    • Workaround Description:
      Hide

      public class UITreeNodeWorkaround extends UITreeNode {
      enum PropertyKeys

      { iterationState }

      @Override
      public Object getIterationState()

      { return getStateHelper().get(PropertyKeys.iterationState); }

      @Override
      public void setIterationState(Object state)

      { getStateHelper().put(PropertyKeys.iterationState, state); }

      }

      and in faces-config:

      <component>
      <component-type>org.richfaces.TreeNode</component-type>
      <component-class>com.example.UITreeNodeWorkaround</component-class>
      </component>

      Show
      public class UITreeNodeWorkaround extends UITreeNode { enum PropertyKeys { iterationState } @Override public Object getIterationState() { return getStateHelper().get(PropertyKeys.iterationState); } @Override public void setIterationState(Object state) { getStateHelper().put(PropertyKeys.iterationState, state); } } and in faces-config: <component> <component-type>org.richfaces.TreeNode</component-type> <component-class>com.example.UITreeNodeWorkaround</component-class> </component>
    • Similar Issues:
      Show 10 results 

      Description

      <rich:treeNode expanded="true">
      has no effect.

      Problem appears to be with AbstractTreeNode class, it saves iterationState by expanded key, overriding expanded property value.

        Activity

        Jan Papousek
        made changes -
        Assignee Jan Papousek [ jpapouse ]
        Hide
        Jan Papousek
        added a comment - - edited

        Andrey, thank you for reporting the issue! Do you think you can send a pull request to RichFaces Components (https://github.com/richfaces/components) ?

        I've reproduced the issue here (https://github.com/papousek/richfaces-sanbox/tree/RF-12325). The workaround works pretty well.

        Show
        Jan Papousek
        added a comment - - edited Andrey, thank you for reporting the issue! Do you think you can send a pull request to RichFaces Components ( https://github.com/richfaces/components ) ? I've reproduced the issue here ( https://github.com/papousek/richfaces-sanbox/tree/RF-12325 ). The workaround works pretty well.
        Hide
        Andrey Zhemoytuk
        added a comment -

        Hm, I could, but now I think that my workaround is wrong (indeed it works, but problem was not with overriding expanded property by iterationState). According to semantics of iterationState it is OK to get (save) and set (restore) properties of component. Problem is that state is saved for one set of components, but restored for other set.

        org.richfaces.component.UIDataAdaptor#setRowKey, for rich:tree case the following is happening:
        1. saveChildState. As current row is null - dataChildren() method returns children of default tree node facet (see org.richfaces.component.AbstractTree#DEFAULT_TREE_NODE_FACET_NAME). State is saved for that components.
        2. this.rowKey = rowKey; ....
        3. restoreChildState. Now current row is not null - dataChildren() method returns children of tree node of current row. And state of default facet children now is applied to these components.

        Show
        Andrey Zhemoytuk
        added a comment - Hm, I could, but now I think that my workaround is wrong (indeed it works, but problem was not with overriding expanded property by iterationState). According to semantics of iterationState it is OK to get (save) and set (restore) properties of component. Problem is that state is saved for one set of components, but restored for other set. org.richfaces.component.UIDataAdaptor#setRowKey, for rich:tree case the following is happening: 1. saveChildState. As current row is null - dataChildren() method returns children of default tree node facet (see org.richfaces.component.AbstractTree#DEFAULT_TREE_NODE_FACET_NAME). State is saved for that components. 2. this.rowKey = rowKey; .... 3. restoreChildState. Now current row is not null - dataChildren() method returns children of tree node of current row. And state of default facet children now is applied to these components.
        Jan Papousek
        made changes -
        Assignee Jan Papousek [ jpapouse ] Brian Leathem [ bleathem ]
        Brian Leathem
        made changes -
        Fix Version/s 5-Tracking [ 12319295 ]
        Fix Version/s 4.3-Tracking [ 12317861 ]
        Lukáš Fryč
        made changes -
        Fix Version/s 5-Tracking [ 12319295 ]
        Lukáš Fryč
        made changes -
        Fix Version/s 5-Tracking [ 12320562 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Andrey Zhemoytuk
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: