01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.forms.formmodel;
18:
19: import org.apache.cocoon.forms.event.ActionEvent;
20: import org.apache.cocoon.forms.event.ActionListener;
21: import org.apache.cocoon.forms.event.WidgetEventMulticaster;
22:
23: /**
24: * The {@link WidgetDefinition} part of an ImageMap widget, see {@link ImageMap}
25: * for more information.
26: *
27: * @version $Id: ImageMapDefinition.java 462520 2006-10-10 19:39:14Z vgritsenko $
28: * @since 2.1.8
29: */
30: public class ImageMapDefinition extends AbstractWidgetDefinition {
31:
32: private String actionCommand;
33: private String imgURI; // URI of widget's image
34: private ActionListener listener;
35:
36: public void setActionCommand(String actionCommand) {
37: this .actionCommand = actionCommand;
38: }
39:
40: public String getActionCommand() {
41: return actionCommand;
42: }
43:
44: public Widget createInstance() {
45: return new ImageMap(this );
46: }
47:
48: public void addActionListener(ActionListener listener) {
49: checkMutable();
50: this .listener = WidgetEventMulticaster.add(this .listener,
51: listener);
52: }
53:
54: public void fireActionEvent(ActionEvent event) {
55: if (this .listener != null) {
56: this .listener.actionPerformed(event);
57: }
58: }
59:
60: public boolean hasActionListeners() {
61: return this .listener != null;
62: }
63:
64: // Set/get image's URI
65: public String getImageURI() {
66: return imgURI;
67: }
68:
69: public void setImageURI(String newImgURI) {
70: this.imgURI = newImgURI;
71: }
72: }
|