Skip to content

Commit

Permalink
Add filtered three to scale value cards (#83)
Browse files Browse the repository at this point in the history
added filtered tree to value cards.
  • Loading branch information
soimugeoWB authored Oct 23, 2024
1 parent 40b0df6 commit ad15200
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 68 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>edu.stanford.protege</groupId>
<artifactId>webprotege-gwt-ui</artifactId>
<version>6.0.18-WHO</version>
<version>7.0.0-WHO</version>
<packaging>pom</packaging>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion webprotege-gwt-ui-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>edu.stanford.protege</groupId>
<artifactId>webprotege-gwt-ui</artifactId>
<version>6.0.18-WHO</version>
<version>7.0.0-WHO</version>
</parent>

<artifactId>webprotege-gwt-ui-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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;
Expand All @@ -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);

Expand Down Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -26,6 +30,8 @@ public class ScaleValueCardPresenter {

private ScaleValueSelectionViewPresenter scaleValueSelectionPresenter;

private WebProtegeEventBus eventBus;


public ScaleValueCardPresenter(DispatchServiceManager dispatchServiceManager,
ProjectId projectId,
Expand Down Expand Up @@ -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();
Expand All @@ -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<OWLClass> 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()));
}
}
Original file line number Diff line number Diff line change
@@ -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<String> getText();

void setTopClass(String scaleTopClass);
@Nonnull
AcceptsOneWidget getHierarchyContainer();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLPanel, ScaleValueSelectionViewImpl> {
}

Expand All @@ -45,19 +41,9 @@ protected void onAttach() {
super.onAttach();
}


@Override
public void clear() {
scaleValueSelection.setText("");
}

@Override
public List<String> getText() {
return Arrays.stream(scaleValueSelection.getText().trim().split("\n")).collect(Collectors.toList());
}

@Nonnull
@Override
public void setTopClass(String scaleTopClass) {

public AcceptsOneWidget getHierarchyContainer() {
return hierarchyContainer;
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:text="urn:import:edu.stanford.bmir.protege.web.client.library.text"
xmlns:g='urn:import:com.google.gwt.user.client.ui'>

<ui:with field="wp" type="edu.stanford.bmir.protege.web.resources.WebProtegeClientBundle"/>

<ui:style>
.main-panel-style {
width: 800px;
max-width: 800px;
width: 500px;
max-width: 500px;
box-sizing: border-box;
overflow: hidden;
}
Expand All @@ -31,9 +30,7 @@
<tr>
<td valign="top">
<g:HTMLPanel addStyleNames="{style.message-block}">
<text:ExpandingTextBoxImpl ui:field="scaleValueSelection"
mode="MULTI_LINE"
anchorVisible="false"/>
<g:SimplePanel ui:field="hierarchyContainer"/>
</g:HTMLPanel>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,57 @@
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<EntityNode> 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
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<String> getSelections() {
return view.getText();
}

public void setAllowMultiValue(ScaleAllowMultiValue scaleAllowMultiValue) {
this.scaleAllowMultiValue = scaleAllowMultiValue;
public Optional<EntityNode> getSelection() {
return selectedEntity;
}

public void setScaleTopClass(String scaleTopClass) {
this.scaleTopClass = scaleTopClass;
this.view.setTopClass(scaleTopClass);
private void clean() {
this.selectedEntity = Optional.empty();
}
}
2 changes: 1 addition & 1 deletion webprotege-gwt-ui-server-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>webprotege-gwt-ui</artifactId>
<groupId>edu.stanford.protege</groupId>
<version>6.0.18-WHO</version>
<version>7.0.0-WHO</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion webprotege-gwt-ui-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>edu.stanford.protege</groupId>
<artifactId>webprotege-gwt-ui</artifactId>
<version>6.0.18-WHO</version>
<version>7.0.0-WHO</version>
</parent>

<artifactId>webprotege-gwt-ui-server</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion webprotege-gwt-ui-shared-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>webprotege-gwt-ui</artifactId>
<groupId>edu.stanford.protege</groupId>
<version>6.0.18-WHO</version>
<version>7.0.0-WHO</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion webprotege-gwt-ui-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>edu.stanford.protege</groupId>
<artifactId>webprotege-gwt-ui</artifactId>
<version>6.0.18-WHO</version>
<version>7.0.0-WHO</version>
</parent>

<artifactId>webprotege-gwt-ui-shared</artifactId>
Expand Down

0 comments on commit ad15200

Please sign in to comment.