diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/parents/EditParentsPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/parents/EditParentsPresenter.java index fd22541b2..cefd66347 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/parents/EditParentsPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/parents/EditParentsPresenter.java @@ -3,6 +3,7 @@ import com.google.common.collect.ImmutableSet; import edu.stanford.bmir.protege.web.client.Messages; import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.client.library.dlg.DialogButton; import edu.stanford.bmir.protege.web.client.library.modal.ModalCloser; import edu.stanford.bmir.protege.web.client.library.modal.ModalManager; @@ -11,7 +12,6 @@ import edu.stanford.bmir.protege.web.shared.hierarchy.ChangeEntityParentsAction; import edu.stanford.bmir.protege.web.shared.hierarchy.ChangeEntityParentsResult; import edu.stanford.bmir.protege.web.shared.hierarchy.GetHierarchyParentsAction; -import edu.stanford.bmir.protege.web.shared.hierarchy.HierarchyId; import edu.stanford.bmir.protege.web.shared.issues.CreateEntityDiscussionThreadAction; import edu.stanford.bmir.protege.web.shared.project.ProjectId; import edu.stanford.bmir.protege.web.shared.renderer.GetEntityRenderingAction; @@ -42,7 +42,7 @@ public class EditParentsPresenter { @Nullable private OWLEntity entity; - private Optional hierarchyId = Optional.empty(); + private Optional hierarchyDescriptor = Optional.empty(); @Nonnull private final ModalManager modalManager; @@ -78,7 +78,7 @@ public void start(@Nonnull OWLEntity entity) { dispatch.execute(GetEntityRenderingAction.create(projectId, entity), result -> view.setOwlEntityData(result.getEntityData())); - hierarchyId.ifPresent(id -> dispatch.execute(GetHierarchyParentsAction.create(projectId, entity, id), + hierarchyDescriptor.ifPresent(id -> dispatch.execute(GetHierarchyParentsAction.create(projectId, entity, hierarchyDescriptor.get()), result -> view.setEntityParents(result.getParents()))); } @@ -87,8 +87,8 @@ public EditParentsView getView() { return view; } - public void setHierarchyId(@Nonnull HierarchyId hierarchyId) { - this.hierarchyId = Optional.of(hierarchyId); + public void setHierarchyDescriptor(@Nonnull HierarchyDescriptor hierarchyDescriptor) { + this.hierarchyDescriptor = Optional.of(hierarchyDescriptor); } private void handleHierarchyChange(ModalCloser closer) { diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/parents/EditParentsUiAction.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/parents/EditParentsUiAction.java index 42e51d1ec..511a38bb0 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/parents/EditParentsUiAction.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/parents/EditParentsUiAction.java @@ -2,8 +2,8 @@ import edu.stanford.bmir.protege.web.client.Messages; import edu.stanford.bmir.protege.web.client.action.AbstractUiAction; +import edu.stanford.bmir.protege.web.client.hierarchy.ClassHierarchyDescriptor; import edu.stanford.bmir.protege.web.client.selection.SelectionModel; -import edu.stanford.bmir.protege.web.shared.hierarchy.HierarchyId; import org.semanticweb.owlapi.model.OWLEntity; import javax.annotation.Nonnull; @@ -33,7 +33,7 @@ public void execute() { } private void showDialog(OWLEntity entity) { - editParentsPresenter.setHierarchyId(HierarchyId.CLASS_HIERARCHY); + editParentsPresenter.setHierarchyDescriptor(ClassHierarchyDescriptor.get()); editParentsPresenter.start(entity); } } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationPortletPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationPortletPresenter.java index 3539c439c..3cf56dfec 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationPortletPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationPortletPresenter.java @@ -2,6 +2,7 @@ import com.google.web.bindery.event.shared.EventBus; 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.lang.DisplayNameRenderer; import edu.stanford.bmir.protege.web.client.library.dlg.DialogButton; import edu.stanford.bmir.protege.web.client.library.msgbox.*; @@ -62,11 +63,9 @@ public LinearizationPortletPresenter(@Nonnull SelectionModel selectionModel, @Override public void startPortlet(PortletUi portletUi, WebProtegeEventBus eventBus) { - - portletUi.setWidget(view.asWidget()); - setDisplaySelectedEntityNameAsSubtitle(true); - dispatch.execute(GetLinearizationDefinitionsAction.create(), result -> { + portletUi.setWidget(view.asWidget()); + setDisplaySelectedEntityNameAsSubtitle(true); for (LinearizationDefinition definition : result.getDefinitionList()) { this.definitionMap.put(definition.getWhoficEntityIri(), definition); } @@ -110,7 +109,7 @@ private void navigateToEntity(Optional entityData) { if (response.getWhoficEntityLinearizationSpecification() != null && response.getWhoficEntityLinearizationSpecification().getLinearizationSpecifications() != null) { - dispatch.execute(GetHierarchyParentsAction.create(getProjectId(), entityData.get(), HierarchyId.CLASS_HIERARCHY), result -> { + dispatch.execute(GetHierarchyParentsAction.create(getProjectId(), entityData.get(), ClassHierarchyDescriptor.get()), result -> { if (result.getParents() != null) { result.getParents().forEach(parent -> this.entityParentsMap.put(parent.getEntity().toStringID(), parent.getBrowserText())); } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationPortletViewImpl.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationPortletViewImpl.java index 594dd829c..d8e91467c 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationPortletViewImpl.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationPortletViewImpl.java @@ -6,6 +6,7 @@ import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; import edu.stanford.bmir.protege.web.client.form.complexcheckbox.*; import edu.stanford.bmir.protege.web.client.library.text.PlaceholderTextBox; +import edu.stanford.bmir.protege.web.client.progress.*; import edu.stanford.bmir.protege.web.shared.linearization.*; import edu.stanford.bmir.protege.web.shared.project.ProjectId; import org.semanticweb.owlapi.model.IRI; @@ -15,12 +16,15 @@ import java.util.logging.*; import java.util.stream.Collectors; -public class LinearizationPortletViewImpl extends Composite implements LinearizationPortletView { +public class LinearizationPortletViewImpl extends Composite implements LinearizationPortletView, HasBusy { Logger logger = java.util.logging.Logger.getLogger("LinearizationPortletViewImpl"); private WhoficEntityLinearizationSpecification specification; + @UiField + BusyView busyView; + @UiField HTMLPanel paneContainer; @@ -194,11 +198,11 @@ public boolean isReadOnly() { private void setEditable() { if (isReadOnly) { - this.backupRows = new ArrayList<>(); - for (LinearizationTableRow row : this.tableRowList) { - this.backupRows.add(row.clone()); - row.setEnabled(); - } + this.backupRows.clear(); + tableRowList.forEach(tableRow -> { + this.backupRows.add(tableRow.clone()); + tableRow.setEnabled(); + }); this.backupUnspecifiedTitle = this.unspecifiedResidualTitle.getValue(); this.backupOtherSpecifiedTitle = this.otherSpecifiedResidualTitle.getValue(); @@ -222,11 +226,10 @@ private void setEditable() { private void setReadOnly() { if (!isReadOnly) { - this.tableRowList = this.backupRows; + this.tableRowList.clear(); flexTable.removeAllRows(); - for (LinearizationTableRow row : this.tableRowList) { - row.setReadOnly(); - } + this.backupRows.forEach(backupRow -> this.tableRowList.add(backupRow.clone())); + this.tableRowList.forEach(LinearizationTableRow::setReadOnly); initializeTableHeader(); orderAndPopulateViewWithRows(); @@ -238,7 +241,7 @@ private void setReadOnly() { disableResiduals(); isReadOnly = true; - this.backupRows = new ArrayList<>(); + this.backupRows.clear(); toggleSaveButtons(); } @@ -250,6 +253,10 @@ private void toggleSaveButtons() { saveValuesButton.setVisible(!isReadOnly); } + @Override + public void setBusy(boolean busy) { + this.busyView.setVisible(busy); + } interface LinearizationPortletViewImplUiBinder extends UiBinder { @@ -289,6 +296,7 @@ private void initializeTableHeader() { @Override public void saveValues() { if (!isReadOnly) { + setBusy(true); List specifications = this.tableRowList.stream() .map(LinearizationTableRow::asLinearizationSpecification) .collect(Collectors.toList()); @@ -309,8 +317,9 @@ public void saveValues() { } dispatch.execute( SaveEntityLinearizationAction.create(projectId, linearizationSpecification), + this, (result) -> { - this.backupRows = new ArrayList<>(); + this.backupRows.clear(); for (LinearizationTableRow row : this.tableRowList) { this.backupRows.add(row.clone()); } @@ -318,7 +327,8 @@ public void saveValues() { this.backupOtherSpecifiedTitle = this.otherSpecifiedResidualTitle.getValue(); this.backupSuppressOtherResidualValue = suppressOthersSpecifiedResidual.getValue(); - + this.backupSuppressUnspecifiedResidualValue = suppressUnspecifiedResidual.getValue(); + this.setBusy(false); } ); } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationPortletViewImpl.ui.xml b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationPortletViewImpl.ui.xml index 8700b7007..c983fd5c7 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationPortletViewImpl.ui.xml +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationPortletViewImpl.ui.xml @@ -1,6 +1,7 @@ .paneContainer { @@ -14,7 +15,7 @@ display: flex; justify-content: end; width: 97%; - margin:15px; + margin: 15px; padding: 3px; } @@ -33,14 +34,15 @@ } .residualsCard { - display:flex; + display: flex; flex-direction: column; - -webkit-box-shadow: 0 0 40px 0 rgba(0,0,0,.15); - box-shadow: 0 0 40px 0 rgba(0,0,0,.15); + -webkit-box-shadow: 0 0 40px 0 rgba(0, 0, 0, .15); + box-shadow: 0 0 40px 0 rgba(0, 0, 0, .15); margin: 14px; width: 97%; } - .residualsCardBody{ + + .residualsCardBody { display: flex; flex-direction: column; } @@ -48,7 +50,7 @@ .residualsCardBody div { } - .residualsCardHeader{ + .residualsCardHeader { font-size: 14px; color: #fff; line-height: 1.4; @@ -66,8 +68,8 @@ margin-right: 15px; font-size: 12px; width: 99%; - border-bottom: 1px solid #f2f2f2; - border-top: 1px solid #f2f2f2; + border-bottom: 1px solid #f2f2f2; + border-top: 1px solid #f2f2f2; min-height: 35px; align-items: center; } @@ -82,8 +84,8 @@ .residualValue { min-width: 40%; margin-left: 7px; - border: 1px solid #B5B5B5; - padding: 5px!important; + border: 1px solid #B5B5B5; + padding: 5px !important; } .residualValue::placeholder { @@ -109,15 +111,22 @@ border-radius: 8px; } + .busyView { + width: 100%; + height: 100%; + } + .titleTextBox { margin-left: 6px; - font-size : 16px; + font-size: 16px; } + .cancelButton:hover { background-color: #E3E3E3; } - + + @@ -127,19 +136,25 @@ - + - + - - + + - - + + diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationTableRow.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationTableRow.java index 59615eac0..50bca795c 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationTableRow.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationTableRow.java @@ -219,20 +219,20 @@ public LinearizationDefinition getLinearizationDefinition() { public LinearizationTableRow clone() { LinearizationTableRow clone = new LinearizationTableRow(); - clone.linearizationSpecification = linearizationSpecification; + clone.linearizationSpecification = this.asLinearizationSpecification(); clone.linearizationParentSelector = getCopy(linearizationParentSelector); clone.linearizationParentLabel = getCopy(linearizationParentLabel); clone.parentSelectionPanel = new HorizontalPanel(); clone.parentSelectionPanel.add(clone.linearizationParentSelector); clone.parentSelectionPanel.add(clone.linearizationParentLabel); - + clone.tableRefresh = this.tableRefresh; clone.parentIri = this.parentIri; clone.linearizationDefinition = this.linearizationDefinition; clone.linearizationDefinitionWidget = new Label(linearizationDefinition.getDisplayLabel()); - clone.isPartOfCheckbox = new ConfigurableCheckbox(new LinearizationCheckboxConfig(), linearizationSpecification.getIsIncludedInLinearization()); - clone.isGroupingCheckbox = new ConfigurableCheckbox(new LinearizationCheckboxConfig(), linearizationSpecification.getIsGrouping()); - clone.isAuxAxChildCheckbox = new ConfigurableCheckbox(new LinearizationCheckboxConfig(), linearizationSpecification.getIsAuxiliaryAxisChild()); + clone.isPartOfCheckbox = new ConfigurableCheckbox(new LinearizationCheckboxConfig(), clone.linearizationSpecification.getIsIncludedInLinearization()); + clone.isGroupingCheckbox = new ConfigurableCheckbox(new LinearizationCheckboxConfig(), clone.linearizationSpecification.getIsGrouping()); + clone.isAuxAxChildCheckbox = new ConfigurableCheckbox(new LinearizationCheckboxConfig(), clone.linearizationSpecification.getIsAuxiliaryAxisChild()); LinearizationComments commentsClone = new LinearizationComments(this.commentsWidget.getText(), linearizationCommentsModal); @@ -299,6 +299,8 @@ private ListBox getCopy(ListBox original) { } } + copy.addChangeHandler((event) -> this.handleParentSelected()); + return copy; } diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyParentsAction.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyParentsAction.java index fc004e002..943388f0f 100644 --- a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyParentsAction.java +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyParentsAction.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.google.auto.value.AutoValue; import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.dispatch.AbstractHasProjectAction; import edu.stanford.bmir.protege.web.shared.project.ProjectId; import org.semanticweb.owlapi.model.OWLEntity; @@ -22,8 +23,8 @@ public abstract class GetHierarchyParentsAction extends AbstractHasProjectAction @JsonCreator public static GetHierarchyParentsAction create(@JsonProperty("projectId") @Nonnull ProjectId projectId, @JsonProperty("entity") @Nonnull OWLEntity entity, - @JsonProperty("hierarchyId") @Nonnull HierarchyId hierarchyId) { - return new AutoValue_GetHierarchyParentsAction(projectId, entity, hierarchyId); + @JsonProperty("hierarchyId") @Nonnull HierarchyDescriptor hierarchyDescriptor) { + return new AutoValue_GetHierarchyParentsAction(projectId, entity, hierarchyDescriptor); } @Nonnull @@ -32,5 +33,5 @@ public static GetHierarchyParentsAction create(@JsonProperty("projectId") @Nonnu public abstract OWLEntity getEntity(); - public abstract HierarchyId getHierarchyId(); + public abstract HierarchyDescriptor getHierarchyDescriptor(); }