Skip to content

Commit

Permalink
added category to field
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandunn committed Feb 26, 2019
1 parent 5accb2d commit 663a8aa
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 27 deletions.
37 changes: 24 additions & 13 deletions src/gwt/org/bbop/apollo/gwt/client/TrackPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ interface TrackUiBinder extends UiBinder<Widget, TrackPanel> {
AnchorListItem selectBamCanvas;
@UiField
AnchorListItem selectBigWigXY;
@UiField
AnchorListItem selectGFF3Canvas;
// @UiField
// AnchorListItem selectGFF3Canvas;
@UiField
AnchorListItem selectVCFCanvas;
@UiField
Expand All @@ -135,6 +135,10 @@ interface TrackUiBinder extends UiBinder<Widget, TrackPanel> {
HTML trackFileHTML;
@UiField
HTML trackFileIndexHTML;
@UiField
HTML categoryNameHTML;
@UiField
com.google.gwt.user.client.ui.TextBox categoryName;

public static ListDataProvider<TrackInfo> dataProvider = new ListDataProvider<>();
private static List<TrackInfo> trackInfoList = new ArrayList<>();
Expand All @@ -161,6 +165,7 @@ public boolean execute() {
addTrackButton.setVisible(true);
configuration.getElement().setPropertyString("placeholder", "Enter configuration data");
trackFileName.getElement().setPropertyString("placeholder", "Enter track name");
categoryName.getElement().setPropertyString("placeholder", "Enter category name");
newTrackForm.setEncoding(FormPanel.ENCODING_MULTIPART);
newTrackForm.setMethod(FormPanel.METHOD_POST);
newTrackForm.setAction(RestService.fixUrl("organism/addTrackToOrganism"));
Expand All @@ -169,7 +174,7 @@ public boolean execute() {
}
return false;
}
}, 200);
}, 400);

