Search in sources :

Example 6 with TablePresentations

use of io.jmix.ui.presentation.TablePresentations in project jmix by jmix-framework.

the class WebGroupTable method createTablePresentations.

@Override
protected TablePresentations createTablePresentations() {
    Presentations presentations = applicationContext.getBean(Presentations.class, this);
    presentationsDelegate = applicationContext.getBean(LegacyPresentationsDelegate.class, this, presentations, getSettingsBinder());
    return presentations;
}
Also used : LegacyPresentationsDelegate(com.haulmont.cuba.gui.presentation.LegacyPresentationsDelegate) Presentations(com.haulmont.cuba.gui.presentation.Presentations) TablePresentations(io.jmix.ui.presentation.TablePresentations)

Example 7 with TablePresentations

use of io.jmix.ui.presentation.TablePresentations in project jmix by jmix-framework.

the class CubaSavePresentationAction method setSettingsToPresentation.

@Override
protected void setSettingsToPresentation(TablePresentations presentations, TablePresentation current) {
    if (table.getFrame().getFrameOwner() instanceof CubaLegacySettings) {
        Presentations ps = (Presentations) presentations;
        Element e = ps.getSettings(current);
        ((HasSettings) table).saveSettings(e);
        ps.setSettings(current, e);
    } else {
        super.setSettingsToPresentation(presentations, current);
    }
}
Also used : Element(org.dom4j.Element) CubaLegacySettings(com.haulmont.cuba.settings.CubaLegacySettings) HasSettings(com.haulmont.cuba.gui.components.HasSettings) TablePresentations(io.jmix.ui.presentation.TablePresentations) Presentations(com.haulmont.cuba.gui.presentation.Presentations)

Example 8 with TablePresentations

use of io.jmix.ui.presentation.TablePresentations in project jmix by jmix-framework.

the class PresentationActionsBuilder method isGlobalPresentation.

protected boolean isGlobalPresentation() {
    TablePresentations presentations = table.getPresentations();
    TablePresentation presentation = presentations.getCurrent();
    UiGlobalPresentationContext globalPresentationContext = new UiGlobalPresentationContext();
    accessManager.applyRegisteredConstraints(globalPresentationContext);
    return presentation != null && (!presentations.isGlobal(presentation) || globalPresentationContext.isPermitted());
}
Also used : TablePresentation(io.jmix.ui.presentation.model.TablePresentation) TablePresentations(io.jmix.ui.presentation.TablePresentations) UiGlobalPresentationContext(io.jmix.ui.accesscontext.UiGlobalPresentationContext)

Example 9 with TablePresentations

use of io.jmix.ui.presentation.TablePresentations in project jmix by jmix-framework.

the class SavePresentationAction method actionPerform.

@Override
public void actionPerform(Component component) {
    tableImpl.hidePresentationsPopup();
    TablePresentations presentations = table.getPresentations();
    TablePresentation current = presentations.getCurrent();
    setSettingsToPresentation(presentations, current);
    presentations.commit();
}
Also used : TablePresentation(io.jmix.ui.presentation.model.TablePresentation) TablePresentations(io.jmix.ui.presentation.TablePresentations)

Example 10 with TablePresentations

use of io.jmix.ui.presentation.TablePresentations in project jmix by jmix-framework.

the class FilterDelegateImpl method saveAsFolder.

protected void saveAsFolder(boolean isAppFolder) {
    final AbstractSearchFolder folder;
    if (isAppFolder) {
        folder = (metadata.create(AppFolder.class));
    } else {
        folder = (metadata.create(SearchFolder.class));
    }
    if (filterEntity.getCode() == null) {
        String folderName = filterEntity != adHocFilter ? filterEntity.getName() : "";
        folder.setName(folderName);
        folder.setTabName(folderName);
    } else {
        String name = messages.getMainMessage(filterEntity.getCode());
        folder.setName(name);
        folder.setTabName(name);
    }
    String newXml = filterParser.getXml(conditions, Param.ValueProperty.VALUE);
    folder.setFilterComponentId(filterEntity.getComponentId());
    folder.setFilterXml(newXml);
    if (!isAppFolder) {
        if (userCanEditGlobalFilter()) {
            ((SearchFolder) folder).setUsername(filterEntity.getUsername());
        } else {
            // todo user substitution
            // ((SearchFolder) folder).setUser(userSessionSource.getUserSession().getCurrentOrSubstitutedUser());
            ((SearchFolder) folder).setUsername(userSessionSource.getUserSession().getUser().getUsername());
        }
    }
    TablePresentations presentations;
    if (applyTo != null && applyTo instanceof HasPresentations) {
        final HasPresentations presentationsOwner = (HasPresentations) applyTo;
        presentations = presentationsOwner.isUsePresentations() ? presentationsOwner.getPresentations() : null;
    } else {
        presentations = null;
    }
    Runnable commitHandler;
    if (isAppFolder) {
        commitHandler = () -> {
            AbstractSearchFolder savedFolder = saveFolder(folder);
            filterEntity.setFolder(savedFolder);
        };
    } else {
        commitHandler = () -> {
            AbstractSearchFolder savedFolder = saveFolder(folder);
            filterEntity.setFolder(savedFolder);
        };
    }
    filterHelper.openFolderEditWindow(isAppFolder, folder, presentations, commitHandler);
}
Also used : HasPresentations(com.haulmont.cuba.gui.components.HasPresentations) AbstractSearchFolder(com.haulmont.cuba.core.entity.AbstractSearchFolder) SearchFolder(com.haulmont.cuba.security.entity.SearchFolder) AbstractSearchFolder(com.haulmont.cuba.core.entity.AbstractSearchFolder) TablePresentations(io.jmix.ui.presentation.TablePresentations)

Aggregations

TablePresentations (io.jmix.ui.presentation.TablePresentations)12 TablePresentation (io.jmix.ui.presentation.model.TablePresentation)5 Presentations (com.haulmont.cuba.gui.presentation.Presentations)4 LegacyPresentationsDelegate (com.haulmont.cuba.gui.presentation.LegacyPresentationsDelegate)3 HasTablePresentations (io.jmix.ui.component.HasTablePresentations)3 HasPresentations (com.haulmont.cuba.gui.components.HasPresentations)2 HasSettings (com.haulmont.cuba.gui.components.HasSettings)2 Element (org.dom4j.Element)2 AbstractSearchFolder (com.haulmont.cuba.core.entity.AbstractSearchFolder)1 SearchFolder (com.haulmont.cuba.security.entity.SearchFolder)1 CubaLegacySettings (com.haulmont.cuba.settings.CubaLegacySettings)1 UiGlobalPresentationContext (io.jmix.ui.accesscontext.UiGlobalPresentationContext)1 UserDetails (org.springframework.security.core.userdetails.UserDetails)1