Example usage for com.google.gwt.view.client NoSelectionModel NoSelectionModel

List of usage examples for com.google.gwt.view.client NoSelectionModel NoSelectionModel

Introduction

In this page you can find the example usage for com.google.gwt.view.client NoSelectionModel NoSelectionModel.

Prototype

public NoSelectionModel() 

Source Link

Document

Constructs a NoSelectionModel without a key provider.

Usage

From source file:TaskListPresenter.java

License:Open Source License

private void initializeResultsTable() {
    if (resultsTable != null) {
        return;/*from  w  w  w .  j av a  2s . c o m*/
    }
    resultsTable = new CellTable<Task>(15, CellTableResources.get.resources);
    resultsTable.setSelectionModel(new NoSelectionModel<Task>());
    resultsTable.setPageSize(ProjectTasksPlace.DEFAULT_PAGESIZE);
    resultsTable.setStyleName("tasks");
    resultsTable.setRowStyles(new RowStyles<Task>() {
        public String getStyleNames(Task row, int rowIndex) {
            if (row.getStatus().getValue().equals("NEW")) {
                return "new";
            }
            return null;
        }
    });

    taskListView.pager.setDisplay(resultsTable);

    taskListColumnConfiguration = new TaskListColumnConfiguration(this, resultsTable, selectionModel);
    taskListColumnConfiguration.configureFromRequest();
    taskListColumnConfiguration.apply();
    taskListView.tasksPanel.add(resultsTable);

}

From source file:com.google.gwt.sample.expenses.client.ExpenseList.java

License:Apache License

/**
 * Create the {@link CellTable}./* w  w  w  . j  a va2  s . co m*/
 */
private void createTable() {
    CellTable.Resources resources = GWT.create(TableResources.class);
    table = new CellTable<ReportProxy>(20, resources);
    table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    Styles.Common common = Styles.common();
    table.addColumnStyleName(0, common.spacerColumn());
    table.addColumnStyleName(1, common.expenseListPurposeColumn());
    table.addColumnStyleName(3, common.expenseListDepartmentColumn());
    table.addColumnStyleName(4, common.expenseListCreatedColumn());
    table.addColumnStyleName(5, common.spacerColumn());

    // Add a selection model.
    final NoSelectionModel<ReportProxy> selectionModel = new NoSelectionModel<ReportProxy>();
    table.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            Object selected = selectionModel.getLastSelectedObject();
            if (selected != null && listener != null) {
                listener.onReportSelected((ReportProxy) selected);
            }
        }
    });

    // Spacer column.
    table.addColumn(new SpacerColumn<ReportProxy>());

    // Purpose column.
    addColumn("Purpose", new HighlightCell(), new GetValue<ReportProxy, String>() {
        public String getValue(ReportProxy object) {
            return object.getPurpose();
        }
    }, "purpose");

    // Notes column.
    addColumn("Notes", new HighlightCell(), new GetValue<ReportProxy, String>() {
        public String getValue(ReportProxy object) {
            return object.getNotes();
        }
    }, "notes");

    // Department column.
    addColumn("Department", new TextCell(), new GetValue<ReportProxy, String>() {
        public String getValue(ReportProxy object) {
            return object.getDepartment();
        }
    }, "department");

    // Created column.
    addColumn("Created", new DateCell(DateTimeFormat.getFormat("MMM dd yyyy")),
            new GetValue<ReportProxy, Date>() {
                public Date getValue(ReportProxy object) {
                    return object.getCreated();
                }
            }, "created");

    // Spacer column.
    table.addColumn(new SpacerColumn<ReportProxy>());
}

From source file:com.google.gwt.sample.expenses.client.MobileExpenseList.java

License:Apache License

public MobileExpenseList(final Listener listener, final ExpensesRequestFactory requestFactory) {
    this.listener = listener;
    this.requestFactory = requestFactory;
    expenseDataProvider = new AsyncDataProvider<ExpenseProxy>(new EntityProxyKeyProvider<ExpenseProxy>()) {
        @Override/*www.  j  a va  2s. c o m*/
        protected void onRangeChanged(HasData<ExpenseProxy> view) {
            requestExpenses();
        }
    };

    expenseList = new CellList<ExpenseProxy>(new ExpenseCell());
    expenseList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);

    expenseSelection = new NoSelectionModel<ExpenseProxy>();
    expenseList.setSelectionModel(expenseSelection);
    expenseSelection.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            listener.onExpenseSelected(expenseSelection.getLastSelectedObject());
        }
    });

    expenseDataProvider.addDataDisplay(expenseList);
    initWidget(expenseList);
}

From source file:com.google.gwt.sample.mobilewebapp.client.desktop.DesktopTaskListView.java

License:Apache License

/**
 * Construct a new {@link DesktopTaskListView}.
 *///from ww w  .j a va  2s. c  o m
