From 04a90341cbb99aa5647aaa15da2e0f136b99a4f4 Mon Sep 17 00:00:00 2001 From: Deepak Date: Wed, 14 Dec 2016 13:23:08 -0600 Subject: [PATCH] Fix double-click behavior for non-transcript features in AnnotatorPanel (#1386) * Fix double-click behavior for non-transcript features in AnnotatorPanel * change method definition for displayFeature --- .../apollo/gwt/client/AnnotatorPanel.java | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java b/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java index 5fafe5aa87..7abb2d65ce 100644 --- a/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java +++ b/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java @@ -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); @@ -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; @@ -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(annotatorPanel.@org.bbop.apollo.gwt.client.AnnotatorPanel::displayTranscript(ILjava/lang/String;)); + $wnd.displayFeature = $entry(annotatorPanel.@org.bbop.apollo.gwt.client.AnnotatorPanel::displayFeature(I)); $wnd.enableGoto = $entry(annotatorPanel.@org.bbop.apollo.gwt.client.AnnotatorPanel::enableGoto(ILjava/lang/String;)); // $wnd.showInAnnotatorPanel = $entry(@org.bbop.apollo.gwt.client.AnnotatorPanel::showInAnnotatorPanel(Ljava/lang/String;Ljava/lang/String;)); }-*/; @@ -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("" + rowValue.getName() + ""); + SafeHtml htmlString = new SafeHtmlBuilder().appendHtmlConstant(html.getHTML()).toSafeHtml(); + td.html(htmlString); + } } td.endTD();