001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package com.sun.rave.web.ui.component.util.event;
042:
043: import com.sun.rave.web.ui.component.util.descriptors.LayoutElement;
044:
045: import java.util.EventObject;
046:
047: import javax.faces.context.FacesContext;
048:
049: /**
050: *
051: * @author Ken Paulsen (ken.paulsen@sun.com)
052: */
053: public interface HandlerContext {
054:
055: /**
056: * <P> Accessor for the FacesContext.</P>
057: *
058: * @return FacesContext
059: */
060: public FacesContext getFacesContext();
061:
062: /**
063: * <P> Accessor for the LayoutElement associated with this Handler. The
064: * LayoutElement associated with this Handler is the LayoutElement
065: * which declared the handler. This provides a way for the handler
066: * to obtain access to the LayoutElement which is responsible for it
067: * being invoked.</P>
068: */
069: public LayoutElement getLayoutElement();
070:
071: /**
072: * <P> Accessor for the EventObject associated with this Handler. This
073: * may be null if an EventObject was not created for this handler.
074: * An EventObject, if it does exist, may provide additional details
075: * describing the context in which this Event is invoked.</P>
076: */
077: public EventObject getEventObject();
078:
079: /**
080: * <P> This method provides access to the EventType. This is mostly
081: * helpful for diagnostics, but may be used in a handler to determine
082: * more information about the context in which the code is
083: * executing.</P>
084: */
085: public String getEventType();
086:
087: /**
088: * <P> Accessor for the Handler descriptor for this Handler. The Handler
089: * descriptor object contains specific meta information describing
090: * the invocation of this handler. This includes details such as
091: * input values, and where output values are to be set.</P>
092: */
093: public Handler getHandler();
094:
095: /**
096: * <P> Setter for the Handler descriptor for this Handler.</P>
097: *
098: * @param handler The Handler
099: */
100: public void setHandler(Handler handler);
101:
102: /**
103: * <P> Accessor for the Handler descriptor for this Handler. The
104: * HandlerDefinition descriptor contains meta information about the
105: * actual Java handler that will handle the processing. This
106: * includes the inputs required, outputs produces, and the types for
107: * both.</P>
108: */
109: public HandlerDefinition getHandlerDefinition();
110:
111: /**
112: * <P> This method returns the value for the named input. Input values
113: * are not stored in this Context itself, but in the Handler. If
114: * you are trying to set input values for a handler, you must create
115: * a new Handler object and set its input values.</P>
116: *
117: * @param name The input name
118: *
119: * @return The value of the input (null if not found)
120: */
121: public Object getInputValue(String name);
122:
123: /**
124: * <P> This method retrieves an Output value. Output values must not be
125: * stored in this Context itself (remember HandlerContext objects
126: * are shared). Output values are stored according to what is
127: * specified in the HandlerDefintion.</P>
128: *
129: * @param name The output name
130: *
131: * @return The value of the output (null if not found)
132: */
133: public Object getOutputValue(String name);
134:
135: /**
136: * <P> This method sets an Output value. Output values must not be
137: * stored in this Context itself (remember HandlerContext objects
138: * are shared). Output values are stored according to what is
139: * specified in the HandlerDefintion.</P>
140: */
141: public void setOutputValue(String name, Object value);
142: }
|