Changeset 163:de4f4b188eef for source


Ignore:
Timestamp:
Jan 6, 2010, 6:38:19 PM (15 years ago)
Author:
fnevgeny
Branch:
default
Phase:
public
Message:

Unified tree leaf creation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/class/pf/Application.js

    r162 r163  
    305305    }
    306306
    307     leaf.setTextColor("red");
     307    leaf.setTextColor(this.leafFavColor);
    308308
    309309    // Add to the list of favorites
     
    329329        return;
    330330    }
    331     leaf.setTextColor("black");
     331    leaf.setTextColor(this.leafColor);
    332332
    333333    var entity  = leaf.getUserData("entity");
     
    396396        showIons       : true,
    397397        showRadiators  : true,
     398       
     399        leafColor      : "black",
     400        leafFavColor   : "red",
    398401       
    399402        plasma : null,
     
    536539           
    537540            return false;
     541        },
     542       
     543        addEntityLeaf : function(entity, species)
     544        {
     545            var icon;
     546            if (species) {
     547                icon = "pf/image/" + species.id + "_small.png";
     548            } else {
     549                icon = "pf/image/all_small.png";
     550            }
     551           
     552            var leaf = new qx.ui.tree.TreeFile(entity.name);
     553            leaf.setIcon(icon);
     554            leaf.addListener("contextmenu", treeMenuCB, this);
     555            leaf.setUserData("entity", entity);
     556
     557            if (species) {
     558                leaf.setUserData("species", species);
     559            }
     560
     561            if (this.isFavorite(leaf)) {
     562                leaf.setTextColor(this.leafFavColor);
     563            } else {
     564                leaf.setTextColor(this.leafColor);
     565            }
     566           
     567            return leaf;
    538568        },
    539569
     
    612642                    for (var j = 0; j < sa.length; j++) {
    613643                        var s = sa[j];
    614                         var icon = "pf/image/" + s.id + "_small.png";
    615 
    616                         leaf = new qx.ui.tree.TreeFile(entity.name);
    617                         leaf.setIcon(icon);
    618                         leaf.addListener("contextmenu", treeMenuCB, this);
    619                         leaf.setUserData("entity", entity);
    620                         leaf.setUserData("species", s);
    621                        
    622                         if (this.isFavorite(leaf)) {
    623                             leaf.setTextColor("red");
    624                         }
    625 
     644                        leaf = this.addEntityLeaf(entity, s);
    626645                        folder.add(leaf);
    627646                    }
    628647                    break;
    629648                default:
    630                     leaf = new qx.ui.tree.TreeFile(entity.name);
    631                     leaf.setIcon("pf/image/all_small.png");
    632                     leaf.addListener("contextmenu", treeMenuCB, this);
    633                     leaf.setUserData("entity", entity);
    634 
    635                     if (this.isFavorite(leaf)) {
    636                         leaf.setTextColor("red");
    637                     }
    638                    
     649                    leaf = this.addEntityLeaf(entity, null);
    639650                    folder.add(leaf);
    640651                    break;
Note: See TracChangeset for help on using the changeset viewer.