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.tools.edit.behaviour;
16:
17: import net.refractions.udig.project.ui.render.displayAdapter.MapMouseEvent;
18: import net.refractions.udig.tools.edit.EditToolHandler;
19: import net.refractions.udig.tools.edit.EventType;
20:
21: /**
22: * A very general validator strategy that essentially returns true if the current state is
23: * considered to be legal by the instance of the validator.
24: *
25: * @author Jesse
26: * @since 1.1.0
27: */
28: public interface IEditValidator {
29: IEditValidator TRUE = new IEditValidator() {
30:
31: public String isValid(EditToolHandler handler,
32: MapMouseEvent event, EventType type) {
33: return null;
34: }
35:
36: };
37:
38: /**
39: * Returns null if the validator considers the state to be "legal" for the new event or
40: * a string which is the human readable message describing the problem.
41: *
42: * @param handler the handler to use for obtaining the state
43: * @param event the event that just occurred.
44: * @param type they type of event
45: * @return null if the validator considers the state to be "legal" for the new event or
46: * a string which is the human readable message describing the problem.
47:
48: */
49: String isValid(EditToolHandler handler, MapMouseEvent event,
50: EventType type);
51: }
|