Search in sources :

Example 1 with Presentation

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");
    }
}
Also used : Presentation(com.haulmont.cuba.security.entity.Presentation)

Example 2 with Presentation

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);
    }
}
Also used : CubaMenuBar(com.haulmont.cuba.web.toolkit.ui.CubaMenuBar) Presentation(com.haulmont.cuba.security.entity.Presentation) Presentations(com.haulmont.cuba.gui.presentations.Presentations)

Example 3 with Presentation

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);
}
Also used : Presentation(com.haulmont.cuba.security.entity.Presentation) Presentations(com.haulmont.cuba.gui.presentations.Presentations)

Example 4 with Presentation

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;
}
Also used : Presentation(com.haulmont.cuba.security.entity.Presentation) Presentations(com.haulmont.cuba.gui.presentations.Presentations)

Example 5 with Presentation

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();
}
Also used : Presentation(com.haulmont.cuba.security.entity.Presentation) Presentations(com.haulmont.cuba.gui.presentations.Presentations)

Aggregations

Presentation (com.haulmont.cuba.security.entity.Presentation)11 Presentations (com.haulmont.cuba.gui.presentations.Presentations)6 DataService (com.haulmont.cuba.core.app.DataService)1 User (com.haulmont.cuba.security.entity.User)1 UserSession (com.haulmont.cuba.security.global.UserSession)1 CubaMenuBar (com.haulmont.cuba.web.toolkit.ui.CubaMenuBar)1 Element (org.dom4j.Element)1