Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/main/java/com/knowledgepixels/nanodash/ViewDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,15 @@ public boolean appliesToClass(IRI targetClass) {
}

/**
* Gets the nanopub ID associated with this ViewDisplay.
* Gets the nanopub ID associated with this ViewDisplay
*
* @return the nanopub ID
*/
public String getNanopubId() {
if (nanopub == null) return null;
return nanopub.getUri().stringValue();
public IRI getNanopubId() {
if (nanopub == null) {
return null;
}
return nanopub.getUri();
}

public Integer getPageSize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<span wicket:id="user-icon" class="user-icon"></span>
<a href="#" wicket:id="link">link</a>
<span class="status" wicket:id="note">note</span>
<a wicket:id="np" href="#" class="source">^</a>
<wicket:container wicket:id="np">[np]</wicket:container>
</span>

</wicket:panel>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.knowledgepixels.nanodash.component;

import com.knowledgepixels.nanodash.User;
import com.knowledgepixels.nanodash.page.ExplorePage;
import com.knowledgepixels.nanodash.page.UserPage;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.panel.Panel;
Expand Down Expand Up @@ -53,7 +52,7 @@ public ItemListElement(String markupId, Class<? extends WebPage> pageClass, fina
if (sourceNanopublication == null) {
add(new Label("np").setVisible(false));
} else {
add(new BookmarkablePageLink<>("np", ExplorePage.class, new PageParameters().add("id", sourceNanopublication.getUri())));
add(new SourceNanopub("np", sourceNanopublication.getUri()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<wicket:panel>
<div class="paneltitlerow listpanel">
<h4 wicket:id="label">Query</h4>
<span class="buttons"><a href="." wicket:id="np" class="smallbutton source">^</a></span>
<span class="buttons"><wicket:container wicket:id="np">[np]</wicket:container></span>
<span wicket:id="buttons" class="buttons"></span>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.knowledgepixels.nanodash.component;

import com.knowledgepixels.nanodash.*;
import com.knowledgepixels.nanodash.page.ExplorePage;
import com.knowledgepixels.nanodash.page.NanodashPage;
import com.knowledgepixels.nanodash.page.PublishPage;
import com.knowledgepixels.nanodash.template.Template;
Expand Down Expand Up @@ -49,7 +48,7 @@ public class QueryResultList extends QueryResult {
}
add(new Label("label", label));
if (viewDisplay.getNanopubId() != null) {
add(new BookmarkablePageLink<Void>("np", ExplorePage.class, new PageParameters().set("id", viewDisplay.getNanopubId())));
add(new SourceNanopub("np", viewDisplay.getNanopubId(), "smallbutton"));
} else {
add(new Label("np").setVisible(false));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ <h4 wicket:id="title">[View Title]</h4>
<span wicket:id="listEnabler" class="list"></span>
<span wicket:id="gridEnabler" class="grid"></span>
<span class="buttons" style="margin: 0;">
<a href="." wicket:id="np" class="source" style="margin-top: 0;">^</a>
</span>
<wicket:container wicket:id="np">[np]</wicket:container>
</span>
</div>
</div>
<div class="flex-container" wicket:id="nanopubs"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected void populateComponent() {
add(nanopubResults);

if (viewDisplay.getNanopubId() != null) {
add(new BookmarkablePageLink<Void>("np", ExplorePage.class, new PageParameters().set("id", viewDisplay.getNanopubId())));
add(new SourceNanopub("np", viewDisplay.getNanopubId()));
} else {
add(new Label("np").setVisible(false));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<wicket:panel>
<div class="paneltitlerow listpanel">
<h4 wicket:id="label">Paragraph</h4>
<span class="buttons"><a href="." wicket:id="np" class="smallbutton source">^</a></span>
<span class="buttons"><wicket:container wicket:id="np">[np]</wicket:container></span>
<span wicket:id="buttons" class="buttons"></span>
</div>
<div wicket:id="paragraphs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.nanopub.extra.services.ApiResponse;
import org.nanopub.extra.services.ApiResponseEntry;
import org.nanopub.extra.services.QueryRef;
import org.apache.wicket.request.mapper.parameter.PageParameters;

/**
* Component for displaying query results in a list format.
Expand All @@ -34,7 +34,7 @@ public class QueryResultPlainParagraph extends QueryResult {
}
add(new Label("label", label));
if (viewDisplay.getNanopubId() != null) {
add(new BookmarkablePageLink<Void>("np", ExplorePage.class, new PageParameters().set("id", viewDisplay.getNanopubId())));
add(new SourceNanopub("np", viewDisplay.getNanopubId(), "smallbutton"));
} else {
add(new Label("np").setVisible(false));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="paneltitlerow tablepanel">
<h4 wicket:id="label">Query</h4>
<input type="text" wicket:id="filter" placeholder="Filter..." style="margin: 5px 10px; padding: 2px 5px; font-size: 12px; width: 150px;"/>
<span class="buttons"><a href="." wicket:id="np" class="smallbutton source">^</a></span>
<span class="buttons"><wicket:container wicket:id="np">[np]</wicket:container></span>
<span wicket:id="buttons" class="buttons"></span>
</div>
<table wicket:id="table"></table>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.knowledgepixels.nanodash.component;

import com.knowledgepixels.nanodash.*;
import com.knowledgepixels.nanodash.page.ExplorePage;
import com.knowledgepixels.nanodash.page.NanodashPage;
import com.knowledgepixels.nanodash.page.PublishPage;
import com.knowledgepixels.nanodash.template.Template;
import org.apache.wicket.Component;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxNavigationToolbar;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.table.*;
Expand Down Expand Up @@ -56,7 +55,7 @@ public class QueryResultTable extends QueryResult {
}
add(new Label("label", label));
if (viewDisplay.getNanopubId() != null) {
add(new BookmarkablePageLink<Void>("np", ExplorePage.class, new PageParameters().set("id", viewDisplay.getNanopubId())));
add(new SourceNanopub("np", viewDisplay.getNanopubId(), "smallbutton"));
} else {
add(new Label("np").setVisible(false));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<a wicket:id="np" class="source">^</a>
</wicket:panel>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.knowledgepixels.nanodash.component;

import com.knowledgepixels.nanodash.page.ExplorePage;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.eclipse.rdf4j.model.IRI;

/**
* Component for displaying a link to a source nanopublication. The link navigates to the ExplorePage with the specified nanopublication IRI.
*/
public class SourceNanopub extends Panel {

private final String ELEMENT_PATH = "np";

/**
* Constructor for SourceNanopub.
*
* @param markupId the markup ID
* @param sourceIri the IRI of the source nanopublication
*/
public SourceNanopub(String markupId, IRI sourceIri) {
super(markupId);
PageParameters pageParameters = new PageParameters();
pageParameters.add("id", sourceIri);
add(new BookmarkablePageLink<Void>(ELEMENT_PATH, ExplorePage.class, pageParameters));
}

/**
* Constructor for SourceNanopub with additional CSS classes.
*
* @param markupId the markup ID for the component
* @param sourceIriAsString the IRI of the source nanopublication as a string
* @param additionalClasses additional CSS classes to add to the component
*/
public SourceNanopub(String markupId, IRI sourceIriAsString, String... additionalClasses) {
this(markupId, sourceIriAsString);
if (additionalClasses != null && additionalClasses.length > 0) {
String classes = String.join(" ", additionalClasses);
this.get(ELEMENT_PATH).add(new AttributeAppender("class", " " + classes));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="row-section">
<div class="col-12 header">
<h2><span wicket:id="resourcename">Resource ABC</span></h2>
<p><a wicket:id="id" href=".">https://...</a> <a wicket:id="np" href="." class="source">^</a></p>
<p><a wicket:id="id" href=".">https://...</a> <wicket:container wicket:id="np">[np]</wicket:container></p>
<p class="hide-if-empty">Namespace: <a wicket:id="namespace" href="." class="hide-if-empty-trigger"></a></p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
import com.knowledgepixels.nanodash.NanodashPageRef;
import com.knowledgepixels.nanodash.ResourceWithProfile;
import com.knowledgepixels.nanodash.Space;
import com.knowledgepixels.nanodash.component.ButtonList;
import com.knowledgepixels.nanodash.component.JustPublishedMessagePanel;
import com.knowledgepixels.nanodash.component.TitleBar;
import com.knowledgepixels.nanodash.component.ViewList;
import com.knowledgepixels.nanodash.component.*;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.AbstractLink;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.eclipse.rdf4j.model.util.Values;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -61,7 +59,7 @@ public MaintainedResourcePage(final PageParameters parameters) {
add(new Label("pagetitle", resource.getLabel() + " (resource) | nanodash"));
add(new Label("resourcename", resource.getLabel()));
add(new BookmarkablePageLink<Void>("id", ExplorePage.class, parameters.set("label", resource.getLabel())).setBody(Model.of(resource.getId())));
add(new BookmarkablePageLink<Void>("np", ExplorePage.class, new PageParameters().set("id", resource.getNanopubId())));
add(new SourceNanopub("np", Values.iri(resource.getNanopubId())));

String namespaceUri = resource.getNamespace() == null ? "" : resource.getNamespace();
add(new BookmarkablePageLink<Void>("namespace", ExplorePage.class, new PageParameters().set("id", namespaceUri)).setBody(Model.of(namespaceUri)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="row-section">
<div class="col-12 header">
<h2><span wicket:id="name">ABC</span></h2>
<p><a wicket:id="id" href=".">https://...</a> <a wicket:id="np" href="." class="source">^</a></p>
<p><a wicket:id="id" href=".">https://...</a> <wicket:container wicket:id="np">[np]</wicket:container></p>
<p wicket:id="description">Description...</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.knowledgepixels.nanodash.*;
import com.knowledgepixels.nanodash.component.ButtonList;
import com.knowledgepixels.nanodash.component.SourceNanopub;
import com.knowledgepixels.nanodash.component.TitleBar;
import com.knowledgepixels.nanodash.component.ViewList;
import org.apache.wicket.Component;
Expand All @@ -13,6 +14,7 @@
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Statement;
import org.eclipse.rdf4j.model.util.Values;
import org.eclipse.rdf4j.model.vocabulary.DCTERMS;
import org.eclipse.rdf4j.model.vocabulary.RDF;
import org.eclipse.rdf4j.model.vocabulary.RDFS;
Expand Down Expand Up @@ -136,7 +138,7 @@ public ResourcePartPage(final PageParameters parameters) {
add(new Label("pagetitle", label + " (resource part) | nanodash"));
add(new Label("name", label));
add(new BookmarkablePageLink<Void>("id", ExplorePage.class, parameters.set("label", label)).setBody(Model.of(id)));
add(new BookmarkablePageLink<Void>("np", ExplorePage.class, new PageParameters().set("id", nanopubId == null ? id : nanopubId)));
add(new SourceNanopub("np", nanopubId == null ? Values.iri(id) : Values.iri(nanopubId)));

// TODO Improve this code, e.g. make Space a subclass of MaintainedResource or otherwise refactor:
// we now use the ProfileResource abstraction, but the code still has to be imprved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="col-12 header">
<h2><span wicket:id="spacename">Space ABC</span></h2>
<p class="subtitle" wicket:id="spacetype">Space type</p>
<p><a wicket:id="id" href=".">https://...</a> <a wicket:id="np" href="." class="source">^</a></p>
<p><a wicket:id="id" href=".">https://...</a><wicket:container wicket:id="np">[np]</wicket:container></p>
<div wicket:id="altids" class="hide-if-empty inline">...</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public SpacePage(final PageParameters parameters) throws FailedApiCallException
add(new Label("spacename", space.getLabel()));
add(new Label("spacetype", space.getTypeLabel()));
add(new BookmarkablePageLink<Void>("id", ExplorePage.class, parameters.set("label", space.getLabel())).setBody(Model.of(space.getId())));
add(new BookmarkablePageLink<Void>("np", ExplorePage.class, new PageParameters().set("id", np.getUri())));
add(new SourceNanopub("np", np.getUri()));

add(new ItemListPanel<String>(
"altids",
Expand Down
Loading