public DesktopTaskListView() {

    // Create the CellTable.
    taskList = new DataGrid<TaskProxy>();
    taskList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    taskList.setWidth("100%");

    // Add the task name column.
    Column<TaskProxy, String> nameColumn = new TextColumn<TaskProxy>() {
        @Override
        public String getValue(TaskProxy object) {
            return (object == null) ? null : object.getName();
        }
    };
    taskList.addColumn(nameColumn, "Task");

    // Add the task notes column.
    Column<TaskProxy, String> notesColumn = new TextColumn<TaskProxy>() {
        @Override
        public String getValue(TaskProxy object) {
            return (object == null) ? "" : object.getNotes();
        }
    };
    taskList.addColumn(notesColumn, "Description");

    // Add the task due date column.
    Column<TaskProxy, Date> dateColumn = new Column<TaskProxy, Date>(new DateCell()) {
        @Override
        public Date getValue(TaskProxy object) {
            return (object == null) ? null : object.getDueDate();
        }
    };
    taskList.addColumn(dateColumn, "Due Date");

    /*
     * Inform the presenter when the user selects a task from the task list.
     */
    final NoSelectionModel<TaskProxy> selectionModel = new NoSelectionModel<TaskProxy>();
    taskList.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            // Edit the task.
            if (presenter != null) {
                presenter.selectTask(selectionModel.getLastSelectedObject());
            }
        }
    });

    // Initialize the widget.
    initWidget(taskList);
}

From source file:com.google.gwt.sample.mobilewebapp.client.mobile.MobileTaskListView.java

License:Apache License

/**
 * Construct a new {@link MobileTaskListView}.
 *//*w w w. java2s .  com*/
public MobileTaskListView() {

    // Create the CellList.
    CellListResources cellListRes = GWT.create(CellListResources.class);
    taskList = new CellList<TaskProxy>(new TaskProxyCell(), cellListRes);
    taskList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);

    /*
     * Inform the presenter when the user selects a task from the task list. We
     * use a NoSelectionModel because we don't want the task to remain selected,
     * we just want to be notified of the selection event.
     */
    final NoSelectionModel<TaskProxy> selectionModel = new NoSelectionModel<TaskProxy>();
    taskList.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            // Edit the task.
            if (presenter != null) {
                presenter.selectTask(selectionModel.getLastSelectedObject());
            }
        }
    });

    // Initialize the widget.
    initWidget(uiBinder.createAndBindUi(this));
}

From source file:com.gwtplatform.carstore.client.application.cars.CarsView.java

License:Apache License

private void initCarGrid() {
    carGrid = new CellTable<CarDto>();
    carGrid.setSelectionModel(new NoSelectionModel<CarDto>());

    pager = new SimplePager(SimplePager.TextLocation.CENTER);
    pager.setDisplay(carGrid);/*from  w w w  . jav a  2 s .c  o m*/
    pager.setPageSize(PAGE_SIZE);

    initDataColumns();
    initActionColumns();
}

From source file:com.gwtplatform.carstore.client.application.manufacturer.ManufacturerView.java

License:Apache License

private void initManufacturerGrid() {
    manufacturerGrid = new CellTable<ManufacturerDto>();
    manufacturerGrid.setSelectionModel(new NoSelectionModel<ManufacturerDto>());

    initDataColumns();/*from  w  w  w.  j  ava  2  s .c  o m*/
    initActionColumns();
}

From source file:com.gwtplatform.carstore.client.application.rating.RatingView.java

License:Apache License

private void initRatingGrid() {
    ratingGrid = new CellTable<RatingDto>();
    ratingGrid.setSelectionModel(new NoSelectionModel<RatingDto>());

    ratingColumnInitializer.initializeColumns(ratingGrid);
    initActionColumns();/*from w  w  w . j av a  2  s .  c  o m*/
}

From source file:com.gwtplatform.carstore.client.application.report.ReportView.java

License:Apache License

private void initCarGrid() {
    reportGrid = new CellTable<ManufacturerRatingDto>();
    reportGrid.setSelectionModel(new NoSelectionModel<ManufacturerRatingDto>());

    ratingsProvider.addDataDisplay(reportGrid);

    initDataColumns();/* w  ww .jav a 2s. c  o m*/
}

From source file:com.novartis.pcs.ontology.webapp.client.view.RelatedTermsView.java

License:Apache License

public RelatedTermsView(EventBus eventBus, OntoBrowserServiceAsync service) {
    super(eventBus, service);

    table.addStyleName("gwt-CellTable");
    table.setWidth("100%");
    table.setKeyboardPagingPolicy(KeyboardPagingPolicy.CURRENT_PAGE);
    table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    table.setSelectionModel(new NoSelectionModel<Relationship>());

    table.addColumn(new RelationshipColumn(), "Relationship");
    table.addColumn(new RelatedTermColumn(), "Related Term");
    table.addColumn(new StatusColumn(), "Status");

    panel.add(table);/*from   ww w  .  j  a va 2  s.  c  o  m*/
    initWidget(panel);
    addStyleName("padded-border vert-scroll fixed-height");

    eventBus.addHandler(ViewTermEvent.TYPE, this);
    eventBus.addHandler(RelationshipUpdatedEvent.TYPE, this);
    eventBus.addHandler(RelationshipDeletedEvent.TYPE, this);
}