public void setupButtons() { menuActionsButton = new Button(); createRefreshToggleButton(menuActionsButton); menuRefreshButton.setIcon(IconType.REFRESH); menuRefreshButton.setSize(ButtonSize.MINI); menuRefreshButton.setTitle(Constants.INSTANCE.Refresh()); menuResetTabsButton.setIcon(IconType.TH_LIST); menuResetTabsButton.setSize(ButtonSize.MINI); menuResetTabsButton.setTitle(Constants.INSTANCE.RestoreDefaultFilters()); }
public void createRefreshToggleButton(final Button refreshIntervalSelector) { refreshIntervalSelector.setToggle(true); refreshIntervalSelector.setIcon(IconType.COG); refreshIntervalSelector.setTitle(Constants.INSTANCE.AutoRefresh()); refreshIntervalSelector.setSize(ButtonSize.MINI); popup.getElement().getStyle().setZIndex(Integer.MAX_VALUE); popup.addAutoHidePartner(refreshIntervalSelector.getElement()); popup.addCloseHandler( new CloseHandler<PopupPanel>() { public void onClose(CloseEvent<PopupPanel> popupPanelCloseEvent) { if (popupPanelCloseEvent.isAutoClosed()) { refreshIntervalSelector.setActive(false); } } }); refreshIntervalSelector.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (!refreshIntervalSelector.isActive()) { showSelectRefreshIntervalPopup( refreshIntervalSelector.getAbsoluteLeft() + refreshIntervalSelector.getOffsetWidth(), refreshIntervalSelector.getAbsoluteTop() + refreshIntervalSelector.getOffsetHeight(), refreshIntervalSelector); } else { popup.hide(false); } } }); }
@Override public void init(final DocumentListPresenter presenter) { List<String> bannedColumns = new ArrayList<String>(); bannedColumns.add(constants.DocumentID()); bannedColumns.add(constants.DocumentName()); bannedColumns.add(constants.Actions()); List<String> initColumns = new ArrayList<String>(); initColumns.add(constants.DocumentID()); initColumns.add(constants.DocumentName()); initColumns.add(constants.Actions()); super.init( presenter, new GridGlobalPreferences("DocumentListGrid", initColumns, bannedColumns)); initFiltersBar(); initPathLink(); selectionModel = new NoSelectionModel<CMSContentSummary>(); selectionModel.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { boolean close = false; if (selectedRow == -1) { listGrid.setRowStyles(selectedStyles); selectedRow = listGrid.getKeyboardSelectedRow(); listGrid.redraw(); } else if (listGrid.getKeyboardSelectedRow() != selectedRow) { listGrid.setRowStyles(selectedStyles); selectedRow = listGrid.getKeyboardSelectedRow(); listGrid.redraw(); } else { close = true; } selectedItem = selectionModel.getLastSelectedObject(); } }); noActionColumnManager = DefaultSelectionEventManager.createCustomManager( new DefaultSelectionEventManager.EventTranslator<CMSContentSummary>() { @Override public boolean clearCurrentSelection(CellPreviewEvent<CMSContentSummary> event) { return false; } @Override public DefaultSelectionEventManager.SelectAction translateSelectionEvent( CellPreviewEvent<CMSContentSummary> event) { NativeEvent nativeEvent = event.getNativeEvent(); if (BrowserEvents.CLICK.equals(nativeEvent.getType())) { // Ignore if the event didn't occur in the correct // column. if (listGrid.getColumnIndex(actionsColumn) == event.getColumn()) { return DefaultSelectionEventManager.SelectAction.IGNORE; } } return DefaultSelectionEventManager.SelectAction.DEFAULT; } }); listGrid.setSelectionModel(selectionModel, noActionColumnManager); Button configRepoButton = new Button(); configRepoButton.setIcon(IconType.COG); configRepoButton.setTitle(Constants.INSTANCE.ConfigurationPanel()); configRepoButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { PlaceStatus instanceDetailsStatus = placeManager.getStatus(new DefaultPlaceRequest("CMIS Configuration")); if (instanceDetailsStatus == PlaceStatus.OPEN) { placeManager.closePlace("CMIS Configuration"); } placeManager.goTo("CMIS Configuration"); } }); listGrid.getRightToolbar().add(configRepoButton); listGrid.setEmptyTableCaption(constants.No_Documents_Available()); listGrid.setRowStyles(selectedStyles); }