1 19 20 package org.netbeans.modules.tasklist.core; 21 22 import org.openide.nodes.PropertySupport; 23 24 import java.beans.PropertyEditor ; 25 import org.netbeans.modules.tasklist.core.filter.SuggestionProperty; 26 27 33 public class ColumnProperty extends PropertySupport.ReadOnly { 34 39 public int uid; public int width; 42 43 private Class propertyEditorClass; 44 45 public ColumnProperty( 46 int uid, 47 SuggestionProperty prop, 48 boolean sortable, 49 boolean defaultVisiblity, 50 int width 51 ) { 52 this(uid, prop.getID(), prop.getValueClass(), prop.getName(), prop.getHint(), sortable, defaultVisiblity, width); 53 } 54 55 public ColumnProperty( 56 int uid, 57 SuggestionProperty prop, 58 boolean sortable, 59 int width 60 ) { 61 this(uid, prop.getID(),prop.getName(), prop.getHint(), sortable, width); 62 } 63 64 65 66 78 public ColumnProperty( 79 int uid, 80 String name, 81 Class type, 82 String displayName, 83 String hint, 84 boolean sortable, 85 boolean defaultVisibility, 86 int width 87 ) { 88 super(name, type, displayName, hint); 89 this.uid = uid; 90 this.width = width; 91 setValue("suppressCustomEditor", Boolean.TRUE); setValue ("ColumnDescriptionTTV", hint); if (sortable) { 95 setValue("ComparableColumnTTV", Boolean.TRUE); } 97 if (!defaultVisibility) { 98 setValue("InvisibleInTreeTableView", Boolean.TRUE); } 100 } 101 102 112 public ColumnProperty ( 113 int uid, 114 String name, 115 String displayName, 116 String hint, 117 boolean sortable, 118 int width 119 ) { 120 super(name, String .class, displayName, hint); 121 this.uid = uid; 122 this.width = width; 123 setValue( "TreeColumnTTV", Boolean.TRUE ); setValue("suppressCustomEditor", Boolean.TRUE); setValue("canEditAsText", Boolean.FALSE); if (sortable) { 127 setValue ("ComparableColumnTTV", Boolean.TRUE); } 129 } 130 131 public Object getValue() { 132 return null; 133 } 134 135 public int getWidth() { 136 return width; 137 } 138 139 public final void setPropertyEditorClass(Class peClass) { 140 propertyEditorClass = peClass; 141 } 142 143 public final PropertyEditor getPropertyEditor() { 144 if (propertyEditorClass != null) 145 try { 146 return (PropertyEditor ) propertyEditorClass.newInstance (); 147 } catch (InstantiationException ex) { 148 } catch (IllegalAccessException iex) { 149 } 150 return super.getPropertyEditor (); 151 } 152 } 153 | Popular Tags |