Added some selection handlers...

This commit is contained in:
David Norton 2006-05-24 13:31:39 +00:00
parent cc195532c0
commit a78715cf5c
3 changed files with 53 additions and 21 deletions

View file

@ -21,12 +21,12 @@ function init()
function newItem(typeID)
{
alert("new item of type: "+typeID);
}
function newFolder()
{
alert("new folder");
}
function folderSelected()
@ -46,4 +46,18 @@ function folderSelected()
document.getElementById('items-tree').view = null;
}
}
function itemSelected()
{
document.getElementById('view-pane').setAttribute('src','http://www.apple.com/');
}
function deleteSelection()
{
if(itemsView && itemsView.selection.count > 0 && confirm("Are you sure you want to delete the selection????"))
{
//either determine focus or just delete from items...
alert("delete not quite implemented yet");
}
}

View file

@ -6,8 +6,8 @@
id="scholar-window"
title="Scholar"
orient="vertical"
width="800"
height="600"
width="1000"
height="700"
onload="Scholar.init(); init();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
@ -20,19 +20,17 @@
<script src="treeView.js"/>
<stringbundle id="scholar-strings" src="chrome://scholar/locale/scholar.properties"/>
<toolbar>
<toolbarbutton label="New Folder..." oncommand="newFolder();"/>
<spacer flex="1"/>
<toolbarbutton id="tb-add" label="New Item..." type="menu">
<menupopup>
</menupopup>
</toolbarbutton>
<spacer flex="1"/>
<label control="tb-search" value="Search:"/><textbox id="tb-search" value=""/>
</toolbar>
<keyset>
<key id="delete-cmd" keycode="VK_DELETE" oncommand="deleteSelection()"/>
<key id="backspace-cmd" keycode="VK_BACK" oncommand="deleteSelection()"/>
</keyset>
<hbox flex="1">
<vbox id="folders-pane" flex="1">
<toolbar>
<toolbarbutton label="New Folder..." oncommand="newFolder();"/>
<spacer flex="1"/>
</toolbar>
<separator/>
<tree
id="folders-tree"
treeviewtype="folders"
@ -51,11 +49,21 @@
<splitter collapse="before" resizebefore="closest" resizeafter="closest">
<grippy/>
</splitter>
<vbox flex="3">
<vbox flex="4">
<toolbar>
<toolbarbutton id="tb-add" label="New Item..." type="menu">
<menupopup>
</menupopup>
</toolbarbutton>
<spacer flex="1"/>
<label control="tb-search" value="Search:"/><textbox id="tb-search" value=""/>
</toolbar>
<separator/>
<tree
id="items-tree"
enablecolumndrag="true"
treeviewtype="items"
treeviewtype="items"
onselect="itemSelected();"
flex="1">
<treecols>
@ -80,7 +88,20 @@
<splitter collapse="after" resizebefore="closest" resizeafter="closest">
<grippy/>
</splitter>
<tree id="edit-pane" flex="2"/>
<tabbox flex="3">
<tabs>
<tab label="Item" selected="true"/>
<tab label="Metadeta"/>
</tabs>
<tabpanels flex="1">
<tabpanel>
<browser id="view-pane" src="" type="content" flex="1"/>
</tabpanel>
<tabpanel>
<label value="sorry!"/>
</tabpanel>
</tabpanels>
</tabbox>
</vbox>
</hbox>
</window>

View file

@ -130,9 +130,6 @@ Scholar.TreeView.prototype.deleteSelection = function()
{
if(this.selection.count == 0)
return;
if(!confirm("Are you sure you want to delete the selected item"+(this.selection.count > 1 ? "s" : "")+"?"))
return;
//collapse open folders
for(var i=0; i<this.rowCount; i++)