Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Tree UI Element : Help on Getter and Setter Methods

Hi All,

I've developed a tree structure where it shows the folder and file structure. The objectives for me being

1. Different icons for the folder and files.

2. Ignoring Action on selecting file.

3. Making the folder not expandable if it has no children. and also for the files.

The Context structure:

Folder|

-


SubFolder(Recursive Node)

-


IsExpanded(Boolean)

-


HasChildren(Boolean)

-


IconSource(String)

-


IgnoreAction(Boolean)

-


Text(String)

I've applied the following codes for the getter methods of IconSource and IgnoreAction

and they are giving the desried results: (1) and (2).

public java.lang.String getFolderContentIconSource(IPrivateFolderStructView.IFolderContentElement element)
  {
    //@@begin getFolderContentIconSource(IPrivateFolderStructView.IFolderContentElement)
       if(element.getText().indexOf(".") != -1)
        	return "~sapicons/s_b_crea.gif"; //Is a folder
        else
			return "~sapicons/s_clofol.gif"; // Is a file
        
    //@@end
  }

public boolean getFolderContentIgnoreAction(IPrivateFolderStructView.IFolderContentElement element)
  {
    //@@begin getFolderContentIgnoreAction(IPrivateFolderStructView.IFolderContentElement)
	if(element.getText().indexOf(".") != -1)
			return true; //Is a folder
		else
			return false; // Is a file
    //@@end
  }

How do I achieve the result (3).

How do I apply similar methods for the rest two attributes to get my objective.

Thanks in advance.

Srikant

Not what you were looking for? View more on this topic or Ask a question