01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.ui.operations;
16:
17: /**
18: * Determines whether a property value is true or false given an object.
19: * <p>
20: * This class is must be implemented by objectProperty extensions to teach the system new properties for
21: * objects.
22: * </p>
23: *
24: *
25: * @author jones
26: * @since 1.1.0
27: */
28: public interface PropertyValue<T> {
29:
30: /**
31: * Returns true if the value provided is a legal value for the object. The subclass determines what
32: * are legal values.
33: *
34: * @param object the object that will be used to determine if the value is legal
35: * @param value an arbitrary string.
36: * @return Returns true if the value provided is a legal value for the object.
37: */
38: boolean isTrue(T object, String value);
39:
40: /**
41: * Returns true if the results can be cached. A result can be cached if
42: * <ol>
43: * <li>The value will never change</li>
44: * <li>It is possible for the filter to listen for changes and update listeners
45: * added via the {@link #addListener(IOpFilterListener)} method</li>
46: * </ol>
47: *
48: * Therefore this method only returns false if it must be calculated each time because there is
49: * no way to listen for state changes. If it is non-blocking that is fine, if it is blocking
50: * then try to do this rarely.
51: *
52: * @return true if the results can be cached.
53: */
54: boolean canCacheResult();
55:
56: /**
57: * Returns true if processing this filter may block when {@link #accept(Object)} is called.
58: *
59: * @return true if processing this filter may block when {@link #accept(Object)} is called.
60: */
61: boolean isBlocking();
62:
63: /**
64: * Adds a listener to listen for events indicating the value has changed.
65: *
66: * @param listener listener to add
67: */
68: void addListener(IOpFilterListener listener);
69:
70: /**
71: * Removes a listeners
72: *
73: * @param listener listener to remove
74: */
75: void removeListener(IOpFilterListener listener);
76: }
|