Skip to content

Commit

Permalink
Merge bef98bf into da96cd1
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandunn authored Feb 12, 2019
2 parents da96cd1 + bef98bf commit 72b41f9
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 138 deletions.
3 changes: 0 additions & 3 deletions src/gwt/org/bbop/apollo/gwt/client/Annotator.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
Expand All @@ -14,7 +12,6 @@
import com.google.gwt.i18n.client.Dictionary;
import com.google.gwt.storage.client.Storage;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import org.bbop.apollo.gwt.client.rest.RestService;
import org.bbop.apollo.gwt.shared.ClientTokenGenerator;
Expand Down
68 changes: 64 additions & 4 deletions src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.cellview.client.*;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.*;
import com.google.gwt.view.client.*;
import org.bbop.apollo.gwt.client.dto.AnnotationInfo;
Expand All @@ -43,6 +42,7 @@
import org.bbop.apollo.gwt.client.event.UserChangeEvent;
import org.bbop.apollo.gwt.client.event.UserChangeEventHandler;
import org.bbop.apollo.gwt.client.resources.TableResources;
import org.bbop.apollo.gwt.client.rest.AnnotationRestService;
import org.bbop.apollo.gwt.client.rest.UserRestService;
import org.bbop.apollo.gwt.shared.FeatureStringEnum;
import org.bbop.apollo.gwt.shared.PermissionEnum;
Expand All @@ -52,6 +52,7 @@
import org.gwtbootstrap3.client.ui.ListBox;
import org.gwtbootstrap3.client.ui.TextBox;
import org.gwtbootstrap3.extras.bootbox.client.Bootbox;
import org.gwtbootstrap3.extras.bootbox.client.callback.ConfirmCallback;

import java.util.Date;
import java.util.HashSet;
Expand Down Expand Up @@ -124,6 +125,8 @@ interface AnnotatorPanelUiBinder extends UiBinder<com.google.gwt.user.client.ui.
Container northPanelContainer;
@UiField
static Button gotoAnnotation;
@UiField
static Button deleteAnnotation;

private static AnnotationInfo selectedAnnotationInfo;
private MultiWordSuggestOracle sequenceOracle = new ReferenceSequenceOracle();
Expand Down Expand Up @@ -259,7 +262,7 @@ public void execute() {
}
// if a child, we need to get the index I think?
final String thisUniqueName = selectedChildUniqueName;
for (AnnotationInfo annotationInfoChild : annotationInfo.getAnnotationInfoSet()) {
for (AnnotationInfo annotationInfoChild : annotationInfo.getChildAnnotations()) {
GWT.log("next-level: " + annotationInfoChild.getType());
if (annotationInfoChild.getUniqueName().equals(selectedAnnotationInfo.getUniqueName())) {
// selectedAnnotationInfo = annotationInfo;
Expand Down Expand Up @@ -664,9 +667,11 @@ public void onSelectionChange(SelectionChangeEvent event) {
if (selectedAnnotationInfo != null) {
exonDetailPanel.updateData(selectedAnnotationInfo);
gotoAnnotation.setEnabled(true);
deleteAnnotation.setEnabled(true);
} else {
exonDetailPanel.updateData();
gotoAnnotation.setEnabled(false);
deleteAnnotation.setEnabled(false);
}
}
});
Expand Down Expand Up @@ -729,9 +734,61 @@ void gotoAnnotation(ClickEvent clickEvent) {
MainPanel.updateGenomicViewerForLocation(selectedAnnotationInfo.getSequence(), min, max, false, false);
}

@UiHandler("deleteAnnotation")
void deleteAnnotation(ClickEvent clickEvent) {
final Set<AnnotationInfo> deletableChildren = getDeletableChildren(selectedAnnotationInfo);
String confirmString = "";
if (deletableChildren.size() > 0) {
confirmString = "Delete the " + deletableChildren.size() + " annotation" + (deletableChildren.size() > 1 ? "s" : "") + " belonging to the " + selectedAnnotationInfo.getType() + " " + selectedAnnotationInfo.getName() + "?";
} else {
confirmString = "Delete the " + selectedAnnotationInfo.getType() + " " + selectedAnnotationInfo.getName() + "?";
}


final RequestCallback requestCallback = new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == 200) {
// reload();
} else {
Bootbox.alert("Problem with deletion: " + response.getText());
}
}

@Override
public void onError(Request request, Throwable exception) {
Bootbox.alert("Problem with deletion: " + exception.getMessage());
}
};

