Skip to content

Commit

Permalink
Merge branch 'master-who' into Implement_a_widget_for_class_creation_…
Browse files Browse the repository at this point in the history
…that_checks_for_duplicates_#4
  • Loading branch information
matthewhorridge committed May 29, 2024
2 parents f7d5f09 + a474723 commit 9a42e19
Show file tree
Hide file tree
Showing 62 changed files with 29,707 additions and 508 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Java CI

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Maven
run: mvn --batch-mode --update-snapshots package
33 changes: 33 additions & 0 deletions .github/workflows/pub-docker-hub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish Docker image to Docker Hub
on:
release:
types:
- published
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- uses: actions/checkout@v3
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
server-id: docker.io
server-username: DOCKER_USERNAME
server-password: DOCKER_PASSWORD
- name: Build package
run: mvn --batch-mode clean package
- name: Build and push image
run: mvn --batch-mode -pl webprotege-gwt-ui-server dockerfile:build dockerfile:push

env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_TOKEN: ${{secrets.DOCKER_PASSWORD}}
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>5.0.4-WHO</version>
<version>5.0.6-WHO</version>
<packaging>pom</packaging>

<properties>
Expand Down
57 changes: 2 additions & 55 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,3 @@
WebProtégé
==========
# webprotege-gwt-ui

What is WebProtégé?
-------------------

WebProtégé is a free, open source collaborative ontology development environment.

It provides the following features:
- Support for editing OWL 2 ontologies
- A default simple editing interface, which provides access to commonly used OWL constructs
- Full change tracking and revision history
- Collaboration tools such as, sharing and permissions, threaded notes and discussions, watches and email notifications
- Customizable user interface
- Support for editing OBO ontologies
- Multiple file formats for upload and download of ontologies (supported formats: RDF/XML, Turtle, OWL/XML, OBO, and others)

WebProtégé runs as a Web application. End users access it through their Web browsers.
They do not need to download or install any software. We encourage end-users to use

https://webprotege.stanford.edu

This repository houses the code for the WebProtege GWT User Interface.

Building
--------

To build WebProtégé from source

1) Clone the github repository
```
git clone https://github.com/protegeproject/webprotege-gwt-ui.git
```
2) Open a terminal in the directory where you clone the repository to
3) Use maven to package WebProtégé
```
mvn clean package
```
5) The WebProtege .war file will be built into the webprotege-server directory

Running from Maven
------------------

To run WebProtégé in SuperDev Mode using maven

