Skip to content

Commit

Permalink
another solution - maybe works in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
koehlers committed Mar 7, 2018
1 parent c0bed54 commit 8e0835b
Showing 1 changed file with 21 additions and 27 deletions.
48 changes: 21 additions & 27 deletions src/hpoweb/HpowebUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,16 @@ public class HpowebUI extends UI {
private final static Object block = new Object();

private static HpData hpData = null;
private static GoogleAnalyticsTracker tracker;

private static Label version;

private static Label copyright;

private static Link feedback;

private static LazyComboBox<SearchableEntity> searchBar;

public static Container gridContainer;

@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = HpowebUI.class)
public static class Servlet extends VaadinServlet {
}

private static String ontologyVersion;

private GoogleAnalyticsTracker tracker;

@Override
protected void init(VaadinRequest request) {

Expand All @@ -111,21 +104,12 @@ protected void init(VaadinRequest request) {
}
}

String ontologyVersion;
if (doParseHpo) {
ontologyVersion = hpData.getExtOwlOntology().getOntologyVersionIri().toString();
}
else {
ontologyVersion = "some ontology version here";
}
version = new Label("Ontology version: " + ontologyVersion);
copyright = new Label("Copyright 2018 - Sebastian Köhler & The Phenomics Group Berlin");
feedback = new Link("Contact: [email protected]",
new ExternalResource("http:https://phenomics.github.io/"));

SearchBarFactory searchbarFactory = new SearchBarFactory();
searchBar = searchbarFactory.getSearchBar(hpData);
searchBar.setWidth("100%");

/*
* Set the site url template
Expand All @@ -142,12 +126,11 @@ protected void init(VaadinRequest request) {
putParametersIntoUriFragment(request);
}
uriFragment = page.getUriFragment();

/************************
* Now the content displayed
*/

gridContainer = refreshContent(uriFragment);

Container gridContainer = getContentContainer(uriFragment);
setContent(gridContainer);

page.addUriFragmentChangedListener(new UriFragmentChangedListener() {
Expand All @@ -156,8 +139,8 @@ public void uriFragmentChanged(UriFragmentChangedEvent source) {
System.out.println("got a change in uri fragment here");
Page page = HpowebUI.get().getPage();
String uriFragment = page.getUriFragment();
gridContainer = refreshContent(uriFragment);
setContent(gridContainer);
Container newGridContainer = getContentContainer(uriFragment);
setContent(newGridContainer);
}
});

Expand All @@ -167,9 +150,15 @@ public void uriFragmentChanged(UriFragmentChangedEvent source) {
* @param uriFragment
* @return
*/
public static Container refreshContent(String uriFragment) {
public static Container getContentContainer(String uriFragment) {

SearchBarFactory searchbarFactory = new SearchBarFactory();
LazyComboBox<SearchableEntity> searchBar = searchbarFactory.getSearchBar(hpData);
searchBar.setWidth("100%");

Container gridContainer = new Container();

gridContainer = new Container();
gridContainer.removeAllComponents();

// just a line that disappears on small devices
addHorizontalLine(gridContainer);
Expand Down Expand Up @@ -218,6 +207,11 @@ else if (dataProvider instanceof IGeneDataProvider) {

}

Label version = new Label("Ontology version: " + ontologyVersion);
Label copyright = new Label("Copyright 2018 - Sebastian Köhler & The Phenomics Group Berlin");
Link feedback = new Link("Contact: [email protected]",
new ExternalResource("http:https://phenomics.github.io/"));

// just a line that disappears on small devices
addHorizontalLine(gridContainer);
addLabelRow(gridContainer, version);
Expand Down

0 comments on commit 8e0835b

Please sign in to comment.