-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master-who' of https://github.com/protegeproject/webpro…
…tege-gwt-ui into Support_hierarchy_change_operations_#8 � Conflicts: � webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/inject/ClientProjectModule.java
- Loading branch information
Showing
47 changed files
with
30,063 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...ient/src/main/java/edu/stanford/bmir/protege/web/client/entity/DuplicateEntitiesView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package edu.stanford.bmir.protege.web.client.entity; | ||
|
||
import com.google.gwt.user.client.ui.AcceptsOneWidget; | ||
import com.google.gwt.user.client.ui.IsWidget; | ||
import edu.stanford.bmir.protege.web.client.progress.HasBusy; | ||
|
||
public interface DuplicateEntitiesView extends HasBusy, IsWidget { | ||
|
||
|
||
AcceptsOneWidget getDuplicateResultsContainer(); | ||
} |
47 changes: 47 additions & 0 deletions
47
.../src/main/java/edu/stanford/bmir/protege/web/client/entity/DuplicateEntitiesViewImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package edu.stanford.bmir.protege.web.client.entity; | ||
|
||
import com.google.gwt.core.client.GWT; | ||
import com.google.gwt.uibinder.client.UiBinder; | ||
import com.google.gwt.uibinder.client.UiField; | ||
import com.google.gwt.user.client.ui.AcceptsOneWidget; | ||
import com.google.gwt.user.client.ui.Composite; | ||
import com.google.gwt.user.client.ui.HTMLPanel; | ||
import com.google.gwt.user.client.ui.SimplePanel; | ||
import edu.stanford.bmir.protege.web.client.progress.BusyView; | ||
|
||
import javax.inject.Inject; | ||
|
||
public class DuplicateEntitiesViewImpl extends Composite implements DuplicateEntitiesView { | ||
|
||
@UiField | ||
BusyView busyView; | ||
|
||
@UiField | ||
public SimplePanel duplicateResultsContainer; | ||
|
||
private static DuplicateEntitiesViewImpl.DuplicateEntitiesViewImplUiBinder ourUiBinder = GWT.create(DuplicateEntitiesViewImpl.DuplicateEntitiesViewImplUiBinder.class); | ||
interface DuplicateEntitiesViewImplUiBinder extends UiBinder<HTMLPanel, DuplicateEntitiesViewImpl> { | ||
|
||
} | ||
|
||
|
||
|
||
@Inject | ||
public DuplicateEntitiesViewImpl() { | ||
initWidget(ourUiBinder.createAndBindUi(this)); | ||
} | ||
|
||
|
||
@Override | ||
public void setBusy(boolean busy) { | ||
this.busyView.setVisible(busy); | ||
} | ||
|
||
|
||
@Override | ||
public AcceptsOneWidget getDuplicateResultsContainer(){ | ||
return duplicateResultsContainer; | ||
} | ||
|
||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...rc/main/java/edu/stanford/bmir/protege/web/client/entity/DuplicateEntitiesViewImpl.ui.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' | ||
xmlns:g='urn:import:com.google.gwt.user.client.ui' | ||
xmlns:progress="urn:import:edu.stanford.bmir.protege.web.client.progress" | ||
> | ||
<ui:with field="msg" type="edu.stanford.bmir.protege.web.client.Messages"/> | ||
<ui:with field="wp" type="edu.stanford.bmir.protege.web.resources.WebProtegeClientBundle"/> | ||
<ui:style> | ||
.main { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: stretch; | ||
} | ||
.main strong { | ||
background-color: #ffea8b; | ||
color: #000; | ||
} | ||
.busyView { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
</ui:style> | ||
|
||
<g:HTMLPanel addStyleNames="{style.main} {wp.style.form}"> | ||
<progress:BusyViewImpl ui:field="busyView" visible="false" addStyleNames="{style.busyView}"/> | ||
<g:Label text="Possible duplicates" addStyleNames="{wp.style.formLabel}"/> | ||
<g:SimplePanel ui:field="duplicateResultsContainer"/> | ||
</g:HTMLPanel> | ||
</ui:UiBinder> |
138 changes: 138 additions & 0 deletions
138
...t/src/main/java/edu/stanford/bmir/protege/web/client/entity/DuplicateEntityPresenter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
package edu.stanford.bmir.protege.web.client.entity; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.google.common.collect.ImmutableSet; | ||
import com.google.gwt.core.client.GWT; | ||
import com.google.gwt.user.client.ui.AcceptsOneWidget; | ||
import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; | ||
import edu.stanford.bmir.protege.web.client.search.EntitySearchFilterTokenFieldPresenter; | ||
import edu.stanford.bmir.protege.web.client.search.HierarchyPopupElementSelectionHandler; | ||
import edu.stanford.bmir.protege.web.client.search.SearchResultChosenHandler; | ||
import edu.stanford.bmir.protege.web.client.search.SearchResultsListPresenter; | ||
import edu.stanford.bmir.protege.web.shared.entity.OWLEntityData; | ||
import edu.stanford.bmir.protege.web.shared.lang.LangTag; | ||
import edu.stanford.bmir.protege.web.shared.lang.LangTagFilter; | ||
import edu.stanford.bmir.protege.web.shared.pagination.PageRequest; | ||
import edu.stanford.bmir.protege.web.shared.project.ProjectId; | ||
import edu.stanford.bmir.protege.web.shared.search.EntitySearchFilter; | ||
import edu.stanford.bmir.protege.web.shared.search.PerformEntitySearchAction; | ||
import edu.stanford.bmir.protege.web.shared.search.PerformEntitySearchResult; | ||
import org.semanticweb.owlapi.model.EntityType; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.inject.Inject; | ||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.logging.Logger; | ||
|
||
import static com.google.common.base.Preconditions.checkNotNull; | ||
|
||
public class DuplicateEntityPresenter { | ||
|
||
|
||
private final ProjectId projectId; | ||
|
||
@Nonnull | ||
private final SearchResultsListPresenter searchResultsPresenter; | ||
|
||
private final Set<EntityType<?>> entityTypes = new HashSet<>(); | ||
|
||
private final EntitySearchFilterTokenFieldPresenter entitySearchFilterTokenFieldPresenter; | ||
|
||
private final DispatchServiceManager dispatchServiceManager; | ||
|
||
private DuplicateEntitiesView view; | ||
|
||
|
||
private String langTag = ""; | ||
|
||
private HierarchyPopupElementSelectionHandler hierarchySelectionHandler = selection -> {}; | ||
|
||
private final static Logger logger = Logger.getLogger(DuplicateEntityPresenter.class.getName()); | ||
|
||
|
||
@Inject | ||
public DuplicateEntityPresenter(@Nonnull ProjectId projectId, | ||
@Nonnull SearchResultsListPresenter searchResultsPresenter, | ||
@Nonnull DuplicateEntitiesView view, | ||
@Nonnull EntitySearchFilterTokenFieldPresenter entitySearchFilterTokenFieldPresenter, | ||
@Nonnull DispatchServiceManager dispatchServiceManager) { | ||
this.projectId = projectId; | ||
this.searchResultsPresenter = searchResultsPresenter; | ||
this.view = view; | ||
this.entitySearchFilterTokenFieldPresenter = checkNotNull(entitySearchFilterTokenFieldPresenter); | ||
this.dispatchServiceManager = dispatchServiceManager; | ||
} | ||
|
||
public void start(@Nonnull AcceptsOneWidget container) { | ||
container.setWidget(view); | ||
hideSearchDuplicatesPanel(); | ||
searchResultsPresenter.setHierarchySelectionHandler(hierarchySelectionHandler); | ||
searchResultsPresenter.start(this.view.getDuplicateResultsContainer()); | ||
} | ||
|
||
public void setEntityTypes(EntityType<?>... entityTypes) { | ||
this.entityTypes.clear(); | ||
this.entityTypes.addAll(Arrays.asList(entityTypes)); | ||
} | ||
|
||
|
||
private void performDuplicateSearch(String entitiesText) { | ||
if (entitiesText.length() < 1) { | ||
hideSearchDuplicatesPanel(); | ||
searchResultsPresenter.clearSearchResults(); | ||
return; | ||
} | ||
int pageNumber = searchResultsPresenter.getPageNumber(); | ||
ImmutableList<EntitySearchFilter> searchFilters = entitySearchFilterTokenFieldPresenter.getSearchFilters(); | ||
|
||
dispatchServiceManager.execute(PerformEntitySearchAction.create(projectId, | ||
entitiesText, | ||
entityTypes, | ||
getLangTagFilter(), | ||
searchFilters, | ||
PageRequest.requestPage(pageNumber)), | ||
view, | ||
this::processSearchActionResult); | ||
|
||
} | ||
|
||
private LangTagFilter getLangTagFilter() { | ||
return LangTagFilter.get(ImmutableSet.of(LangTag.get(this.langTag))); | ||
} | ||
|
||
public void handleEntitiesStringChanged(String value) { | ||
this.performDuplicateSearch(value); | ||
} | ||
|
||
|
||
public void setLangTag(String langTag) { | ||
this.langTag = langTag; | ||
} | ||
|
||
private void processSearchActionResult(PerformEntitySearchResult result) { | ||
if(result.getResults() == null || result.getResults().getTotalElements() == 0){ | ||
hideSearchDuplicatesPanel(); | ||
return; | ||
} | ||
|
||
this.view.asWidget().setVisible(true); | ||
|
||
this.searchResultsPresenter.displaySearchResult(result.getResults()); | ||
} | ||
|
||
private void hideSearchDuplicatesPanel(){ | ||
this.view.asWidget().setVisible(false); | ||
} | ||
|
||
public Optional<OWLEntityData> getSelectedSearchResult() { | ||
return searchResultsPresenter.getSelectedSearchResult(); | ||
} | ||
|
||
public void setHierarchySelectionHandler(HierarchyPopupElementSelectionHandler handler){ | ||
this.hierarchySelectionHandler = handler; | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
...c/main/java/edu/stanford/bmir/protege/web/client/entity/EntitiesStringChangedHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package edu.stanford.bmir.protege.web.client.entity; | ||
|
||
public interface EntitiesStringChangedHandler { | ||
|
||
void handleEntitiesStringChangedHandler(String value); | ||
} |
31 changes: 31 additions & 0 deletions
31
...t/src/main/java/edu/stanford/bmir/protege/web/client/entity/WhoCreateClassDialogView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package edu.stanford.bmir.protege.web.client.entity; | ||
|
||
import com.google.gwt.user.client.ui.AcceptsOneWidget; | ||
import com.google.gwt.user.client.ui.IsWidget; | ||
import edu.stanford.bmir.protege.web.client.library.dlg.HasInitialFocusable; | ||
import org.semanticweb.owlapi.model.EntityType; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
/** | ||
* Matthew Horridge Stanford Center for Biomedical Informatics Research 7 Dec 2017 | ||
*/ | ||
public interface WhoCreateClassDialogView extends IsWidget, HasInitialFocusable { | ||
|
||
void setEntityType(@Nonnull EntityType<?> entityType); | ||
|
||
@Nonnull | ||
String getText(); | ||
|
||
@Nonnull | ||
String getReasonForChange(); | ||
|
||
void clear(); | ||
|
||
@Nonnull | ||
AcceptsOneWidget getDuplicateEntityResultsContainer(); | ||
|
||
void setEntitiesStringChangedHandler(EntitiesStringChangedHandler handler); | ||
|
||
boolean isReasonForChangeSet(); | ||
} |
Oops, something went wrong.