Changeset 99:ca0f0b38a1d9 for source/class/pf
- Timestamp:
- Jan 8, 2009, 6:19:06 PM (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/class/pf/Application.js
r98 r99 324 324 } 325 325 326 function click EntityCB(ev)326 function clickTreeCB(ev) 327 327 { 328 328 var e = ev.getTarget(); 329 var entity = e.getUserData("entity"); 330 331 this.gui_entity_units.update(entity.dimension, 332 this.prefs.units[entity.dimension]); 333 334 this.updateEntityValue(); 329 if (e.isSelected()) { 330 var entity = e.getUserData("entity"); 331 332 if (entity) { 333 this.gui_entity_units.update(entity.dimension, 334 this.prefs.units[entity.dimension]); 335 } else { 336 this.gui_entity_units.update(null, null); 337 } 338 339 this.updateEntityValue(); 340 } 335 341 } 336 342 … … 716 722 var species = leaf.getUserData("species"); 717 723 718 var name = this.getEntityFullName(entity, species); 724 var name, section, value; 725 if (entity) { 726 var v = this.evaluateEntityValue(entity, species); 727 var scale = this.gui_entity_units.getSelected().getValue(); 728 729 name = this.getEntityFullName(entity, species); 730 section = entity.section; 731 value = v*scale 732 } else { 733 name = null; 734 section = null; 735 value = 0; 736 } 737 719 738 this.gui_entity_name.setValue(name); 720 739 721 this.gui_entity_section.setValue(entity.section); 722 723 var v = this.evaluateEntityValue(entity, species); 724 725 var scale = this.gui_entity_units.getSelected().getValue(); 726 727 this.gui_entity_value.setNumValue(v*scale); 740 this.gui_entity_section.setValue(section); 741 742 this.gui_entity_value.setNumValue(value); 728 743 729 744 if (this.prefs.autoLoadWiki) { … … 809 824 break; 810 825 } 826 folder.addListener("changeSelected", clickTreeCB, this); 811 827 812 828 var leaf; … … 819 835 820 836 leaf = new qx.legacy.ui.tree.TreeFile(entity.name, icon); 821 leaf.addListener("changeSelected", click EntityCB, this);837 leaf.addListener("changeSelected", clickTreeCB, this); 822 838 leaf.addListener("contextmenu", treeMenuCB, this); 823 839 leaf.setUserData("entity", entity); … … 834 850 leaf = new qx.legacy.ui.tree.TreeFile(entity.name, 835 851 "pf/image/all_small.png"); 836 leaf.addListener("changeSelected", click EntityCB, this);852 leaf.addListener("changeSelected", clickTreeCB, this); 837 853 leaf.addListener("contextmenu", treeMenuCB, this); 838 854 leaf.setUserData("entity", entity);
Note: See TracChangeset
for help on using the changeset viewer.