List of usage examples for org.apache.wicket.extensions.markup.html.repeater.util SingleSortState SingleSortState
SingleSortState
From source file:com.locke.tricks.u.U.java
License:Apache License
@SuppressWarnings("unchecked") public U() {/* w w w . j a va 2s . c o m*/ final IColumn<Utility>[] columns = new IColumn[2]; columns[0] = new PropertyColumn<Utility>(new Model<String>("Code"), "code", "code"); columns[1] = new PropertyColumn<Utility>(new Model<String>("Output"), "output", "output"); final DataTable<Utility> dataTable = new DataTable<Utility>("utilities", columns, this.utilitiesDataProvider, Integer.MAX_VALUE); dataTable.addTopToolbar(new HeadersToolbar(dataTable, new ISortStateLocator() { private ISortState sortState = new SingleSortState(); public ISortState getSortState() { return this.sortState; } public void setSortState(final ISortState state) { this.sortState = state; } })); add(dataTable); this.utilities.add(new Utility("Time.now().toString()") { @Override public String getOutput() { return Time.now().toString(); } }); this.utilities.add(new Utility("Duration.ONE_WEEK.toString()") { @Override public String getOutput() { return Duration.ONE_WEEK.toString(); } }); this.utilities.add(new Utility("Duration.ONE_WEEK.add(Duration.ONE_DAY).toString()") { @Override public String getOutput() { return Duration.ONE_WEEK.add(Duration.ONE_DAY).toString(); } }); this.utilities.add(new Utility("Time.now().add(Duration.ONE_WEEK).toString()") { @Override public String getOutput() { return Time.now().add(Duration.ONE_WEEK).toString(); } }); this.utilities.add(new Utility("Bytes.valueOf(\"512K\") + Bytes.megabytes(1.3)") { @Override public String getOutput() { return Bytes.bytes(Bytes.valueOf("512K").bytes() + Bytes.megabytes(1.3).bytes()).toString(); } }); this.utilities.add(new Utility("Parsing \'13 + 13\' using MetaPattern") { @Override public String getOutput() { final IntegerGroup a = new IntegerGroup(MetaPattern.DIGITS); final IntegerGroup b = new IntegerGroup(MetaPattern.DIGITS); final MetaPattern sum = new MetaPattern(new MetaPattern[] { a, MetaPattern.OPTIONAL_WHITESPACE, MetaPattern.PLUS, MetaPattern.OPTIONAL_WHITESPACE, b }); final Matcher matcher = sum.matcher("13 + 13"); if (matcher.matches()) { return Integer.toString(a.getInt(matcher) + b.getInt(matcher)); } return "Failed to match."; } }); }
From source file:de.alpharogroup.wicket.data.provider.AbstractSortableDataProvider.java
License:Apache License
/** * Factory method for creating the new {@link SingleSortState} for the sort state. This method * is invoked in the constructor from the derived classes and can be overridden so users can * provide their own version of a new {@link SingleSortState} for the sort state. * * @return the new {@link SingleSortState} for the sort state. *///from ww w .j a va2 s.c o m protected SingleSortState<S> newSortState() { return new SingleSortState<>(); }
From source file:net.databinder.models.hib.CriteriaSorter.java
License:Open Source License
/** * @param defaultProperty - property for a default sort before any is set * @param asc - sort ascending/descending * @param cased - sort cased/case insensitive *//*w w w .j a v a 2 s . c o m*/ public CriteriaSorter(String defaultProperty, boolean asc, boolean cased) { sortState = new SingleSortState(); this.defaultProperty = defaultProperty; this.asc = asc; this.cased = cased; }
From source file:nl.mpi.lamus.web.unlinkednodes.providers.UnlinkedNodesModelProvider.java
License:Open Source License
@Override public ISortState<String> getSortState() { return new SingleSortState<>(); }
From source file:org.cast.cwm.admin.EventLog.java
License:Open Source License
protected OrderingCriteriaBuilder makeCriteriaBuilder() { EventCriteriaBuilder eventCriteriaBuilder = new EventCriteriaBuilder(); SingleSortState<String> defaultSort = new SingleSortState<String>(); defaultSort.setSort(new SortParam<String>("insertTime", false)); // Sort by Insert Time by default eventCriteriaBuilder.setSortState(defaultSort); return eventCriteriaBuilder; }
From source file:org.cast.cwm.data.builders.LoginSessionCriteriaBuilder.java
License:Open Source License
public LoginSessionCriteriaBuilder() { SingleSortState<String> sort = new SingleSortState<String>(); sort.setSort(new SortParam<String>("startTime", true)); sortState = sort;/*w w w . ja v a 2s. c o m*/ }
From source file:org.cast.cwm.service.UserService.java
License:Open Source License
@Override public IModel<User> getAllByEmail(String email) { // Sort valid users to the top SingleSortState<String> sort = new SingleSortState<String>(); SortParam<String> sortParam = new SortParam<String>("valid", false); sort.setSort(sortParam);//w w w.j av a2 s .c o m // it is possible to return both valid and invalid UserCriteriaBuilder c = new UserCriteriaBuilder(); c.setEmail(email); c.setGetAllUsers(true); c.setSortState(sort); UserListModel userListModel = new UserListModel(c); return new HibernateObjectModel<User>(userListModel.getObject().get(0)); }
From source file:wicketbox.examples.FooDataProvider.java
License:Apache License
public ISortState<String> getSortState() { return new SingleSortState<String>(); }