Package org.gwtoolbox.widget.client.grid

Examples of org.gwtoolbox.widget.client.grid.DataGrid$HeaderCellHandler


        );
        columns.setFeatures("lastName", SORTABLE, HIDABLE);
        columns.setFeatures("age", SORTABLE, HIDABLE);
        columns.setAlignment("age", ALIGN_CENTER);

        final DataGrid grid = new DataGrid(columns);
        grid.setEditInPlace(true);
        grid.setSize("100%", "250px");
        grid.setSelectionModel(new SingleRowSelectionModel());

        Record record = new MapRecord()
                .setValue("firstName", "Uri")
                .setValue("lastName", "Boness")
                .setIntValue("age", 33)
                .setValue("gender", Gender.MALE)
                .setValue("birthTime", new Time(5))
                .setValue("dutch", false);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Daan")
                .setValue("lastName", "Boness")
                .setIntValue("age", 5)
                .setValue("gender", Gender.MALE)
                .setValue("birthTime", new Time(5))
                .setValue("dutch", true);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Lian")
                .setValue("lastName", "Boness")
                .setIntValue("age", 2)
                .setValue("gender", Gender.FEMALE)
                .setValue("birthTime", new Time(10))
                .setValue("dutch", true);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Lian")
                .setValue("lastName", "Boness")
                .setIntValue("age", 2)
                .setValue("gender", Gender.FEMALE)
                .setValue("birthTime", new Time(10))
                .setValue("dutch", true);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Lian")
                .setValue("lastName", "Boness")
                .setIntValue("age", 2)
                .setValue("gender", Gender.FEMALE)
                .setValue("birthTime", new Time(10))
                .setValue("dutch", true);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Lian")
                .setValue("lastName", "Boness")
                .setIntValue("age", 2)
                .setValue("gender", Gender.FEMALE)
                .setValue("birthTime", new Time(10))
                .setValue("dutch", true);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Lian")
                .setValue("lastName", "Boness")
                .setIntValue("age", 2)
                .setValue("gender", Gender.FEMALE)
                .setValue("birthTime", new Time(10))
                .setValue("dutch", true);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Lian")
                .setValue("lastName", "Boness")
                .setIntValue("age", 2)
                .setValue("gender", Gender.FEMALE)
                .setValue("birthTime", new Time(10))
                .setValue("dutch", true);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Lian")
                .setValue("lastName", "Boness")
                .setIntValue("age", 2)
                .setValue("gender", Gender.FEMALE)
                .setValue("birthTime", new Time(10))
                .setValue("dutch", true);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Lian")
                .setValue("lastName", "Boness")
                .setIntValue("age", 2)
                .setValue("gender", Gender.FEMALE)
                .setValue("birthTime", new Time(10))
                .setValue("dutch", true);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Lian")
                .setValue("lastName", "Boness")
                .setIntValue("age", 2)
                .setValue("gender", Gender.FEMALE)
                .setValue("birthTime", new Time(10))
                .setValue("dutch", true);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Lian")
                .setValue("lastName", "Boness")
                .setIntValue("age", 2)
                .setValue("gender", Gender.FEMALE)
                .setValue("birthTime", new Time(10))
                .setValue("dutch", true);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Lian")
                .setValue("lastName", "Boness")
                .setIntValue("age", 2)
                .setValue("gender", Gender.FEMALE)
                .setValue("birthTime", new Time(10))
                .setValue("dutch", true);
        grid.addRecord(record);

        record = new MapRecord()
                .setValue("firstName", "Lian")
                .setValue("lastName", "Boness")
                .setIntValue("age", 2)
                .setValue("gender", Gender.FEMALE)
                .setValue("birthTime", new Time(10))
                .setValue("dutch", true);
        grid.addRecord(record);


        final Label messageLabel = new Label();
        DOM.setStyleAttribute(messageLabel.getElement(), "marginTop", "10px");

        SimpleButton singleModelButton = new SimpleButton("Set Single Line Selection", new ClickHandler() {
            public void onClick(ClickEvent event) {
                SingleRowSelectionModel model = new SingleRowSelectionModel();
                model.addListener(new SingleRowSelectionModel.Listener() {
                    public void selectionCleared() {
                        messageLabel.setText("Selection cleared.");
                    }

                    public void rowSelected(int row, SingleRowSelection selection) {
                        messageLabel.setText("selected row " + row);
                    }
                });
                grid.setSelectionModel(model);
            }
        });

        SimpleButton multiModelButton = new SimpleButton("Set Multi-Line Selection", new ClickHandler() {
            public void onClick(ClickEvent event) {
                MultiRowSelectionModel model = new MultiRowSelectionModel();
                model.addListener(new MultiRowSelectionModel.Listener() {
                    public void selectionCleared() {
                        messageLabel.setText("Selection cleared.");
                    }

                    public void rowSelected(int row, MultiRowSelection model) {
                        messageLabel.setText("Selected rows: " + StringUtils.collectionToDelimetedString(model.getSelectedRows(), ", "));
                    }

                    public void rowUnselected(int row, MultiRowSelection model) {
                        messageLabel.setText("Selected rows: " + StringUtils.collectionToDelimetedString(model.getSelectedRows(), ", "));
                    }
                });
                grid.setSelectionModel(model);
            }
        });

        SimpleButton clearModelButton = new SimpleButton("Clear Selection Model", new ClickHandler() {
            public void onClick(ClickEvent event) {
                grid.clearSelectionModel();
            }
        });

        SimpleButton sortByAgeButton = new SimpleButton("Sort By Age (asc)", new ClickHandler() {
            public void onClick(ClickEvent event) {
                grid.sortByColumn("age", true);
            }
        });

        SimpleButton sortByAgeDescButton = new SimpleButton("Sort By Age (desc)", new ClickHandler() {
            public void onClick(ClickEvent event) {
                grid.sortByColumn("age", false);
            }
        });

        HorizontalPanel buttons = new HorizontalPanel();
        buttons.add(singleModelButton);
View Full Code Here


* @author Uri Boness
*/
public abstract class MultiRecordSelectionListener implements MultiRowSelection.Listener {

    public final void rowSelected(int row, MultiRowSelection model) {
        DataGrid grid = model.getTable();
        List<Integer> rows = model.getSelectedRows();
        List<Record> records = new ArrayList<Record>(rows.size());
        for (Integer selectedRow : rows) {
            records.add(grid.getRecordInRow(selectedRow));
        }
        selectionChanged(records);
    }
View Full Code Here

        }
        selectionChanged(records);
    }

    public final void rowUnselected(int row, MultiRowSelection model) {
        DataGrid grid = model.getTable();
        List<Integer> rows = model.getSelectedRows();
        List<Record> records = new ArrayList<Record>(rows.size());
        for (Integer selectedRow : rows) {
            records.add(grid.getRecordInRow(selectedRow));
        }
        selectionChanged(records);
    }
View Full Code Here

* @author Uri Boness
*/
public abstract class SingleRecordSelectionListener implements SingleRowSelectionModel.Listener {

    public final void rowSelected(int row, SingleRowSelection selection) {
        DataGrid grid = selection.getTable();
        Record record = grid.getRecordInRow(row);
        recordSelected(record);
    }
View Full Code Here

TOP

Related Classes of org.gwtoolbox.widget.client.grid.DataGrid$HeaderCellHandler

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.