IClusterable is just a tagging interface for the sole purpose of clustering via Terracotta. So if you don't need TC, then Serializable should be fine.
Regards, Sebastiaan Hoover, William wrote:
I was looking into providing a List<SortParam> in a ISortState/IClusterable (multiple version of SingleSortState) for a SortableDataProvider. Does the list within the sort state need to be IClusterable? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
package com.sebster.util.wicket; import java.util.Collections; import java.util.List; import org.apache.wicket.extensions.markup.html.repeater.data.sort.ISortState; import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider; import org.apache.wicket.extensions.markup.html.repeater.util.SortParam; public abstract class MultiSortableDataProvider implements ISortableDataProvider { private static final long serialVersionUID = 1L; private MultiSortState state = new MultiSortState(); /** * @see ISortableDataProvider#getSortState() */ public final ISortState getSortState() { return state; } /** * @see ISortableDataProvider#setSortState(org.apache.wicket.extensions.markup.html.repeater.data.sort.ISortState) */ public final void setSortState(final ISortState state) { if (!(state instanceof MultiSortState)) { throw new IllegalArgumentException("state must be an instance of " + MultiSortState.class.getName()); } this.state = (MultiSortState) state; } public List<SortParam> getSort() { return state.getSort(); } @SuppressWarnings("unchecked") public void clearSort() { state.setSort(Collections.EMPTY_LIST); } /** * Sets the current sort state * * @param sortParams * list of parameters containing new sorting information */ public void setSort(List<SortParam> sortParams) { state.setSort(sortParams); } public void sortBy(final String property, final boolean ascending) { state.setPropertySortOrder(property, ascending ? ISortState.ASCENDING : ISortState.DESCENDING); } /** * @see ISortableDataProvider#detach() */ public void detach() { // Do nothing. } }
package com.sebster.util.wicket; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import org.apache.wicket.IClusterable; import org.apache.wicket.extensions.markup.html.repeater.data.sort.ISortState; import org.apache.wicket.extensions.markup.html.repeater.util.SortParam; public class MultiSortState implements ISortState, IClusterable { private static final long serialVersionUID = 1L; private final List<SortParam> sortParams = new ArrayList<SortParam>(); public int getPropertySortOrder(final String property) { if (property == null) { throw new NullPointerException("property"); } for (final SortParam sortParam : sortParams) { if (property.equals(sortParam.getProperty())) { return sortParam.isAscending() ? ISortState.ASCENDING : ISortState.DESCENDING; } } return ISortState.NONE; } public void setPropertySortOrder(final String property, final int state) { if (property == null) { throw new NullPointerException("property"); } for (final Iterator<SortParam> i = sortParams.iterator(); i.hasNext();) { if (property.equals(i.next().getProperty())) { i.remove(); break; } } if (state != ISortState.NONE) { sortParams.add(0, new SortParam(property, state == ISortState.ASCENDING)); } } public List<SortParam> getSort() { return Collections.unmodifiableList(sortParams); } public void setSort(final List<SortParam> sortParams) { sortParams.clear(); sortParams.addAll(sortParams); } }
smime.p7s
Description: S/MIME Cryptographic Signature