[richfaces-issues] [JBoss JIRA] (RF-12887) Nodes with types that are not listed in <rich:treeNode> are not rendered
Brian Leathem (JIRA)
jira-events at lists.jboss.org
Thu Apr 11 14:02:55 EDT 2013
[ https://issues.jboss.org/browse/RF-12887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765473#comment-12765473 ]
Brian Leathem edited comment on RF-12887 at 4/11/13 2:02 PM:
-------------------------------------------------------------
Backing bean:
{code}
public class BaseTreeBean implements Serializable {
protected TreeNode rootNode;
public BaseTreeBean() {
DemoTreeNodeData rootNodeData = new DemoTreeNodeData( "rootNode" );
this.rootNode = new DataHolderTreeNodeImpl( null, "root", false, rootNodeData );
TreeNode node1 = new DataHolderTreeNodeImpl( this.rootNode, "1", false, new DemoTreeNodeData();
TreeNode node11 = new DataHolderTreeNodeImpl( node1, "1_1", false, new DemoTreeNodeData() );
TreeNode node12 = new DataHolderTreeNodeImpl( node1, "1_2", false, new DemoTreeNodeData() );
TreeNode node13 = new DataHolderTreeNodeImpl( node1, "1_3", false, new DemoTreeNodeData() );
new DataHolderTreeNodeImpl( node11, "11_1", true, new DemoTreeNodeData() );
new DataHolderTreeNodeImpl( node11, "11_2", true, new DemoTreeNodeData() );
new DataHolderTreeNodeImpl( node12, "22_1", true, new DemoTreeNodeData() );
new DataHolderTreeNodeImpl( node12, "22_2", true, new DemoTreeNodeData() );
new DataHolderTreeNodeImpl( node13, "33_1", true, new DemoTreeNodeData() );
}
public TreeNode getRootNode() {
return this.rootNode;
}
}
{code}
Data holder classes
{code}
public class DemoDataHolder extends DataHolderTreeNodeImpl {
public DemoDataHolder() {
super();
}
public DemoDataHolder( final boolean leaf, final AbstractTreeNodeData data ) {
this( null, null, leaf, data );
}
public DemoDataHolder( final TreeNode parent, final Object key ) {
this( parent, key, true, null );
}
public DemoDataHolder( final TreeNode parent, final Object key, final boolean leaf, final AbstractTreeNodeData data ) {
super( parent, key, leaf, data );
if ( getData() != null ) {
if ( ( getData().getLabel() == null ) && ( getData().getName() == null ) ) {
getData().setName( ( key.toString() ) );
}
if ( key != null ) {
getData().setExpanded( key.toString().startsWith( "1" ) );
getData().setType( key.toString() );
}
}
}
@Override
public String toString() {
return getData().getLabel();
}
}
{code}
{code}
public class DataHolderTreeNodeImpl extends TreeNodeImpl {
private AbstractTreeNodeData data;
private TreeNode parent;
public DataHolderTreeNodeImpl() {
super();
}
public DataHolderTreeNodeImpl( final boolean leaf, final AbstractTreeNodeData data ) {
this( null, null, leaf, data );
}
public DataHolderTreeNodeImpl( final TreeNode parent, final Object key, final boolean leaf ) {
this( parent, key, leaf, null );
}
public DataHolderTreeNodeImpl( final TreeNode parent, final Object key ) {
this( parent, key, true, null );
}
public DataHolderTreeNodeImpl( final TreeNode parent, final Object key, final boolean leaf,
final AbstractTreeNodeData data ) {
super( leaf );
this.parent = parent;
if ( this.parent != null ) {
parent.addChild( key, this );
}
this.data = data;
if ( getData() != null ) {
if ( ( getData().getLabel() == null ) && ( getData().getName() == null ) ) {
getData().setName( ( key.toString() ) );
}
if ( key != null ) {
getData().setExpanded( key.toString().startsWith( "1" ) );
getData().setType( key.toString() );
}
}
}
public AbstractTreeNodeData getData() {
return this.data;
}
public void setData( final AbstractTreeNodeData data ) {
this.data = data;
}
public TreeNode getParent() {
return this.parent;
}
public void setParent( final TreeNode parent ) {
this.parent = parent;
}
}
{code}
Tree node data classes
{code}
public class DemoTreeNodeData extends AbstractTreeNodeData {
private static final long serialVersionUID = 1725923477252098882L;
private static final PresentationLogger log = LoggerFactory.createLogger( DemoTreeNodeData.class );
private static final String ICON = "/images/tree/folder.png";
private static final String ICON_LEAF = "/images/tree/pdf-document.png";
private boolean visible = true;
public DemoTreeNodeData() {
this( null, true, null );
}
public DemoTreeNodeData( final String label ) {
this( label, true, null );
}
public DemoTreeNodeData( final String label, final boolean draggable, final Menu menu ) {
super( label, null );
setIcon( ICON );
setIconLeaf( ICON_LEAF );
}
public DemoTreeNodeData( final String label, final Menu menu ) {
this( label, true, menu );
}
public boolean isVisible() {
return this.visible;
}
public void setVisible( final boolean visible ) {
this.visible = visible;
}
@Override
public String toString() {
return getLabel();
}
}
{code}
{code}
public abstract class AbstractTreeNodeData implements Serializable {
private static final long serialVersionUID = 4265239470205397789L;
private String label;
private String name;
private String icon;
private String iconLeaf;
private boolean expanded;
private String type;
public AbstractTreeNodeData() {
super();
}
public AbstractTreeNodeData( final String label, final String icon ) {
this();
this.label = label;
this.icon = icon;
}
public String getType() {
return this.type;
}
public void setType( final String type ) {
this.type = type;
}
public String getLabel() {
if ( null == this.label ) {
return getName();
}
return this.label;
}
public void setLabel( final String label ) {
this.label = label;
}
public String getName() {
return this.name;
}
public void setName( final String name ) {
this.name = name;
}
public String getIcon() {
return this.icon;
}
public void setIcon( final String icon ) {
this.icon = icon;
}
public String getIconLeaf() {
if ( null == this.iconLeaf ) {
return getIcon();
} else {
return this.iconLeaf;
}
}
public void setIconLeaf( final String iconLeaf ) {
this.iconLeaf = iconLeaf;
}
public boolean isExpanded() {
return this.expanded;
}
public void setExpanded( final boolean expanded ) {
this.expanded = expanded;
}
}
{code}
was (Author: skawajar):
Backing bean:
public class BaseTreeBean implements Serializable {
protected TreeNode rootNode;
public BaseTreeBean() {
DemoTreeNodeData rootNodeData = new DemoTreeNodeData( "rootNode" );
this.rootNode = new DataHolderTreeNodeImpl( null, "root", false, rootNodeData );
TreeNode node1 = new DataHolderTreeNodeImpl( this.rootNode, "1", false, new DemoTreeNodeData();
TreeNode node11 = new DataHolderTreeNodeImpl( node1, "1_1", false, new DemoTreeNodeData() );
TreeNode node12 = new DataHolderTreeNodeImpl( node1, "1_2", false, new DemoTreeNodeData() );
TreeNode node13 = new DataHolderTreeNodeImpl( node1, "1_3", false, new DemoTreeNodeData() );
new DataHolderTreeNodeImpl( node11, "11_1", true, new DemoTreeNodeData() );
new DataHolderTreeNodeImpl( node11, "11_2", true, new DemoTreeNodeData() );
new DataHolderTreeNodeImpl( node12, "22_1", true, new DemoTreeNodeData() );
new DataHolderTreeNodeImpl( node12, "22_2", true, new DemoTreeNodeData() );
new DataHolderTreeNodeImpl( node13, "33_1", true, new DemoTreeNodeData() );
}
public TreeNode getRootNode() {
return this.rootNode;
}
}
Data holder classes
public class DemoDataHolder extends DataHolderTreeNodeImpl {
public DemoDataHolder() {
super();
}
public DemoDataHolder( final boolean leaf, final AbstractTreeNodeData data ) {
this( null, null, leaf, data );
}
public DemoDataHolder( final TreeNode parent, final Object key ) {
this( parent, key, true, null );
}
public DemoDataHolder( final TreeNode parent, final Object key, final boolean leaf, final AbstractTreeNodeData data ) {
super( parent, key, leaf, data );
if ( getData() != null ) {
if ( ( getData().getLabel() == null ) && ( getData().getName() == null ) ) {
getData().setName( ( key.toString() ) );
}
if ( key != null ) {
getData().setExpanded( key.toString().startsWith( "1" ) );
getData().setType( key.toString() );
}
}
}
@Override
public String toString() {
return getData().getLabel();
}
}
public class DataHolderTreeNodeImpl extends TreeNodeImpl {
private AbstractTreeNodeData data;
private TreeNode parent;
public DataHolderTreeNodeImpl() {
super();
}
public DataHolderTreeNodeImpl( final boolean leaf, final AbstractTreeNodeData data ) {
this( null, null, leaf, data );
}
public DataHolderTreeNodeImpl( final TreeNode parent, final Object key, final boolean leaf ) {
this( parent, key, leaf, null );
}
public DataHolderTreeNodeImpl( final TreeNode parent, final Object key ) {
this( parent, key, true, null );
}
public DataHolderTreeNodeImpl( final TreeNode parent, final Object key, final boolean leaf,
final AbstractTreeNodeData data ) {
super( leaf );
this.parent = parent;
if ( this.parent != null ) {
parent.addChild( key, this );
}
this.data = data;
if ( getData() != null ) {
if ( ( getData().getLabel() == null ) && ( getData().getName() == null ) ) {
getData().setName( ( key.toString() ) );
}
if ( key != null ) {
getData().setExpanded( key.toString().startsWith( "1" ) );
getData().setType( key.toString() );
}
}
}
public AbstractTreeNodeData getData() {
return this.data;
}
public void setData( final AbstractTreeNodeData data ) {
this.data = data;
}
public TreeNode getParent() {
return this.parent;
}
public void setParent( final TreeNode parent ) {
this.parent = parent;
}
}
Tree node data classes
public class DemoTreeNodeData extends AbstractTreeNodeData {
private static final long serialVersionUID = 1725923477252098882L;
private static final PresentationLogger log = LoggerFactory.createLogger( DemoTreeNodeData.class );
private static final String ICON = "/images/tree/folder.png";
private static final String ICON_LEAF = "/images/tree/pdf-document.png";
private boolean visible = true;
public DemoTreeNodeData() {
this( null, true, null );
}
public DemoTreeNodeData( final String label ) {
this( label, true, null );
}
public DemoTreeNodeData( final String label, final boolean draggable, final Menu menu ) {
super( label, null );
setIcon( ICON );
setIconLeaf( ICON_LEAF );
}
public DemoTreeNodeData( final String label, final Menu menu ) {
this( label, true, menu );
}
public boolean isVisible() {
return this.visible;
}
public void setVisible( final boolean visible ) {
this.visible = visible;
}
@Override
public String toString() {
return getLabel();
}
}
public abstract class AbstractTreeNodeData implements Serializable {
private static final long serialVersionUID = 4265239470205397789L;
private String label;
private String name;
private String icon;
private String iconLeaf;
private boolean expanded;
private String type;
public AbstractTreeNodeData() {
super();
}
public AbstractTreeNodeData( final String label, final String icon ) {
this();
this.label = label;
this.icon = icon;
}
public String getType() {
return this.type;
}
public void setType( final String type ) {
this.type = type;
}
public String getLabel() {
if ( null == this.label ) {
return getName();
}
return this.label;
}
public void setLabel( final String label ) {
this.label = label;
}
public String getName() {
return this.name;
}
public void setName( final String name ) {
this.name = name;
}
public String getIcon() {
return this.icon;
}
public void setIcon( final String icon ) {
this.icon = icon;
}
public String getIconLeaf() {
if ( null == this.iconLeaf ) {
return getIcon();
} else {
return this.iconLeaf;
}
}
public void setIconLeaf( final String iconLeaf ) {
this.iconLeaf = iconLeaf;
}
public boolean isExpanded() {
return this.expanded;
}
public void setExpanded( final boolean expanded ) {
this.expanded = expanded;
}
}
> Nodes with types that are not listed in <rich:treeNode> are not rendered
> ------------------------------------------------------------------------
>
> Key: RF-12887
> URL: https://issues.jboss.org/browse/RF-12887
> Project: RichFaces
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: component-tree
> Affects Versions: 4.3.0.Final
> Environment: RichFaces 4.3.0.Final and JSF 2.2
> JBoss AS 7.1.1.Final
> Reporter: Sergey Suvorov
> Priority: Minor
> Labels: waiting_on_user
>
> When using attribute "type" of <rich:treeNode> nodes with different types are not rendered. In the following tree only nodes with types "1", "2" and "1_1" will be rendered
> {code}
> <rich:tree id="tree" nodeType="#{item.data.type}" var="item" value="#{backingBean.rootNode}" toggleType="client" selectionType="ajax">
> <rich:treeNode type="1">
> #{item.data.label}
> </rich:treeNode>
> <rich:treeNode type="2">
> #{item.data.label}
> </rich:treeNode>
> <rich:treeNode type="1_1">
> #{item.data.label}
> </rich:treeNode>
> </rich:tree>
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the richfaces-issues
mailing list