01: /*
02: * @author <a href="mailto:novotny@gridsphere.org">Jason Novotny</a>
03: * @version $Id: PortletFrameEventImpl.java 6385 2007-10-25 14:02:26Z wehrens $
04: */
05: package org.gridsphere.layout.event.impl;
06:
07: import org.gridsphere.layout.PortletComponent;
08: import org.gridsphere.layout.PortletFrame;
09: import org.gridsphere.layout.event.ComponentAction;
10: import org.gridsphere.layout.event.PortletFrameEvent;
11:
12: /**
13: * A <code>PortletFrameEventImpl</code> is the concrete implementation of
14: * <code>PortletFrameEvent</code>
15: */
16: public class PortletFrameEventImpl implements PortletFrameEvent {
17:
18: private ComponentAction action;
19: private int id;
20: private String width = "";
21: private PortletFrame frame = null;
22:
23: /**
24: * Constructs an instance of PortletFrameEventImpl from an action
25: * and the component id of teh PortletFrame
26: *
27: * @param frame the portlet frame
28: * @param action a window action
29: * @param id the component id of the PortletFrame
30: */
31: public PortletFrameEventImpl(PortletFrame frame,
32: ComponentAction action, int id) {
33: this .frame = frame;
34: this .action = action;
35: this .id = id;
36: }
37:
38: public boolean hasAction() {
39: return (action != null);
40: }
41:
42: /**
43: * Returns the type of PortletFrame action received
44: *
45: * @return the window action
46: */
47: public ComponentAction getAction() {
48: return action;
49: }
50:
51: public PortletComponent getPortletComponent() {
52: return frame;
53: }
54:
55: /**
56: * Returns the component id of the PortletFrame that triggered the event
57: *
58: * @return the component id of the PortletFrame
59: */
60: public int getID() {
61: return id;
62: }
63:
64: /**
65: * Used in the case of portlet frame resize when it needs to know the original width of the frame
66: *
67: * @param originalWidth the portlet frame original width
68: */
69: public void setOriginalWidth(String originalWidth) {
70: this .width = originalWidth;
71: }
72:
73: /**
74: * Used in the case of portlet frame resize when it needs to know the original width of the frame
75: *
76: * @return the portlet frame original width
77: */
78: public String getOriginalWidth() {
79: return width;
80: }
81: }
|