Skip to content

Commit

Permalink
seems working
Browse files Browse the repository at this point in the history
  • Loading branch information
drseb committed Feb 5, 2016
1 parent b3ff732 commit 9f47ef6
Show file tree
Hide file tree
Showing 13 changed files with 216 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .settings/com.vaadin.integration.eclipse.prefs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
com.vaadin.integration.eclipse.previousCompileAction=theme
com.vaadin.integration.eclipse.useLatestNightly=false
com.vaadin.integration.eclipse.widgetsetCompilationEta=43862
com.vaadin.integration.eclipse.widgetsetCompilationEta=41585
com.vaadin.integration.eclipse.widgetsetDirty=false
eclipse.preferences.version=1
8 changes: 4 additions & 4 deletions WebContent/VAADIN/themes/hpoweb/hpoweb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
//$v-friendly-color: #2c9720;
//$v-error-indicator-color: #ed473b;


$v-app-loading-text: "Loading HPO data... please wait";


// For more information, see: https://vaadin.com/book/-/page/themes.valo.html
// Example variants can be copy/pasted from https://vaadin.com/wiki/-/wiki/Main/Valo+Examples

Expand All @@ -45,10 +49,6 @@
padding-left: 1px;
}

.tab-content-content{
//padding-left: 5px;
//padding-bottom: 5px;
}

