001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.ajax.attributes;
018
019import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
020import org.apache.wicket.util.lang.Args;
021
022/**
023 * ajax attribute names
024 * 
025 * @author mosmann
026 */
027public enum AjaxAttributeName {
028
029        /**
030         * throttling settings (tr)
031         * 
032         * @see AjaxRequestAttributes#getThrottlingSettings()
033         */
034        THROTTLING("tr"),
035
036        /**
037         * throttling - postpone timer on upate (p)
038         * 
039         * @see ThrottlingSettings#getPostponeTimerOnUpdate()
040         */
041        THROTTLING_POSTPONE_ON_UPDATE("p"),
042
043        /**
044         * throttling - delay (d)
045         * 
046         * @see ThrottlingSettings#getDelay()
047         */
048        THROTTLING_DELAY("d"),
049
050        /**
051         * throttling - id (id)
052         * 
053         * @see ThrottlingSettings#getId()
054         */
055        THROTTLING_ID("id"),
056
057        /**
058         * datatype (dt)
059         * 
060         * @see AjaxRequestAttributes#getDataType()
061         */
062        DATATYPE("dt"),
063
064        /**
065         * is wicket ajax response (wr)
066         * 
067         * @see AjaxRequestAttributes#isWicketAjaxResponse()
068         */
069        IS_WICKET_AJAX_RESPONSE("wr"),
070
071        /**
072         * request timeout (rt)
073         * 
074         * @see AjaxRequestAttributes#getRequestTimeout()
075         */
076        REQUEST_TIMEOUT("rt"),
077
078        /**
079         * allow default
080         * 
081         * @see AjaxRequestAttributes#isPreventDefault()
082         */
083        IS_PREVENT_DEFAULT("pd"),
084
085        /**
086         * stop propagation
087         *
088         * @see AjaxRequestAttributes#setEventPropagation(org.apache.wicket.ajax.attributes.AjaxRequestAttributes.EventPropagation)
089         */
090        EVENT_PROPAGATION("sp"),
091
092        /**
093         * channel (ch)
094         * 
095         * @see AjaxRequestAttributes#getChannel()
096         */
097        CHANNEL("ch"),
098
099        /**
100         * event name (e)
101         * 
102         * @see AjaxRequestAttributes#getEventNames()
103         */
104        EVENT_NAME("e"),
105
106        /**
107         * is async (async)
108         * 
109         * @see AjaxRequestAttributes#isAsynchronous()
110         */
111        IS_ASYNC("async"),
112
113        /**
114         * dynamic parameters (dep)
115         * 
116         * @see AjaxRequestAttributes#getDynamicExtraParameters()
117         */
118        DYNAMIC_PARAMETER_FUNCTION("dep"),
119
120        /**
121         * extra parameters (ep)
122         * 
123         * @see AjaxRequestAttributes#getExtraParameters()
124         */
125        EXTRA_PARAMETERS("ep"),
126
127        /**
128         * precondition (pre)
129         * 
130         * @see AjaxCallListener#getPrecondition(org.apache.wicket.Component)
131         */
132        PRECONDITION("pre"),
133
134        /**
135         * complete handler (coh)
136         * 
137         * @see AjaxCallListener#getCompleteHandler(org.apache.wicket.Component)
138         */
139        COMPLETE_HANDLER("coh"),
140
141        /**
142         * failure handler (fh)
143         * 
144         * @see AjaxCallListener#getFailureHandler(org.apache.wicket.Component)
145         */
146        FAILURE_HANDLER("fh"),
147
148        /**
149         * success handler (sh)
150         * 
151         * @see AjaxCallListener#getSuccessHandler(org.apache.wicket.Component)
152         */
153        SUCCESS_HANDLER("sh"),
154
155        /**
156         * after handler (ah)
157         * 
158         * @see AjaxCallListener#getAfterHandler(org.apache.wicket.Component)
159         */
160        AFTER_HANDLER("ah"),
161
162        /**
163         * before send handler (bsh)
164         * 
165         * @see AjaxCallListener#getBeforeSendHandler(org.apache.wicket.Component)
166         */
167        BEFORE_SEND_HANDLER("bsh"),
168
169        /**
170         * before handler (bh)
171         * 
172         * @see AjaxCallListener#getBeforeHandler(org.apache.wicket.Component)
173         */
174        BEFORE_HANDLER("bh"),
175
176        /**
177         * init handler (ih)
178         * 
179         * @see AjaxCallListener#getInitHandler(org.apache.wicket.Component)
180         */
181        INIT_HANDLER("ih"),
182
183        /**
184         * done handler (dh)
185         *
186         * @see AjaxCallListener#getDoneHandler(org.apache.wicket.Component)
187         */
188        DONE_HANDLER("dh"),
189
190        /**
191         * the indicator id, if any found (i)
192         * 
193         * See AbstractDefaultAjaxBehavior#findIndicatorId()
194         */
195        INDICATOR_ID("i"),
196
197        /**
198         * submitting component name (sc)
199         * 
200         * @see AjaxRequestAttributes#getSubmittingComponentName()
201         */
202        SUBMITTING_COMPONENT_NAME("sc"),
203
204        /**
205         * is multipart (mp)
206         * 
207         * @see AjaxRequestAttributes#isMultipart()
208         */
209        IS_MULTIPART("mp"),
210
211        /**
212         * form id (f)
213         * 
214         * @see AjaxRequestAttributes#getFormId()
215         */
216        FORM_ID("f"),
217
218        /**
219         * markup id of behavior attached component (c)
220         * 
221         * See AbstractDefaultAjaxBehavior#renderAjaxAttributes(Component)
222         */
223        MARKUP_ID("c"),
224
225        /**
226         * http method (m)
227         * 
228         * @see AjaxRequestAttributes#getMethod()
229         */
230        METHOD("m"),
231
232        /**
233         * @see AbstractDefaultAjaxBehavior#getCallbackUrl()
234         */
235        URL("u"),
236
237        /**
238         * @see AjaxRequestAttributes#setChildSelector(CharSequence)
239         */
240        CHILD_SELECTOR("sel"),
241
242        /**
243         * @see AjaxRequestAttributes#setSerializeRecursively(boolean)
244         */
245        SERIALIZE_RECURSIVELY("sr");
246
247        private final String jsonName;
248
249        AjaxAttributeName(String jsonName)
250        {
251                this.jsonName = Args.notNull(jsonName, "jsonName");
252        }
253
254        /**
255         * the json parameter name
256         * 
257         * @return as string
258         */
259        public String jsonName()
260        {
261                return jsonName;
262        }
263
264        @Override
265        public String toString()
266        {
267                return jsonName;
268        }
269}