001: /*
002: * $Id: OrderByBorder.java 3345 2005-12-05 08:29:28 +0000 (Mon, 05 Dec 2005)
003: * ivaynberg $ $Revision: 3345 $ $Date: 2005-12-05 08:29:28 +0000 (Mon, 05 Dec
004: * 2005) $
005: *
006: * ==================================================================== Licensed
007: * under the Apache License, Version 2.0 (the "License"); you may not use this
008: * file except in compliance with the License. You may obtain a copy of the
009: * License at
010: *
011: * http://www.apache.org/licenses/LICENSE-2.0
012: *
013: * Unless required by applicable law or agreed to in writing, software
014: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
015: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
016: * License for the specific language governing permissions and limitations under
017: * the License.
018: */
019: package wicket.extensions.ajax.markup.html.repeater.data.sort;
020:
021: import wicket.ajax.AjaxRequestTarget;
022: import wicket.ajax.IAjaxCallDecorator;
023: import wicket.extensions.markup.html.repeater.data.sort.ISortStateLocator;
024: import wicket.extensions.markup.html.repeater.data.sort.OrderByBorder;
025: import wicket.markup.html.border.Border;
026:
027: /**
028: * Ajaxified version of {@link OrderByBorder}
029: *
030: * @see OrderByBorder
031: *
032: * @since 1.2.1
033: *
034: * @author Igor Vaynberg (ivaynberg)
035: *
036: */
037: public abstract class AjaxFallbackOrderByBorder extends Border {
038: private static final long serialVersionUID = 1L;
039:
040: /**
041: * Constructor
042: *
043: * @param id
044: * @param property
045: * @param stateLocator
046: */
047: public AjaxFallbackOrderByBorder(String id, String property,
048: ISortStateLocator stateLocator) {
049: this (id, property, stateLocator,
050: AjaxFallbackOrderByLink.DefaultCssProvider
051: .getInstance(), null);
052: }
053:
054: /**
055: * Constructor
056: *
057: * @param id
058: * @param property
059: * @param stateLocator
060: * @param cssProvider
061: */
062: public AjaxFallbackOrderByBorder(String id, String property,
063: ISortStateLocator stateLocator,
064: AjaxFallbackOrderByLink.ICssProvider cssProvider) {
065: this (id, property, stateLocator, cssProvider, null);
066: }
067:
068: /**
069: * Constructor
070: *
071: * @param id
072: * @param property
073: * @param stateLocator
074: * @param decorator
075: */
076: public AjaxFallbackOrderByBorder(String id, String property,
077: ISortStateLocator stateLocator, IAjaxCallDecorator decorator) {
078: this (id, property, stateLocator,
079: AjaxFallbackOrderByLink.DefaultCssProvider
080: .getInstance(), decorator);
081: }
082:
083: /**
084: * Constructor
085: *
086: * @param id
087: * @param property
088: * @param stateLocator
089: * @param cssProvider
090: * @param decorator
091: */
092: public AjaxFallbackOrderByBorder(String id, String property,
093: ISortStateLocator stateLocator,
094: AjaxFallbackOrderByLink.ICssProvider cssProvider,
095: final IAjaxCallDecorator decorator) {
096: super (id);
097: AjaxFallbackOrderByLink link = new AjaxFallbackOrderByLink(
098: "orderByLink", property, stateLocator, cssProvider,
099: decorator) {
100:
101: private static final long serialVersionUID = 1L;
102:
103: protected void onSortChanged() {
104: AjaxFallbackOrderByBorder.this .onSortChanged();
105: }
106:
107: protected void onAjaxClick(AjaxRequestTarget target) {
108: AjaxFallbackOrderByBorder.this .onAjaxClick(target);
109:
110: }
111: };
112: add(link);
113: add(new AjaxFallbackOrderByLink.CssModifier(link, cssProvider));
114: }
115:
116: /**
117: * This method is a hook for subclasses to perform an action after sort has
118: * changed
119: */
120: protected void onSortChanged() {
121: // noop
122: }
123:
124: protected abstract void onAjaxClick(AjaxRequestTarget target);
125:
126: }
|