newTrackForm.addSubmitHandler(new FormPanel.SubmitHandler() {
@Override
Expand Down Expand Up @@ -305,7 +310,7 @@ private TreeItem generateTreeItem(JSONObject jsonObject) {

private void setTrackTypeAndUpdate(TrackTypeEnum trackType) {
configurationButton.setText(trackType.toString());
configuration.setText(TrackConfigurationTemplate.generateForTypeAndKey(trackType, trackFileName.getText()).toString());
configuration.setText(TrackConfigurationTemplate.generateForTypeAndKeyAndCategory(trackType, trackFileName.getText(),categoryName.getText()).toString());
showFileOptions(trackType);
if (trackType.isIndexed()) {
showIndexOptions(trackType);
Expand Down Expand Up @@ -338,7 +343,7 @@ public void uploadTrackFile(ChangeEvent event) {

@UiHandler("trackFileName")
public void updateTrackFileName(KeyUpEvent event) {
configuration.setText(TrackConfigurationTemplate.generateForTypeAndKey(getTrackType(), trackFileName.getText()).toString());
configuration.setText(TrackConfigurationTemplate.generateForTypeAndKeyAndCategory(getTrackType(), trackFileName.getText(),categoryName.getText()).toString());
}

@UiHandler("cancelNewTrack")
Expand All @@ -363,6 +368,9 @@ private void showFileOptions(TrackTypeEnum typeEnum) {
trackNameHTML.setVisible(true);
trackFileName.setVisible(true);

categoryName.setVisible(true);
categoryNameHTML.setVisible(true);

trackConfigurationHTML.setVisible(true);
configuration.setVisible(true);

Expand Down Expand Up @@ -393,6 +401,9 @@ private void resetNewTrackModel() {
trackNameHTML.setVisible(false);
trackFileName.setVisible(false);

categoryName.setVisible(false);
categoryNameHTML.setVisible(false);

trackConfigurationHTML.setVisible(false);
configuration.setVisible(false);

Expand Down Expand Up @@ -436,20 +447,20 @@ public void selectGFF3(ClickEvent clickEvent) {
setTrackTypeAndUpdate(TrackTypeEnum.GFF3);
}

@UiHandler("selectGFF3Canvas")
public void selectGFF3Canvas(ClickEvent clickEvent) {
setTrackTypeAndUpdate(TrackTypeEnum.GFF3_CANVAS);
}
// @UiHandler("selectGFF3Canvas")
// public void selectGFF3Canvas(ClickEvent clickEvent) {
// setTrackTypeAndUpdate(TrackTypeEnum.GFF3_CANVAS);
// }

@UiHandler("selectGFF3Tabix")
public void selectGFF3Tabix(ClickEvent clickEvent) {
setTrackTypeAndUpdate(TrackTypeEnum.GFF3_TABIX);
}

@UiHandler("selectGFF3TabixCanvas")
public void selectGFF3TabixCanvas(ClickEvent clickEvent) {
setTrackTypeAndUpdate(TrackTypeEnum.GFF3_TABIX_CANVAS);
}
// @UiHandler("selectGFF3TabixCanvas")
// public void selectGFF3TabixCanvas(ClickEvent clickEvent) {
// setTrackTypeAndUpdate(TrackTypeEnum.GFF3_TABIX_CANVAS);
// }

@UiHandler("selectVCF")
public void selectVCF(ClickEvent clickEvent) {
Expand Down
3 changes: 3 additions & 0 deletions src/gwt/org/bbop/apollo/gwt/client/TrackPanel.ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
<gwt:HTML text="Track Name" styleName="{style.areaFile}" visible="false" ui:field="trackNameHTML"/>
<gwt:TextBox ui:field="trackFileName" name="trackFileName" visible="false"/>

<gwt:HTML text="Category" styleName="{style.areaFile}" visible="false" ui:field="categoryNameHTML"/>
<gwt:TextBox ui:field="categoryName" name="categoryName" visible="false"/>

<gwt:HTML text="Track Configuration JSON" styleName="{style.areaFile}" visible="false" ui:field="trackConfigurationHTML"/>
<gwt:TextArea ui:field="configuration" name="trackConfig" visible="false"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,39 @@ public class TrackConfigurationTemplate {
String label;
String type;
String key;
String category;
TrackTypeEnum typeEnum;
// key is entered


public TrackConfigurationTemplate() {
}

public TrackConfigurationTemplate(String storeClass,
String urlTemplate,
String label,
String type,
String key,
String category,
TrackTypeEnum typeEnum
) {
this.storeClass = storeClass;
this.urlTemplate = urlTemplate;
this.label = label;
this.type = type;
this.key = key;
this.category = category ;
this.typeEnum = typeEnum ;
}


public static TrackConfigurationTemplate generateForType(String type) {
TrackConfigurationTemplate trackConfigurationTemplate = new TrackConfigurationTemplate();


return trackConfigurationTemplate;
}

JSONObject toJSON() {
JSONObject returnObject = new JSONObject();
returnObject.put("storeClass", new JSONString(this.storeClass));
returnObject.put("urlTemplate", new JSONString(this.urlTemplate));
returnObject.put("label", new JSONString(this.label));
returnObject.put("type", new JSONString(this.type));
returnObject.put("key", new JSONString(this.key));
if(category!=null && category.trim().length()>0){
returnObject.put("category", new JSONString(this.category));
}
JSONObject apolloDetails = new JSONObject();
apolloDetails.put("source", new JSONString("upload"));
apolloDetails.put("type", new JSONString(this.typeEnum.name()));
Expand All @@ -64,11 +60,8 @@ static String generateString() {
return returnString;
}

public static JSONObject generateForType(TrackTypeEnum type) {
return generateForTypeAndKey(type, generateString());
}

public static JSONObject generateForTypeAndKey(TrackTypeEnum type, String key) {
public static JSONObject generateForTypeAndKeyAndCategory(TrackTypeEnum type, String key,String category) {
String randomFileName = key!=null && key.trim().length()>1 ? key : generateString() ;
switch (type) {
case BAM:
Expand All @@ -78,6 +71,7 @@ public static JSONObject generateForTypeAndKey(TrackTypeEnum type, String key) {
randomFileName,
"JBrowse/View/Track/Alignments",
randomFileName,
category,
type
).toJSON();
case BAM_CANVAS:
Expand All @@ -87,6 +81,7 @@ public static JSONObject generateForTypeAndKey(TrackTypeEnum type, String key) {
randomFileName,
"JBrowse/View/Track/Alignments2",
randomFileName,
category,
type
).toJSON();
case BIGWIG_HEAT_MAP:
Expand All @@ -96,6 +91,7 @@ public static JSONObject generateForTypeAndKey(TrackTypeEnum type, String key) {
randomFileName,
"JBrowse/View/Track/Wiggle/Density",
randomFileName,
category,
type
).toJSON();
case BIGWIG_XY:
Expand All @@ -105,6 +101,7 @@ public static JSONObject generateForTypeAndKey(TrackTypeEnum type, String key) {
randomFileName,
"JBrowse/View/Track/Wiggle/XYPlot",
randomFileName,
category,
type
).toJSON();
case VCF:
Expand All @@ -114,6 +111,7 @@ public static JSONObject generateForTypeAndKey(TrackTypeEnum type, String key) {
randomFileName,
"JBrowse/View/Track/HTMLVariants",
randomFileName,
category,
type
).toJSON();
case VCF_CANVAS:
Expand All @@ -123,6 +121,7 @@ public static JSONObject generateForTypeAndKey(TrackTypeEnum type, String key) {
randomFileName,
"JBrowse/View/Track/CanvasVariants",
randomFileName,
category,
type
).toJSON();
case GFF3:
Expand All @@ -132,6 +131,7 @@ public static JSONObject generateForTypeAndKey(TrackTypeEnum type, String key) {
randomFileName,
"JBrowse/View/Track/HTMLFeatures",
randomFileName,
category,
type
).toJSON();
case GFF3_CANVAS:
Expand All @@ -141,6 +141,7 @@ public static JSONObject generateForTypeAndKey(TrackTypeEnum type, String key) {
randomFileName,
"JBrowse/View/Track/CanvasFeatures",
randomFileName,
category,
type
).toJSON();
case GFF3_TABIX:
Expand All @@ -150,6 +151,7 @@ public static JSONObject generateForTypeAndKey(TrackTypeEnum type, String key) {
randomFileName,
"JBrowse/View/Track/HTMLFeatures",
randomFileName,
category,
type
).toJSON();
case GFF3_TABIX_CANVAS:
Expand All @@ -159,6 +161,7 @@ public static JSONObject generateForTypeAndKey(TrackTypeEnum type, String key) {
randomFileName,
"JBrowse/View/Track/CanvasFeatures",
randomFileName,
category,
type
).toJSON();
}
Expand Down

0 comments on commit 663a8aa

Please sign in to comment.