protected void fireCurrentPresentationChanged(Object oldPresentationId) { if (listeners != null) { for (final PresentationsChangeListener listener : listeners) { listener.currentPresentationChanged(this, oldPresentationId); } } }
protected void fireDefaultPresentationChanged(Object oldPresentationId) { if (listeners != null) { for (final PresentationsChangeListener listener : listeners) { listener.defaultPresentationChanged(this, oldPresentationId); } } }
protected void firePresentationsSetChanged() { if (listeners != null) { for (final PresentationsChangeListener listener : listeners) { listener.presentationsSetChanged(this); } } }
@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(); } }
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(); presentations.remove(current); presentations.commit(); } }
protected void fillPresentations(Presentations presentations) { presentation.removeAllItems(); Collection<Object> availablePresentationIds = presentations.getPresentationIds(); for (Object pId : availablePresentationIds) { Presentation p = presentations.getPresentation(pId); presentation.addItem(p); presentation.setItemCaption(p, presentations.getCaption(pId)); } }
protected void applyPresentation(Presentation p) { if (presentations != null) { Element settingsElement = presentations.getSettings(p); applySettings(settingsElement); presentations.setCurrent(p); component.markAsDirty(); } }
@Override public void applyPresentationAsDefault(Object id) { if (isUsePresentations() && presentations != null) { Presentation p = presentations.getPresentation(id); if (p != null) { presentations.setDefault(p); applyPresentation(p); } } else { throw new UnsupportedOperationException("Component doesn't use presentations"); } }
protected boolean isGlobalPresentation() { Presentations presentations = table.getPresentations(); Presentation presentation = presentations.getCurrent(); return presentation != null && (!presentations.isGlobal(presentation) || userSessionSource.getUserSession().isSpecificPermitted("cuba.gui.presentations.global")); } }
@Override public Presentation getCurrent() { checkLoad(); return current; }
@Override public String getCaption(Object id) { Presentation p = getPresentation(id); if (p != null) { return p.getName(); } return null; }
@Override public Object getDefaultPresentationId() { if (presentations == null) { return null; } Presentation def = presentations.getDefault(); return def == null ? null : def.getId(); }
@Override public void resetPresentation() { if (defaultSettings != null) { applySettings(defaultSettings.getRootElement()); if (presentations != null) { presentations.setCurrent(null); } } }
@Override public void applyPresentation(Object id) { if (isUsePresentations() && presentations != null) { Presentation p = presentations.getPresentation(id); applyPresentation(p); } else { throw new UnsupportedOperationException("Component doesn't use presentations"); } }
@Override public void loadPresentations() { if (isUsePresentations()) { presentations = new PresentationsImpl(this); setTablePresentations(new TablePresentations(this)); } else { throw new UnsupportedOperationException("Component doesn't use presentations"); } }
@Override public Presentation getPresentation(Object id) { checkLoad(); return presentations.get(id); }
@Override public boolean isGlobal(Presentation p) { p = getPresentation(p.getId()); return p != null && !PersistenceHelper.isNew(p) && p.getUser() == null; }
@Override public Collection<Object> getPresentationIds() { checkLoad(); return Collections.unmodifiableCollection(presentations.keySet()); }
@Override public boolean isAutoSave(Presentation p) { p = getPresentation(p.getId()); return p != null && BooleanUtils.isTrue(p.getAutoSave()); }