[ 
https://jira.jboss.org/jira/browse/RF-7616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nick Belaevski updated RF-7616:
-------------------------------

       Issue Type: Feature Request  (was: Bug)
    Fix Version/s: Future
         Assignee: Nick Belaevski


> UITree does not accept datamodel as value
> -----------------------------------------
>
>                 Key: RF-7616
>                 URL: https://jira.jboss.org/jira/browse/RF-7616
>             Project: RichFaces
>          Issue Type: Feature Request
>          Components: component-tree
>    Affects Versions: 3.3.1
>            Reporter: John Leed
>            Assignee: Nick Belaevski
>             Fix For: Future
>
>
> UIData accepts both data or a datamodel as its value, in the former case 
> wrapping the data in a datamodel. As a subclass of UIData, UITree should 
> behave the same way. Instead, if the value is set to a TreeDataModel, UITree 
> tries wrapping it in a swingTreeDataModel. This presents a problem if a 
> custom data model is desired.
> Proposed fix:
> protected ExtendedDataModel createDataModel() {
>       Object value = this.getValue();
>       if (value != null) {
>               if (value instanceof TreeDataModel {
>                       return value;
>               }
>               else if (value instanceof TreeNode) {
>                       TreeDataModel<TreeNode> treeDataModel = new 
> ClassicTreeDataModel();
>                       treeDataModel.setWrappedData(value);
>                               
>                       if (this.allowCachedModel && 
> PRESERVE_MODEL_REQUEST.equals(getPreserveModel())) {
>                               treeDataModel = new 
> ClassicCacheableTreeDataModel(treeDataModel);
>                       }
>                       return treeDataModel;
>               } else {
>                       TreeDataModel<javax.swing.tree.TreeNode> 
> swingTreeDataModel = new SwingTreeDataModel();
>                       swingTreeDataModel.setWrappedData(value);
>                       
>                       if (this.allowCachedModel && 
> PRESERVE_MODEL_REQUEST.equals(getPreserveModel())) {
>                               swingTreeDataModel = new 
> SwingCacheableTreeDataModel(swingTreeDataModel);
>                       }
>                       return swingTreeDataModel;
>               }
>       } else {
>               //TODO implement request caching
>               StackingTreeModel stackingTreeModel = new 
> VisualStackingTreeModel(null);
>               if (getChildCount() > 0) {
>                       Iterator children = getChildren().iterator();
>                       while (children.hasNext()) {
>                               UIComponent component = (UIComponent) 
> children.next();
>                               if (component instanceof 
> StackingTreeModelProvider) {
>                                       StackingTreeModelProvider provider = 
> (StackingTreeModelProvider) component;
>                               
> stackingTreeModel.addStackingModel(provider.getStackingModel());
>                               }
>                       }
>               }
>               
>               return stackingTreeModel;
>       }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to