@SuppressWarnings("unchecked") @Override public void actionPerform(Component component) { // if standard behaviour if (!hasSubscriptions(ActionPerformedEvent.class)) { if (!(target.getItems() instanceof EntityDataUnit)) { throw new IllegalStateException("CreateAction target items is null or does not implement EntityDataUnit"); } MetaClass metaClass = ((EntityDataUnit) target.getItems()).getEntityMetaClass(); if (metaClass == null) { throw new IllegalStateException("Target is not bound to entity"); } Screen editor = screenBuilders.editor(target) .newEntity() .build(); editor.show(); } else { super.actionPerform(component); } } }
@SuppressWarnings("unchecked") @Override public void actionPerform(Component component) { // if standard behaviour if (!hasSubscriptions(ActionPerformedEvent.class)) { Screen lookupScreen = screenBuilders.lookup(target) .build(); lookupScreen.show(); } else { super.actionPerform(component); } } }
@SuppressWarnings("unchecked") @Override public void actionPerform(Component component) { // if standard behaviour if (!hasSubscriptions(ActionPerformedEvent.class)) { if (!(target.getItems() instanceof EntityDataUnit)) { throw new IllegalStateException("EditAction target dataSource is null or does not implement EntityDataUnit"); } MetaClass metaClass = ((EntityDataUnit) target.getItems()).getEntityMetaClass(); if (metaClass == null) { throw new IllegalStateException("Target is not bound to entity"); } Entity editedEntity = target.getSingleSelected(); if (editedEntity == null) { throw new IllegalStateException("There is not selected item in EditAction target"); } Screen editor = screenBuilders.editor(target) .editEntity(editedEntity) .build(); editor.show(); } else { super.actionPerform(component); } } }
@SuppressWarnings("unchecked") @Override public void actionPerform(Component component) { // if standard behaviour if (!hasSubscriptions(ActionPerformedEvent.class)) { MetaClass metaClass = pickerField.getMetaClass(); if (metaClass == null) { throw new DevelopmentException("Neither metaClass nor datasource/property is specified " + "for the PickerField", "action ID", getId()); } Screen lookupScreen = screenBuilders.lookup(pickerField) .build(); lookupScreen.show(); } else { // call action perform handlers from super, delegate execution super.actionPerform(component); } } }
Screen editorScreen = screenBuilders.editor(pickerField) .build();
protected Screen createLookupScreen(Runnable afterLookupSelect) { Class<V> entityClass = getLookupEntityClass(); OpenMode openMode = lookupOpenMode != null ? lookupOpenMode.getOpenMode() : OpenMode.DIALOG; Screen lookupScreen = screenBuilders.lookup(entityClass, getFrame().getFrameOwner()) .withScreenId(getLookupScreenInternal()) .withLaunchMode(openMode) .withOptions(new MapScreenOptions(getLookupScreenParamsInternal())) .withSelectHandler(selected -> { handleLookupSelection(selected); if (afterLookupSelect != null) { afterLookupSelect.run(); } }) .build(); if (lookupOpenMode != null) { applyOpenTypeParameters(lookupScreen.getWindow(), lookupOpenMode); } if (lookupScreen instanceof MultiSelectLookupScreen) { ((MultiSelectLookupScreen) lookupScreen).setLookupComponentMultiSelect(isMultiSelect()); } return lookupScreen; }
Screen screenEditor = screenBuilders.editor(entity.getMetaClass().getJavaClass(), window.getFrameOwner()) .withScreenId(windowAlias) .editEntity(entity)