-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
314 additions
and
5 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
30 changes: 30 additions & 0 deletions
30
src/main/java/org/sagebionetworks/web/client/jsinterop/CardConfiguration.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,30 @@ | ||
package org.sagebionetworks.web.client.jsinterop; | ||
|
||
import java.util.Map; | ||
import jsinterop.annotations.JsFunction; | ||
import jsinterop.annotations.JsOverlay; | ||
import jsinterop.annotations.JsPackage; | ||
import jsinterop.annotations.JsType; | ||
import jsinterop.base.Js; | ||
import jsinterop.base.JsPropertyMap; | ||
|
||
@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") | ||
public class CardConfiguration { | ||
|
||
String type; | ||
double secondaryLabelLimit; | ||
GenericCardSchema genericCardSchema; | ||
|
||
@JsOverlay | ||
public static CardConfiguration create( | ||
String type, | ||
int secondaryLabelLimit, | ||
GenericCardSchema genericCardSchema | ||
) { | ||
CardConfiguration config = new CardConfiguration(); | ||
config.type = type; | ||
config.secondaryLabelLimit = secondaryLabelLimit; | ||
config.genericCardSchema = genericCardSchema; | ||
return config; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/org/sagebionetworks/web/client/jsinterop/GenericCardSchema.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,36 @@ | ||
package org.sagebionetworks.web.client.jsinterop; | ||
|
||
import java.util.Map; | ||
import jsinterop.annotations.JsNullable; | ||
import jsinterop.annotations.JsOverlay; | ||
import jsinterop.annotations.JsPackage; | ||
import jsinterop.annotations.JsType; | ||
import jsinterop.base.Js; | ||
import jsinterop.base.JsPropertyMap; | ||
|
||
@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") | ||
public class GenericCardSchema { | ||
|
||
String type; | ||
String title; | ||
String subTitle; | ||
String description; | ||
String[] secondaryLabels; | ||
|
||
@JsOverlay | ||
public static GenericCardSchema create( | ||
String type, | ||
String title, | ||
String subTitle, | ||
String description, | ||
String[] secondaryLabels | ||
) { | ||
GenericCardSchema config = new GenericCardSchema(); | ||
config.type = type; | ||
config.title = title; | ||
config.subTitle = subTitle; | ||
config.description = description; | ||
config.secondaryLabels = secondaryLabels; | ||
return config; | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
src/main/java/org/sagebionetworks/web/client/place/DataCatalogPagePlace.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,33 @@ | ||
package org.sagebionetworks.web.client.place; | ||
|
||
import com.google.gwt.place.shared.Place; | ||
import com.google.gwt.place.shared.PlaceTokenizer; | ||
import com.google.gwt.place.shared.Prefix; | ||
|
||
public class DataCatalogPagePlace extends Place { | ||
|
||
private String token; | ||
|
||
public DataCatalogPagePlace(String token) { | ||
this.token = token; | ||
} | ||
|
||
public String toToken() { | ||
return token; | ||
} | ||
|
||
@Prefix("DataCatalog") | ||
public static class Tokenizer | ||
implements PlaceTokenizer<DataCatalogPagePlace> { | ||
|
||
@Override | ||
public String getToken(DataCatalogPagePlace place) { | ||
return place.toToken(); | ||
} | ||
|
||
@Override | ||
public DataCatalogPagePlace getPlace(String token) { | ||
return new DataCatalogPagePlace(token); | ||
} | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
src/main/java/org/sagebionetworks/web/client/presenter/DataCatalogPagePresenter.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,32 @@ | ||
package org.sagebionetworks.web.client.presenter; | ||
|
||
import com.google.gwt.activity.shared.AbstractActivity; | ||
import com.google.gwt.event.shared.EventBus; | ||
import com.google.gwt.user.client.ui.AcceptsOneWidget; | ||
import com.google.inject.Inject; | ||
import org.sagebionetworks.web.client.view.DataCatalogPageView; | ||
|
||
public class DataCatalogPagePresenter | ||
extends AbstractActivity | ||
implements | ||
Presenter<org.sagebionetworks.web.client.place.DataCatalogPagePlace> { | ||
|
||
private DataCatalogPageView view; | ||
|
||
@Inject | ||
public DataCatalogPagePresenter(DataCatalogPageView view) { | ||
this.view = view; | ||
} | ||
|
||
@Override | ||
public void start(AcceptsOneWidget panel, EventBus eventBus) { | ||
panel.setWidget(view.asWidget()); | ||
} | ||
|
||
@Override | ||
public void setPlace( | ||
final org.sagebionetworks.web.client.place.DataCatalogPagePlace place | ||
) { | ||
view.render(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/sagebionetworks/web/client/view/DataCatalogPageView.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,7 @@ | ||
package org.sagebionetworks.web.client.view; | ||
|
||
import com.google.gwt.user.client.ui.IsWidget; | ||
|
||
public interface DataCatalogPageView extends IsWidget { | ||
public void render(); | ||
} |
76 changes: 76 additions & 0 deletions
76
src/main/java/org/sagebionetworks/web/client/view/DataCatalogPageViewImpl.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,76 @@ | ||
package org.sagebionetworks.web.client.view; | ||
|
||
import com.google.gwt.user.client.Window; | ||
import com.google.gwt.user.client.ui.SimplePanel; | ||
import com.google.gwt.user.client.ui.Widget; | ||
import com.google.inject.Inject; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider; | ||
import org.sagebionetworks.web.client.jsinterop.CardConfiguration; | ||
import org.sagebionetworks.web.client.jsinterop.GenericCardSchema; | ||
import org.sagebionetworks.web.client.widget.header.Header; | ||
import org.sagebionetworks.web.client.widget.table.explore.QueryWrapperPlotNav; | ||
|
||
public class DataCatalogPageViewImpl implements DataCatalogPageView { | ||
|
||
SimplePanel container; | ||
|
||
private Header headerWidget; | ||
private SynapseReactClientFullContextPropsProvider propsProvider; | ||
|
||
@Inject | ||
public DataCatalogPageViewImpl( | ||
Header headerWidget, | ||
SynapseReactClientFullContextPropsProvider propsProvider | ||
) { | ||
container = new SimplePanel(); | ||
container.addStyleName("padding-30"); | ||
this.headerWidget = headerWidget; | ||
this.propsProvider = propsProvider; | ||
} | ||
|
||
@Override | ||
public void render() { | ||
Window.scrollTo(0, 0); // scroll user to top of page | ||
headerWidget.configure(); | ||
|
||
String[] secondaryLabels = { "contributors", "individuals", "id", "link" }; | ||
GenericCardSchema genericCardSchema = GenericCardSchema.create( | ||
"dataset", | ||
"name", | ||
"community", | ||
"description", | ||
secondaryLabels | ||
); | ||
CardConfiguration cardConfiguration = CardConfiguration.create( | ||
"GENERIC_CARD", | ||
4, | ||
genericCardSchema | ||
); | ||
|
||
QueryWrapperPlotNav plotNav = new QueryWrapperPlotNav( | ||
propsProvider, | ||
"SELECT * FROM syn61609402 WHERE includedInDataCatalog = 'true'", | ||
null, | ||
null, | ||
newBundle -> {}, | ||
null, | ||
true, | ||
false, | ||
true, | ||
true, | ||
true, | ||
null, | ||
cardConfiguration, | ||
"Data Catalog" | ||
); | ||
container.clear(); | ||
container.setWidget(plotNav); | ||
} | ||
|
||
@Override | ||
public Widget asWidget() { | ||
return container.asWidget(); | ||
} | ||
} |
Oops, something went wrong.