use of com.haulmont.cuba.security.entity.Presentation in project cuba by cuba-platform.
the class WebAbstractTable method applyPresentationAsDefault.
@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");
}
}
use of com.haulmont.cuba.security.entity.Presentation in project cuba by cuba-platform.
the class TablePresentations method buildPresentationsList.
protected void buildPresentationsList() {
menuBar.removeItems();
presentationsMenuMap = new HashMap<>();
final Presentations p = table.getPresentations();
for (final Object presId : p.getPresentationIds()) {
final MenuBar.MenuItem item = menuBar.addItem(StringUtils.defaultString(p.getCaption(presId)), new com.vaadin.ui.MenuBar.Command() {
@Override
public void menuSelected(com.vaadin.ui.MenuBar.MenuItem selectedItem) {
table.applyPresentation(presId);
}
});
final Presentation current = p.getCurrent();
if (current != null && presId.equals(current.getId())) {
setCurrentItemStyle(item);
}
final Presentation defaultPresentation = p.getDefault();
if (defaultPresentation != null && presId.equals(defaultPresentation.getId())) {
setDefaultItemStyle(item);
}
presentationsMenuMap.put(presId, item);
}
}
use of com.haulmont.cuba.security.entity.Presentation in project cuba by cuba-platform.
the class EditPresentationAction method actionPerform.
@Override
public void actionPerform(Component component) {
tableImpl.hidePresentationsPopup();
Presentations presentations = table.getPresentations();
Presentation current = presentations.getCurrent();
openEditor(current);
}
use of com.haulmont.cuba.security.entity.Presentation in project cuba by cuba-platform.
the class PresentationEditor method validate.
protected boolean validate() {
Presentations presentations = component.getPresentations();
// check that name is empty
if (StringUtils.isEmpty(nameField.getValue())) {
App.getInstance().getWindowManager().showNotification(messages.getMainMessage("PresentationsEditor.error"), messages.getMainMessage("PresentationsEditor.error.nameRequired"), Frame.NotificationType.HUMANIZED);
return false;
}
// check that name is unique
final Presentation pres = presentations.getPresentationByName(nameField.getValue());
if (pres != null && !pres.equals(presentation)) {
App.getInstance().getWindowManager().showNotification(messages.getMainMessage("PresentationsEditor.error"), messages.getMainMessage("PresentationsEditor.error.nameAlreadyExists"), Frame.NotificationType.HUMANIZED);
return false;
}
return true;
}
use of com.haulmont.cuba.security.entity.Presentation in project cuba by cuba-platform.
the class DeletePresentationAction method actionPerform.
@Override
public void actionPerform(Component component) {
tableImpl.hidePresentationsPopup();
Presentations presentations = table.getPresentations();
Presentation current = presentations.getCurrent();
presentations.remove(current);
presentations.commit();
}
Aggregations