01: /*
02: ItsNat Java Web Application Framework
03: Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
04: Author: Jose Maria Arranz Santamaria
05:
06: This program is free software: you can redistribute it and/or modify
07: it under the terms of the GNU Affero General Public License as published by
08: the Free Software Foundation, either version 3 of the License, or
09: (at your option) any later version. See the GNU Affero General Public
10: License for more details. See the copy of the GNU Affero General Public License
11: included in this program. If not, see <http://www.gnu.org/licenses/>.
12: */
13:
14: package org.itsnat.core.event;
15:
16: /**
17: * This listener is called when a new JavaScript code is being added to an
18: * {@link org.itsnat.core.ItsNatDocument} or {@link org.itsnat.core.ClientDocument}.
19: *
20: * @see org.itsnat.core.ItsNatDocument#addCodeToSend(Object)
21: * @see org.itsnat.core.ClientDocument#addCodeToSend(Object)
22: * @see org.itsnat.core.ItsNatDocument#addCodeToSendListener(CodeToSendListener)
23: * @see org.itsnat.core.ClientDocument#addCodeToSendListener(CodeToSendListener)
24: * @author Jose Maria Arranz Santamaria
25: */
26: public interface CodeToSendListener {
27: /**
28: * Is called <i>before</i> the new code is definitely added to the document
29: * or client, the event object contains the new code.
30: *
31: * <p>If null is returned the new code is rejected, otherwise the returned value is used as the new code.
32: * In this scenario the listener may be used as a filter.</p>
33: *
34: * @param event the event containing the new code to send.
35: * @return the new code or null if code must be rejected.
36: */
37: public Object preSendCode(CodeToSendEvent event);
38:
39: /**
40: * Is called <i>after</i> the new code is definitely added to the document
41: * or client, the event object contains the new code.
42: *
43: * @param event the event containing the new code added to send.
44: */
45: public void postSendCode(CodeToSendEvent event);
46: }
|