KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tasklist > core > filter > SuggestionProperties


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.tasklist.core.filter;
21
22 import org.netbeans.modules.tasklist.client.Suggestion;
23 import org.netbeans.modules.tasklist.core.filter.SuggestionProperty;
24
25
26 /**
27  * An abstract factory for creating SuggestionProperties from their id.
28  */

29 public class SuggestionProperties {
30   public static final String JavaDoc PROPID_PRIORITY = "priority";
31   public static final String JavaDoc PROPID_SUMMARY = "summary";
32   public static final String JavaDoc PROPID_DETAILS = "details";
33
34   /**
35    * A factory method for properties on Suggestion.
36    * @param propID one of the PROP_* constant defined in this class
37    * @return a property for accessing the property
38    */

39   public static SuggestionProperty getProperty(String JavaDoc propID) {
40     if (propID.equals(PROPID_PRIORITY)) { return PROP_PRIORITY;}
41     else if (propID.equals(PROPID_SUMMARY)) { return PROP_SUMMARY;}
42     else if (propID.equals(PROPID_DETAILS)) { return PROP_DETAILS;}
43     else throw new IllegalArgumentException JavaDoc("Unresolved property id " + propID);
44   }
45
46
47   public static SuggestionProperty PROP_SUMMARY =
48     new SuggestionProperty(PROPID_SUMMARY, String JavaDoc.class) {
49       public Object JavaDoc getValue(Object JavaDoc obj) {return ((Suggestion) obj).getSummary(); }
50     };
51
52   public static SuggestionProperty PROP_PRIORITY =
53     new SuggestionProperty(PROPID_PRIORITY, String JavaDoc.class) {
54       public Object JavaDoc getValue(Object JavaDoc obj) {return ((Suggestion) obj).getPriority(); }
55     };
56
57   public static SuggestionProperty PROP_DETAILS =
58     new SuggestionProperty(PROPID_DETAILS, String JavaDoc.class) {
59       public Object JavaDoc getValue(Object JavaDoc obj) {return ((Suggestion) obj).getDetails(); }
60     };
61
62
63 }
64     
65
Popular Tags