@Override public T getEditedEntity() { return getItem(); }
@Override public Widget getItem() { Widget item = super.getItem(); item.setCreatedBy(accessHelper.getCurrentSessionLogin()); return item; }
public void validateAdditionalRules(ValidationErrors errors) { // all previous validations return no errors if (crossFieldValidate && errors.isEmpty()) { BeanValidation beanValidation = getBeanLocator().get(BeanValidation.NAME); Validator validator = beanValidation.getValidator(); Set<ConstraintViolation<Entity>> violations = validator.validate(getItem(), UiCrossFieldChecks.class); violations.stream() .filter(violation -> { Path propertyPath = violation.getPropertyPath(); Path.Node lastNode = Iterables.getLast(propertyPath); return lastNode.getKind() == ElementKind.BEAN; }) .forEach(violation -> errors.add(violation.getMessage())); } }
public void editAttribute() { Set<ManagedBeanAttribute> selected = attributesTable.getSelected(); if (selected.isEmpty()) { return; } ManagedBeanAttribute mba = selected.iterator().next(); if (!mba.getWriteable()) { return; } AbstractEditor w = openEditor("jmxConsoleEditAttribute", mba, OpenType.DIALOG); w.addCloseListener(actionId -> { if (Window.COMMIT_ACTION_ID.equals(actionId)) { Object item = w.getItem(); reloadAttribute((ManagedBeanAttribute) item); } }); }
protected void showInfo(Object target) { AbstractEditor editor = (AbstractEditor) findEditor((Layout) target); Entity entity = editor.getItem(); Metadata metadata = AppBeans.get(Metadata.NAME); MetaClass metaClass = metadata.getSession().getClass(entity.getClass()); new ShowInfoAction().showInfo(entity, metaClass, editor); }
protected boolean commitInternal(boolean close) { if (!preCommit()) return false; boolean committed; DsContext context = getDsContext(); if (context != null) { committed = context.commit(); } else { DataSupplier supplier = getDataService(); supplier.commit(getItem()); committed = true; } return postCommit(committed, close); }
Entity editorItem = editor.getItem();
/** * Hook to be implemented in subclasses. Called by the framework after committing datasources. * The default implementation notifies about commit and calls {@link #postInit()} if the window is not closing. * * @param committed whether any data were actually changed and committed * @param close whether the window is going to be closed * @return true to continue, false to abort */ protected boolean postCommit(boolean committed, boolean close) { if (committed && !close) { if (showSaveNotification) { Entity entity = getItem(); MetadataTools metadataTools = getBeanLocator().get(MetadataTools.class); showNotification( messages.formatMainMessage("info.EntitySave", messages.getTools().getEntityCaption(entity.getMetaClass()), metadataTools.getInstanceName(entity)), NotificationType.TRAY); } postInit(); afterWindowApplyPostInit(); } return true; }
Entity editedItem = window.getItem(); if (editedItem != null) { if (parentDs == null) {
Entity editedItem = window.getItem(); if (editedItem != null) { if (parentDs == null) {
editor.addCloseListener(actionId -> { if (Window.COMMIT_ACTION_ID.equals(actionId)) { Entity item = editor.getItem(); afterCommitOpenedEntity(item);