01: /*
02: * $Id$ $Revision$ $Date$
03: *
04: * ==============================================================================
05: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
06: * use this file except in compliance with the License. You may obtain a copy of
07: * the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14: * License for the specific language governing permissions and limitations under
15: * the License.
16: */
17: package wicket.extensions.ajax.markup.html.repeater.data.table;
18:
19: import wicket.ajax.AjaxRequestTarget;
20: import wicket.ajax.IAjaxCallDecorator;
21: import wicket.extensions.ajax.markup.html.repeater.data.sort.AjaxFallbackOrderByBorder;
22: import wicket.extensions.markup.html.repeater.data.sort.ISortStateLocator;
23: import wicket.extensions.markup.html.repeater.data.table.DataTable;
24: import wicket.extensions.markup.html.repeater.data.table.HeadersToolbar;
25: import wicket.markup.html.WebMarkupContainer;
26:
27: /**
28: * Ajaxified {@link HeadersToolbar}
29: *
30: * @see HeadersToolbar
31: *
32: * @author ivaynberg
33: *
34: */
35: public class AjaxFallbackHeadersToolbar extends HeadersToolbar {
36: private static final long serialVersionUID = 1L;
37:
38: /**
39: * Constructor
40: *
41: * @param table
42: * @param stateLocator
43: */
44: public AjaxFallbackHeadersToolbar(DataTable table,
45: ISortStateLocator stateLocator) {
46: super (table, stateLocator);
47: table.setOutputMarkupId(true);
48: }
49:
50: /**
51: * @see wicket.extensions.markup.html.repeater.data.table.HeadersToolbar#newSortableHeader(java.lang.String,
52: * java.lang.String,
53: * wicket.extensions.markup.html.repeater.data.sort.ISortStateLocator)
54: */
55: protected WebMarkupContainer newSortableHeader(String borderId,
56: String property, ISortStateLocator locator) {
57: return new AjaxFallbackOrderByBorder(borderId, property,
58: locator, getAjaxCallDecorator()) {
59: private static final long serialVersionUID = 1L;
60:
61: protected void onAjaxClick(AjaxRequestTarget target) {
62: target.addComponent(getTable());
63:
64: }
65:
66: };
67: }
68:
69: /**
70: * Returns a decorator that will be used to decorate ajax links used in
71: * sortable headers
72: *
73: * @return decorator or null for none
74: */
75: protected IAjaxCallDecorator getAjaxCallDecorator() {
76: return null;
77: }
78:
79: }
|