Search in sources :

Example 1 with CreateCollectionItemsAction

use of edu.stanford.bmir.protege.web.shared.collection.CreateCollectionItemsAction in project webprotege by protegeproject.

the class CollectionPresenter method handleAddCollectionItems.

private void handleAddCollectionItems() {
    current.ifPresent(subject -> {
        addItemPromptProvider.get().showPrompt(itemNamesString -> {
            // Create Empty Data for the fresh item
            List<String> itemNames = Arrays.stream(itemNamesString.split("\n")).map(String::trim).collect(Collectors.toList());
            if (itemNames.isEmpty()) {
                return;
            }
            CollectionItem freshItem = CollectionItem.get(itemNames.get(0));
            dispatchServiceManager.execute(new CreateCollectionItemsAction(subject.getProjectId(), subject.getCollectionId(), itemNames), result -> {
                placeController.goTo(new CollectionViewPlace(subject.getProjectId(), subject.getCollectionId(), subject.getFormId(), Optional.of(freshItem)));
                listPresenter.refresh(() -> {
                });
            });
        });
    });
}
Also used : CreateCollectionItemsAction(edu.stanford.bmir.protege.web.shared.collection.CreateCollectionItemsAction) CollectionViewPlace(edu.stanford.bmir.protege.web.shared.place.CollectionViewPlace) CollectionItem(edu.stanford.bmir.protege.web.shared.collection.CollectionItem)

Aggregations

CollectionItem (edu.stanford.bmir.protege.web.shared.collection.CollectionItem)1 CreateCollectionItemsAction (edu.stanford.bmir.protege.web.shared.collection.CreateCollectionItemsAction)1 CollectionViewPlace (edu.stanford.bmir.protege.web.shared.place.CollectionViewPlace)1