1) Start the GWT code server in one terminal window
```
mvn gwt:codeserver
```
2) In a different terminal window start the tomcat server
```
mvn -Denv=dev tomcat7:run
```
3) Start the WebProtégé Backend
4) Browse to WebProtégé in a Web browser by navigating to [http://localhost:8080](http://localhost:8080)
This is the UI server for WebProtégé.
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>5.0.4-WHO</version>
<version>5.0.6-WHO</version>
</parent>

<artifactId>webprotege-gwt-ui-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,10 @@ public interface Messages extends com.google.gwt.i18n.client.Messages {
@Key("search")
String search();

@DefaultMessage("Search Icd")
@Key("searchIcd")
String searchIcd();


@DefaultMessage("Search for Class")
@Key("search.class")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import edu.stanford.bmir.protege.web.client.portlet.PortletAction;
import edu.stanford.bmir.protege.web.client.portlet.PortletUi;
import edu.stanford.bmir.protege.web.client.search.SearchModal;
import edu.stanford.bmir.protege.web.client.searchIcd.SearchIcdModal;
import edu.stanford.bmir.protege.web.client.selection.SelectionModel;
import edu.stanford.bmir.protege.web.client.tag.TagVisibilityPresenter;
import edu.stanford.bmir.protege.web.shared.entity.EntityNode;
Expand Down Expand Up @@ -51,12 +52,17 @@ public class ClassHierarchyPortletPresenter extends AbstractWebProtegePortletPre
@Nonnull
private final SearchModal searchModal;

@Nonnull
private final SearchIcdModal searchIcdModal;

private final Messages messages;

private final EntityHierarchyModel hierarchyModel;
@Nonnull
private final EntityNodeHtmlRenderer renderer;

private final UIAction searchActionIcd;

private final UIAction createClassAction;

private final UIAction deleteClassAction;
Expand Down Expand Up @@ -100,6 +106,7 @@ public class ClassHierarchyPortletPresenter extends AbstractWebProtegePortletPre
public ClassHierarchyPortletPresenter(@Nonnull final ProjectId projectId,
@Nonnull SelectionModel selectionModel,
@Nonnull SearchModal searchModal,
@Nonnull SearchIcdModal searchIcdModal,
@Nonnull Messages messages,
@Nonnull EntityHierarchyModel hierarchyModel,
@Nonnull EntityHierarchyContextMenuPresenterFactory contextMenuPresenterFactory,
Expand All @@ -117,6 +124,7 @@ public ClassHierarchyPortletPresenter(@Nonnull final ProjectId projectId,
@Nonnull DispatchServiceManager dispatch) {
super(selectionModel, projectId, displayNameRenderer, dispatch);
this.searchModal = searchModal;
this.searchIcdModal = searchIcdModal;
this.messages = checkNotNull(messages);
this.hierarchyModel = checkNotNull(hierarchyModel);
this.contextMenuPresenterFactory = checkNotNull(contextMenuPresenterFactory);
Expand All @@ -125,16 +133,19 @@ public ClassHierarchyPortletPresenter(@Nonnull final ProjectId projectId,
this.createEntityPresenter = checkNotNull(createEntityPresenter);

this.createClassAction = new PortletAction(messages.create(),
"wp-btn-g--create-class wp-btn-g--create",
this::handleCreateSubClasses);
"wp-btn-g--create-class wp-btn-g--create",
this::handleCreateSubClasses);

this.deleteClassAction = new PortletAction(messages.delete(),
"wp-btn-g--delete-class wp-btn-g--delete",
this::handleDelete);
"wp-btn-g--delete-class wp-btn-g--delete",
this::handleDelete);

this.searchActionIcd = new PortletAction(messages.searchIcd(),
"wp-btn-g--searchIcd",
this::handleIcdSearch);
this.searchAction = new PortletAction(messages.search(),
"wp-btn-g--search",
this::handleSearch);
"wp-btn-g--search",
this::handleSearch);
this.deleteEntitiesPresenter = deleteEntitiesPresenter;
this.actionStatePresenter = actionStatePresenter;
this.dropHandler = dropHandler;
Expand Down Expand Up @@ -163,6 +174,7 @@ public void startPortlet(@Nonnull PortletUi portletUi,
@Nonnull WebProtegeEventBus eventBus) {
portletUi.addAction(createClassAction);
portletUi.addAction(deleteClassAction);
portletUi.addAction(searchActionIcd);
portletUi.addAction(searchAction);
portletUi.setWidget(treeWidget);
portletUi.setFilterView(filterView);
Expand All @@ -178,14 +190,14 @@ public void startPortlet(@Nonnull PortletUi portletUi,
renderer.setDisplayLanguage(displayNameSettingsManager.getLocalDisplayNameSettings());
treeWidget.setRenderer(renderer);
treeWidget.setModel(GraphTreeNodeModel.create(hierarchyModel,
node -> node.getEntity()));
node -> node.getEntity()));
treeWidget.setDropHandler(this.dropHandler);
dropHandler.start(CLASS_HIERARCHY);
contextMenuPresenterFactory.create(hierarchyModel,
treeWidget,
createClassAction,
deleteClassAction)
.install();
treeWidget,
createClassAction,
deleteClassAction)
.install();

tagVisibilityPresenter.start(filterView, treeWidget);
setSelectionInTree(getSelectedEntity());
Expand All @@ -205,16 +217,16 @@ private void setPreferredDisplayLanguage(@Nonnull DisplayNameSettings lang) {

private Optional<OWLClass> getFirstSelectedClass() {
return treeWidget.getFirstSelectedKey()
.filter(sel -> sel instanceof OWLClass)
.map(sel -> (OWLClass) sel);
.filter(sel -> sel instanceof OWLClass)
.map(sel -> (OWLClass) sel);
}

private void transmitSelectionFromTree(SelectionChangeEvent event) {
actionStatePresenter.setSelectionPresent(!treeWidget.getSelectedKeys().isEmpty());
if(!treeWidget.isAttached()) {
if (!treeWidget.isAttached()) {
return;
}
if(settingSelectionInTree) {
if (settingSelectionInTree) {
return;
}
try {
Expand All @@ -231,8 +243,8 @@ private void transmitSelectionFromTree(SelectionChangeEvent event) {

private void handleCreateSubClasses() {
createEntityPresenter.createEntities(CLASS,
getFirstSelectedClass(),
CreateEntitiesInHierarchyHandler.get(treeWidget)
getFirstSelectedClass(),
CreateEntitiesInHierarchyHandler.get(treeWidget)
);
}

Expand All @@ -249,6 +261,12 @@ private void handleSearch() {
searchModal.showModal();
}

private void handleIcdSearch() {
searchIcdModal.setEntityTypes(CLASS);
searchIcdModal.setHierarchySelectedOptions(treeWidget.getFirstSelectedUserObject());
searchIcdModal.showModal();
}

private void selectAndExpandPath(Path<OWLEntity> entityPath) {
treeWidget.setSelected(entityPath, true, () -> treeWidget.setExpanded(entityPath));
}
Expand All @@ -257,7 +275,7 @@ private void setSelectionInTree(Optional<OWLEntity> selection) {
if (transmittingSelectionFromTree) {
return;
}
if(treeWidget.getSelectedKeys().contains(selection.orElse(null))) {
if (treeWidget.getSelectedKeys().contains(selection.orElse(null))) {
return;
}
try {
Expand Down
Loading

0 comments on commit 9a42e19

Please sign in to comment.