View Javadoc
1   // ---------- Attention: Generated code, please do not modify! -----------
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   *
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  package org.apache.myfaces.tobago.component;
21  
22  import javax.faces.component.behavior.ClientBehaviorHolder;
23  import javax.faces.context.FacesContext;
24  import org.apache.myfaces.tobago.internal.component.AbstractUIEvent;
25  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
26  import org.apache.myfaces.tobago.internal.util.StringUtils;
27  import org.apache.myfaces.tobago.internal.util.Deprecation;
28  import org.apache.myfaces.tobago.component.Tags;
29  import javax.annotation.Generated;
30  import javax.el.ELException;
31  import javax.faces.FacesException;
32  import java.util.Arrays;
33  import java.util.ArrayList;
34  import java.util.Collection;
35  import java.util.List;
36  import javax.el.MethodExpression;
37  import javax.el.ValueExpression;
38  
39  /**
40   Add an event behavior to the component.
41    It can contain f:ajax and tc:operation tags.
42    * UIComponent class, generated from template {@code component.stg} with class
43    * {@link org.apache.myfaces.tobago.internal.taglib.component.EventTagDeclaration}.
44   */
45  @Generated("component.stg")
46  public class UIEvent
47      extends AbstractUIEvent implements ClientBehaviorHolder {
48  
49    public static final String COMPONENT_TYPE = Tags.event.componentType();
50  
51    public static final String COMPONENT_FAMILY = "javax.faces.Command";
52  
53    private static final Collection<String> EVENT_NAMES = Arrays.asList("change", "click", "dblclick", "focus", "blur", "mouseout", "mouseover", "complete", "load", "reload", "resize");
54  
55    @Override
56    public Collection<String> getEventNames() {
57      return EVENT_NAMES;
58    }
59  
60    @Override
61    public String getDefaultEventName() {
62      return "click";
63    }
64  
65  
66    enum PropertyKeys {
67      fragment,
68      link,
69      confirmation,
70      event,
71      omit,
72      outcome,
73      transition,
74      target,
75    }
76  
77    public String getFamily() {
78      return COMPONENT_FAMILY;
79    }
80  
81  
82    /**
83    The identifier of the page fragment which should
84     be brought into focus when the target page is
85     rendered. The value of this attribute is appended
86     to the end of target URL following a hash (#) mark.
87     This notation is part of the standard URL syntax.
88  
89    */
90    public java.lang.String getFragment() {
91      return (java.lang.String) getStateHelper().eval(PropertyKeys.fragment);
92    }
93  
94    public void setFragment(java.lang.String fragment) {
95      getStateHelper().put(PropertyKeys.fragment, fragment);
96    }
97  
98    /**
99    <p>
100    Link to an arbitrary URL, either an internal link or an external link. For internal URLs, a session id will be
101    added, if needed (when cookies disabled). The context path needs to be added manually e.g. #{request.contextPath}.
102    For JSF navigation to a viewId use the outcome attribute!
103    </p>
104 
105    <p>
106    The semantic of this attributes has been changed from Tobago 3 to 4!
107    </p>
108 
109   */
110   public java.lang.String getLink() {
111     return (java.lang.String) getStateHelper().eval(PropertyKeys.link);
112   }
113 
114   public void setLink(java.lang.String link) {
115     getStateHelper().put(PropertyKeys.link, link);
116   }
117 
118   /**
119   Text to use as confirmation message.
120 
121   */
122   public java.lang.String getConfirmation() {
123     return (java.lang.String) getStateHelper().eval(PropertyKeys.confirmation);
124   }
125 
126   public void setConfirmation(java.lang.String confirmation) {
127     getStateHelper().put(PropertyKeys.confirmation, confirmation);
128   }
129 
130   /**
131   The name of the event as an instance of {
132 
133   */
134   public org.apache.myfaces.tobago.component.ClientBehaviors getEvent() {
135     return (org.apache.myfaces.tobago.component.ClientBehaviors) getStateHelper().eval(PropertyKeys.event);
136   }
137 
138   public void setEvent(org.apache.myfaces.tobago.component.ClientBehaviors event) {
139     getStateHelper().put(PropertyKeys.event, event);
140   }
141 
142   /**
143   Flag indicating that the action of this element, will not be executed from client side
144    (e. g. when the user clicks a button.
145    When setting this value to true, the action will not be executed by the Tobago, but it can executed
146    by JavaScript.
147    This attribute is useful, when you want to add JavaScript event handlers to commands manually.
148    In this case you usually don't want a submit with a full reload of the page.
149   <br>Default: <code>false</code>
150   */
151   public boolean isOmit() {
152     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.omit);
153     if (bool != null) {
154       return bool;
155     }
156     return false;
157   }
158 
159   public void setOmit(boolean omit) {
160     getStateHelper().put(PropertyKeys.omit, omit);
161   }
162 
163   /**
164   Link to an internal facelet page, like the outcome of an action.
165    The context path will be added.
166    A session id will be added, if needed.
167 
168   */
169   public java.lang.String getOutcome() {
170     return (java.lang.String) getStateHelper().eval(PropertyKeys.outcome);
171   }
172 
173   public void setOutcome(java.lang.String outcome) {
174     getStateHelper().put(PropertyKeys.outcome, outcome);
175   }
176 
177   /**
178   Specify, if the command calls an JSF-Action.
179    Useful to switch off the Double-Submit-Check and Waiting-Behavior.
180   <br>Default: <code>true</code>
181   */
182   public boolean isTransition() {
183     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.transition);
184     if (bool != null) {
185       return bool;
186     }
187     return true;
188   }
189 
190   public void setTransition(boolean transition) {
191     getStateHelper().put(PropertyKeys.transition, transition);
192   }
193 
194   /**
195   Name of a frame where the resource retrieved via this hyperlink is to be
196    displayed.
197 
198   */
199   public java.lang.String getTarget() {
200     return (java.lang.String) getStateHelper().eval(PropertyKeys.target);
201   }
202 
203   public void setTarget(java.lang.String target) {
204     getStateHelper().put(PropertyKeys.target, target);
205   }
206 
207 
208   @Override
209   public void restoreState(FacesContext context, Object state) {
210     // FIXME HACK for mojarra SystemEventListener state restoring bug
211     pushComponentToEL(context, this);
212     super.restoreState(context, state);
213     popComponentFromEL(context);
214   }
215 
216 }