List of usage examples for com.google.gwt.view.client CellPreviewEvent getValue
public T getValue()
From source file:eu.zeigermann.gwt.demo.client.list.DefaultShoppingListView.java
License:Apache License
private void initTable(ListDataProvider<ShoppingList> dataProvider) { final ProvidesKey<ShoppingList> keyProvider = new ProvidesKey<ShoppingList>() { public Object getKey(ShoppingList list) { return list == null ? null : list.getId(); }//from w ww . j ava 2 s.c o m }; cellTable = new CellTable<ShoppingList>(keyProvider); dataProvider.addDataDisplay(cellTable); cellTable.setPageSize(5); cellTable.sinkEvents(Event.ONDBLCLICK); final MultiSelectionModel<ShoppingList> selectionModel = new MultiSelectionModel<ShoppingList>(keyProvider); cellTable.setSelectionModel(selectionModel, new CellPreviewEvent.Handler<ShoppingList>() { @Override public void onCellPreview(CellPreviewEvent<ShoppingList> event) { int eventType = Event.getTypeInt(event.getNativeEvent().getType()); if (eventType == Event.ONDBLCLICK) { ShoppingList list = event.getValue(); presenter.editItems(list); } } }); // styles // bootstrap cellTable.addStyleName("table"); cellTable.addStyleName("table-bordered"); // makes selection invisible on every even row // cellTable.addStyleName("table-striped"); // columns addNameColumn(dataProvider); addEditColumn(); addDeleteColumn(); }
From source file:eu.zeigermann.gwt.demo.client.shop.DefaultShopView.java
License:Apache License
private void initTable(ListDataProvider<Shop> dataProvider) { final ProvidesKey<Shop> keyProvider = new ProvidesKey<Shop>() { public Object getKey(Shop list) { return list == null ? null : list.getId(); }/*from w w w . j av a2 s.c om*/ }; cellTable = new CellTable<Shop>(keyProvider); dataProvider.addDataDisplay(cellTable); cellTable.setPageSize(5); final MultiSelectionModel<Shop> selectionModel = new MultiSelectionModel<Shop>(keyProvider); cellTable.setSelectionModel(selectionModel, new CellPreviewEvent.Handler<Shop>() { @Override public void onCellPreview(CellPreviewEvent<Shop> event) { int eventType = Event.getTypeInt(event.getNativeEvent().getType()); if (eventType == Event.ONCLICK) { Shop list = event.getValue(); presenter.edit(list); } } }); // styles // bootstrap cellTable.addStyleName("table"); cellTable.addStyleName("table-bordered"); // makes selection invisible on every even row // cellTable.addStyleName("table-striped"); // columns addNameColumn(dataProvider); addEditColumn(); addDeleteColumn(); }
From source file:org.apache.hupa.client.activity.MessageListActivity.java
License:Apache License
@Override public void start(AcceptsOneWidget container, final EventBus eventBus) { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x2_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x3_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x30x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x30x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x20x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x4"); InstrumentationLoggerProvider.get()//from ww w .ja v a 2s . com .instrument("org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x00x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x00x0"); refreshMessagesTimer.scheduleRepeating(5 * 60 * 1000); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x10x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x10x00x0"); container.setWidget(display.asWidget()); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x20x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x2_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x20x1"); if (!first) { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x20x10x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x20x10x0"); display.refresh(); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x20x10x10x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x20x10x1"); first = false; } InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x3_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x00x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x0"); rf.sessionRequest().getUser().fire(new Receiver<User>() { @Override public void onSuccess(User u) { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed617"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x20x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x3_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x2"); if (u == null) { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x30x00x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x30x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x30x00x0"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x30x00x10x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x30x00x10x0"); onFailure(null); } else { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x30x00x2"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x30x00x20x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x193aed6170x30x00x20x00x0"); user = u; } } @Override public void onFailure(ServerFailure error) { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x17148ac25"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x17148ac250x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x17148ac250x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x17148ac250x20x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x17148ac250x3_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x30x00x10x17148ac250x2"); } }); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x4_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x00x1"); this.registerHandler(display.getGrid().addCellPreviewHandler(new Handler<Message>() { @Override public void onCellPreview(final CellPreviewEvent<Message> event) { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x20x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x20x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x20x10x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x3_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x2_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x20x10x1"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f34364"); if (hasClickedButFirstCol(event)) { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x30x00x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x30x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x30x0"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x30x00x10x00x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x30x00x10x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d687191a1d0x40x40x00x10x10x111f343640x30x00x10x0"); onMessageSelected(event.getValue()); } } })); }
From source file:org.codesearch.searcher.client.ui.searchview.SearchViewImpl.java
License:Open Source License
private void initResultTable() { resultTable = new CellTable<SearchResultDto>(PAGE_SIZE); resultTable.addColumn(new TextColumn<SearchResultDto>() { /**/*from w w w. j av a 2s . c o m*/ * {@inheritDoc} */ @Override public String getValue(SearchResultDto dto) { return relevanceFormatter.format(dto.getRelevance()); } }, RELEVANCE_TITLE); resultTable.addColumn(new TextColumn<SearchResultDto>() { /** * {@inheritDoc} */ @Override public String getValue(SearchResultDto object) { return object.getFilePath(); } }, PATH_TITLE); resultTable.addColumn(new TextColumn<SearchResultDto>() { /** * {@inheritDoc} */ @Override public String getValue(SearchResultDto dto) { return dto.getRepository(); } }, REPOSITORY_TITLE); resultTable.addColumn(new TextColumn<SearchResultDto>() { /** * {@inheritDoc} */ @Override public String getValue(SearchResultDto dto) { return dto.getLastRevision(); } }, REVISION_TITLE); final SelectionModel<SearchResultDto> selectionModel = new NoSelectionModel<SearchResultDto>(); resultTable.setSelectionModel(selectionModel); resultTable.addCellPreviewHandler(new CellPreviewEvent.Handler<SearchResultDto>() { @Override public void onCellPreview(CellPreviewEvent<SearchResultDto> event) { SearchResultDto dto = event.getValue(); boolean open = false; boolean newTab = false; if ("click".equals(event.getNativeEvent().getType())) { if ((NativeEvent.BUTTON_LEFT & event.getNativeEvent().getButton()) == NativeEvent.BUTTON_LEFT) { open = true; } if ((NativeEvent.BUTTON_MIDDLE & event.getNativeEvent().getButton()) == NativeEvent.BUTTON_MIDDLE) { open = true; newTab = true; } } else if ("keyup".equals(event.getNativeEvent().getType())) { if (KeyCodes.KEY_ENTER == event.getNativeEvent().getKeyCode()) { open = true; } } if (open) { // either CTRL+CLICK or CTRL+ENTER open a new tab if (event.getNativeEvent().getCtrlKey()) { newTab = true; } Place target = new FilePlace(dto.getRepository(), dto.getFilePath(), searchBox.getValue(), 1); if (newTab) { String url = Window.Location.getPath() + "#"; url += ClientFactory.getDefaultFactory().getHistoryMapper().getToken(target); Window.open(url, "_blank", ""); } else { presenter.goTo(target); } } } }); // Create a pager to control the table. SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class); resultTablePager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true); resultTablePager.setDisplay(resultTable); searchResultDataProvider = new ListDataProvider<SearchResultDto>(); searchResultDataProvider.addDataDisplay(resultTable); }
From source file:org.gss_project.gss.web.client.GSSSelectionEventManager.java
License:Open Source License
/** * Handle an event that could cause a value to be selected for a * {@link MultiSelectionModel}. This overloaded method adds support for both * the control and shift keys. If the shift key is held down, all rows between * the previous selected row and the current row are selected. * /* w ww . j a va 2 s. co m*/ * @param event the {@link CellPreviewEvent} that triggered selection * @param action the action to handle * @param selectionModel the {@link SelectionModel} to update */ protected void handleMultiSelectionEvent(CellPreviewEvent<T> event, SelectAction action, MultiSelectionModel<? super T> selectionModel) { NativeEvent nativeEvent = event.getNativeEvent(); String type = nativeEvent.getType(); boolean rightclick = "mousedown".equals(type) && nativeEvent.getButton() == NativeEvent.BUTTON_RIGHT; if (rightclick) { boolean shift = nativeEvent.getShiftKey(); boolean ctrlOrMeta = nativeEvent.getCtrlKey() || nativeEvent.getMetaKey(); boolean clearOthers = (translator == null) ? !ctrlOrMeta : translator.clearCurrentSelection(event); if (action == null || action == SelectAction.DEFAULT) { action = ctrlOrMeta ? SelectAction.TOGGLE : SelectAction.SELECT; } //if the row is selected then do nothing if (selectionModel.isSelected(event.getValue())) { return; } doMultiSelection(selectionModel, event.getDisplay(), event.getIndex(), event.getValue(), action, shift, clearOthers); } else if ("click".equals(type)) { /* * Update selection on click. Selection is toggled only if the user * presses the ctrl key. If the user does not press the control key, * selection is additive. */ boolean shift = nativeEvent.getShiftKey(); boolean ctrlOrMeta = nativeEvent.getCtrlKey() || nativeEvent.getMetaKey(); boolean clearOthers = (translator == null) ? !ctrlOrMeta : translator.clearCurrentSelection(event); if (action == null || action == SelectAction.DEFAULT) { action = ctrlOrMeta ? SelectAction.TOGGLE : SelectAction.SELECT; } doMultiSelection(selectionModel, event.getDisplay(), event.getIndex(), event.getValue(), action, shift, clearOthers); if (ctrlOrMeta) { event.setCanceled(true); } } else if ("keyup".equals(type)) { int keyCode = nativeEvent.getKeyCode(); if (keyCode == 32) { /* * Update selection when the space bar is pressed. The spacebar always * toggles selection, regardless of whether the control key is pressed. */ boolean shift = nativeEvent.getShiftKey(); boolean clearOthers = (translator == null) ? false : translator.clearCurrentSelection(event); if (action == null || action == SelectAction.DEFAULT) { action = SelectAction.TOGGLE; } doMultiSelection(selectionModel, event.getDisplay(), event.getIndex(), event.getValue(), action, shift, clearOthers); } } }
From source file:org.gss_project.gss.web.client.GSSSelectionEventManager.java
License:Open Source License
/** * Handle an event that could cause a value to be selected. This method works * for any {@link SelectionModel}. Pressing the space bar or ctrl+click will * toggle the selection state. Clicking selects the row if it is not selected. * /*from ww w. j a v a2 s .c o m*/ * @param event the {@link CellPreviewEvent} that triggered selection * @param action the action to handle * @param selectionModel the {@link SelectionModel} to update */ protected void handleSelectionEvent(CellPreviewEvent<T> event, SelectAction action, SelectionModel<? super T> selectionModel) { // Handle selection overrides. T value = event.getValue(); if (action != null) { switch (action) { case IGNORE: return; case SELECT: selectionModel.setSelected(value, true); return; case DESELECT: selectionModel.setSelected(value, false); return; case TOGGLE: selectionModel.setSelected(value, !selectionModel.isSelected(value)); return; } } // Handle default selection. NativeEvent nativeEvent = event.getNativeEvent(); String type = nativeEvent.getType(); if ("click".equals(type)) { if (nativeEvent.getCtrlKey() || nativeEvent.getMetaKey()) { // Toggle selection on ctrl+click. selectionModel.setSelected(value, !selectionModel.isSelected(value)); } else { // Select on click. selectionModel.setSelected(value, true); } } else if ("keyup".equals(type)) { // Toggle selection on space. int keyCode = nativeEvent.getKeyCode(); if (keyCode == 32) { selectionModel.setSelected(value, !selectionModel.isSelected(value)); } } }
From source file:org.jboss.as.console.client.administration.role.form.RolesFormItem.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public Widget asWidget() { // table/*from w ww. java 2 s. co m*/ DefaultCellTable<Role> table = new DefaultCellTable<Role>(pageSize, keyProvider); table.setSelectionModel(selectionModel, DefaultSelectionEventManager .createCustomManager(new DefaultSelectionEventManager.CheckboxEventTranslator<Role>() { @Override public SelectAction translateSelectionEvent(CellPreviewEvent<Role> event) { SelectAction action = super.translateSelectionEvent(event); if (action.equals(SelectAction.IGNORE)) { Role role = event.getValue(); boolean selected = selectionModel.isSelected(role); return selected ? SelectAction.DESELECT : SelectAction.SELECT; } return action; } })); dataProvider.addDataDisplay(table); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(final SelectionChangeEvent event) { value.clear(); value.addAll(selectionModel.getSelectedSet()); setModified(true); } }); // columns Column<Role, Boolean> checkColumn = new Column<Role, Boolean>(new CheckboxCell(true, false)) { @Override public Boolean getValue(Role role) { // Get the value from the selection model. return selectionModel.isSelected(role); } }; TextColumn<Role> nameColumn = new TextColumn<Role>() { @Override public String getValue(Role role) { return role.getName(); } }; table.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>")); table.setColumnWidth(checkColumn, 40, PX); table.addColumn(nameColumn, Console.CONSTANTS.common_label_name()); // pager DefaultPager pager = new DefaultPager(); pager.setWidth("auto"); pager.setDisplay(table); // panels VerticalPanel content = new VerticalPanel(); content.setWidth("95%"); content.add(table); content.add(pager); wrapper = new FormItemPanelWrapper(content, this); return wrapper; }
From source file:org.jboss.as.console.client.v3.deployment.wizard.AssignContentDialog.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public Widget asWidget() { VerticalPanel root = new VerticalPanel(); root.setStyleName("window-content"); errorMessages = new HTML(); errorMessages.setVisible(false);// w w w . j av a2s.co m errorMessages.setStyleName("error-panel"); intro = new Label(); intro.getElement().getStyle().setMarginBottom(10, PX); root.add(new HTML("<h3>" + Console.CONSTANTS.assignContent() + "</h3>")); root.add(errorMessages); root.add(intro); // provider, selection model ProvidesKey<String> keyProvider = item -> item; dataProvider = new ListDataProvider<>(keyProvider); selectionModel = new MultiSelectionModel<>(keyProvider); // table table = new DefaultCellTable<>(5, keyProvider); table.setSelectionModel(selectionModel, DefaultSelectionEventManager .createCustomManager(new DefaultSelectionEventManager.CheckboxEventTranslator<String>() { @Override public SelectAction translateSelectionEvent(CellPreviewEvent<String> event) { SelectAction action = super.translateSelectionEvent(event); if (action.equals(SelectAction.IGNORE)) { String serverGroup = event.getValue(); boolean selected = selectionModel.isSelected(serverGroup); return selected ? SelectAction.DESELECT : SelectAction.SELECT; } return action; } })); dataProvider.addDataDisplay(table); root.add(table); // columns Column<String, Boolean> checkColumn = new Column<String, Boolean>(new CheckboxCell(true, false)) { @Override public Boolean getValue(String serverGroup) { return selectionModel.isSelected(serverGroup); } }; TextColumn<String> nameColumn = new TextColumn<String>() { @Override public String getValue(String serverGroup) { return serverGroup; } }; table.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>")); table.setColumnWidth(checkColumn, 40, PX); table.addColumn(nameColumn, "Server Group"); // pager DefaultPager pager = new DefaultPager(); pager.setWidth("auto"); pager.setDisplay(table); root.add(pager); // enable assignments? Form<Object> form = new Form<>(Object.class); // form is just used for layout reasons CheckBoxItem enable = new CheckBoxItem("enable", Console.CONSTANTS.enableAssignmentOnSelectedServerGroups()); form.setFields(enable); root.add(form.asWidget()); return new TrappedFocusPanel(new WindowContentBuilder(root, new DialogueOptions(Console.CONSTANTS.common_label_assign(), event -> { Set<String> selectedSet = selectionModel.getSelectedSet(); if (selectedSet.isEmpty()) { errorMessages.setText(Console.CONSTANTS.pleaseSelectServerGroup()); errorMessages.setVisible(true); } else { close(); presenter.assignContent(content, selectedSet, enable.getValue(), unmanaged); } }, Console.CONSTANTS.common_label_cancel(), event -> close())).build()); }
From source file:org.jboss.as.console.client.v3.deployment.wizard.UnassignContentDialog.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public Widget asWidget() { VerticalPanel root = new VerticalPanel(); root.setStyleName("window-content"); errorMessages = new HTML(); errorMessages.setVisible(false);// w w w .j a v a 2s. c o m errorMessages.setStyleName("error-panel"); intro = new Label(); intro.getElement().getStyle().setMarginBottom(10, PX); root.add(new HTML("<h3>Unassign Content</h3>")); root.add(errorMessages); root.add(intro); // provider, selection model ProvidesKey<String> keyProvider = item -> item; dataProvider = new ListDataProvider<>(keyProvider); selectionModel = new MultiSelectionModel<>(keyProvider); // table table = new DefaultCellTable<>(5, keyProvider); table.setSelectionModel(selectionModel, DefaultSelectionEventManager .createCustomManager(new DefaultSelectionEventManager.CheckboxEventTranslator<String>() { @Override public SelectAction translateSelectionEvent(CellPreviewEvent<String> event) { SelectAction action = super.translateSelectionEvent(event); if (action.equals(SelectAction.IGNORE)) { String serverGroup = event.getValue(); boolean selected = selectionModel.isSelected(serverGroup); return selected ? SelectAction.DESELECT : SelectAction.SELECT; } return action; } })); dataProvider.addDataDisplay(table); root.add(table); // columns Column<String, Boolean> checkColumn = new Column<String, Boolean>(new CheckboxCell(true, false)) { @Override public Boolean getValue(String serverGroup) { return selectionModel.isSelected(serverGroup); } }; TextColumn<String> nameColumn = new TextColumn<String>() { @Override public String getValue(String serverGroup) { return serverGroup; } }; table.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>")); table.setColumnWidth(checkColumn, 40, PX); table.addColumn(nameColumn, "Server Group"); // pager DefaultPager pager = new DefaultPager(); pager.setWidth("auto"); pager.setDisplay(table); root.add(pager); return new TrappedFocusPanel(new WindowContentBuilder(root, new DialogueOptions(Console.CONSTANTS.common_label_unassign(), event -> { Set<String> selectedSet = selectionModel.getSelectedSet(); if (selectedSet.isEmpty()) { errorMessages.setText(Console.CONSTANTS.pleaseSelectServerGroup()); errorMessages.setVisible(true); } else { close(); presenter.unassignContent(content, selectedSet); } }, Console.CONSTANTS.common_label_cancel(), event -> close())).build()); }
From source file:org.jbpm.console.ng.cm.client.casegrid.CasesListGridViewImpl.java
License:Apache License
private void onMouseOverGrid(final CellPreviewEvent<CaseSummary> event) { CaseSummary caseInstance = event.getValue(); if (caseInstance.getDescription() != null) { listGrid.setTooltip(listGrid.getKeyboardSelectedRow(), event.getColumn(), caseInstance.getDescription()); }//from w ww . j a va2 s.c o m }