Skip to content

Commit

Permalink
Compiles but has runtime errors due to Guava not being GWT Serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhorridge committed May 22, 2024
1 parent 68716ee commit 8ae08ac
Show file tree
Hide file tree
Showing 28 changed files with 5,529 additions and 16 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<guava.version>33.2.0</guava.version>
<guava.version>32.1.0</guava.version>
<dagger.version>2.51.1</dagger.version>
<owlapi.version>4.5.13</owlapi.version>
<widgetmap.version>4.0.1</widgetmap.version>
Expand All @@ -28,6 +28,7 @@
<auto-factory.version>1.0-beta7</auto-factory.version>
<junit.version>4.12</junit.version>
<commonmark.version>0.11.0</commonmark.version>
<gwt.version>2.10.0</gwt.version>
</properties>

<scm>
Expand Down
6 changes: 6 additions & 0 deletions webprotege-gwt-ui-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<artifactId>webprotege-gwt-ui-client</artifactId>
<packaging>gwt-app</packaging>

<properties>
<gwt.compiler.log-level>INFO</gwt.compiler.log-level>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down Expand Up @@ -40,6 +44,7 @@
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
Expand Down Expand Up @@ -238,6 +243,7 @@
<compilerArgs>
<arg>-incremental</arg>
</compilerArgs>
<logLevel>${gwt.compiler.log-level}</logLevel>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ public interface Messages extends com.google.gwt.i18n.client.Messages {
@DefaultMessage("({0,number} rows in total)")
@AlternateMessage({"one", "(1 row in total)"})
@Key("pagination.rows")
String pagination_rows(long elementCount);
String pagination_rows(@PluralCount int elementCount);

@DefaultMessage("Local name")
@Key("dictionaryLanguage.localName")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package edu.stanford.bmir.protege.web.client.gh;

import com.google.auto.factory.AutoFactory;
import com.google.auto.factory.Provided;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import edu.stanford.bmir.protege.web.client.showdown.Showdown;
import edu.stanford.bmir.protege.web.shared.event.WebProtegeEventBus;
import edu.stanford.bmir.protege.web.shared.gh.GitHubIssue;

import javax.inject.Inject;

/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 2024-05-21
*/
@AutoFactory
public class GitHubIssuePresenter {

private final GitHubIssueView view;

private final GitHubLabelPresenterFactory labelPresenterFactory;

private WebProtegeEventBus eventBus;

@Inject
public GitHubIssuePresenter(@Provided GitHubIssueView view,
@Provided GitHubLabelPresenterFactory labelPresenterFactory) {
this.view = view;
this.labelPresenterFactory = labelPresenterFactory;
}

public void start(WebProtegeEventBus eventBus, AcceptsOneWidget container) {
this.eventBus = eventBus;
container.setWidget(view);
}

public void displayIssue(GitHubIssue issue) {
String bodyInMarkdown = Showdown.renderMarkdown(issue.body());
view.setIssueTitle(issue.title());
view.setBody(bodyInMarkdown);
view.setHtmlUrl(issue.htmlUrl());
issue.labels()
.forEach(label -> {
AcceptsOneWidget labelContainer = view.addLabelContainer();
GitHubLabelPresenter labelPresenter = labelPresenterFactory.create();
labelPresenter.start(eventBus, labelContainer);
labelPresenter.displayLabel(label);
});
}

public void stop() {

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package edu.stanford.bmir.protege.web.client.gh;

import com.google.auto.factory.AutoFactory;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.user.client.ui.IsWidget;

import javax.annotation.Nonnull;

/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 2024-05-21
*/
public interface GitHubIssueView extends IsWidget {

void setIssueTitle(@Nonnull String title);

void setBody(@Nonnull String body);

void setHtmlUrl(String s);

AcceptsOneWidget addLabelContainer();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package edu.stanford.bmir.protege.web.client.gh;

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.*;

import javax.annotation.Nonnull;
import javax.inject.Inject;

public class GitHubIssueViewImpl extends Composite implements GitHubIssueView {

interface GitHubIssueViewImplUiBinder extends UiBinder<HTMLPanel, GitHubIssueViewImpl> {

}

private static GitHubIssueViewImplUiBinder ourUiBinder = GWT.create(GitHubIssueViewImplUiBinder.class);

@UiField
Label issueTitle;

@UiField
Label issueBody;

@UiField
Anchor htmlUrl;

@UiField
HTMLPanel labelContainer;

@Inject
public GitHubIssueViewImpl() {
initWidget(ourUiBinder.createAndBindUi(this));
}

@Override
public void setIssueTitle(@Nonnull String title) {
issueTitle.setText(title);
}

@Override
public void setBody(@Nonnull String body) {
issueBody.setText(body);
}

@Override
public void setHtmlUrl(String s) {
htmlUrl.setHref(s);
}

@Override
public AcceptsOneWidget addLabelContainer() {
SimplePanel container = new SimplePanel();
labelContainer.add(container);
return container;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:with field="wp" type="edu.stanford.bmir.protege.web.resources.WebProtegeClientBundle"/>
<ui:style>
.outer {
padding: 10px;
}
.title {
font-weight: bolder;
}
</ui:style>
<g:HTMLPanel addStyleNames="{style.outer}">
<g:Label ui:field="issueTitle" addStyleNames="{style.title}"/>
<g:Label ui:field="issueBody" addStyleNames="{wp.discussion.commentBody}"/>
<g:HTMLPanel ui:field="labelContainer"/>
<g:Anchor target="_blank" ui:field="htmlUrl">View on GitHub</g:Anchor>
</g:HTMLPanel>
</ui:UiBinder>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package edu.stanford.bmir.protege.web.client.gh;

import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.user.client.ui.IsWidget;

/**
Expand All @@ -10,4 +11,8 @@
public interface GitHubIssuesView extends IsWidget {

void setContent(String html);

AcceptsOneWidget addIssueContainer();

void clearIssueContainers();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
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 javax.inject.Inject;

Expand All @@ -28,4 +30,18 @@ public GitHubIssuesViewImpl() {
public void setContent(String html) {
container.getElement().setInnerHTML(html);
}

@Override
public AcceptsOneWidget addIssueContainer() {
SimplePanel issueContainer = new SimplePanel();
container.add(issueContainer);
return issueContainer;
}

@Override
public void clearIssueContainers() {
for(int i = container.getWidgetCount() - 1; i > -1; i--) {
container.remove(i);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package edu.stanford.bmir.protege.web.client.gh;

import com.google.auto.factory.AutoFactory;
import com.google.auto.factory.Provided;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import edu.stanford.bmir.protege.web.shared.color.Color;
import edu.stanford.bmir.protege.web.shared.event.WebProtegeEventBus;
import edu.stanford.bmir.protege.web.shared.gh.GitHubLabel;

import javax.inject.Inject;

/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 2024-05-21
*/
@AutoFactory
public class GitHubLabelPresenter {

private final GitHubLabelView view;

@Inject
public GitHubLabelPresenter(@Provided GitHubLabelView view) {
this.view = view;
}

public void start(WebProtegeEventBus eventBus, AcceptsOneWidget container) {
container.setWidget(view);
}

public void displayLabel(GitHubLabel label) {
view.setName(label.name());
view.setColor("#" + label.color());
view.setDescription(label.description());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package edu.stanford.bmir.protege.web.client.gh;

import com.google.gwt.user.client.ui.IsWidget;
import edu.stanford.bmir.protege.web.shared.color.Color;

/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 2024-05-21
*/
public interface GitHubLabelView extends IsWidget {

void setName(String title);

void setColor(String color);

void setDescription(String description);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package edu.stanford.bmir.protege.web.client.gh;

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.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Label;
import edu.stanford.bmir.protege.web.client.tooltip.Tooltip;
import edu.stanford.bmir.protege.web.shared.color.Color;

import javax.inject.Inject;

public class GitHubLabelViewImpl extends Composite implements GitHubLabelView {

interface GitHubLabelViewImplUiBinder extends UiBinder<HTMLPanel, GitHubLabelViewImpl> {

}

private static GitHubLabelViewImplUiBinder ourUiBinder = GWT.create(GitHubLabelViewImplUiBinder.class);

@UiField
Label name;

@Inject
public GitHubLabelViewImpl() {
initWidget(ourUiBinder.createAndBindUi(this));
}

@Override
public void setName(String title) {
name.setText(title);
}

@Override
public void setColor(String color) {
name.getElement().getStyle().setBackgroundColor(color);
}

@Override
public void setDescription(String description) {
name.getElement().setTitle(description);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:style>
.gitHubLabel {
padding: 5px;
border-radius: 12px;
display: inline-block;
margin: 2px;
}
</ui:style>
<g:HTMLPanel>
<g:Label ui:field="name" addStyleNames="{style.gitHubLabel}"/>
</g:HTMLPanel>
</ui:UiBinder>
Loading

0 comments on commit 8ae08ac

Please sign in to comment.