Skip to content

Commit

Permalink
Fix double-click behavior for non-transcript features in AnnotatorPan…
Browse files Browse the repository at this point in the history
…el (#1386)

* Fix double-click behavior for non-transcript features in AnnotatorPanel

* change method definition for displayFeature
  • Loading branch information
deepakunni3 authored and nathandunn committed Dec 14, 2016
1 parent 189eb9e commit 04a9034
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private static void updateAnnotationInfo(AnnotationInfo annotationInfo) {
geneDetailPanel.updateData(annotationInfo);
tabPanel.getTabWidget(1).getParent().setVisible(false);
break;
case "Transcript":
case "transcript":
transcriptDetailPanel.updateData(annotationInfo);
tabPanel.getTabWidget(1).getParent().setVisible(true);
exonDetailPanel.updateData(annotationInfo,selectedAnnotationInfo);
Expand All @@ -446,7 +446,6 @@ private static void updateAnnotationInfo(AnnotationInfo annotationInfo) {
break;
case "transposable_element":
case "repeat_region":
// fireAnnotationInfoChangeEvent(annotationInfo);
repeatRegionDetailPanel.updateData(annotationInfo);
tabPanel.getTabWidget(1).getParent().setVisible(false);
break;
Expand Down Expand Up @@ -688,9 +687,28 @@ public void displayTranscript(int geneIndex, String uniqueName) {
MainPanel.updateGenomicViewerForLocation(selectedAnnotationInfo.getSequence(), min, max, false);
}

// also used by javascript function
public void displayFeature(int featureIndex) {
AnnotationInfo annotationInfo = dataGrid.getVisibleItem(Math.abs(dataGrid.getVisibleRange().getStart() - featureIndex));
String type = annotationInfo.getType();
if (type.equals("transposable_element") || type.equals("repeat_region")) {
// do nothing
}
else {
exonDetailPanel.updateData(annotationInfo);
}
gotoAnnotation.setEnabled(true);
lastGeneIndex = featureIndex;
Integer min = selectedAnnotationInfo.getMin() - 50;
Integer max = selectedAnnotationInfo.getMax() + 50;
min = min < 0 ? 0 : min;
MainPanel.updateGenomicViewerForLocation(selectedAnnotationInfo.getSequence(), min, max, false);
}

public static native void exportStaticMethod(AnnotatorPanel annotatorPanel) /*-{
var that = this;
$wnd.displayTranscript = $entry([email protected]::displayTranscript(ILjava/lang/String;));
$wnd.displayFeature = $entry([email protected]::displayFeature(I));
$wnd.enableGoto = $entry([email protected]::enableGoto(ILjava/lang/String;));
// $wnd.showInAnnotatorPanel = $entry(@org.bbop.apollo.gwt.client.AnnotatorPanel::showInAnnotatorPanel(Ljava/lang/String;Ljava/lang/String;));
}-*/;
Expand Down Expand Up @@ -732,7 +750,17 @@ private void buildAnnotationRow(final AnnotationInfo rowValue, int absRowIndex,
SafeHtml htmlString = new SafeHtmlBuilder().appendHtmlConstant(html.getHTML()).toSafeHtml();
td.html(htmlString);
} else {
renderCell(td, createContext(0), nameColumn, rowValue);
String type = rowValue.getType();
if (type.equals("gene") || type.equals("pseudogene")) {
renderCell(td, createContext(0), nameColumn, rowValue);
}
else {
// handles singleton features
String featureStyle = "color: #800080;";
HTML html = new HTML("<a style='" + featureStyle + "' ondblclick=\"displayFeature(" + absRowIndex + ")\");\">" + rowValue.getName() + "</a>");
SafeHtml htmlString = new SafeHtmlBuilder().appendHtmlConstant(html.getHTML()).toSafeHtml();
td.html(htmlString);
}
}
td.endTD();

Expand Down

0 comments on commit 04a9034

Please sign in to comment.