Bootbox.confirm(confirmString, new ConfirmCallback() {
@Override
public void callback(boolean result) {
if (result) {
if (deletableChildren.size() == 0) {
Set<AnnotationInfo> annotationInfoSet = new HashSet<>();
annotationInfoSet.add(selectedAnnotationInfo);
AnnotationRestService.deleteAnnotations(requestCallback, annotationInfoSet);
} else {
JSONObject jsonObject = AnnotationRestService.deleteAnnotations(requestCallback, deletableChildren);
}
}
}
});
}


private Set<AnnotationInfo> getDeletableChildren(AnnotationInfo selectedAnnotationInfo) {
String type = selectedAnnotationInfo.getType();
GWT.log("type:" + type);
if (type.equalsIgnoreCase(FeatureStringEnum.GENE.getValue()) || type.equalsIgnoreCase(FeatureStringEnum.PSEUDOGENE.getValue())) {
return selectedAnnotationInfo.getChildAnnotations();
}
return new HashSet<>();
}

private static AnnotationInfo getChildAnnotation(AnnotationInfo annotationInfo, String uniqueName) {
for (AnnotationInfo childAnnotation : annotationInfo.getAnnotationInfoSet()) {
for (AnnotationInfo childAnnotation : annotationInfo.getChildAnnotations()) {
if (childAnnotation.getUniqueName().equalsIgnoreCase(uniqueName)) {
return childAnnotation;
}
Expand All @@ -747,6 +804,7 @@ public void enableGoto(int geneIndex, String uniqueName) {
exonDetailPanel.updateData(selectedAnnotationInfo);
updateAnnotationInfo(selectedAnnotationInfo);
gotoAnnotation.setEnabled(true);
deleteAnnotation.setEnabled(true);
selectedChildUniqueName = selectedAnnotationInfo.getUniqueName();
}

Expand All @@ -758,6 +816,7 @@ public void displayTranscript(int geneIndex, String uniqueName) {
selectedAnnotationInfo = getChildAnnotation(annotationInfo, uniqueName);
exonDetailPanel.updateData(selectedAnnotationInfo);
gotoAnnotation.setEnabled(true);
deleteAnnotation.setEnabled(true);
selectedChildUniqueName = selectedAnnotationInfo.getUniqueName();

// for some reason doesn't like call gotoAnnotation
Expand All @@ -777,6 +836,7 @@ public void displayFeature(int featureIndex) {
exonDetailPanel.updateData(annotationInfo);
}
gotoAnnotation.setEnabled(true);
deleteAnnotation.setEnabled(true);
Integer min = selectedAnnotationInfo.getMin() - 50;
Integer max = selectedAnnotationInfo.getMax() + 50;
min = min < 0 ? 0 : min;
Expand Down Expand Up @@ -804,7 +864,7 @@ protected void buildRowImpl(AnnotationInfo rowValue, int absRowIndex) {

if (showingTranscripts.contains(rowValue.getUniqueName())) {
// add some random rows
Set<AnnotationInfo> annotationInfoSet = rowValue.getAnnotationInfoSet();
Set<AnnotationInfo> annotationInfoSet = rowValue.getChildAnnotations();
if (annotationInfoSet.size() > 0) {
for (AnnotationInfo annotationInfo : annotationInfoSet) {
buildAnnotationRow(annotationInfo, absRowIndex, true);
Expand Down
209 changes: 91 additions & 118 deletions src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,14 @@
word-wrap: break-word;
}

.assemblage-buttons {
.action-buttons {
margin-right: 10px;
display: inline;
}
</ui:style>
<gwt:DockLayoutPanel ui:field="splitPanel">
<gwt:north size="120">
<b:Container fluid="true" styleName="{style.northPanel}" ui:field="northPanelContainer">
<!--<b:Row styleName="{style.rowPadding}">-->
<!--<b:Column size="MD_6">-->
<!--<b:TextBox placeholder="Annotation Name"-->
<!--ui:field="nameSearchBox" addStyleNames="{style.widgetBox}"/>-->
<!--</b:Column>-->
<!--<b:Column size="MD_5">-->
<!--<b:ListBox ui:field="typeList" addStyleNames="{style.widgetBox}"/>-->
<!--</b:Column>-->
<!--<b:Column size="MD_6">-->
<!--<b:SuggestBox ui:field="sequenceList" addStyleNames="{style.widgetBox}"/>-->
<!--</b:Column>-->
<!--&lt;!&ndash;</b:Row>&ndash;&gt;-->
<!--&lt;!&ndash;<b:Row styleName="{style.rowPadding}">&ndash;&gt;-->
<!--<b:Column size="MD_5">-->
<!--<b:ListBox ui:field="userField" addStyleNames="{style.widgetBox}"/>-->
<!--</b:Column>-->
<!--</b:Row>-->

<b:Row styleName="{style.rowPadding}">
<b:Column size="MD_6">
<b:TextBox placeholder="Annotation Name"
Expand All @@ -83,106 +66,96 @@
<b:Column size="MD_3">
<b:ListBox ui:field="userField" addStyleNames="{style.widgetBox}"/>
</b:Column>
<b:Column size="MD_4">
<!--<gwt:SuggestBox ui:field="sequenceList" width="200px"/>-->
<!--<b:Button type="PRIMARY" icon="BOOKMARK" text="+" size="EXTRA_SMALL" title="Add new assemblage"-->
<!--ui:field="addNewAssemblage" enabled="false"-->
<!--addStyleNames="{style.assemblage-buttons}"/>-->

<!--<b:ButtonGroup>-->
<!--<b:Button type="PRIMARY" icon="EYE" text="+" size="EXTRA_SMALL" title="Add to view"-->
<!--ui:field="addToView" enabled="false" addStyleNames="{style.assemblage-buttons}"/>-->
<!--<b:Button type="PRIMARY" icon="EYE" title="View" size="EXTRA_SMALL"-->
<!--ui:field="viewAnnotation" enabled="false"-->
<!--addStyleNames="{style.assemblage-buttons}"/>-->
<!--</b:ButtonGroup>-->
<b:Button type="PRIMARY" icon="ARROW_CIRCLE_O_RIGHT" title="Go To" iconSize="LARGE" text="Go to Annotation"
ui:field="gotoAnnotation" enabled="false" addStyleNames="{style.assemblage-buttons}"/>
</b:Row>
<b:Row>
<b:Column size="MD_10">
<b:ButtonGroup>
<b:Button type="PRIMARY" icon="ARROW_CIRCLE_O_RIGHT" title="Go To" iconSize="LARGE"
text="Go to Annotation"
ui:field="gotoAnnotation" enabled="false" addStyleNames="{style.action-buttons}"/>
<b:Button type="DANGER" icon="TRASH_O" title="Go To" iconSize="LARGE"
text="Delete Annotation"
ui:field="deleteAnnotation" enabled="false"
addStyleNames="{style.action-buttons}"/>
</b:ButtonGroup>
</b:Column>
</b:Row>
</b:Container>
</gwt:north>
<gwt:center>
<gwt:DockLayoutPanel>
<gwt:north size="30">
<gwt:HTMLPanel>
<table style="width:100%">
<tr>
<td style="width:20%">
<!--<b:Button ui:field="selectSelectedButton" size="EXTRA_SMALL" enabled="false" icon="CHECK_CIRCLE" marginLeft="10"/>-->
</td>
<td align="center">
<apollo:WebApolloSimplePager ui:field="pager" styleName="{style.pager}"/>
</td>
<td style="width:20%"/>
</tr>
</table>
</gwt:HTMLPanel>
</gwt:north>
<gwt:center>
<cellview:DataGrid ui:field="dataGrid" styleName="{style.dataGrid}"/>
</gwt:center>
</gwt:DockLayoutPanel>
</gwt:center>
<gwt:south size="280">
<gwt:TabLayoutPanel barHeight="35" ui:field="tabPanel">
<gwt:tab>
<gwt:header>Details</gwt:header>
<b:Container fluid="true" width="100%">
<b:Row>
<apollo:GeneDetailPanel ui:field="geneDetailPanel" visible="false"/>
<apollo:VariantDetailPanel ui:field="variantDetailPanel" visible="false"/>
<apollo:TranscriptDetailPanel ui:field="transcriptDetailPanel" visible="false"/>
<apollo:RepeatRegionDetailPanel ui:field="repeatRegionDetailPanel" visible="false"/>
<!--<apollo:ExonDetailPanel ui:field="exonDetailPanel" visible="false"/>-->
<!--<apollo:CDSDetailPanel ui:field="cdsDetailPanel" visible="false"/>-->
</b:Row>
</b:Container>
</gwt:tab>
<gwt:tab>
<gwt:header>Coding</gwt:header>
<apollo:ExonDetailPanel ui:field="exonDetailPanel"/>
</gwt:tab>
<gwt:tab>
<gwt:header>Alternate Alleles</gwt:header>
<apollo:VariantAllelesPanel ui:field="variantAllelesPanel"/>
</gwt:tab>
<gwt:tab>
<gwt:header>Variant Info</gwt:header>
<apollo:VariantInfoPanel ui:field="variantInfoPanel"/>
</gwt:tab>
<gwt:tab>
<gwt:header>Allele Info</gwt:header>
<apollo:AlleleInfoPanel ui:field="alleleInfoPanel"/>
</gwt:tab>

<!--TODO: 2.1-->
<!--<gwt:tab>-->
<!--<gwt:header>DbXref</gwt:header>-->
<!--<gwt:HTML text="dbxref"/>-->
<!--</gwt:tab>-->
<!--<gwt:tab>-->
<!--<gwt:header>PubMed</gwt:header>-->
<!--<gwt:HTML text="pubmed stuf"/>-->
<!--</gwt:tab>-->
<!--<gwt:tab>-->
<!--<gwt:header>Attributes</gwt:header>-->
<!--<gwt:HTML text="attributes"/>-->
<!--</gwt:tab>-->
<!--<gwt:tab>-->
<!--<gwt:header>GO Evidence</gwt:header>-->
<!--<gwt:HTML text="go evidence"/>-->
<!--</gwt:tab>-->
<!--<gwt:tab>-->
<!--<gwt:header>Comments</gwt:header>-->
<!--<gwt:HTML text="comments"/>-->
<!--</gwt:tab>-->
</b:Container>
</gwt:north>
<gwt:center>
<gwt:DockLayoutPanel>
<gwt:north size="30">
<gwt:HTMLPanel>
<table style="width:100%">
<tr>
<td style="width:20%">
</td>
<td align="center">
<apollo:WebApolloSimplePager ui:field="pager" styleName="{style.pager}"/>
</td>
<td style="width:20%"/>
</tr>
</table>
</gwt:HTMLPanel>
</gwt:north>
<gwt:center>
<cellview:DataGrid ui:field="dataGrid" styleName="{style.dataGrid}"/>
</gwt:center>
</gwt:DockLayoutPanel>
</gwt:center>
<gwt:south size="280">
<gwt:TabLayoutPanel barHeight="35" ui:field="tabPanel">
<gwt:tab>
<gwt:header>Details</gwt:header>
<b:Container fluid="true" width="100%">
<b:Row>
<apollo:GeneDetailPanel ui:field="geneDetailPanel" visible="false"/>
<apollo:VariantDetailPanel ui:field="variantDetailPanel" visible="false"/>
<apollo:TranscriptDetailPanel ui:field="transcriptDetailPanel" visible="false"/>
<apollo:RepeatRegionDetailPanel ui:field="repeatRegionDetailPanel" visible="false"/>
</b:Row>
</b:Container>
</gwt:tab>
<gwt:tab>
<gwt:header>Coding</gwt:header>
<apollo:ExonDetailPanel ui:field="exonDetailPanel"/>
</gwt:tab>
<gwt:tab>
<gwt:header>Alternate Alleles</gwt:header>
<apollo:VariantAllelesPanel ui:field="variantAllelesPanel"/>
</gwt:tab>
<gwt:tab>
<gwt:header>Variant Info</gwt:header>
<apollo:VariantInfoPanel ui:field="variantInfoPanel"/>
</gwt:tab>
<gwt:tab>
<gwt:header>Allele Info</gwt:header>
<apollo:AlleleInfoPanel ui:field="alleleInfoPanel"/>
</gwt:tab>

</gwt:TabLayoutPanel>
<!--</gwt:VerticalPanel>-->
</gwt:south>
</gwt:DockLayoutPanel>
<!--<gwt:HTMLPanel>-->
<!--TODO: 2.1-->
<!--<gwt:tab>-->
<!--<gwt:header>DbXref</gwt:header>-->
<!--<gwt:HTML text="dbxref"/>-->
<!--</gwt:tab>-->
<!--<gwt:tab>-->
<!--<gwt:header>PubMed</gwt:header>-->
<!--<gwt:HTML text="pubmed stuf"/>-->
<!--</gwt:tab>-->
<!--<gwt:tab>-->
<!--<gwt:header>Attributes</gwt:header>-->
<!--<gwt:HTML text="attributes"/>-->
<!--</gwt:tab>-->
<!--<gwt:tab>-->
<!--<gwt:header>GO Evidence</gwt:header>-->
<!--<gwt:HTML text="go evidence"/>-->
<!--</gwt:tab>-->
<!--<gwt:tab>-->
<!--<gwt:header>Comments</gwt:header>-->
<!--<gwt:HTML text="comments"/>-->
<!--</gwt:tab>-->

<!--</gwt:HTMLPanel>-->
</ui:UiBinder>
</gwt:TabLayoutPanel>
</gwt:south>
</gwt:DockLayoutPanel>
</ui:UiBinder>
Loading

0 comments on commit 72b41f9

Please sign in to comment.