.v-csslayout-gridelement{
padding-top: 10px;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
11 changes: 11 additions & 0 deletions WebContent/VAADIN/themes/hpoweb/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,17 @@ div.v-layout.v-horizontal.v-widget {
border-radius: 4px;
}

.hpoweb .v-app-loading:after {
position: fixed;
z-index: 100;
top: 45%;
padding-top: 47px;
text-align: center;
left: 0;
right: 0;
content: "Loading HPO data... please wait";
}

.hpoweb .v-loading-indicator {
position: fixed !important;
z-index: 99999;
Expand Down
2 changes: 1 addition & 1 deletion ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<!-- Compiler for custom widget sets. Should not be deployed -->
<dependency org="com.vaadin" name="vaadin-client-compiler" rev="&vaadin.version;" conf="widgetset-compile->default" />
<dependency org="org.vaadin" name="viritin" rev="1.34" />
<dependency org="org.vaadin.addons" name="graph-explorer" rev="0.7.0" />
<dependency org="org.vaadin.addons" name="graph-explorer" rev="0.7.0" />
<dependency org="org.vaadin.addon" name="tableexport-for-vaadin" rev="1.5.1.5" />
<dependency org="org.vaadin.addons" name="googleanalyticstracker" rev="2.1.0" />
<dependency org="com.github.vaadin4qbanos" name="jsclipboard" rev="1.0.2" />
Expand Down
129 changes: 93 additions & 36 deletions src/hpoweb/HpowebUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.themes.ValoTheme;

import de.charite.phenowl.annotations.DiseaseId;
import hpoweb.data.HpData;
import hpoweb.data.dataprovider.IDiseaseDataProvider;
import hpoweb.data.dataprovider.IEntityDataProvider;
import hpoweb.data.dataprovider.IGeneDataProvider;
import hpoweb.data.dataprovider.IHpClassDataProvider;
import hpoweb.data.dataprovider.impl.DiseaseDataProvider;
import hpoweb.data.dataprovider.impl.FakeDiseaseDataProvider;
Expand All @@ -47,7 +48,9 @@
import hpoweb.data.dataprovider.impl.HpClassDataProvider;
import hpoweb.data.entities.SearchableEntity;
import hpoweb.uicontent.SearchBarFactory;
import hpoweb.uicontent.graph.GraphtestUI;
import hpoweb.uicontent.tabs.disease.DiseaseTabFactory;
import hpoweb.uicontent.tabs.gene.GeneTabFactory;
import hpoweb.uicontent.tabs.hpoclass.HpoClassTabFactory;
import hpoweb.util.CONSTANTS;
import hpoweb.util.TableUtils;
Expand Down Expand Up @@ -99,6 +102,7 @@ protected void init(VaadinRequest request) {
Container gridContainer = new Container();
setContent(gridContainer);

// just a line that disappears on small devices
addLineRow(gridContainer);

/*
Expand All @@ -111,17 +115,19 @@ protected void init(VaadinRequest request) {
*/
addTracker();

// just a line that disappears on small devices
addLineRow(gridContainer);

/*
* Data provider initialization
*/
IEntityDataProvider dataProvider = setupDataProvider(request, parameterMap);
if (dataProvider == null)
return;

addLineRow(gridContainer);

addInfoLabels(gridContainer, dataProvider);

// just a line that disappears on small devices
addLineRow(gridContainer);

TableUtils tableUtils = new TableUtils();
Expand All @@ -131,30 +137,25 @@ protected void init(VaadinRequest request) {
HpoClassTabFactory hpoClassTabFactory = new HpoClassTabFactory(hpData, tableUtils);
hpoClassTabFactory.addTermInfoElements(gridContainer, (IHpClassDataProvider) dataProvider);

addExtraButtons(gridContainer, (IHpClassDataProvider) dataProvider);
}
else if (dataProvider instanceof IDiseaseDataProvider) {

DiseaseTabFactory diseaseTabFactory = new DiseaseTabFactory(tableUtils);
diseaseTabFactory.addDiseaseInfoElements(gridContainer, (IDiseaseDataProvider) dataProvider);
}
else if (dataProvider instanceof IGeneDataProvider) {

GeneTabFactory geneTabFactory = new GeneTabFactory(tableUtils);
geneTabFactory.addGeneInfoElements(gridContainer, (IGeneDataProvider) dataProvider);

// else if (dataProvider instanceof IGeneDataProvider) {
//
// GeneTabFactory geneTabFactory = new GeneTabFactory(tableUtils);
// geneTabFactory.addGeneInfoTabs(sheet, (IGeneDataProvider)
// dataProvider);
// }
}

// verticalLayout.addComponent(sheet);
// verticalLayout.setExpandRatio(sheet, 1f);
// verticalLayout.setSizeFull();
// just a line that disappears on small devices
addLineRow(gridContainer);

// verticalLayout.addComponent(getCopyPasteButtons(dataProvider.getId(),
// dataProvider.getLabel()));
String ontologyVersion;
if (doParseHpo)

{
if (doParseHpo) {
ontologyVersion = hpData.getExtOwlOntology().getOntologyVersionIri().toString();
}
else
Expand All @@ -163,18 +164,81 @@ else if (dataProvider instanceof IDiseaseDataProvider) {
ontologyVersion = "some ontology version here";
}

/*
* Bottom part
*/
Label version = new Label("Ontology version: " + ontologyVersion);
version.addStyleName(ValoTheme.LABEL_LIGHT);
version.addStyleName(ValoTheme.LABEL_NO_MARGIN);
version.addStyleName(ValoTheme.LABEL_SMALL);

// verticalLayout.addComponent(version);
Label copyright = new Label("Copyright 2015 - The Human Phenotype Ontology Project");
copyright.addStyleName(ValoTheme.LABEL_LIGHT);
copyright.addStyleName(ValoTheme.LABEL_NO_MARGIN);
copyright.addStyleName(ValoTheme.LABEL_SMALL);
// verticalLayout.addComponent(copyright);
Label feedback = new Label("Question, Comments, Feedback: [email protected]");
addLabelRow(gridContainer, version);
addLabelRow(gridContainer, copyright);
addLabelRow(gridContainer, feedback);

}

private void addLabelRow(Container gridContainer, Label label) {
Row r = gridContainer.addRow();
Col c = r.addCol();
c.addComponent(label);
label.addStyleName(ValoTheme.LABEL_LIGHT);
label.addStyleName(ValoTheme.LABEL_NO_MARGIN);
label.addStyleName(ValoTheme.LABEL_SMALL);
}

private void addExtraButtons(Container gridContainer, IHpClassDataProvider dataProvider) {

Row r = gridContainer.addRow();
r.setWidth("100%");

/*
* Copypaste
*/
Button cpButton = getCopyPasteButton(dataProvider.getId(), dataProvider.getLabel());
VerticalLayout vlCp = new VerticalLayout();
vlCp.addComponent(cpButton);

Col c1 = r.addCol(ColMod.SM_6);
c1.addComponent(vlCp);
c1.addStyleName("v-csslayout-gridelement");

/*
* Graph
*/
Button graphButton = getGraphViewButton(dataProvider);
VerticalLayout vlGraph = new VerticalLayout();
vlGraph.addComponent(graphButton);
Col c2 = r.addCol(ColMod.SM_6);
c2.addComponent(vlGraph);
c2.addStyleName("v-csslayout-gridelement");

}

private Button getGraphViewButton(IHpClassDataProvider dataProvider) {

Button b = new Button("Graph view");
b.addClickListener(new Button.ClickListener() {

@Override
public void buttonClick(ClickEvent event) {
GraphtestUI ui = dataProvider.getGraphtestUi();
Window subWindow = new Window("Sub-window");
VerticalLayout subContent = new VerticalLayout();
subContent.setMargin(true);
subWindow.setContent(subContent);

// Put some components in it
subContent.addComponent(ui.getGraphComponent());
subContent.setSizeFull();
// Center it in the browser window
subWindow.center();
subWindow.setWidth("90%");
subWindow.setHeight("90%");

UI.getCurrent().addWindow(subWindow);
}
});

return b;
}

private IEntityDataProvider setupDataProvider(VaadinRequest request, Map<String, String[]> parameterMap) {
Expand Down Expand Up @@ -274,7 +338,7 @@ private void addInfoLabels(Container gridContainer, IEntityDataProvider dataProv
private void addLineRow(Container gridContainer) {
Row row1 = gridContainer.addRow();
row1.setWidth("100%");
Col col12 = row1.addCol(VisibilityMod.HIDDEN_SM);
Col col12 = row1.addCol(VisibilityMod.HIDDEN_SM, VisibilityMod.HIDDEN_XS);
col12.addComponent(new Label("<hr />", ContentMode.HTML));

}
Expand All @@ -290,14 +354,8 @@ private void addTracker() {
/**
* Not sure this is really elegant ;-)
*
* @param string
*
* @param id
* @param label
* @return
*/
private Component getCopyPasteButtons(final String id, final String label) {
final VerticalLayout layout = new VerticalLayout();
private Button getCopyPasteButton(final String id, final String label) {
final JSClipboard clipboard = new JSClipboard();

Button b = new Button("Copy Id/Label");
Expand Down Expand Up @@ -335,8 +393,7 @@ public void onError() {
}
});

layout.addComponent(b);
return layout;
return b;
}

private OWLClass parseHpId(VaadinRequest request) {
Expand Down
18 changes: 18 additions & 0 deletions src/hpoweb/uicontent/tabs/disease/DiseaseTabFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.ValoTheme;

import hpoweb.data.dataprovider.IDiseaseDataProvider;
import hpoweb.data.entities.DiseaseGene;
Expand Down Expand Up @@ -53,6 +54,11 @@ public void addDiseaseInfoTabs(TabSheet sheet, IDiseaseDataProvider dataProvider
private VerticalLayout getAssociatedGenesTab(IDiseaseDataProvider dataProvider) {
VerticalLayout vl_genes = new VerticalLayout();

Label lab1 = new Label("Associated genes");
lab1.addStyleName(ValoTheme.LABEL_LIGHT);
lab1.addStyleName("tab-content-header");
vl_genes.addComponent(lab1);

Collection<DiseaseGene> genes = dataProvider.getAssociatedGenes();
if (genes.size() < 1) {
Label l = new Label("No genes associated with this disease.");
Expand All @@ -76,10 +82,16 @@ private VerticalLayout getAnnotatedHpoClassesTab(IDiseaseDataProvider dataProvid
VerticalLayout tableVL = new VerticalLayout();
tableVL.setSizeFull();

Label lab1 = new Label("Associated HPO classes");
lab1.addStyleName(ValoTheme.LABEL_LIGHT);
lab1.addStyleName("tab-content-header");
tableVL.addComponent(lab1);

Table table = new Table();
table.addContainerProperty("HPO id", TableLabel.class, null);
table.addContainerProperty("HPO label", TableLabel.class, null);
table.setSizeFull();
table.setHeight("275px");

List<HpoClassTableEntry> tableContent = dataProvider.getAnnotatedHpoClasses();

Expand All @@ -104,12 +116,18 @@ private VerticalLayout getAnnotatedHpoClassesTab(IDiseaseDataProvider dataProvid
tableUtils.addDownloadButtons(tableVL, table, fileName, header);
tableVL.addStyleName("tab-content-vl");
tableVL.setExpandRatio(table, 1f);
tableVL.setHeight("350px");
return tableVL;
}

private VerticalLayout getAltNamesTab(IDiseaseDataProvider dataProvider) {
VerticalLayout vl_syns = new VerticalLayout();

Label lab1 = new Label("Alternative names");
lab1.addStyleName(ValoTheme.LABEL_LIGHT);
lab1.addStyleName("tab-content-header");
vl_syns.addComponent(lab1);

Collection<String> synonyms = dataProvider.getAlternativeNames();
if (synonyms.size() < 1) {
Label l = new Label("No synonyms or alternative names");
Expand Down
Loading

0 comments on commit 9f47ef6

Please sign in to comment.