Skip to content

Commit

Permalink
dialog box to change some parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
bhofmei committed Nov 10, 2016
1 parent 95b16f0 commit 94ea7b5
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 18 deletions.
5 changes: 5 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ div.nuc-dens-sublabel {
div.nuc-dens-sublabel.last {
border-bottom: 1px solid #999;
}

div#nuc-dens-parameters{
border-bottom: 1px solid lightgray;
padding-bottom: 3px;
}
93 changes: 93 additions & 0 deletions js/View/Dialog/NucleotideDensityDialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
define([
'dojo/_base/declare',
'dojo/dom-construct',
'dojo/on',
'dijit/focus',
'dijit/form/NumberSpinner',
'dijit/form/Button',
'JBrowse/View/Dialog/WithActionBar'
],
function(
declare,
dom,
on,
focus,
NumberSpinner,
Button,
ActionBarDialog
) {
return declare(ActionBarDialog, {
title: 'Set Nucleotide Density Track Options',

constructor: function(args) {
this.windowSize = args.windowSize || 100;
this.windowDelta = args.windowDelta || 10;
this.browser = args.browser;
this.setCallback = args.setCallback || function() {};
this.cancelCallback = args.cancelCallback || function() {};
},

_fillActionBar: function(actionBar) {
new Button({
label: 'OK',
onClick: dojo.hitch(this, function() {
var windowSize = +this.windowSizeSpinner.getValue();
var windowDelta = +this.windowDeltaSpinner.getValue();
if (isNaN(windowSize) || isNaN(windowDelta)) {
return;
}
this.setCallback && this.setCallback(windowSize, windowDelta);
this.hide();
})
}).placeAt(actionBar);

new Button({
label: 'Cancel',
onClick: dojo.hitch(this, function() {
this.cancelCallback && this.cancelCallback();
this.hide();
})
}).placeAt(actionBar);
},

show: function(/* callback */) {
dojo.addClass(this.domNode, 'nuc-dens-dialog');


var topPane = dom.create('div',{id:'nuc-dens-parameters'});
this._createTopPane(topPane);

this.set('content', [
topPane
]);

this.inherited(arguments);
},

_createTopPane: function(obj){
var thisB = this;
this.windowSizeSpinner = new NumberSpinner({
value: thisB.windowSize,
smallDelta: 10,
id: 'nuc-dens-window-size'
});
dom.create('label', { for: 'nuc-dens-window-size', innerHTML: 'Window size (bp)', style: {display: 'inline-block', width: '100px'} }, obj);
this.windowSizeSpinner.placeAt(obj);
dom.create('br',{},obj);

this.windowDeltaSpinner = new NumberSpinner({
value: thisB.windowDelta,
smallDelta: 10,
id: 'nuc-dens-window-delta'
});
dom.create('label', { for: 'nuc-dens-window-delta', innerHTML: 'Window delta (bp)', style: {display: 'inline-block', width: '100px'} }, obj);
this.windowDeltaSpinner.placeAt(obj);
dom.create('br',{},obj);
},

hide: function() {
this.inherited(arguments);
window.setTimeout(dojo.hitch(this, 'destroyRecursive'), 500);
}
});
});
30 changes: 12 additions & 18 deletions js/View/Track/NucleotideDensity.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ define([
'dojo/_base/lang',
'dojo/_base/Color',
'dojox/color',
'NucleotideDensityPlugin/Store/SeqFeature/NucContentMulti',
'NucleotideDensityPlugin/Store/SeqFeature/NucDensityMulti',
'JBrowse/View/Track/Wiggle/Density',
'JBrowse/Util',
'dijit/Tooltip'
'NucleotideDensityPlugin/View/Dialog/NucleotideDensityDialog'
],
function(
declare,
Expand All @@ -18,7 +18,7 @@ function(
NucContent,
WiggleDensity,
Util,
Tooltip
NucDensDialog
) {
return declare(WiggleDensity, {
constructor: function() {
Expand Down Expand Up @@ -225,34 +225,28 @@ function(
}
}, this);
}
}
/*_trackMenuOptions: function() {
},
_trackMenuOptions: function() {
var track = this;
var options = this.inherited(arguments);
options.push({
label: 'GC Track Options',
options.push(
{ type: 'dijit/MenuSeparator' },
{
label: 'Track options',
iconClass: 'dijitIconFunction',
onClick: function() {
new WindowSize({
new NucDensDialog({
setCallback: function(ws, wd, mode) {
track.config.windowSize = ws;
track.config.windowDelta = wd;
track.config.gcMode = mode;
if (mode === 'skew') {
track.config.min_score = -1;
track.config.bicolor_pivot = 0;
} else {
track.config.min_score = 0;
track.config.bicolor_pivot = 0.5;
}
track.browser.publish('/jbrowse/v1/c/tracks/replace', [track.config]);
},
windowSize: track.config.windowSize,
windowDelta: track.config.windowDelta,
gcMode: track.config.gcMode
}).show();
}
});
return options;
}*/
}
});
});

0 comments on commit 94ea7b5

Please sign in to comment.