diff --git a/pom.xml b/pom.xml index f98703f60..09a183d60 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ edu.stanford.protege webprotege-gwt-ui - 6.0.18-WHO + 7.0.0-WHO pom diff --git a/webprotege-gwt-ui-client/pom.xml b/webprotege-gwt-ui-client/pom.xml index ca8788fbd..994c0751b 100644 --- a/webprotege-gwt-ui-client/pom.xml +++ b/webprotege-gwt-ui-client/pom.xml @@ -6,7 +6,7 @@ edu.stanford.protege webprotege-gwt-ui - 6.0.18-WHO + 7.0.0-WHO webprotege-gwt-ui-client diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletPresenter.java index 02ff047c5..3ccc46414 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletPresenter.java @@ -1,6 +1,5 @@ package edu.stanford.bmir.protege.web.client.postcoordination; -import com.google.web.bindery.event.shared.EventBus; import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; import edu.stanford.bmir.protege.web.client.lang.DisplayNameRenderer; import edu.stanford.bmir.protege.web.client.library.dlg.DialogButton; @@ -34,7 +33,6 @@ public class PostCoordinationPortletPresenter extends AbstractWebProtegePortletP private final Logger logger = Logger.getLogger("PostCoordinationPortletPresenter"); private final DispatchServiceManager dispatch; - private final EventBus eventBus; private final LoggedInUserManager loggedInUserManager; private final MessageBox messageBox; @@ -56,13 +54,14 @@ public class PostCoordinationPortletPresenter extends AbstractWebProtegePortletP private final ScaleValueSelectionViewPresenter scaleSelectionPresenter; + private WebProtegeEventBus eventBus; + @Inject public PostCoordinationPortletPresenter(@Nonnull SelectionModel selectionModel, @Nonnull ProjectId projectId, @Nonnull DisplayNameRenderer displayNameRenderer, @Nonnull DispatchServiceManager dispatch, @Nonnull PostCoordinationPortletView view, - @Nonnull EventBus eventBus, @Nonnull MessageBox messageBox, @Nonnull LoggedInUserManager loggedInUserManager, ModalManager modalManager, @@ -71,7 +70,6 @@ public PostCoordinationPortletPresenter(@Nonnull SelectionModel selectionModel, this.view = view; this.messageBox = messageBox; this.dispatch = dispatch; - this.eventBus = eventBus; this.loggedInUserManager = loggedInUserManager; this.modalManager = modalManager; this.scaleSelectionPresenter = scaleSelectionPresenter; @@ -80,6 +78,7 @@ public PostCoordinationPortletPresenter(@Nonnull SelectionModel selectionModel, @Override public void startPortlet(PortletUi portletUi, WebProtegeEventBus eventBus) { + this.eventBus = eventBus; portletUi.setWidget(view.asWidget()); setDisplaySelectedEntityNameAsSubtitle(true); @@ -312,7 +311,7 @@ private void addScaleValueCardPresenter(String axisIri) { PostcoordinationScaleValue.create(axisIri, currentAxisLabels.getScaleLabel(), existingScaleValueForAxis, genericScale1) ); scaleValueCardPresenters.put(axisIri, newPresenter); - newPresenter.start(editMode); + newPresenter.start(eventBus, editMode); updateScaleValueCards(); } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardPresenter.java index 0fe2e6175..ce291a6b2 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardPresenter.java @@ -1,14 +1,18 @@ package edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard; import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; +import edu.stanford.bmir.protege.web.client.hierarchy.ClassHierarchyDescriptor; import edu.stanford.bmir.protege.web.client.library.dlg.DialogButton; import edu.stanford.bmir.protege.web.client.library.modal.*; import edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.scaleValueSelectionModal.ScaleValueSelectionViewPresenter; import edu.stanford.bmir.protege.web.shared.entity.GetRenderedOwlEntitiesAction; +import edu.stanford.bmir.protege.web.shared.event.WebProtegeEventBus; import edu.stanford.bmir.protege.web.shared.postcoordination.*; import edu.stanford.bmir.protege.web.shared.project.ProjectId; +import org.semanticweb.owlapi.model.*; +import uk.ac.manchester.cs.owl.owlapi.OWLClassImpl; -import java.util.Set; +import java.util.*; import java.util.stream.*; public class ScaleValueCardPresenter { @@ -26,6 +30,8 @@ public class ScaleValueCardPresenter { private ScaleValueSelectionViewPresenter scaleValueSelectionPresenter; + private WebProtegeEventBus eventBus; + public ScaleValueCardPresenter(DispatchServiceManager dispatchServiceManager, ProjectId projectId, @@ -103,7 +109,8 @@ public void setEditMode(boolean editMode) { view.setEditMode(editMode); } - public void start(boolean isEditMode) { + public void start(WebProtegeEventBus eventBus, boolean isEditMode) { + this.eventBus = eventBus; this.view = new ScaleValueCardViewImpl(); bindView(); initTable(); @@ -120,13 +127,12 @@ public void showModalForSelection() { closer.closeModal(); selectChosenEntity(); }); - scaleValueSelectionPresenter.setAllowMultiValue(ScaleAllowMultiValue.fromString(scaleValue.getGenericScale().getAllowMultiValue())); - scaleValueSelectionPresenter.setScaleTopClass(scaleValue.getGenericScale().getGenericPostcoordinationScaleTopClass()); - scaleValueSelectionPresenter.start(); + Set roots = new HashSet<>(Collections.singletonList(new OWLClassImpl(IRI.create(scaleValue.getGenericScale().getGenericPostcoordinationScaleTopClass())))); + scaleValueSelectionPresenter.start(eventBus, ClassHierarchyDescriptor.get(roots)); modalManager.showModal(modalPresenter); } private void selectChosenEntity() { - scaleValueSelectionPresenter.getSelections().forEach(scaleValue -> addRow(scaleValue, scaleValue)); + scaleValueSelectionPresenter.getSelection().ifPresent(owlEntity -> addRow(owlEntity.getEntity().toStringID(), owlEntity.getBrowserText())); } } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionView.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionView.java index 478fbaab4..746814f0d 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionView.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionView.java @@ -1,16 +1,12 @@ package edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.scaleValueSelectionModal; -import com.google.gwt.user.client.ui.IsWidget; -import edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.ScaleAllowMultiValue; +import com.google.gwt.user.client.ui.*; import edu.stanford.bmir.protege.web.client.progress.HasBusy; -import java.util.List; +import javax.annotation.Nonnull; public interface ScaleValueSelectionView extends IsWidget, HasBusy { - void clear(); - - List getText(); - - void setTopClass(String scaleTopClass); + @Nonnull + AcceptsOneWidget getHierarchyContainer(); } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.java index 5480e7967..566dbcccc 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.java @@ -4,24 +4,20 @@ import com.google.gwt.uibinder.client.*; import com.google.gwt.user.client.ui.*; import edu.stanford.bmir.protege.web.client.Messages; -import edu.stanford.bmir.protege.web.client.library.text.ExpandingTextBoxImpl; -import edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.ScaleAllowMultiValue; import javax.annotation.Nonnull; import javax.inject.Inject; -import java.util.*; import java.util.logging.Logger; -import java.util.stream.Collectors; public class ScaleValueSelectionViewImpl extends Composite implements ScaleValueSelectionView { - @UiField - ExpandingTextBoxImpl scaleValueSelection; - private final Messages messages; private static final Logger logger = Logger.getLogger(ScaleValueSelectionViewImpl.class.getName()); + @UiField + public SimplePanel hierarchyContainer; + interface ScaleValueSelectionModalImplUiBinder extends UiBinder { } @@ -45,19 +41,9 @@ protected void onAttach() { super.onAttach(); } - - @Override - public void clear() { - scaleValueSelection.setText(""); - } - - @Override - public List getText() { - return Arrays.stream(scaleValueSelection.getText().trim().split("\n")).collect(Collectors.toList()); - } - + @Nonnull @Override - public void setTopClass(String scaleTopClass) { - + public AcceptsOneWidget getHierarchyContainer() { + return hierarchyContainer; } } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.ui.xml b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.ui.xml index e68a2f3cc..f68ae1f20 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.ui.xml +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.ui.xml @@ -1,13 +1,12 @@ .main-panel-style { - width: 800px; - max-width: 800px; + width: 500px; + max-width: 500px; box-sizing: border-box; overflow: hidden; } @@ -31,9 +30,7 @@ - + diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewPresenter.java index 37791b33d..bdd08075e 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewPresenter.java @@ -1,26 +1,33 @@ package edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.scaleValueSelectionModal; -import edu.stanford.bmir.protege.web.client.library.modal.ModalManager; -import edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.ScaleAllowMultiValue; +import edu.stanford.bmir.protege.web.client.hierarchy.*; +import edu.stanford.bmir.protege.web.shared.entity.EntityNode; +import edu.stanford.bmir.protege.web.shared.event.WebProtegeEventBus; import javax.annotation.Nonnull; import javax.inject.Inject; -import java.util.List; +import java.util.Optional; public class ScaleValueSelectionViewPresenter { private ScaleValueSelectionView view; - private ScaleAllowMultiValue scaleAllowMultiValue; - private String scaleTopClass; @Nonnull - private final ModalManager modalManager; + private final HierarchyPopupView hierarchyView; + + @Nonnull + private final EntityHierarchyModel model; + + private Optional selectedEntity = Optional.empty(); + @Inject public ScaleValueSelectionViewPresenter(ScaleValueSelectionView view, - @Nonnull ModalManager modalManager) { + @Nonnull HierarchyPopupView hierarchyView, + @Nonnull EntityHierarchyModel model) { this.view = view; - this.modalManager = modalManager; + this.hierarchyView = hierarchyView; + this.model = model; } @Nonnull @@ -28,19 +35,23 @@ public ScaleValueSelectionView getView() { return view; } - public void start() { - } + public void start(WebProtegeEventBus eventBus, HierarchyDescriptor hierarchyDescriptor) { + this.clean(); + model.start(eventBus, + hierarchyDescriptor); + hierarchyView.setModel(model); + hierarchyView.setSelectionChangedHandler( + entityNode -> selectedEntity = Optional.of(entityNode) + ); + this.view.getHierarchyContainer().setWidget(hierarchyView); - public List getSelections() { - return view.getText(); } - public void setAllowMultiValue(ScaleAllowMultiValue scaleAllowMultiValue) { - this.scaleAllowMultiValue = scaleAllowMultiValue; + public Optional getSelection() { + return selectedEntity; } - public void setScaleTopClass(String scaleTopClass) { - this.scaleTopClass = scaleTopClass; - this.view.setTopClass(scaleTopClass); + private void clean() { + this.selectedEntity = Optional.empty(); } } diff --git a/webprotege-gwt-ui-server-core/pom.xml b/webprotege-gwt-ui-server-core/pom.xml index 0a3f7c1fa..d15c5d584 100644 --- a/webprotege-gwt-ui-server-core/pom.xml +++ b/webprotege-gwt-ui-server-core/pom.xml @@ -5,7 +5,7 @@ webprotege-gwt-ui edu.stanford.protege - 6.0.18-WHO + 7.0.0-WHO 4.0.0 diff --git a/webprotege-gwt-ui-server/pom.xml b/webprotege-gwt-ui-server/pom.xml index df5d3d97a..3259e0f8e 100644 --- a/webprotege-gwt-ui-server/pom.xml +++ b/webprotege-gwt-ui-server/pom.xml @@ -6,7 +6,7 @@ edu.stanford.protege webprotege-gwt-ui - 6.0.18-WHO + 7.0.0-WHO webprotege-gwt-ui-server diff --git a/webprotege-gwt-ui-shared-core/pom.xml b/webprotege-gwt-ui-shared-core/pom.xml index abd93b329..df9f07666 100644 --- a/webprotege-gwt-ui-shared-core/pom.xml +++ b/webprotege-gwt-ui-shared-core/pom.xml @@ -5,7 +5,7 @@ webprotege-gwt-ui edu.stanford.protege - 6.0.18-WHO + 7.0.0-WHO 4.0.0 diff --git a/webprotege-gwt-ui-shared/pom.xml b/webprotege-gwt-ui-shared/pom.xml index d666b1ad2..55c031758 100644 --- a/webprotege-gwt-ui-shared/pom.xml +++ b/webprotege-gwt-ui-shared/pom.xml @@ -6,7 +6,7 @@ edu.stanford.protege webprotege-gwt-ui - 6.0.18-WHO + 7.0.0-WHO webprotege-gwt-ui-shared