Changeset 981
- Timestamp:
- 12/11/10 17:15:09 (13 years ago)
- Location:
- VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main
- Files:
-
- 2 added
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/table/FilterState.java
r964 r981 9 9 @SuppressWarnings("serial") 10 10 final class FilterState implements Serializable { 11 public enum SearchMode { 12 CONTAINS, 13 STARTS_WITH, 14 ENDS_WITH 15 } // enum FilterState.SearchMode 16 private SearchMode nameMode; 11 17 private String name; 18 private SearchMode descriptionMode; 19 private String description; 12 20 private VirtualCollection.Type type; 13 21 private VirtualCollection.State state; 14 private String description; 15 private QueryOptions.Relation createdRelation = QueryOptions.Relation.EQ; 22 private QueryOptions.Relation createdRelation; 16 23 private Date created; 17 24 25 public FilterState() { 26 clear(); 27 } 28 29 public SearchMode getNameMode() { 30 return nameMode; 31 } 32 33 public void setNameMode(SearchMode nameMode) { 34 if (nameMode == null) { 35 throw new IllegalArgumentException("nameMode == null"); 36 } 37 this.nameMode = nameMode; 38 } 39 18 40 public String getName() { 19 41 return name; … … 26 48 public boolean hasName() { 27 49 return name != null; 50 } 51 52 public String getNameWithWildcard() { 53 return addWildcards(name, nameMode); 54 } 55 56 public SearchMode getDescriptionMode() { 57 return descriptionMode; 58 } 59 60 public void setDescriptionMode(SearchMode descriptionMode) { 61 if (descriptionMode == null) { 62 throw new IllegalArgumentException("descriptionMode == null"); 63 } 64 this.descriptionMode = descriptionMode; 65 } 66 67 public String getDescription() { 68 return description; 69 } 70 71 public void setDescription(String description) { 72 this.description = description; 28 73 } 29 74 … … 52 97 } 53 98 54 public String getDescription() {55 return description ;99 public boolean hasDescription() { 100 return description != null; 56 101 } 57 102 58 public void setDescription(String description) { 59 this.description = description; 60 } 61 62 public boolean hasDescription() { 63 return description != null; 103 public String getDescriptionWithWildcard() { 104 return addWildcards(description, descriptionMode); 64 105 } 65 106 … … 69 110 70 111 public void setCreatedRelation(QueryOptions.Relation createdRelation) { 112 if (createdRelation == null) { 113 throw new IllegalArgumentException("createdRelation == null"); 114 } 71 115 this.createdRelation = createdRelation; 72 116 } … … 85 129 86 130 public void clear() { 131 nameMode = SearchMode.CONTAINS; 87 132 name = null; 133 descriptionMode = SearchMode.CONTAINS; 134 description = null; 88 135 type = null; 89 136 state = null; 90 description = null;91 137 createdRelation = QueryOptions.Relation.EQ; 92 138 created = null; 93 139 } 94 140 141 private static String addWildcards(String s, SearchMode mode) { 142 s = s.replaceAll("\\*+", "*"); 143 StringBuilder sb = new StringBuilder(); 144 if ((mode != SearchMode.STARTS_WITH) && !s.startsWith("*")) { 145 sb.append('*'); 146 } 147 sb.append(s); 148 if ((mode != SearchMode.ENDS_WITH) && !s.endsWith("*")) { 149 sb.append('*'); 150 } 151 return sb.toString(); 152 } 153 95 154 } // class FilterState -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/table/Provider.java
r964 r981 87 87 filter.add(QueryOptions.Property.VC_NAME, 88 88 QueryOptions.Relation.EQ, 89 filterstate.getName ());89 filterstate.getNameWithWildcard()); 90 90 } 91 91 if (filterstate.hasType()) { … … 102 102 filter.add(QueryOptions.Property.VC_DESCRIPTION, 103 103 QueryOptions.Relation.EQ, 104 filterstate.getDescription ());104 filterstate.getDescriptionWithWildcard()); 105 105 } 106 106 if (filterstate.hasCreated()) { -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/table/VirtualCollectionTable.html
r976 r981 7 7 <wicket:panel> 8 8 <div wicket:id="border"> 9 <label>Name</label> <select><option>contains</option><option>starts with</option><option>ends with</option></select> <input type="text" /><br /> 10 <label>Description</label> <select><option>contains</option><option>starts with</option><option>ends with</option></select> <input type="text" /><br /> 11 <label>Type</label> <select><option>extensional</option><option>intensional</option></select><br /> 12 <label>Created</label> <select><option>is less-than</option><option>is less-than or equals</option><option>equals</option><option>is greater-than or equals</option><option>is greater-than</option></select> <input type="text" /><br /> 13 <input type="submit" value="filter" /><input type="submit" value="reset" /> 9 <div wicket:id="filterForm"></div> 14 10 </div> 15 11 <table wicket:id="table" class="collectionsTable"></table> 16 <!--17 <div wicket:id="feedback" class="collectionsTableFeedback"></div>18 -->19 12 </wicket:panel> 20 13 </body> -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/table/VirtualCollectionTable.java
r976 r981 22 22 setOutputMarkupId(true); 23 23 24 final AjaxToggleBorder border = new AjaxToggleBorder("border", 25 new Model<String>("Filter")); 26 add(border); 27 28 // setup table 24 // setup table provider 29 25 List<IColumn<VirtualCollection>> columns = 30 26 new ArrayList<IColumn<VirtualCollection>>(); … … 37 33 columns.add(new ColumnActions(this)); 38 34 Provider provider = new Provider(privateMode); 35 36 // setup table 39 37 final DataTable<VirtualCollection> table = 40 38 new AjaxFallbackDefaultDataTable<VirtualCollection>("table", 41 columns, provider, 4);39 columns, provider, 30); 42 40 table.addBottomToolbar(new AjaxNavigationToolbar(table)); 41 42 // setup filter 43 final AjaxToggleBorder border = 44 new AjaxToggleBorder("border", new Model<String>("Filter")); 45 border.add(new FilterForm("filterForm", provider, table, privateMode)); 46 add(border); 43 47 add(table); 44 48 } -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/table/VirtualCollectionTable.properties
r964 r981 11 11 State.DELETED: deleted 12 12 State.DEAD: dead 13 Relation.LT: less-than 14 Relation.LE: less-than or equals 15 Relation.EQ: equals 16 Relation.GE: greater-than or equals 17 Relation.GT: greater-than 18 SearchMode.CONTAINS: contains 19 SearchMode.STARTS_WITH: starts with 20 SearchMode.ENDS_WITH: ends with 13 21 button.filter: Filter 14 22 button.clear: Clear -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/webapp/css/vcr.css
r976 r981 182 182 font-family: Verdana, sans-serif; 183 183 font-size: 100%; 184 border: 1px solid #000000; 184 185 } 185 186 … … 328 329 width: 570px; 329 330 overflow: auto; 331 margin-bottom: 5px; 330 332 } 331 333 … … 779 781 padding: 5px; 780 782 } 783 784 form.filterForm { 785 margin: 0; 786 padding: 0; 787 } 788 789 form.filterForm fieldset { 790 padding: 0; 791 margin: 0; 792 border: none; 793 } 794 795 form.filterForm div.optional { 796 margin-bottom: 4px; 797 } 798 799 form.filterForm label { 800 width: 75px !important; 801 } 802 803 form.filterForm input.name, 804 form.filterForm input.desc { 805 width: 790px; 806 }
Note: See TracChangeset
for help on using the changeset viewer.