protected boolean handleSpecificVariables(Map<String, Object> variables) { boolean needReload = false; if (isUsePresentations() && presentations != null) { Presentations p = getPresentations(); if (p.getCurrent() != null && p.isAutoSave(p.getCurrent()) && needUpdatePresentation(variables)) { Element e = p.getSettings(p.getCurrent()); saveSettings(e); p.setSettings(p.getCurrent(), e); } } //noinspection ConstantConditions return needReload; }
@Override public void actionPerform(Component component) { tableImpl.hidePresentationsPopup(); Presentations presentations = table.getPresentations(); Presentation current = presentations.getCurrent(); openEditor(current); } }
@Override public void actionPerform(Component component) { tableImpl.hidePresentationsPopup(); Presentations presentations = table.getPresentations(); Presentation current = presentations.getCurrent(); presentations.remove(current); presentations.commit(); } }
protected boolean isGlobalPresentation() { Presentations presentations = table.getPresentations(); Presentation presentation = presentations.getCurrent(); return presentation != null && (!presentations.isGlobal(presentation) || userSessionSource.getUserSession().isSpecificPermitted("cuba.gui.presentations.global")); } }
protected void buildPresentationsList() { menuBar.removeItems(); presentationsMenuMap = new HashMap<>(); Presentations p = table.getPresentations(); for (Object presId : p.getPresentationIds()) { MenuBar.MenuItem item = menuBar.addItem( defaultString(p.getCaption(presId)), selectedItem -> table.applyPresentation(presId) ); Presentation current = p.getCurrent(); if (current != null && presId.equals(current.getId())) { setCurrentItemStyle(item); } Presentation defaultPresentation = p.getDefault(); if (defaultPresentation != null && presId.equals(defaultPresentation.getId())) { setDefaultItemStyle(item); } presentationsMenuMap.put(presId, item); } }
@Override public void currentPresentationChanged(Presentations presentations, Object oldPresentationId) { table.getPresentations().commit(); if (presentationsMenuMap != null) { // simple change current item if (oldPresentationId != null) { if (oldPresentationId instanceof Presentation) oldPresentationId = ((Presentation) oldPresentationId).getId(); com.vaadin.ui.MenuBar.MenuItem lastMenuItem = presentationsMenuMap.get(oldPresentationId); if (lastMenuItem != null) removeCurrentItemStyle(lastMenuItem); } Presentation current = presentations.getCurrent(); if (current != null) { com.vaadin.ui.MenuBar.MenuItem menuItem = presentationsMenuMap.get(current.getId()); if (menuItem != null) setCurrentItemStyle(menuItem); } buildActions(); } }
@Override public void actionPerform(Component component) { tableImpl.hidePresentationsPopup(); Presentations presentations = table.getPresentations(); Presentation current = presentations.getCurrent(); Element e = presentations.getSettings(current); table.saveSettings(e); presentations.setSettings(current, e); presentations.commit(); } }