Search in sources :

Example 6 with Presentation

use of com.haulmont.cuba.security.entity.Presentation in project cuba by cuba-platform.

the class PresentationActionsBuilder method isGlobalPresentation.

protected boolean isGlobalPresentation() {
    Presentations presentations = table.getPresentations();
    Presentation presentation = presentations.getCurrent();
    return presentation != null && (!presentations.isGlobal(presentation) || userSessionSource.getUserSession().isSpecificPermitted("cuba.gui.presentations.global"));
}
Also used : Presentation(com.haulmont.cuba.security.entity.Presentation) Presentations(com.haulmont.cuba.gui.presentations.Presentations)

Example 7 with Presentation

use of com.haulmont.cuba.security.entity.Presentation in project cuba by cuba-platform.

the class SaveAsPresentationAction method actionPerform.

@Override
public void actionPerform(Component component) {
    tableImpl.hidePresentationsPopup();
    Presentation presentation = metadata.create(Presentation.class);
    presentation.setComponentId(ComponentsHelper.getComponentPath(table));
    openEditor(presentation);
}
Also used : Presentation(com.haulmont.cuba.security.entity.Presentation)

Example 8 with Presentation

use of com.haulmont.cuba.security.entity.Presentation in project cuba by cuba-platform.

the class SavePresentationAction method actionPerform.

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

Example 9 with Presentation

use of com.haulmont.cuba.security.entity.Presentation in project cuba by cuba-platform.

the class FolderEditWindow method fillPresentations.

protected void fillPresentations(Presentations presentations) {
    presentation.removeAllItems();
    final Collection<Object> availablePresentationIds = presentations.getPresentationIds();
    for (final Object pId : availablePresentationIds) {
        final Presentation p = presentations.getPresentation(pId);
        presentation.addItem(p);
        presentation.setItemCaption(p, presentations.getCaption(pId));
    }
}
Also used : Presentation(com.haulmont.cuba.security.entity.Presentation)

Example 10 with Presentation

use of com.haulmont.cuba.security.entity.Presentation in project cuba by cuba-platform.

the class PresentationsImpl method checkLoad.

private void checkLoad() {
    if (presentations == null) {
        DataService ds = AppBeans.get(DataService.NAME);
        LoadContext ctx = new LoadContext(Presentation.class);
        ctx.setView("app");
        UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
        UserSession session = sessionSource.getUserSession();
        User user = session.getCurrentOrSubstitutedUser();
        ctx.setQueryString("select p from sec$Presentation p " + "where p.componentId = :component and (p.user is null or p.user.id = :userId)").setParameter("component", name).setParameter("userId", user.getId());
        final List<Presentation> list = ds.loadList(ctx);
        presentations = new LinkedHashMap<>(list.size());
        for (final Presentation p : list) {
            presentations.put(p.getId(), p);
        }
    }
}
Also used : User(com.haulmont.cuba.security.entity.User) UserSession(com.haulmont.cuba.security.global.UserSession) Presentation(com.haulmont.cuba.security.entity.Presentation) DataService(com.haulmont.cuba.core.app.DataService)

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