Last active
July 15, 2016 20:20
-
-
Save scottcain/5d8459bf0f39d4e5faff7dadf30cca69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'RestrictionSearch/View/SearchSeqDialog':function(){ | |
define([ | |
'dojo/_base/declare', | |
'dojo/dom-construct', | |
'dojo/aspect', | |
'dijit/focus', | |
'dijit/form/Button', | |
'dijit/form/CheckBox', | |
'dijit/form/FilteringSelect', | |
'dojo/store/Memory', | |
'JBrowse/View/Dialog/WithActionBar' | |
], | |
function( | |
declare, | |
dom, | |
aspect, | |
focus, | |
dButton, | |
dCheckBox, | |
dSelect, | |
dMemory, | |
ActionBarDialog | |
) { | |
return declare( ActionBarDialog, { | |
constructor: function() { | |
var thisB = this; | |
aspect.after( this, 'hide', function() { | |
focus.curNode && focus.curNode.blur(); | |
setTimeout( function() { thisB.destroyRecursive(); }, 500 ); | |
}); | |
}, | |
_dialogContent: function () { | |
var content = this.content = {}; | |
var container = dom.create('div', { className: 'search-dialog' } ); | |
var introdiv = dom.create('div', { | |
className: 'search-dialog intro', | |
innerHTML: 'This tool creates a track showing the location of the selected restriction site.' | |
}, container ); | |
// Render enzyme select | |
var selectDiv = dom.create('div', { | |
className: "section" | |
}, container ); | |
var memStore = new dMemory({ | |
data: [ | |
{ name: "EcoRI", id: "GAATTC" }, | |
{ name: "Acc36I", id: "ACCTGC"}, | |
{ name: "AceIII", id: "CAGCTC" }, | |
{ name: "AflIII", id: "AC[AG][CT]GT" }, | |
{ name: "AlfI", id: "GCA([ATCGN]{6})TGC" } | |
] | |
}); | |
content.enzyme = new dSelect({ | |
id : "select_enzyme", | |
name: "enzyme", | |
store: memStore, | |
searchAttr: "name" | |
}, "select_enzyme").startup(); | |
selectDiv.appendChild( content.enzyme.domNode ); | |
dom.create( "label", { "for": "select_enzyme", innerHTML: "Select enzyme"}, selectDiv ); | |
return container; | |
}, | |
_getSearchParams: function() { | |
var content = this.content; | |
return { | |
enzyme: content.enzyme.get('value'), | |
enzymeLabel: content.enzyme.get('displayedValue'), | |
maxLen: 100 | |
}; | |
}, | |
_fillActionBar: function ( actionBar ) { | |
var thisB = this; | |
new dButton({ | |
label: 'Search', | |
iconClass: 'dijitIconBookmark', | |
onClick: function() { | |
var searchParams = thisB._getSearchParams(); | |
thisB.callback( searchParams ); | |
thisB.hide(); | |
} | |
}) | |
.placeAt( actionBar ); | |
new dButton({ | |
label: 'Cancel', | |
iconClass: 'dijitIconDelete', | |
onClick: function() { | |
thisB.callback( false ); | |
thisB.hide(); | |
} | |
}) | |
.placeAt( actionBar ); | |
}, | |
show: function ( callback ) { | |
this.callback = callback || function() {}; | |
this.set( 'title', "Add sequence search track"); | |
this.set( 'content', this._dialogContent() ); | |
this.inherited( arguments ); | |
focus.focus( this.closeButtonNode ); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment