@Override public void actionPerform(Component component) { tableImpl.hidePresentationsPopup(); Presentations presentations = table.getPresentations(); Presentation current = presentations.getCurrent(); presentations.remove(current); presentations.commit(); } }
@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(); } }
Presentations presentations = ((HasPresentations) component).getPresentations(); if (presentations != null) { presentations.commit();
protected void commit() { Presentations presentations = component.getPresentations(); Document doc = DocumentHelper.createDocument(); doc.setRootElement(doc.addElement("presentation")); component.saveSettings(doc.getRootElement()); String xml = Dom4j.writeDocument(doc, false); presentation.setXml(xml); presentation.setName(nameField.getValue()); presentation.setAutoSave(autoSaveField.getValue()); presentation.setDefault(defaultField.getValue()); User user = sessionSource.getUserSession().getCurrentOrSubstitutedUser(); boolean userOnly = !allowGlobalPresentations || !BooleanUtils.isTrue(globalField.getValue()); presentation.setUser(userOnly ? user : null); if (log.isTraceEnabled()) { log.trace(String.format("XML: %s", Dom4j.writeDocument(doc, true))); } if (isNew) { presentations.add(presentation); } else { presentations.modify(presentation); } presentations.commit(); addCloseListener(e -> { if (isNew) { component.applyPresentation(presentation.getId()); } }); }