1 17 package org.alfresco.web.ui.repo.component; 18 19 import javax.faces.component.UICommand; 20 import javax.faces.component.UIComponent; 21 import javax.faces.context.FacesContext; 22 import javax.faces.el.ValueBinding; 23 import javax.faces.event.ActionEvent; 24 25 import org.alfresco.service.cmr.repository.NodeRef; 26 27 30 public class UINodeDescendants extends UICommand 31 { 32 35 38 public UINodeDescendants() 39 { 40 setRendererType("org.alfresco.faces.NodeDescendantsLinkRenderer"); 41 } 42 43 44 47 50 public String getFamily() 51 { 52 return "org.alfresco.faces.NodeDescendants"; 53 } 54 55 58 public void restoreState(FacesContext context, Object state) 59 { 60 Object values[] = (Object [])state; 61 super.restoreState(context, values[0]); 63 this.maxChildren = (Integer )values[1]; 64 this.showEllipses = (Boolean )values[2]; 65 } 66 67 70 public Object saveState(FacesContext context) 71 { 72 Object values[] = new Object [3]; 73 values[0] = super.saveState(context); 75 values[1] = this.maxChildren; 76 values[2] = this.showEllipses; 77 return (values); 78 } 79 80 81 84 87 public int getMaxChildren() 88 { 89 ValueBinding vb = getValueBinding("maxChildren"); 90 if (vb != null) 91 { 92 this.maxChildren = (Integer )vb.getValue(getFacesContext()); 93 } 94 95 if (this.maxChildren != null) 96 { 97 return this.maxChildren.intValue(); 98 } 99 else 100 { 101 return 3; 103 } 104 } 105 106 109 public void setMaxChildren(int value) 110 { 111 if (value > 0 && value <= 256) 112 { 113 this.maxChildren = Integer.valueOf(value); 114 } 115 } 116 117 120 public boolean getShowEllipses() 121 { 122 ValueBinding vb = getValueBinding("showEllipses"); 123 if (vb != null) 124 { 125 this.showEllipses = (Boolean )vb.getValue(getFacesContext()); 126 } 127 128 if (this.showEllipses != null) 129 { 130 return this.showEllipses.booleanValue(); 131 } 132 else 133 { 134 return true; 136 } 137 } 138 139 142 public void setShowEllipses(boolean showEllipses) 143 { 144 this.showEllipses = Boolean.valueOf(showEllipses); 145 } 146 147 148 151 154 public static class NodeSelectedEvent extends ActionEvent 155 { 156 public NodeSelectedEvent(UIComponent component, NodeRef nodeRef, boolean isParent) 157 { 158 super(component); 159 this.NodeReference = nodeRef; 160 this.IsParent = isParent; 161 } 162 163 public NodeRef NodeReference; 164 public boolean IsParent; 165 } 166 167 168 171 172 private Integer maxChildren = null; 173 174 175 private Boolean showEllipses = null; 176 } 177 | Popular Tags |