Put it a String in my tree label

I have a tree and i print the tree putting newTree.labelField = "@label";, but i want to put something more in the labelField. Now I'm printing
Inbox
Sent
Folder
Folder2
And I want to put:
Inbox (8)
Sent (2)
Folder
Folder2 (1)
(x) can be a string or.. I don't know what. I don't know how can I put that, I try put it @label + '(2)' but don' work, the structure is different.
I can do it or not?

use labelFunction.
private function tree_labelFunc(item:XML):String {
var label:String;
label = item.@label + '(' + item.@number_field + ')';
return label;
    <mx:Tree id="tree"
            dataProvider="{your_xmllist}"
            labelFunction="tree_labelFunc"/>

Similar Messages

  • Tree Label - verticalAlign??

    I've gone round and round with this tree component trying to
    get the labelField to verticalAlign to the middle and still I can't
    get it to stop aligning to the top.
    I would like help in figuring this out so that I may use
    bigger icons with my Tree component.
    If someone would be so kind to share the css code or the
    direct style declaration for the tree label it would be greatly
    appreciated.
    Thank you in advance to the kind soul who chooses to help out

    Found the solution...
    Of course an item renderer has be incorporated into the
    solution.
    You make a class that extends the TreeItemRenderer and then
    override
    the protected function createChildren()
    then you put in that function the following:
    super.createChildren();
    super.label.multiline = true;
    super.label.autoSize = TextFieldAutoSize.LEFT;
    and that's all you need to get the label to render correctly
    with the vertical align property on the tree component. Don't
    forget to set your new component class as the tree's
    itemRenderer.

  • Tree label editable

    hi, i would like to edit the labels in the tree... i put menu
    on the left side of the node, and when i choose edit, i make the
    tree editable, but it focuses on the first node, not on the
    selecteditem, can anyone felp me on this? tnx..

    Not directly as Andreas said but alternately you can do by
    You can set the label of NODE and update into the BASE table block and re-populate the tree
    - on Double click the label call custom Stack canvas contains new label in text item and user will press OK
    - Sets the Label of the Tree node
    - Update the new label to the base table block
    - Commit and re-populate the tree
    if responses are helpful or correct please mark it
    Baig,
    http://baigsorcl.blogspot.com

  • Add String to JNDI Tree

    I'm coming from a Glassfish/Tomcat environment where we can add Strings directly to the JNDI tree. What we would like to do is add "config/env/dev" to the JNDI tree so that we can use Spring to determine which environment we are in based on this setting in each node in the cluster environment. From there, we use CommonsConfiguration to manage our environment specific settings in our applications.
    Can someone tell me how I can add a string variable as such to the JNDI tree in WebLogic 10.3?
    Thanks,
    Lou

    WRITE THE FOLLOWING SCRIPT IN THE WHEN-BUTTON-PRESSED
    INSERT INTO TABLE VALUES (NEW_DISPLAY_LABEL,NEW_VALUE);
    COMMIT;
    P_PARENT_NODE_VALUE:= ftree.get_tree_node_property('tree4',:system.trigger_node,ftree.node_value);
    P_PARENT_NODE := Ftree.Find_Tree_Node('tree4',P_PARENT_NODE_VALUE,Ftree.FIND_NEXT, Ftree.NODE_value, Ftree.ROOT_NODE, Ftree.ROOT_NODE);
    P_NEW_NODE := ftree.add_tree_node('tree4',P_PARENT_NODE,ftree.parent_offset,ftree.last_child,ftree.expanded_node,NEW_DISPLAY_LABEL,null,NEW_VALUE);
    Message was edited by:
    zakaoullah

  • Tree label

    Hi,
    I'm struggling with a tree problem.
    Normal labels show up like this:
    Very long labels however show up like this:
    Problems:
    1. Indent of the first line
    2. following lines are too close to the icon
    3. icon should be placed at the top
    This is how I want the label to be presented:
    Any help is welcome,
    Thx,
    Dany

    You may have to make a custom TreeItemRenderer that extends the TreeItemRenderer class and do your stuff there.  I looked at the updateDisplayList method of TreeItemRenderer.as and that seems to be the part of interest to you which is where the set the y variable for the icon and disclosureIcon.  There is a style parameter in that method too that is used  alight the label also.

  • Putting " into a string

    I have a long string which includes "
    how do I put this into a string as
    String s = " he said "hello"..." ;
    obviously doesnt work

    That's easy just use escape sequences,
    such as if you want to put " you should prepend it by \ such as \" .
    similarly if you want to put \ you should have \\.

  • How to put the background of an java.awt.Label transparent?

    I have a label (java.awt.Label) and I want to put the background transparent, so if i move it over other elements, one can only see the text and not the background.
    How does this work? Can anyone help me?
    Bye
    Sebastian

    how I can get the background color of a cell when mouse clickedAttach a mouseListener to your table. In that listener find the clicked cell through myTable.rowAtPoint(MouseEvent.getPoint()) dto. with column.
    Then myTable.getCellRenderer(int row, int column), and in the renderer you look for the colour.

  • Easy one - Put "" into a String ?

    How can I put the character " into a string ?
    Java thinks I am ending the string when it sees "
    I'm sure there is a special character to use but I'm not sure.
    Thanks
    Josh

    If you put a backslash character '\' in front of your " it will put it in the String.

  • How to put "(" and ")" in String

    I need to construct a String like: String a="hello"; String b="John"; String s=a+"("+b+")"; this not working since "(" and ")" doesn't recognized as a string,what is the escape character for "(" and ")"?

    Why not??? It works for me!!!
         public static void main(String arg[]) {
              String a = "Hello";
              String b = "John";
              String jhonzhang = a + "(" + b + ")";
              System.out.println(jhonzhang );
         }No escape character is required for "("

  • How do I put and sort string data into an array?

    I have a txt file that has the following sample data:
    Sample.txt----
    Jones Bill 12,500 Salesperson
    Adams Frank 34,980 Manager
    Adams John 23,000 Salesperson
    Thompson Joe 59,500 Trainee
    I need to incorporate each line of data into an individual array element, while using a user-defined method
    (ex. setAllValues(String last, String first, String salary, String job)
    How do I loop the data into the array to be displayed and what is the best way to do sorts on this sample data. Any code or clues would be super helpful.
    Sanctos

    If you set up an array of Strings you can use the java.util.Arrays.sort() method to sort it. If you need to sort arbitrary Objects (i.e. your 3 strings as a whole entity) your 3-way object will have to either implement Comparable or you could write a Comparitor class to do the ordering. Not much to it, though.
    Dom.

  • PreparedStatement puts ticks around strings when doing ALTER statement

    Hi,
    I am trying to add a column to a table with a prepared statement:
    private static final String ALTER_TABLE = "ALTER TABLE scene_tags ADD ? BOOL DEFAULT FALSE";
    addNewTagCol = conn.prepareStatement(ALTER_TABLE);
    addNewTagCol.setString(1, newTagName.getText());
    addNewTagCol.executeUpdate();
    When I execute this in java I get a syntax error from mySQL:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''dd' BOOL DEFAULT FALSE' at line 1
    If I do:
    System.out.println(addNewTagCol.toString());
    I get:
    ALTER TABLE scene_tags ADD 'dd' BOOL DEFAULT FALSE
    The probem is the 'dd' which should be just dd.
    If I copy this into the command line it doesn't like the 'dd'.
    How do I stop the ticks ticking?
    Thanks,
    John

    Personally, I don't think that CREATE and ALTER statements should be executed in Java.
    The schema is usually in place when a Java app starts. The application then performs CRUD operations on a well-defined, static schema. Changing the schema means changing the application, something that you shouldn't be doing on the fly.
    If you think you have to alter a table in a Java app, I'm betting that you have a bad design that needs rethinking.
    Unless you're trying to write an admin tool from scratch, of course. In that case I'd refer you to an admin tool like SQL Squirrel.
    %

  • I put a conde. For acess TRE icluds ADN fortes it. Now I can,t Make The back um thru tem

    Sorry But. I forgot my iclouds code. I now I can,t Make The back up thru it.

    Sorry But. I forgot my iclouds code. I now I can,t Make The back up thru it.

  • JTable + Hashtable + Collection doesn't seem to work properly

    Hi folks,
    I'm having a problem with JTree class. Basically, I want to instantiate it by using an Hashtable, though
    depending on the fact that I use collection or arrays the result can substantially vary.
    Take the following use case:
    import javax.swing.*;
    import java.util.*;
    public class Tree extends JApplet{
      public Tree(){
        super();
        setSize(300, 250);
        init();
        setVisible(true);
      public void init(){
        Hashtable<String,List<String>> hash = new Hashtable<String,List<String>>();
        hash.put("Foo", Arrays.asList("Bar"));
        JTree tree = new JTree(hash);
        getContentPane().add(tree);
    }This displays a wrong tree, in fact you should have a Foo node that contains a Bar leaf.
    Now if I use array instead of collections (generics are not the problem) everything work just as
    expected!?
    import javax.swing.*;
    import java.util.*;
    public class Tree extends JApplet{
      public Tree(){
        super();
        setSize(300, 250);
        init();
        setVisible(true);
      public void init(){
        Hashtable<String,String [] > hash = new Hashtable<String,String []>();
        hash.put("Foo", new String []{"Bar"});
        JTree tree = new JTree(hash);
        getContentPane().add(tree);
    }Considering that the constructor of JTree allows the following instantiation for Hastable:
    public JTree(Hashtable<?,?> value)the use of wildcards let me assume that I can put whatever I like as the type of my keys/values.
    Am I missing something or this is indeed some very strange (buggy) behavior.
    Cheers,
    Mirco

    lins314159 wrote:
    [Javadocs for createChildren method|http://java.sun.com/javase/6/docs/api/javax/swing/JTree.DynamicUtilTreeNode.html#createChildren%28javax.swing.tree.DefaultMutableTreeNode,%20java.lang.Object%29]
    If you look in the source code for JTree, there's no mention of Lists in there. Not quite sure why they handle Vectors and Hashtables only instead of Lists and Maps.Hi lins,
    thanks for taking the time for giving me your though.
    I have take a glance at the javadoc for method createChildren, but once again it tells me that if I have an entry of the type
    <A,Collection<B>> I should get a Node named after the object of type A and whose leaf are the ones contained in the collection.
    I agree with you that is bizarre that the JTree constructor only accept Hashtable (and not Map, that appear to me more convenient);
    but I can live with that as long as the value field of the hashtable behave as I would expect.
    I'm not an experienced Java programmer, so if any of you gurus has any thoughts on that, please let me know.
    Cheers,
    Mirco
    Edited by: Mirco on Feb 29, 2008 12:07 AM

  • Putting words from a text file into a binary tree.

    I am having problems figuring out how to do this.
    the text file will have a sentence like this
    Every one likes to play games.
    My Dog tore up my apartment last night.
    How old are you sir.I know how to put regular strings into a binary tree, but I don't know what to do in order to put these textfile strings into it.
    I thought of using string tokenizer but I couldn't get that to work because the sentences are not a specific length, they can be any length. Can somebody give me some tips on what to use?
    Thank you

    JulianJ wrote:
    That will work?I'm sorry to tell you, that is a really bad question. Of course it won't work, because you did something else wrong. I have no idea what, but it's pretty certain that you haven't got everything right yet. (And that's nothing personal, it's just an observation about computer programming in general.) But don't let that stop you. And don't wait around for people to validate your ideas. Try it and see what happens. You won't break anything. And when it doesn't work, figure out why and carry on.

  • TreeMap.put(Date, String) throws ClassCastException

    Hello World!
    i have a problem with TreeMap,
    when i try to put a Key-Object and an Object-Object
    i get ClassCastException. WHY??
    Code:
    Date date = GregorianCalendar.getTime();
    TreeMap tm = new TreeMap();
    tm.put(date, new String("My String"));
    By puting into the tree i get the damn exception.
    Any ideas?
    thank,
    Sergej

    Hello World!
    i have a problem with TreeMap,
    when i try to put a Key-Object and an Object-Object
    i get ClassCastException. WHY??
    Code:
    Date date = GregorianCalendar.getTime();
    TreeMap tm = new TreeMap();
    tm.put(date, new String("My String"));
    By puting into the tree i get the damn exception.
    Any ideas?
    thank,
    SergejHi, doing the
    new String("My String")
    is not really a good idea.
    One rather useless string instance is created.
    just put the string literal put (..., "My String");
    Just had to make this comment, no offence.
    Regards,
    Stepan

Maybe you are looking for

  • Remote app for iPhone not connecting correctly

    I use the Remote app to connect to my iTunes library. Everything worked fine until about 6 weeks ago, when the whole thing became intermittent. Sometimes it would connect, sometimes it would not. I have the remote app on my iPhone 4S running latest v

  • Magsafe indicator faint/dim and blinking amber/green

    I am working on a Macbook purchased in November 2008. Until now, no problems, but this morning after a full night's charge, I ran it for about two hours without being plugged in. When I plugged it in to charge, the indicator light on the magsafe woul

  • Itunes 10.5.1 doesn't open with windows 7 64 bit

    i have just purchased a new HP laptop with windows 7 64bit and have installed itunes. all the files have installed correctly but the program doesnt open. any ideas ?

  • Reset cleared iteams

    hi, some body run auto clearing tcode(f.13),we have to reset all cleared items.what is the tcode.we are using FBRA.in this tcode we have to do one by one document number.we have more than 150 documents.is it possible to do all documents at a time wha

  • Scan problem with OS 10.8.2

    Recently the scan feature on my Mac Mini with OS 10.8.2 and HP OfficeJet 4500 flatbed printer/scanner is all messed up. I scan a document, then the image of the scan appears and fills the entire background of the scanner control window on the desktop