1 package org.jahia.engines.filemanager; 2 3 import org.apache.slide.webdav.util.URLUtil; 4 5 import java.io.Serializable ; 6 7 11 public class TableEntry implements Serializable { 12 private String name; 13 private String encodedName; 14 private String displayName; 15 private boolean hasChildren = false; 16 private boolean isExpanded; 17 private int indent; 18 private boolean isLastSister; 19 private String type; 20 private boolean canWrite; 21 private boolean canAdmin; 22 private boolean canWriteParent; 23 private boolean canAdminParent; 24 private boolean hasRevisions; 25 private boolean isLocked; 26 27 public TableEntry (String name, String displayName, boolean expanded, int indent, 28 String type, boolean canWrite, boolean canAdmin, boolean canWriteParent, 29 boolean canAdminParent, boolean hasRevisions, boolean isLocked) { 30 this.name = name; 31 this.displayName = displayName; 32 isExpanded = expanded; 33 this.indent = indent; 34 this.type = type; 35 this.canWrite = canWrite; 36 this.canAdmin = canAdmin; 37 this.canWriteParent = canWriteParent; 38 this.canAdminParent = canAdminParent; 39 this.hasRevisions = hasRevisions; 40 this.isLocked = isLocked; 41 } 42 43 public String getName () { 44 return name; 45 } 46 47 public String getDisplayName () { 48 return displayName; 49 } 50 51 public String getEncodedName() { 52 if (encodedName == null) { 53 encodedName = javascriptEncode(name); 54 } 55 return encodedName; 56 } 57 58 public static String javascriptEncode(String name) { 59 if (name == null) return null; 60 name = URLUtil.URLEncode(name, "UTF-8"); 61 name = name.replace('%','|'); 62 return name; 63 } 64 65 public static String javascriptDecode(String name) { 66 if (name == null) return null; 67 name = name.replace('|','%'); 68 name = URLUtil.URLDecode(name, "UTF-8"); 69 return name; 70 } 71 72 public boolean hasChildren () { 73 return hasChildren; 74 } 75 76 public void setHasChildren (boolean hasChildren) { 77 this.hasChildren = hasChildren; 78 } 79 80 public boolean isExpanded () { 81 return isExpanded; 82 } 83 84 public int getIndent () { 85 return indent; 86 } 87 88 public String getType () { 89 return type; 90 } 91 92 public boolean isLastSister () { 93 return isLastSister; 94 } 95 96 public void setLastSister (boolean lastSister) { 97 isLastSister = lastSister; 98 } 99 100 108 public boolean isCanWrite () { 109 return canWrite; 110 } 111 112 public boolean isCanAdmin () { 113 return canAdmin; 114 } 115 116 public boolean isCanWriteParent () { 117 return canWriteParent; 118 } 119 120 public boolean isCanAdminParent () { 121 return canAdminParent; 122 } 123 124 public boolean hasRevisions () { 125 return hasRevisions; 126 } 127 128 public boolean isLocked () { 129 return isLocked; 130 } 131 } 132 | Popular Tags |