From 3d97d853771c373d4f448cd7211e99b753a6d708 Mon Sep 17 00:00:00 2001 From: Nathan Dunn Date: Mon, 9 Mar 2020 16:02:08 -0700 Subject: [PATCH 1/3] fixes #2395 by fixing lookups --- client/apollo/js/View/Track/AnnotTrack.js | 4 ++-- .../org/bbop/apollo/gwt/client/AnnotatorPanel.java | 6 ++++++ src/gwt/org/bbop/apollo/gwt/client/MainPanel.java | 12 ++++++++---- src/gwt/org/bbop/apollo/gwt/client/SearchPanel.java | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/client/apollo/js/View/Track/AnnotTrack.js b/client/apollo/js/View/Track/AnnotTrack.js index 721c23ae3b..b55f5d61e0 100644 --- a/client/apollo/js/View/Track/AnnotTrack.js +++ b/client/apollo/js/View/Track/AnnotTrack.js @@ -2363,12 +2363,12 @@ define([ var selectedFeatureDetails = selectedFeature.afeature; while(selectedFeature ){ if(topTypes.indexOf(selectedFeatureDetails.type.name)>=0){ - this.getApollo().viewInAnnotationPanel(selectedFeatureDetails.uniquename); + this.getApollo().viewInAnnotationPanel(selectedFeatureDetails.uniquename,null); return ; } else if(topTypes.indexOf(selectedFeatureDetails.parent_type.name)>=0){ - this.getApollo().viewInAnnotationPanel(selectedFeatureDetails.parent_id); + this.getApollo().viewInAnnotationPanel(selectedFeatureDetails.parent_id,selectedFeatureDetails.uniquename); return ; } selectedFeature = selectedFeature._parent ; diff --git a/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java b/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java index 8a0aeb7146..4155adddc9 100644 --- a/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java +++ b/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java @@ -958,6 +958,12 @@ public void searchName(KeyUpEvent keyUpEvent) { @UiHandler("showCurrentView") public void setShowCurrentView(ClickEvent clickEvent) { + nameSearchBox.setText(""); + sequenceList.setText(""); + userField.setSelectedIndex(0); + typeList.setSelectedIndex(0); + uniqueNameCheckBox.setValue(false); + goOnlyCheckBox.setValue(false); queryViewInRangeOnly = true; reload(); } diff --git a/src/gwt/org/bbop/apollo/gwt/client/MainPanel.java b/src/gwt/org/bbop/apollo/gwt/client/MainPanel.java index 1c52e73814..431f4cf71e 100644 --- a/src/gwt/org/bbop/apollo/gwt/client/MainPanel.java +++ b/src/gwt/org/bbop/apollo/gwt/client/MainPanel.java @@ -1108,7 +1108,7 @@ public static boolean isOfficialTrack(String trackName){ /** */ - public static Boolean viewInAnnotationPanel(String parentName) { + public static Boolean viewInAnnotationPanel(String parentName,String childName) { try { // ids are registered with clone for some reason in JSONUtils.js for RR and TE . . not sure if it will break other things, so correcting here if(parentName.endsWith("-clone")){ @@ -1121,7 +1121,8 @@ public static Boolean viewInAnnotationPanel(String parentName) { detailTabs.selectTab(TabPanelIndex.ANNOTATIONS.getIndex()); MainPanel.getInstance().openPanel(); MainPanel.getInstance().addOpenTranscript(parentName); - MainPanel.getInstance().selectOpenTranscript(parentName); + GWT.log("viewing: ["+parentName+"] child: ["+childName+"]"); + MainPanel.getInstance().selectOpenTranscript(childName); return true ; } catch (Exception e) { Bootbox.alert("Problem viewing annotation"); @@ -1130,9 +1131,12 @@ public static Boolean viewInAnnotationPanel(String parentName) { } } - private void selectOpenTranscript(String parentName) { + private void selectOpenTranscript(String childName) { annotatorPanel.selectTranscriptPanel(); detailTabs.selectTab(TabPanelIndex.ANNOTATIONS.getIndex()); +// if(childName!=null){ +// annotatorPanel.enableGoto(0,childName); +// } } @@ -1211,7 +1215,7 @@ public static native void exportStaticMethod() /*-{ $wnd.getCurrentOrganism = $entry(@org.bbop.apollo.gwt.client.MainPanel::getCurrentOrganismAsJson()); $wnd.getCurrentUser = $entry(@org.bbop.apollo.gwt.client.MainPanel::getCurrentUserAsJson()); $wnd.getCurrentSequence = $entry(@org.bbop.apollo.gwt.client.MainPanel::getCurrentSequenceAsJson()); - $wnd.viewInAnnotationPanel = $entry(@org.bbop.apollo.gwt.client.MainPanel::viewInAnnotationPanel(Ljava/lang/String;)); + $wnd.viewInAnnotationPanel = $entry(@org.bbop.apollo.gwt.client.MainPanel::viewInAnnotationPanel(Ljava/lang/String;Ljava/lang/String;)); $wnd.isOfficialTrack = $entry(@org.bbop.apollo.gwt.client.MainPanel::isOfficialTrack(Ljava/lang/String;)); $wnd.closeAnnotatorPanel = $entry(@org.bbop.apollo.gwt.client.MainPanel::closePanel()); $wnd.viewGoPanel = $entry(@org.bbop.apollo.gwt.client.MainPanel::viewGoPanel(Ljava/lang/String;)); diff --git a/src/gwt/org/bbop/apollo/gwt/client/SearchPanel.java b/src/gwt/org/bbop/apollo/gwt/client/SearchPanel.java index 067b8860b1..503d59d7f3 100644 --- a/src/gwt/org/bbop/apollo/gwt/client/SearchPanel.java +++ b/src/gwt/org/bbop/apollo/gwt/client/SearchPanel.java @@ -170,7 +170,7 @@ public void onResponseReceived(Request request, Response response) { @Override public void callback(boolean result) { if(result){ - MainPanel.viewInAnnotationPanel(parentName); + MainPanel.viewInAnnotationPanel(parentName,null); } } }); From ece8e94a34259e1bf6f074de92d732880285affc Mon Sep 17 00:00:00 2001 From: Nathan Dunn Date: Mon, 9 Mar 2020 16:26:46 -0700 Subject: [PATCH 2/3] properly selecting --- .../apollo/gwt/client/AnnotatorPanel.java | 30 ++++++++++++++++--- .../org/bbop/apollo/gwt/client/MainPanel.java | 1 + 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java b/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java index 4155adddc9..1af92863bd 100644 --- a/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java +++ b/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java @@ -48,6 +48,7 @@ import org.gwtbootstrap3.client.ui.CheckBox; import org.gwtbootstrap3.client.ui.Label; import org.gwtbootstrap3.client.ui.ListBox; +import org.gwtbootstrap3.client.ui.SuggestBox; import org.gwtbootstrap3.client.ui.TextBox; import org.gwtbootstrap3.client.ui.*; import org.gwtbootstrap3.client.ui.constants.ButtonType; @@ -64,7 +65,8 @@ public class AnnotatorPanel extends Composite { - interface AnnotatorPanelUiBinder extends UiBinder { + + interface AnnotatorPanelUiBinder extends UiBinder { } private static AnnotatorPanelUiBinder ourUiBinder = GWT.create(AnnotatorPanelUiBinder.class); @@ -76,7 +78,7 @@ interface AnnotatorPanelUiBinder extends UiBinder dateColumn; private Column showHideColumn; private long requestIndex = 0; - private static String selectedChildUniqueName = null; + String selectedChildUniqueName = null; private static int selectedSubTabIndex = 0; private static int pageSize = 25; @@ -88,7 +90,7 @@ interface AnnotatorPanelUiBinder extends UiBinder Date: Mon, 9 Mar 2020 16:29:04 -0700 Subject: [PATCH 3/3] simplified the code a bit --- .../apollo/gwt/client/AnnotatorPanel.java | 30 ++++++++++--------- .../org/bbop/apollo/gwt/client/MainPanel.java | 4 --- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java b/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java index 1af92863bd..f5a42ce013 100644 --- a/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java +++ b/src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java @@ -306,27 +306,29 @@ public void onResponseReceived(Request request, Response response) { dataGrid.setRowCount(annotationCount, true); final List annotationInfoList = AnnotationInfoConverter.convertFromJsonArray(jsonArray); dataGrid.setRowData(start, annotationInfoList); + + // if a single entry if (annotationInfoList.size() == 1) { String type = annotationInfoList.get(0).getType(); if ( (!type.equals("gene") && !type.equals("pseudogene")) || uniqueNameCheckBox.getValue()) { selectedAnnotationInfo = annotationInfoList.get(0); - updateAnnotationInfo(selectedAnnotationInfo); // if a child, we need to get the index I think? - if(selectedChildUniqueName==null ) return ; - - final String thisUniqueName = selectedChildUniqueName; - GWT.log("setting the childe's unique name: "+thisUniqueName + " " + selectedAnnotationInfo + " " + selectedAnnotationInfo.getChildAnnotations().size()); - for (AnnotationInfo annotationInfoChild : selectedAnnotationInfo.getChildAnnotations()) { - if (annotationInfoChild.getUniqueName().equals(thisUniqueName)) { -// selectedAnnotationInfo = annotationInfo; - selectedAnnotationInfo = getChildAnnotation(selectedAnnotationInfo, thisUniqueName); - GWT.log("I hope it has sa child: "+selectedAnnotationInfo); - singleSelectionModel.clear(); - singleSelectionModel.setSelected(selectedAnnotationInfo, true); - updateAnnotationInfo(selectedAnnotationInfo); - return; + if(selectedChildUniqueName==null || selectedAnnotationInfo.getChildAnnotations().size()==0) { + updateAnnotationInfo(selectedAnnotationInfo); + return ; + } + else{ + for (AnnotationInfo annotationInfoChild : selectedAnnotationInfo.getChildAnnotations()) { + if (annotationInfoChild.getUniqueName().equals(selectedChildUniqueName)) { + selectedAnnotationInfo = getChildAnnotation(selectedAnnotationInfo, selectedChildUniqueName); + singleSelectionModel.clear(); + singleSelectionModel.setSelected(selectedAnnotationInfo, true); + updateAnnotationInfo(selectedAnnotationInfo); + return; + } } } + } } diff --git a/src/gwt/org/bbop/apollo/gwt/client/MainPanel.java b/src/gwt/org/bbop/apollo/gwt/client/MainPanel.java index 8b9675cc5b..9b6e260621 100644 --- a/src/gwt/org/bbop/apollo/gwt/client/MainPanel.java +++ b/src/gwt/org/bbop/apollo/gwt/client/MainPanel.java @@ -1122,7 +1122,6 @@ public static Boolean viewInAnnotationPanel(String parentName,String childName) detailTabs.selectTab(TabPanelIndex.ANNOTATIONS.getIndex()); MainPanel.getInstance().openPanel(); MainPanel.getInstance().addOpenTranscript(parentName); - GWT.log("viewing: ["+parentName+"] child: ["+childName+"]"); MainPanel.getInstance().selectOpenTranscript(childName); return true ; } catch (Exception e) { @@ -1135,9 +1134,6 @@ public static Boolean viewInAnnotationPanel(String parentName,String childName) private void selectOpenTranscript(String childName) { annotatorPanel.selectTranscriptPanel(); detailTabs.selectTab(TabPanelIndex.ANNOTATIONS.getIndex()); -// if(childName!=null){ -// annotatorPanel.enableGoto(0,childName); -// } }