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.context.FacesContext;
23  import org.apache.myfaces.tobago.internal.component.AbstractUIReload;
24  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
25  import org.apache.myfaces.tobago.internal.util.StringUtils;
26  import org.apache.myfaces.tobago.internal.util.Deprecation;
27  import org.apache.myfaces.tobago.component.Tags;
28  import javax.annotation.Generated;
29  import javax.el.ELException;
30  import javax.faces.FacesException;
31  import java.util.Arrays;
32  import java.util.ArrayList;
33  import java.util.Collection;
34  import java.util.List;
35  import javax.el.MethodExpression;
36  import javax.el.ValueExpression;
37  
38  /**
39   Update the parent component
40  
41    ********************* <br/>
42    WARNING <br/>
43    ********************* <br/>
44    This feature is preliminary and may be subject of change in later versions!  <br/>
45    * UIComponent class, generated from template {@code component.stg} with class
46    * {@link org.apache.myfaces.tobago.internal.taglib.component.ReloadTagDeclaration}.
47   */
48  @Generated("component.stg")
49  public class UIReload
50      extends AbstractUIReload  {
51  
52    public static final String COMPONENT_TYPE = Tags.reload.componentType();
53  
54    public static final String COMPONENT_FAMILY = "org.apache.myfaces.tobago.Reload";
55  
56  
57    enum PropertyKeys {
58      immediate,
59      update,
60      frequency,
61    }
62  
63    public String getFamily() {
64      return COMPONENT_FAMILY;
65    }
66  
67  
68    /**
69    Flag indicating that
70     the update check should be performed
71     immediately (that is, during Apply Request Values phase) rather than
72     waiting until Render Response phase.
73    <br>Default: <code>true</code>
74    */
75    public boolean isImmediate() {
76      Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.immediate);
77      if (bool != null) {
78        return bool;
79      }
80      return true;
81    }
82  
83    public void setImmediate(boolean immediate) {
84      getStateHelper().put(PropertyKeys.immediate, immediate);
85    }
86  
87    /**
88    Is update required.
89    <br>Default: <code>true</code>
90    */
91    public boolean isUpdate() {
92      Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.update);
93      if (bool != null) {
94        return bool;
95      }
96      return true;
97    }
98  
99    public void setUpdate(boolean update) {
100     getStateHelper().put(PropertyKeys.update, update);
101   }
102 
103   /**
104   Time in milliseconds after which the parent component is automatically reloaded.
105   <br>Default: <code>5000</code>
106   */
107   public java.lang.Integer getFrequency() {
108     Number value  = (Number) getStateHelper().eval(PropertyKeys.frequency);
109     if (value != null) {
110       return value.intValue();
111     }
112     return 5000;
113   }
114 
115   public void setFrequency(java.lang.Integer frequency) {
116     getStateHelper().put(PropertyKeys.frequency, frequency);
117   }
118 
119 
120   @Override
121   public void restoreState(FacesContext context, Object state) {
122     // FIXME HACK for mojarra SystemEventListener state restoring bug
123     pushComponentToEL(context, this);
124     super.restoreState(context, state);
125     popComponentFromEL(context);
126   }
127 
128 }