Package com.inmethod.grid.datagrid

Examples of com.inmethod.grid.datagrid.DataGrid


    columns.add(new PropertyColumn(new ResourceModel("firstName"), "firstName", "firstName"));
    columns.add(new PropertyColumn(new ResourceModel("lastName"), "lastName", "lastName"));
    columns.add(new PropertyColumn(new ResourceModel("homePhone"), "homePhone"));
    columns.add(new PropertyColumn(new ResourceModel("cellPhone"), "cellPhone"));

    DataGrid grid = new DefaultDataGrid("grid", new ContactDataSourceWithUnknownItemCount(), columns);
    add(grid);

    grid.setRowsPerPage(50);
    grid.setContentHeight(25, SizeUnit.EM);
  }
View Full Code Here


    columns.add(new PropertyColumn(new ResourceModel("firstName"), "firstName", "firstName"));
    columns.add(new PropertyColumn(new ResourceModel("lastName"), "lastName", "lastName"));
    columns.add(new PropertyColumn(new ResourceModel("homePhone"), "homePhone"));
    columns.add(new PropertyColumn(new ResourceModel("cellPhone"), "cellPhone"));

    final DataGrid grid = new DefaultDataGrid("grid", new ContactDataSource(), columns) {

      private static final long serialVersionUID = 1L;

      @Override
      public void onItemSelectionChanged(IModel item, boolean newValue) {
        super.onItemSelectionChanged(item, newValue);

        // when item selection changes the label showing selected items needs to be
        // refreshed
        AjaxRequestTarget target = AjaxRequestTarget.get();
        target.addComponent(selectionLabel);
      }
    };
    add(grid);

    grid.setCleanSelectionOnPageChange(false);
    grid.setClickRowToSelect(true);
    grid.setRowsPerPage(15);

    // model for label that shows selected items
    IModel selectedItemsModel = new Model() {
      private static final long serialVersionUID = 1L;
View Full Code Here

    columns.add(new PropertyColumn(new ResourceModel("firstName"), "firstName", "firstName"));
    columns.add(new PropertyColumn(new ResourceModel("lastName"), "lastName", "lastName"));
    columns.add(new PropertyColumn(new ResourceModel("homePhone"), "homePhone"));
    columns.add(new PropertyColumn(new ResourceModel("cellPhone"), "cellPhone"));

    DataGrid grid = new DefaultDataGrid("grid", new ContactDataSource(), columns);
    add(grid);
   
    grid.setRowsPerPage(30);
    grid.setContentHeight(25, SizeUnit.EM);
  }
View Full Code Here

    columns.add(new PropertyColumn(new ResourceModel("firstName"), "firstName", "firstName"));
    columns.add(new PropertyColumn(new ResourceModel("lastName"), "lastName", "lastName"));
    columns.add(new PropertyColumn(new ResourceModel("homePhone"), "homePhone"));
    columns.add(new PropertyColumn(new ResourceModel("cellPhone"), "cellPhone"));
   
    DataGrid grid = new DefaultDataGrid("grid", new ContactDataSource(), columns);
   
    add(grid);
  }
View Full Code Here

    });
    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(true);
    grid.setClickRowToSelect(true);
    grid.setClickRowToDeselect(false);
  }
View Full Code Here

    });
    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);
  }
View Full Code Here

        .setInitialSize(10)
        .setSizeUnit(SizeUnit.EM)
        .setResizable(false)
    );
   
    DataGrid grid = new DefaultDataGrid("grid", new ContactDataSource(), columns);
    add(grid);
   
    grid.setRowsPerPage(15);
  }
View Full Code Here

      IGridSortState gridSortState = query.getSortState();

      ISortState state = locator.getSortState();
      if (state != null) {
        DataGrid grid = ((DataGrid.IGridQuery) query).getDataGrid();
        setSortState(state, grid, gridSortState);
      }
    }

    result.setTotalCount(dataProvider.size());
View Full Code Here

            protected void onError(AjaxRequestTarget target, IModel rowModel, WebMarkupContainer rowComponent) {
                target.addComponent(feedback);
            }
        });

        final DataGrid grid = new DataGrid("grid", dataSource, columns) {
            @Override
            public void onItemSelectionChanged(IModel item, boolean newValue) {
                AjaxRequestTarget target = AjaxRequestTarget.get();
                if (target != null) {
                    target.addComponent(removeSelected);
                }
                super.onItemSelectionChanged(item, newValue);
            }
        };
        grid.setRowsPerPage(Integer.MAX_VALUE);
        grid.setAllowSelectMultiple(true);
        grid.setContentHeight(14, SizeUnit.EM);
        grid.setSelectToEdit(false);
        add(grid);

        add(removeSelected = new AjaxLink<Void>("removeSelected") {
            @Override
            public void onClick(AjaxRequestTarget target) {
                Collection<IModel> items = grid.getSelectedItems();
                if (items.size() > 0) {
                    for (IModel model : items) {
                        Entry entry = (Entry) model.getObject();
                        dataSource.removeEntry(entry);
                    }
                    grid.resetSelectedItems();
                    dataSource.storeToPageParameters();
                    grid.markAllItemsDirty();
                    grid.update();
                } else {
                    target.appendJavaScript("alert('" + getString("noItemsSelected") + "');");
                }
            }

            @Override
            public boolean isEnabled() {
                return !grid.getSelectedItems().isEmpty();
            }
        });
    }
View Full Code Here

                    }
                };
            }
        }.setInitialSize(5).setSizeUnit(SizeUnit.EM).setResizable(false));

        final DataGrid grid = new DataGrid("grid", dataSource, columns) {
            @Override
            public void onItemSelectionChanged(IModel item, boolean newValue) {
                AjaxRequestTarget target = AjaxRequestTarget.get();
                if (target != null) {
                    target.addComponent(removeSelected);
                }
                super.onItemSelectionChanged(item, newValue);
            }
        };

        grid.setRowsPerPage(Integer.MAX_VALUE);
        grid.setAllowSelectMultiple(true);
        grid.setContentHeight(14, SizeUnit.EM);
        grid.setSelectToEdit(false);
        add(grid);

        add(removeSelected = new AjaxLink<Void>("removeSelected") {
            @Override
            public void onClick(AjaxRequestTarget target) {
                Collection<IModel> items = grid.getSelectedItems();
                if (items.size() > 0) {
                    for (IModel model : items) {
                        Entry entry = (Entry) model.getObject();
                        dataSource.removeEntry(entry);
                    }
                    grid.resetSelectedItems();
                    dataSource.storeToPageParameters();
                    grid.markAllItemsDirty();
                    grid.update();
                } else {
                    target.appendJavaScript("alert('" + getString("noItemsSelected") + "');");
                }
            }

            @Override
            public boolean isEnabled() {
                return !grid.getSelectedItems().isEmpty();
            }
        });
    }
View Full Code Here

TOP

Related Classes of com.inmethod.grid.datagrid.DataGrid

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.