use of io.jmix.ui.presentation.model.TablePresentation in project jmix by jmix-framework.
the class PresentationEditor method validate.
protected boolean validate() {
TablePresentations presentations = component.getPresentations();
// check that name is empty
if (StringUtils.isEmpty(nameField.getValue()) && AppUI.getCurrent() != null) {
AppUI.getCurrent().getNotifications().create(Notifications.NotificationType.HUMANIZED).withCaption(messages.getMessage("PresentationsEditor.error")).withDescription(messages.getMessage("PresentationsEditor.error.nameRequired")).show();
return false;
}
// check that name is unique
final TablePresentation pres = presentations.getPresentationByName(nameField.getValue());
if (pres != null && !pres.equals(presentation) && AppUI.getCurrent() != null) {
AppUI.getCurrent().getNotifications().create(Notifications.NotificationType.HUMANIZED).withCaption(messages.getMessage("PresentationsEditor.error")).withDescription(messages.getMessage("PresentationsEditor.error.nameAlreadyExists")).show();
return false;
}
return true;
}
use of io.jmix.ui.presentation.model.TablePresentation in project jmix by jmix-framework.
the class DeletePresentationAction method actionPerform.
@Override
public void actionPerform(Component component) {
tableImpl.hidePresentationsPopup();
TablePresentations presentations = table.getPresentations();
TablePresentation current = presentations.getCurrent();
presentations.remove(current);
presentations.commit();
}
use of io.jmix.ui.presentation.model.TablePresentation in project jmix by jmix-framework.
the class EditPresentationAction method actionPerform.
@Override
public void actionPerform(Component component) {
tableImpl.hidePresentationsPopup();
TablePresentations presentations = table.getPresentations();
TablePresentation current = presentations.getCurrent();
openEditor(current);
}
use of io.jmix.ui.presentation.model.TablePresentation in project jmix by jmix-framework.
the class SaveAsPresentationAction method actionPerform.
@Override
public void actionPerform(Component component) {
tableImpl.hidePresentationsPopup();
TablePresentation presentation = table.getPresentations().create();
presentation.setComponentId(ComponentsHelper.getComponentPath(table));
openEditor(presentation);
}
use of io.jmix.ui.presentation.model.TablePresentation in project jmix by jmix-framework.
the class TablePresentationsImpl method checkLoad.
protected void checkLoad() {
if (presentations == null) {
LoadContext<UiTablePresentation> ctx = new LoadContext<>(metadata.getClass(UiTablePresentation.class));
ctx.setFetchPlan(fetchPlanRepository.getFetchPlan(UiTablePresentation.class, "app"));
UserDetails user = currentUserSubstitution.getEffectiveUser();
ctx.setQueryString("select p from ui_TablePresentation p " + "where p.componentId = :component and (p.username is null or p.username = :username)").setParameter("component", name).setParameter("username", user.getUsername());
final List<UiTablePresentation> list = dataManager.loadList(ctx);
presentations = new LinkedHashMap<>(list.size());
for (final TablePresentation p : list) {
presentations.put(EntityValues.<UUID>getId(p), p);
}
}
}
Aggregations