Source Code Cross Referenced for UICommand.java in  » J2EE » myfaces-core-1.2.0 » javax » faces » component » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » myfaces core 1.2.0 » javax.faces.component 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // WARNING: This file was automatically generated. Do not edit it directly,
002:        //          or you will lose your changes.
003:
004:        /*
005:         * Licensed to the Apache Software Foundation (ASF) under one
006:         * or more contributor license agreements.  See the NOTICE file
007:         * distributed with this work for additional information
008:         * regarding copyright ownership.  The ASF licenses this file
009:         * to you under the Apache License, Version 2.0 (the
010:         * "License"); you may not use this file except in compliance
011:         * with the License.  You may obtain a copy of the License at
012:         *
013:         *   http://www.apache.org/licenses/LICENSE-2.0
014:         *
015:         * Unless required by applicable law or agreed to in writing,
016:         * software distributed under the License is distributed on an
017:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
018:         * KIND, either express or implied.  See the License for the
019:         * specific language governing permissions and limitations
020:         * under the License.
021:         */
022:        package javax.faces.component;
023:
024:        import javax.el.MethodExpression;
025:        import javax.el.ValueExpression;
026:        import javax.faces.context.FacesContext;
027:        import javax.faces.el.MethodBinding;
028:        import javax.faces.event.AbortProcessingException;
029:        import javax.faces.event.ActionEvent;
030:        import javax.faces.event.ActionListener;
031:        import javax.faces.event.FacesEvent;
032:        import javax.faces.event.PhaseId;
033:
034:        /**
035:         *
036:         * <h4>Events:</h4>
037:         * <table border="1" width="100%" cellpadding="3" summary="">
038:         * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
039:         * <th align="left">Type</th>
040:         * <th align="left">Phases</th>
041:         * <th align="left">Description</th>
042:         * </tr>
043:         * <tr class="TableRowColor">
044:         * <td valign="top"><code>javax.faces.event.ActionEvent</code></td>
045:         * <td valign="top" nowrap>Apply Request Values</td>
046:         * <td valign="top">Event delivered when the "action" of the component has been
047:         invoked;  for example, by clicking on a button.  The action may result
048:         in page navigation.</td>
049:         * </tr>
050:         * </table>
051:         */
052:        public class UICommand extends UIComponentBase implements  ActionSource2 {
053:
054:            static public final String COMPONENT_FAMILY = "javax.faces.Command";
055:            static public final String COMPONENT_TYPE = "javax.faces.Command";
056:
057:            /**
058:             * Construct an instance of the UICommand.
059:             */
060:            public UICommand() {
061:                setRendererType("javax.faces.Button");
062:            }
063:
064:            /**
065:             * @deprecated Use setActionExpression instead.
066:             */
067:            public void setAction(MethodBinding action) {
068:                if (action != null) {
069:                    setActionExpression(new _MethodBindingToMethodExpression(
070:                            action));
071:                } else {
072:                    setActionExpression(null);
073:                }
074:            }
075:
076:            /**
077:             * @deprecated Use getActionExpression() instead.
078:             */
079:            public MethodBinding getAction() {
080:                MethodExpression actionExpression = getActionExpression();
081:                if (actionExpression instanceof  _MethodBindingToMethodExpression) {
082:                    return ((_MethodBindingToMethodExpression) actionExpression)
083:                            .getMethodBinding();
084:                }
085:                if (actionExpression != null) {
086:                    return new _MethodExpressionToMethodBinding(
087:                            actionExpression);
088:                }
089:                return null;
090:            }
091:
092:            @Override
093:            public void broadcast(FacesEvent event)
094:                    throws AbortProcessingException {
095:                super .broadcast(event);
096:
097:                if (event instanceof  ActionEvent) {
098:                    FacesContext context = getFacesContext();
099:
100:                    MethodBinding mb = getActionListener();
101:                    if (mb != null) {
102:                        mb.invoke(context, new Object[] { event });
103:                    }
104:
105:                    ActionListener defaultActionListener = context
106:                            .getApplication().getActionListener();
107:                    if (defaultActionListener != null) {
108:                        defaultActionListener
109:                                .processAction((ActionEvent) event);
110:                    }
111:                }
112:            }
113:
114:            @Override
115:            public void queueEvent(FacesEvent event) {
116:                if (event != null && event instanceof  ActionEvent) {
117:                    if (isImmediate()) {
118:                        event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
119:                    } else {
120:                        event.setPhaseId(PhaseId.INVOKE_APPLICATION);
121:                    }
122:                }
123:                super .queueEvent(event);
124:            }
125:
126:            // Property: immediate
127:            private boolean _immediate;
128:            private boolean _immediateSet;
129:
130:            /**
131:             * Gets A boolean value that identifies the phase during which action events
132:             *         should fire. During normal event processing, action methods and
133:             *         action listener methods are fired during the "invoke application"
134:             *         phase of request processing. If this attribute is set to "true",
135:             *         these methods are fired instead at the end of the "apply request
136:             *         values" phase.
137:             *
138:             * @return  the new immediate value
139:             */
140:            public boolean isImmediate() {
141:                if (_immediateSet) {
142:                    return _immediate;
143:                }
144:                ValueExpression expression = getValueExpression("immediate");
145:                if (expression != null) {
146:                    return (Boolean) expression.getValue(getFacesContext()
147:                            .getELContext());
148:                }
149:                return false;
150:            }
151:
152:            /**
153:             * Sets A boolean value that identifies the phase during which action events
154:             *         should fire. During normal event processing, action methods and
155:             *         action listener methods are fired during the "invoke application"
156:             *         phase of request processing. If this attribute is set to "true",
157:             *         these methods are fired instead at the end of the "apply request
158:             *         values" phase.
159:             * 
160:             * @param immediate  the new immediate value
161:             */
162:            public void setImmediate(boolean immediate) {
163:                this ._immediate = immediate;
164:                this ._immediateSet = true;
165:            }
166:
167:            // Property: value
168:            private Object _value;
169:
170:            /**
171:             * Gets The initial value of this component.
172:             *
173:             * @return  the new value value
174:             */
175:            public Object getValue() {
176:                if (_value != null) {
177:                    return _value;
178:                }
179:                ValueExpression expression = getValueExpression("value");
180:                if (expression != null) {
181:                    return expression
182:                            .getValue(getFacesContext().getELContext());
183:                }
184:                return null;
185:            }
186:
187:            /**
188:             * Sets The initial value of this component.
189:             * 
190:             * @param value  the new value value
191:             */
192:            public void setValue(Object value) {
193:                this ._value = value;
194:            }
195:
196:            // Property: actionExpression
197:            private MethodExpression _actionExpression;
198:
199:            /**
200:             * Gets Specifies the action to take when this command is invoked.
201:             *         If the value is an expression, it is expected to be a method
202:             *         binding EL expression that identifies an action method. An action method
203:             *         accepts no parameters and has a String return value, called the action
204:             *         outcome, that identifies the next view displayed. The phase that this
205:             *         event is fired in can be controlled via the immediate attribute.
206:             * 
207:             *         If the value is a string literal, it is treated as a navigation outcome
208:             *         for the current view.  This is functionally equivalent to a reference to
209:             *         an action method that returns the string literal.
210:             *
211:             * @return  the new actionExpression value
212:             */
213:            public MethodExpression getActionExpression() {
214:                if (_actionExpression != null) {
215:                    return _actionExpression;
216:                }
217:                ValueExpression expression = getValueExpression("actionExpression");
218:                if (expression != null) {
219:                    return (MethodExpression) expression
220:                            .getValue(getFacesContext().getELContext());
221:                }
222:                return null;
223:            }
224:
225:            /**
226:             * Sets Specifies the action to take when this command is invoked.
227:             *         If the value is an expression, it is expected to be a method
228:             *         binding EL expression that identifies an action method. An action method
229:             *         accepts no parameters and has a String return value, called the action
230:             *         outcome, that identifies the next view displayed. The phase that this
231:             *         event is fired in can be controlled via the immediate attribute.
232:             * 
233:             *         If the value is a string literal, it is treated as a navigation outcome
234:             *         for the current view.  This is functionally equivalent to a reference to
235:             *         an action method that returns the string literal.
236:             * 
237:             * @param actionExpression  the new actionExpression value
238:             */
239:            public void setActionExpression(MethodExpression actionExpression) {
240:                this ._actionExpression = actionExpression;
241:            }
242:
243:            // Property: actionListener
244:            private MethodBinding _actionListener;
245:
246:            /**
247:             * Gets A method binding EL expression that identifies an action listener method
248:             *         to be invoked if this component is activated by the user. An action
249:             *         listener method accepts a parameter of type javax.faces.event.ActionEvent
250:             *         and returns void. The phase that this event is fired in can be controlled
251:             *         via the immediate attribute.
252:             *
253:             * @return  the new actionListener value
254:             * @deprecated
255:             */
256:            public MethodBinding getActionListener() {
257:                if (_actionListener != null) {
258:                    return _actionListener;
259:                }
260:                ValueExpression expression = getValueExpression("actionListener");
261:                if (expression != null) {
262:                    return (MethodBinding) expression
263:                            .getValue(getFacesContext().getELContext());
264:                }
265:                return null;
266:            }
267:
268:            /**
269:             * Sets A method binding EL expression that identifies an action listener method
270:             *         to be invoked if this component is activated by the user. An action
271:             *         listener method accepts a parameter of type javax.faces.event.ActionEvent
272:             *         and returns void. The phase that this event is fired in can be controlled
273:             *         via the immediate attribute.
274:             * 
275:             * @param actionListener  the new actionListener value
276:             * @deprecated
277:             */
278:            public void setActionListener(MethodBinding actionListener) {
279:                this ._actionListener = actionListener;
280:            }
281:
282:            /**
283:             * Adds a action listener.
284:             *
285:             * @param listener  the action listener to add
286:             */
287:            public void addActionListener(ActionListener listener) {
288:                addFacesListener(listener);
289:            }
290:
291:            /**
292:             * Removes a action listener.
293:             *
294:             * @param listener  the action listener to remove
295:             */
296:            public void removeActionListener(ActionListener listener) {
297:                removeFacesListener(listener);
298:            }
299:
300:            /**
301:             * Returns an array of attached action listeners.
302:             *
303:             * @return  an array of attached action listeners.
304:             */
305:            public ActionListener[] getActionListeners() {
306:                return (ActionListener[]) getFacesListeners(ActionListener.class);
307:            }
308:
309:            @Override
310:            public Object saveState(FacesContext facesContext) {
311:                Object[] values = new Object[6];
312:                values[0] = super .saveState(facesContext);
313:                values[1] = _immediate;
314:                values[2] = _immediateSet;
315:                values[3] = _value;
316:                values[4] = saveAttachedState(facesContext, _actionExpression);
317:                values[5] = saveAttachedState(facesContext, _actionListener);
318:
319:                return values;
320:            }
321:
322:            @Override
323:            public void restoreState(FacesContext facesContext, Object state) {
324:                Object[] values = (Object[]) state;
325:                super .restoreState(facesContext, values[0]);
326:                _immediate = (Boolean) values[1];
327:                _immediateSet = (Boolean) values[2];
328:                _value = values[3];
329:                _actionExpression = (MethodExpression) restoreAttachedState(
330:                        facesContext, values[4]);
331:                _actionListener = (MethodBinding) restoreAttachedState(
332:                        facesContext, values[5]);
333:            }
334:
335:            @Override
336:            public String getFamily() {
337:                return COMPONENT_FAMILY;
338:            }
339:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.