Пример #1
0
 /** @return "y" in "Showing x to y of z" */
 public long getTo() {
   if (table.getTotalRowCount() == 0) {
     return 0;
   } else {
     long count = getFrom() + table.getCurrentPageItemCount() - 1;
     return count;
   }
 }
  /** Constructor. */
  public EditableDataGridWithSelectionPage() {
    List<IGridColumn> columns = new ArrayList<IGridColumn>();

    Form form = new Form("form");
    add(form);

    columns.add(new CheckBoxColumn("check"));
    columns.add(new PropertyColumn(new ResourceModel("id"), "id"));
    columns.add(
        new EditablePropertyColumn(new ResourceModel("firstName"), "firstName", "firstName") {

          private static final long serialVersionUID = 1L;

          @Override
          protected void addValidators(FormComponent component) {
            component.setRequired(true);
          }
        });
    columns.add(
        new EditablePropertyColumn(new ResourceModel("lastName"), "lastName", "lastName") {

          private static final long serialVersionUID = 1L;

          @Override
          protected void addValidators(FormComponent component) {
            component.setRequired(true);
          }
        });
    columns.add(new EditablePropertyColumn(new ResourceModel("homePhone"), "homePhone"));
    columns.add(new EditablePropertyColumn(new ResourceModel("cellPhone"), "cellPhone"));
    columns.add(new SubmitCancelColumn("esd", new Model("Edit")));

    DataGrid grid = new DefaultDataGrid("grid", new ContactDataSource(), columns);
    form.add(grid);

    grid.setAllowSelectMultiple(true);
    grid.setSelectToEdit(false);

    grid.setClickRowToSelect(true);
  }
Пример #3
0
 /** @return "x" in "Showing x to y of z" */
 public long getFrom() {
   if (table.getTotalRowCount() == 0) {
     return 0;
   }
   return table.getCurrentPage() * table.getRowsPerPage() + 1;
 }
Пример #4
0
 /** @return "z" in "Showing x to y of z" */
 public String getOf() {
   long total = table.getTotalRowCount();
   return total != -1 ? "" + total : getString("unknown", null, "unknown");
 }