List of usage examples for com.google.gwt.user.cellview.client SimplePager SimplePager
public SimplePager(TextLocation location, Resources resources, boolean showFastForwardButton, final int fastForwardRows, boolean showLastPageButton)
From source file:cimav.client.view.catalogos.tabulador.NivelesUi.java
private void buildGrid() { // super.onLoad(); //To change body of generated methods, choose Tools | Templates. /*/*from www . ja va 2 s . c om*/ * Set a key provider that provides a unique key for each contact. If key is * used to identify contacts when fields (such as the name and address) * change. */ dataGrid = new CellTable<>(NivelesProvider.get().getDataProvider()); //cellTable.setWidth("100%"); //cellTable.setHeight("100%"); /* * Do not refresh the headers every time the data is updated. The footer * depends on the current data, so we do not disable auto refresh on the * footer. */ dataGrid.setAutoHeaderRefreshDisabled(true); // Set the message to display when the table is empty. dataGrid.setEmptyTableWidget(new Label("No hay Niveles")); // Attach a column sort handler to the ListDataProvider to sort the list. ColumnSortEvent.ListHandler<Tabulador> sortHandler = new ColumnSortEvent.ListHandler<>( NivelesProvider.get().getDataProvider().getList()); dataGrid.addColumnSortHandler(sortHandler); // Create a Pager to control the table. SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class); pager = new SimplePager(SimplePager.TextLocation.CENTER, pagerResources, false, 0, true); pager.setDisplay(dataGrid); dataGrid.setPageSize(50); // Add a selection model so we can select cells. final SelectionModel<Tabulador> selectionModel = new SingleSelectionModel<>( NivelesProvider.get().getDataProvider()); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { //System.out.println("123> " + event.getSource() + " - " + event.getAssociatedType()); if (event.getSource() instanceof SingleSelectionModel) { SingleSelectionModel selecter = (SingleSelectionModel) event.getSource(); Tabulador sel = (Tabulador) selecter.getSelectedObject(); GWT.log("Sel>> " + sel); } } }); dataGrid.setSelectionModel(selectionModel); dataGrid.addDomHandler(new DoubleClickHandler() { @SuppressWarnings("unchecked") @Override public void onDoubleClick(DoubleClickEvent event) { // DataGrid<Departamento> grid = (DataGrid<Departamento>) event.getSource(); // int row = grid.getKeyboardSelectedRow(); // Departamento item = grid.getVisibleItem(row); } }, DoubleClickEvent.getType()); initTableColumns(sortHandler); // Add the CellList to the adapter in the database. NivelesProvider.get().getDataProvider().addDataDisplay(dataGrid); }
From source file:com.adamantium.company.gwtp.client.application.list.ListView.java
License:Apache License
private void buildPager() { SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class); pager = new SimplePager(SimplePager.TextLocation.CENTER, pagerResources, false, 0, true); pager.setDisplay(cellTable);// w ww. ja v a 2 s . c om }
From source file:com.Administration.client.Administration.java
License:Apache License
/** * ? UI/*from w ww. ja va 2 s.c o m*/ */ public void onModuleLoad() { label = new HTML(); // ? ? label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); loginLabel = new HTML(); // ? ? loginLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); dialog = new PasswordDialog(); // list = new LinkedList<>(); // ? ? ProvidesKey<LinkData> KEY_PROVIDER = new ProvidesKey<LinkData>() { // - ?? @Override public Object getKey(LinkData item) { return item == null ? null : item.getId(); } }; cellTable = new CellTable<>(KEY_PROVIDER); // ? dataProvider = new ListDataProvider<>(); // dataProvider.addDataDisplay(cellTable); // ?, ???? ? sortHandler = new ListHandler<>(list); // ? cellTable.addColumnSortHandler(sortHandler); // ? SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class); pager = new SimplePager(SimplePager.TextLocation.CENTER, pagerResources, false, 0, true); // pager - ? pager.setDisplay(cellTable); // ?, pager ? ? initTable(); // ? cellTable.setWidth("100%"); cellTable.setHeight("80%"); cellTable.setAutoHeaderRefreshDisabled(true); cellTable.setAutoFooterRefreshDisabled(true); // ? VerticalPanel VP = new VerticalPanel(); VP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); VP.add(cellTable); VP.add(pager); logoutButton = new Button("Logout"); // ? HorizontalPanel loginHP = new HorizontalPanel(); loginHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); loginHP.setSpacing(5); loginHP.add(loginLabel); loginHP.add(logoutButton); logoutButton.addClickHandler(new ClickHandler() { // @Override public void onClick(ClickEvent event) { // Cookies.removeCookie(cookieName); // ? // ? ??? loginLabel.setHTML(""); loginLabel.setVisible(false); label.setHTML(""); cellTable.setVisible(false); pager.setVisible(false); logoutButton.setVisible(false); dataProvider.getList().clear(); // ? dialog.show(); // dialog.center(); } }); logoutButton.setVisible(false); // RootPanel.get("Login").add(loginHP); RootPanel.get("Data").add(VP); RootPanel.get("Data").add(label); // ? cellTable.setVisible(false); pager.setVisible(false); dialog.Login(); }
From source file:com.appspot.socialinquirer.client.view.ActivityViewImpl.java
License:Apache License
/** * Instantiates a new activity view impl. * * @param constants the constants//from w w w . ja va 2s. c om * @param master the master */ public ActivityViewImpl(final EverScribeConstants constants, final boolean master) { this.constants = constants; activitiesTable = new CellTable<NamedBean>(); SimplePager.Resources linkedHubPagerResources = GWT.create(SimplePager.Resources.class); activitiesPaginator = new SimplePager(TextLocation.CENTER, linkedHubPagerResources, false, 0, true); activitiesPaginator.setDisplay(activitiesTable); activitiesPaginator.setPageSize(5); activitiesTable.setPageSize(5); final SelectionModel<NamedBean> activitiesSelectionModel = new SingleSelectionModel<NamedBean>( new KeyProvider<NamedBean>()); activitiesTable.setSelectionModel(activitiesSelectionModel, DefaultSelectionEventManager.<NamedBean>createCheckboxManager()); initTableColumns(activitiesTable, activitiesSelectionModel); initWidget(uiBinder.createAndBindUi(ActivityViewImpl.this)); }
From source file:com.appspot.socialinquirer.client.view.HomeViewImpl.java
License:Apache License
/** * Instantiates a new home view impl.// w ww. j a va2 s. c o m * * @param constants the constants * @param oracle the oracle */ public HomeViewImpl(final EverScribeConstants constants, SingleWordSuggestOracle oracle) { this.constants = constants; questionsTable = new CellTable<Question>(); SimplePager.Resources ideasPagerResources = GWT.create(SimplePager.Resources.class); questionsPaginator = new SimplePager(TextLocation.CENTER, ideasPagerResources, false, 0, true); questionsPaginator.setDisplay(questionsTable); final SelectionModel<Question> questionsSelectionModel = new SingleSelectionModel<Question>( new KeyProvider<Question>()); questionsTable.setSelectionModel(questionsSelectionModel, DefaultSelectionEventManager.<Question>createCheckboxManager()); initTableColumns(questionsTable, questionsSelectionModel); questionsSearchBox = new SuggestBox(oracle); templatesTable = new CellTable<Message>(); SimplePager.Resources linkedHubPagerResources = GWT.create(SimplePager.Resources.class); templatesPaginator = new SimplePager(TextLocation.CENTER, linkedHubPagerResources, false, 0, true); templatesPaginator.setPageSize(5); templatesTable.setPageSize(5); templatesPaginator.setDisplay(templatesTable); // final SelectionModel<Message> linkedHubConnectionsSelectionModel = new MultiSelectionModel<Message>( // new KeyProvider<Message>()); // templatesTable.setSelectionModel(linkedHubConnectionsSelectionModel, // DefaultSelectionEventManager.<Message>createCheckboxManager()); initTableColumns(templatesTable); initWidget(uiBinder.createAndBindUi(this)); searchResults.setVisible(false); introduction.setVisible(true); feeds.setVisible(false); viewMenu.setCommand(new Command() { @Override public void execute() { presenter.onViewClicked(getSelectedQuestion()); } }); // followMenu.setCommand(new Command() { // @Override // public void execute() { // presenter.onFollowClicked(getSelectedQuestion()); // } // }); analyzeMenu.setCommand(new Command() { @Override public void execute() { presenter.onAnalyzeClicked(getSelectedQuestion()); } }); summarizeMenu.setCommand(new Command() { @Override public void execute() { presenter.onSummarizeClicked(getSelectedQuestion()); } }); suggestAnswerMenu.setCommand(new Command() { @Override public void execute() { presenter.onSuggestAnswerClicked(getSelectedQuestion()); } }); spellCheckMenu.setCommand(new Command() { @Override public void execute() { presenter.onSpellCheckClicked(getSelectedQuestion()); } }); speakMenu.setCommand(new Command() { @Override public void execute() { presenter.onSpeakClicked(getSelectedQuestion()); } }); runCodeMenu.setCommand(new Command() { @Override public void execute() { presenter.onRunCodeClicked(getSelectedQuestion()); } }); for (final TextLanguage language : TextLanguage.values()) { MenuItem menuItem = new MenuItem(language.name(), new Command() { @Override public void execute() { presenter.onTranslateClicked(getSelectedQuestion(), language); } }); menuItem.setEnabled(true); languageBar.addItem(menuItem); } }
From source file:com.appspot.socialinquirer.client.view.NetworkViewImpl.java
License:Apache License
/** * Instantiates a new network view impl. * * @param constants the constants//from w w w .j ava 2 s . c o m */ public NetworkViewImpl(EverScribeConstants constants) { this.constants = constants; GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { Window.alert("Code download failed"); } public void onSuccess() { connectionsTable = new CellTable<User>(); SimplePager.Resources linkedHubPagerResources = GWT.create(SimplePager.Resources.class); connectionsPaginator = new SimplePager(TextLocation.CENTER, linkedHubPagerResources, false, 0, true); connectionsPaginator.setDisplay(connectionsTable); final SelectionModel<User> linkedHubConnectionsSelectionModel = new SingleSelectionModel<User>( new KeyProvider<User>()); connectionsTable.setSelectionModel(linkedHubConnectionsSelectionModel, DefaultSelectionEventManager.<User>createCheckboxManager()); initTableColumns(connectionsTable, linkedHubConnectionsSelectionModel); initWidget(uiBinder.createAndBindUi(NetworkViewImpl.this)); } }); }
From source file:com.appspot.socialinquirer.client.view.PagesViewImpl.java
License:Apache License
/** * Instantiates a new pages view impl./*from www . jav a2s . c o m*/ * * @param constants the constants * @param master the master */ public PagesViewImpl(final EverScribeConstants constants, final boolean master) { this.constants = constants; templatesTable = new CellTable<Page>(); SimplePager.Resources linkedHubPagerResources = GWT.create(SimplePager.Resources.class); templatesPaginator = new SimplePager(TextLocation.CENTER, linkedHubPagerResources, false, 0, true); templatesPaginator.setPageSize(5); templatesTable.setPageSize(5); templatesPaginator.setDisplay(templatesTable); final SelectionModel<Page> linkedHubConnectionsSelectionModel = new MultiSelectionModel<Page>( new KeyProvider<Page>()); templatesTable.setSelectionModel(linkedHubConnectionsSelectionModel, DefaultSelectionEventManager.<Page>createCheckboxManager()); initTableColumns(templatesTable, linkedHubConnectionsSelectionModel); initWidget(uiBinder.createAndBindUi(PagesViewImpl.this)); }
From source file:com.appspot.socialinquirer.client.view.QuestionsViewImpl.java
License:Apache License
/** * Instantiates a new questions view impl. * * @param constants the constants/*from w w w .ja v a 2 s. co m*/ */ public QuestionsViewImpl(final EverScribeConstants constants) { this.constants = constants; questionsTable = new CellTable<Question>(); SimplePager.Resources ideasPagerResources = GWT.create(SimplePager.Resources.class); questionsPaginator = new SimplePager(TextLocation.CENTER, ideasPagerResources, false, 0, true); questionsPaginator.setDisplay(questionsTable); final SelectionModel<Question> questionsSelectionModel = new SingleSelectionModel<Question>( new KeyProvider<Question>()); questionsTable.setSelectionModel(questionsSelectionModel, DefaultSelectionEventManager.<Question>createCheckboxManager()); initTableColumns(questionsTable, questionsSelectionModel); initWidget(uiBinder.createAndBindUi(this)); // menu commands viewMenu.setCommand(new Command() { @Override public void execute() { presenter.onViewClicked(getSelectedQuestion()); } }); // followMenu.setCommand(new Command() { // @Override // public void execute() { // presenter.onFollowClicked(getSelectedQuestion()); // } // }); analyzeMenu.setCommand(new Command() { @Override public void execute() { presenter.onAnalyzeClicked(getSelectedQuestion()); } }); summarizeMenu.setCommand(new Command() { @Override public void execute() { presenter.onSummarizeClicked(getSelectedQuestion()); } }); suggestAnswerMenu.setCommand(new Command() { @Override public void execute() { presenter.onSuggestAnswerClicked(getSelectedQuestion()); } }); spellCheckMenu.setCommand(new Command() { @Override public void execute() { presenter.onSpellCheckClicked(getSelectedQuestion()); } }); speakMenu.setCommand(new Command() { @Override public void execute() { presenter.onSpeakClicked(getSelectedQuestion()); } }); runCodeMenu.setCommand(new Command() { @Override public void execute() { presenter.onRunCodeClicked(getSelectedQuestion()); } }); for (final TextLanguage language : TextLanguage.values()) { MenuItem menuItem = new MenuItem(language.name(), new Command() { @Override public void execute() { presenter.onTranslateClicked(getSelectedQuestion(), language); } }); menuItem.setEnabled(true); languageBar.addItem(menuItem); } }
From source file:com.appspot.socialinquirer.client.view.QuestionViewImpl.java
License:Apache License
/** * Instantiates a new question view impl. * * @param constants the constants//from w w w . j a v a 2s .com */ public QuestionViewImpl(final EverScribeConstants constants) { this.constants = constants; answersTable = new CellTable<Answer>(); SimplePager.Resources ideasPagerResources = GWT.create(SimplePager.Resources.class); answersPaginator = new SimplePager(TextLocation.CENTER, ideasPagerResources, false, 0, true); answersPaginator.setDisplay(answersTable); final SelectionModel<Answer> answerSelectionModel = new SingleSelectionModel<Answer>( new KeyProvider<Answer>()); answersTable.setSelectionModel(answerSelectionModel, DefaultSelectionEventManager.<Answer>createCheckboxManager()); initTableColumns(answersTable, answerSelectionModel); initWidget(uiBinder.createAndBindUi(this)); // followMenu.setCommand(new Command() { // @Override // public void execute() { // presenter.onFollowClicked(question); // } // }); analyzeMenu.setCommand(new Command() { @Override public void execute() { presenter.onAnalyzeClicked(question); } }); summarizeMenu.setCommand(new Command() { @Override public void execute() { presenter.onSummarizeClicked(question); } }); suggestAnswerMenu.setCommand(new Command() { @Override public void execute() { presenter.onSuggestAnswerClicked(question); } }); spellCheckMenu.setCommand(new Command() { @Override public void execute() { presenter.onSpellCheckClicked(question); } }); speakMenu.setCommand(new Command() { @Override public void execute() { presenter.onSpeakClicked(question); } }); runCodeMenu.setCommand(new Command() { @Override public void execute() { presenter.onRunCodeClicked(question); } }); followQuestionAuthorMenu.setCommand(new Command() { @Override public void execute() { presenter.onFollowUserClicked(questionAuthor.getText()); } }); // followAnswerAuthorMenu.setCommand(new Command() { // @Override // public void execute() { // presenter.onFollowUserClicked(answerAuthor.getText()); // } // }); for (final TextLanguage language : TextLanguage.values()) { MenuItem menuItem = new MenuItem(language.name(), new Command() { @Override public void execute() { presenter.onTranslateClicked(question, language); } }); menuItem.setEnabled(true); languageBar.addItem(menuItem); } answers.setAnimationEnabled(true); }
From source file:com.appspot.socialinquirer.client.view.QuizViewImpl.java
License:Apache License
/** * Instantiates a new quiz view impl./* w w w .jav a2s . c o m*/ * * @param constants the constants */ public QuizViewImpl(final EverScribeConstants constants) { this.constants = constants; answersTable = new CellTable<Answer>(); SimplePager.Resources ideasPagerResources = GWT.create(SimplePager.Resources.class); answersPaginator = new SimplePager(TextLocation.CENTER, ideasPagerResources, false, 0, true); answersPaginator.setDisplay(answersTable); final SelectionModel<Answer> answerSelectionModel = new SingleSelectionModel<Answer>( new KeyProvider<Answer>()); answersTable.setSelectionModel(answerSelectionModel, DefaultSelectionEventManager.<Answer>createCheckboxManager()); initTableColumns(answersTable, answerSelectionModel); initWidget(uiBinder.createAndBindUi(this)); }