Skip to content

Commit

Permalink
Merge 43dd922 into 3e11432
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandunn committed Mar 9, 2020
2 parents 3e11432 + 43dd922 commit 748d44e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 12 deletions.
4 changes: 2 additions & 2 deletions client/apollo/js/View/Track/AnnotTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;
Expand Down
40 changes: 35 additions & 5 deletions src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -64,7 +65,8 @@
public class AnnotatorPanel extends Composite {


interface AnnotatorPanelUiBinder extends UiBinder<com.google.gwt.user.client.ui.Widget, AnnotatorPanel> {

interface AnnotatorPanelUiBinder extends UiBinder<Widget, AnnotatorPanel> {
}

private static AnnotatorPanelUiBinder ourUiBinder = GWT.create(AnnotatorPanelUiBinder.class);
Expand All @@ -76,7 +78,7 @@ interface AnnotatorPanelUiBinder extends UiBinder<com.google.gwt.user.client.ui.
private Column<AnnotationInfo, String> dateColumn;
private Column<AnnotationInfo, String> showHideColumn;
private long requestIndex = 0;
private static String selectedChildUniqueName = null;
String selectedChildUniqueName = null;

private static int selectedSubTabIndex = 0;
private static int pageSize = 25;
Expand All @@ -88,7 +90,7 @@ interface AnnotatorPanelUiBinder extends UiBinder<com.google.gwt.user.client.ui.
@UiField
TextBox nameSearchBox;
@UiField(provided = true)
org.gwtbootstrap3.client.ui.SuggestBox sequenceList;
SuggestBox sequenceList;

private static DataGrid.Resources tablecss = GWT.create(TableResources.TableCss.class);

Expand Down Expand Up @@ -197,7 +199,7 @@ public int getIndex() {


public AnnotatorPanel() {
sequenceList = new org.gwtbootstrap3.client.ui.SuggestBox(sequenceOracle);
sequenceList = new SuggestBox(sequenceOracle);
sequenceList.getElement().setAttribute("placeHolder", "Reference Sequence");
dataGrid.setWidth("100%");
dataGrid.setTableBuilder(new CustomTableBuilder());
Expand Down Expand Up @@ -304,11 +306,29 @@ public void onResponseReceived(Request request, Response response) {
dataGrid.setRowCount(annotationCount, true);
final List<AnnotationInfo> 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 || 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;
}
}
}

}
}

Expand All @@ -328,10 +348,12 @@ public void execute() {
}
// if a child, we need to get the index I think?
final String thisUniqueName = selectedChildUniqueName;
GWT.log("setting the childe's unique name: "+thisUniqueName);
for (AnnotationInfo annotationInfoChild : annotationInfo.getChildAnnotations()) {
if (annotationInfoChild.getUniqueName().equals(selectedAnnotationInfo.getUniqueName())) {
// selectedAnnotationInfo = annotationInfo;
selectedAnnotationInfo = getChildAnnotation(annotationInfo, thisUniqueName);
GWT.log("I hope it has sa child: "+selectedAnnotationInfo);
singleSelectionModel.clear();
singleSelectionModel.setSelected(selectedAnnotationInfo, true);
updateAnnotationInfo(selectedAnnotationInfo);
Expand Down Expand Up @@ -958,6 +980,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();
}
Expand Down Expand Up @@ -994,7 +1022,9 @@ public void enableGoto(int geneIndex, String uniqueName) {
selectedAnnotationInfo = getChildAnnotation(annotationInfo, uniqueName);
exonDetailPanel.updateData(selectedAnnotationInfo);
updateAnnotationInfo(selectedAnnotationInfo);
GWT.log("updated? " + selectedAnnotationInfo.getUniqueName());
selectedChildUniqueName = selectedAnnotationInfo.getUniqueName();
GWT.log("again?? " + selectedAnnotationInfo.getUniqueName());
}

public void setSelectedAnnotationInfo(AnnotationInfo annotationInfo) {
Expand Down
9 changes: 5 additions & 4 deletions src/gwt/org/bbop/apollo/gwt/client/MainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")){
Expand All @@ -1117,11 +1117,12 @@ public static Boolean viewInAnnotationPanel(String parentName) {
annotatorPanel.sequenceList.setText("");
annotatorPanel.nameSearchBox.setText(parentName);
annotatorPanel.uniqueNameCheckBox.setValue(true);
annotatorPanel.selectedChildUniqueName = childName;
annotatorPanel.reload();
detailTabs.selectTab(TabPanelIndex.ANNOTATIONS.getIndex());
MainPanel.getInstance().openPanel();
MainPanel.getInstance().addOpenTranscript(parentName);
MainPanel.getInstance().selectOpenTranscript(parentName);
MainPanel.getInstance().selectOpenTranscript(childName);
return true ;
} catch (Exception e) {
Bootbox.alert("Problem viewing annotation");
Expand All @@ -1130,7 +1131,7 @@ public static Boolean viewInAnnotationPanel(String parentName) {
}
}

private void selectOpenTranscript(String parentName) {
private void selectOpenTranscript(String childName) {
annotatorPanel.selectTranscriptPanel();
detailTabs.selectTab(TabPanelIndex.ANNOTATIONS.getIndex());
}
Expand Down Expand Up @@ -1211,7 +1212,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;));
Expand Down
2 changes: 1 addition & 1 deletion src/gwt/org/bbop/apollo/gwt/client/SearchPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
});
Expand Down

0 comments on commit 748d44e

Please sign in to comment.