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;
}
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);
}
}
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());
}
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();
}
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);
}
Aggregations