Htmlb:tree node count limitation
Hi Experts,
I have a problem with htmlb:tree. Rendering up to 60 nodes will works well, if my tree has more than 60-65 nodes and I klick any link or the tree itself, after rendering has been finished, the Browser will get stuck and keep searching forever. SAP recommends to use htmlb:tree for trees with 30-50 nodes. Some suggestion was to load the node using AJAX. Are there some other ideas?
Many thanks for help!
check out this weblog
[BSP/How-To: Build performance-efficient dynamic htmlb:tree|BSP/How-To: Build performance-efficient dynamic htmlb:tree]
Raja
Similar Messages
-
htmlb:tree : Node IDs not unique - error handling
From an internal table of customers and contact persons, I made a tree using TVIEWNODE2 structure. Some of the customers are not having contact persons for which contact person ids are simply '00000000'. Thus these nodes may not be unique here. Somehow everything is working fine but sometimes I am getting the above error mentioned in subject.
Actually I have a tabstrip and one of the items of tabstrip contains tree. The occurrence of this error is not at all uniform , sometimes it works and sometimes don't. It's very difficult to find when and why it's triggered. In the same situation and circumstances sometimes it works and sometimes doesn't.Appearance of this error is irrespective of whether tree is operated or any other event is handled.
Can anybody throw light on this? Thanks in advance.hi thomas
you are absolutely correct when you say that the error occurs in the second request cycle. do i need to clear the tree table then?
As you said , if the application is stateful, the best place is 'On create' event to write the code. But my application is stateless and that is why I am hesitant to put the code in 'On create' and rather placed it in 'On request' event where I am getting the cookie of internal table from which I am preparing tree table.
So, I think keeping the code in 'On request' as before but ensuring that the table is cleared everytime will solve the problem. But let me check this and tell you.
I am very thankful for your quick replies and focussing on my problem. thanks a lot.
I will let you know the outcome soon.
regards
jawahar -
Htmlb:tree differentiate between nodeclick and tree node expander click
Hi,
how can i differentiate between nodeclick and tree node expander (to get to its children) click in my event processing in htmlb:tree element.
<u><b>What i am trying to achieve?</b></u>
Onload just load root node and its immediate children.
On node expand get the children of the current node and modify htmlb:tree table2 with additional node inofs.
on node click call some client function.
But my issue is that i am not able to differentiate between node expander click and node click in my event handling. Any help on this is appreciated.
(I am not using MVC)
Thanks in advance.
Regards
Raja
Message was edited by: Durairaj Athavan RajaAfter reading your weblog I think I understand better. I did some testing with my example. I am using the toggle = "true", so that the page returns to the server each time an expander is selected.
<htmlb:tree id = "myTree1"
height = "75%"
toggle = "true"
title = "<b><otr>EQI Reporting Tree</otr></b>"
width = "90%"
onTreeClick = "myTreeClick"
table = "<%= application->selection_model->itview %>" >
</htmlb:tree>
However I have not added any coding in my event handler to respond to the expander event. I only respond to myTreeClick (which loads some data for the given selection). The BSP tree element itself must be doing the hard work for me.
if event_id cs 'tr_myTree1'.
data: tree_event type ref to cl_htmlb_event_tree.
tree_event ?= htmlb_event.
if tree_event->server_event = 'myTreeClick'.
clear appl->message1.
appl->selection_model->get_chart_data( appl = appl
node = tree_event->node ).
endif.
endif.
I pass my entire tree defintion to the element. It appears that it only sends visible nodes to be rendered. When the expander is selected, I don't have to do anything, the tree re-renders with only the newly visible rows.
I tested and turned off the toggle (toggle = "false") and my page took forever to load because it was sending all the nodes to the frontend on the first load. -
CTE for Count the Binary Tree nodes
i have the table structure like this :
Create table #table(advId int identity(1,1),name nvarchar(100),Mode nvarchar(5),ReferId int )
insert into #table(name,Mode,ReferId)values('King','L',0)
insert into #table(name,Mode,ReferId)values('Fisher','L',1)
insert into #table(name,Mode,ReferId)values('Manasa','R',1)
insert into #table(name,Mode,ReferId)values('Deekshit','L',2)
insert into #table(name,Mode,ReferId)values('Sujai','R',2)
insert into #table(name,Mode,ReferId)values('Fedric','L',3)
insert into #table(name,Mode,ReferId)values('Bruce','R',3)
insert into #table(name,Mode,ReferId)values('paul','L',4)
insert into #table(name,Mode,ReferId)values('walker','R',4)
insert into #table(name,Mode,ReferId)values('Diesel','L',5)
insert into #table(name,Mode,ReferId)values('Jas','R',5)
insert into #table(name,Mode,ReferId)values('Edward','L',6)
insert into #table(name,Mode,ReferId)values('Lara','R',6)
select *from #table
How do i write the CTE for count the Binary tree nodes on level basis. Here is the example,
now,what i want to do is if i'm going to calculate the Count of the downline nodes.which means i want to calculate for '1' so the resultset which i'm expecting
count level mode
1 1 L
1 1 R
2 2 L
2 2 R
4 3 L
2 3 R
How do i acheive this,i have tried this
with cte (advId,ReferId,mode,Level)
as
select advId,ReferId,mode,0 as Level from #table where advid=1
union all
select a.advId,a.ReferId,a.mode ,Level+1 from #table as a inner join cte as b on b.advId=a.referId
select *From cte order by Level
i hope its clear. Thank youSee Itzik Ben-Gan examples for the subject
REATE TABLE Employees
empid int NOT NULL,
mgrid int NULL,
empname varchar(25) NOT NULL,
salary money NOT NULL,
CONSTRAINT PK_Employees PRIMARY KEY(empid),
CONSTRAINT FK_Employees_mgrid_empid
FOREIGN KEY(mgrid)
REFERENCES Employees(empid)
CREATE INDEX idx_nci_mgrid ON Employees(mgrid)
SET NOCOUNT ON
INSERT INTO Employees VALUES(1 , NULL, 'Nancy' , $10000.00)
INSERT INTO Employees VALUES(2 , 1 , 'Andrew' , $5000.00)
INSERT INTO Employees VALUES(3 , 1 , 'Janet' , $5000.00)
INSERT INTO Employees VALUES(4 , 1 , 'Margaret', $5000.00)
INSERT INTO Employees VALUES(5 , 2 , 'Steven' , $2500.00)
INSERT INTO Employees VALUES(6 , 2 , 'Michael' , $2500.00)
INSERT INTO Employees VALUES(7 , 3 , 'Robert' , $2500.00)
INSERT INTO Employees VALUES(8 , 3 , 'Laura' , $2500.00)
INSERT INTO Employees VALUES(9 , 3 , 'Ann' , $2500.00)
INSERT INTO Employees VALUES(10, 4 , 'Ina' , $2500.00)
INSERT INTO Employees VALUES(11, 7 , 'David' , $2000.00)
INSERT INTO Employees VALUES(12, 7 , 'Ron' , $2000.00)
INSERT INTO Employees VALUES(13, 7 , 'Dan' , $2000.00)
INSERT INTO Employees VALUES(14, 11 , 'James' , $1500.00)
The first request is probably the most common one:
returning an employee (for example, Robert whose empid=7)
and his/her subordinates in all levels.
The following CTE provides a solution to this request:
WITH EmpCTE(empid, empname, mgrid, lvl)
AS
-- Anchor Member (AM)
SELECT empid, empname, mgrid, 0
FROM Employees
WHERE empid = 7
UNION ALL
-- Recursive Member (RM)
SELECT E.empid, E.empname, E.mgrid, M.lvl+1
FROM Employees AS E
JOIN EmpCTE AS M
ON E.mgrid = M.empid
SELECT * FROM EmpCTE
Using this level counter you can limit the number of iterations
in the recursion. For example, the following CTE is used to return
all employees who are two levels below Janet:
WITH EmpCTEJanet(empid, empname, mgrid, lvl)
AS
SELECT empid, empname, mgrid, 0
FROM Employees
WHERE empid = 3
UNION ALL
SELECT E.empid, E.empname, E.mgrid, M.lvl+1
FROM Employees as E
JOIN EmpCTEJanet as M
ON E.mgrid = M.empid
WHERE lvl < 2
SELECT empid, empname
FROM EmpCTEJanet
WHERE lvl = 2
As mentioned earlier, CTEs can refer to
local variables that are defined within the same batch.
For example, to make the query more generic, you can use
variables instead of constants for employee ID and level:
DECLARE @empid AS INT, @lvl AS INT
SET @empid = 3 -- Janet
SET @lvl = 2 -- two levels
WITH EmpCTE(empid, empname, mgrid, lvl)
AS
SELECT empid, empname, mgrid, 0
FROM Employees
WHERE empid = @empid
UNION ALL
SELECT E.empid, E.empname, E.mgrid, M.lvl+1
FROM Employees as E
JOIN EmpCTE as M
ON E.mgrid = M.empid
WHERE lvl < @lvl
SELECT empid, empname
FROM EmpCTE
WHERE lvl = @lvl
Results generated thus far might be returned (but are not guaranteed to be),
and error 530 is generated. You might think of using the MAXRECURSION option
to implement the request to return employees who are two levels below
Janet using the MAXRECURSION hint instead of the filter in the recursive member
WITH EmpCTE(empid, empname, mgrid, lvl)
AS
SELECT empid, empname, mgrid, 0
FROM Employees
WHERE empid = 1
UNION ALL
SELECT E.empid, E.empname, E.mgrid, M.lvl+1
FROM Employees as E
JOIN EmpCTE as M
ON E.mgrid = M.empid
SELECT * FROM EmpCTE
OPTION (MAXRECURSION 2)
WITH EmpCTE(empid, empname, mgrid, lvl, sortcol)
AS
SELECT empid, empname, mgrid, 0,
CAST(empid AS VARBINARY(900))
FROM Employees
WHERE empid = 1
UNION ALL
SELECT E.empid, E.empname, E.mgrid, M.lvl+1,
CAST(sortcol + CAST(E.empid AS BINARY(4)) AS VARBINARY(900))
FROM Employees AS E
JOIN EmpCTE AS M
ON E.mgrid = M.empid
SELECT
REPLICATE(' | ', lvl)
+ '(' + (CAST(empid AS VARCHAR(10))) + ') '
+ empname AS empname
FROM EmpCTE
ORDER BY sortcol
(1) Nancy
| (2) Andrew
| | (5) Steven
| | (6) Michael
| (3) Janet
| | (7) Robert
| | | (11) David
| | | | (14) James
| | | (12) Ron
| | | (13) Dan
| | (8) Laura
| | (9) Ann
| (4) Margaret
| | (10) Ina
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Hi all
Do any one give me the code to make the object in the tree node as link to navigate to another page,
Note:Onmouseover alone the object gets the link and I need to get the hand symbol
reg
balajiHi,
In the below code i need to make Course type 1A, Course type 2A, Course type 3A as a link to navigate to other pages. Please guide me reagarding this,
<hbj:treeNode id="e_root" text="Desk" isOpen="true" >
<hbj:treeNode id="e_cga" text="Course group A" isOpen="true" tooltip="Course group A">
<hbj:treeNode id="e_cta" text="Course type 1A" tooltip="Course type 1A "/>
<hbj:treeNode id="e_ctb" text="Course type 2A" tooltip="Course type 2A "/>
<hbj:treeNode id="e_ctc" text="Course type 3A" tooltip="Course type 3A "/>
</hbj:treeNode>
<hbj:treeNode id="e_cgb" text="Course group B" isOpen="true" tooltip="Course group B" >
<hbj:treeNode id="e_ct1" text="Course type 1B" tooltip="Course type 1B " />
<hbj:treeNode id="e_ct2" text="Course type 2B" tooltip="Course type 2B " />
<hbj:treeNode id="e_ct3" text="Course type 3B" tooltip="Course type 3B "/>
</hbj:treeNode>
</hbj:treeNode>
Waiting for replies, -
Useful Code of the Day: Hideable Tree Nodes
Someone posted about how they could selectively hide tree nodes, and I already had this AbstractTreeModel class (which does some things DefaultTreeModel does and some it doesn't) and a concrete subclass for TreeNode objects, so I was thinking how one could do hideable nodes. So I came up with this solution.
There's 4 classes here:
- AbstractTreeModel is the base for the concrete TreeNodeTreeModel
- TreeNodeTreeModel extends AbstractTreeModel to support TreeNodes (DefautlMutableTreeNode, etc.)
- HideableMutableTreeNode which is a DefautlMutableTreeNode subclass which has a visible field (with is/set methods, of course).
- HideableTreeModel is the hideable model which is a subclass of TreeNodeTreeModel.
A HideableMutableTreeNode can be set invisible directly, but the tree still needs to be notified to update. So it's best to use the methods in HideableTreeModel which set a node's visibility which notify the tree of changes accordingly. Methods are also provided to check a full path's visibility or ensure a node including all parent nodes are visible.
A HideableTreeModel can take any TreeNode class, it doesn't have to be all HideableMutableTreeNodes, but only HideableMutableTreeNodes can be made invisible, of course. Any other TreeNode type would just be considered visible.
Hiding nodes works basically by making the tree think there's less nodes then there are. And to do this, the node counts and child index search just works by looping thru the parent's children. This has potential perfomance drawbacks of course, since one has to loop thru the node's children to get nodes every time. This could be alleviated by not supporting non-hideable nodes changing the internal maintenance of HideableMutableTreeNode contents. But I'll leave that to whoever really needs it. It shouldn't be a problem if there are are a relatively small set of child nodes in any given parent.
Also, note that the root node in the model cannot be made invisible, cuz it'd be redundant since JTree can be set to hide the root node.
// *** HideableTreeModel ***
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
* <code>HideableTreeModel</code> is an <code>TreeNodeTreeModel</code>
* implementation for <code>HideableMutableTreeNode</code> objects. The
* model can also take any other <code>javax.swing.tree.TreeNode</code>
* objects.
public class HideableTreeModel extends TreeNodeTreeModel {
* Creates a new <code>HideableTreeModel</code> object.
* @param root the root node
public HideableTreeModel(TreeNode root) {
super(root);
* Checks if the specified node is visible. A node can only be
* hidden if the node is an instance of <code>HideableMutableTreeNode</code>. <br />
* <br />
* Note that this only test the visibility of the specified node, not
* whether a parent node is visible. Use <code>isPathToNodeVisible(Object)</code>
* to check if the full path is visible.
* @param node the node
* @param true if the node is visible, else false
public boolean isNodeVisible(Object node) {
if(node != getRoot()) {
if(node instanceof HideableMutableTreeNode) {
return ((HideableMutableTreeNode)node).isVisible();
return true;
* Sets the specified node to be hidden. A node can only be made hidden
* if the node is an instance of <code>HideableMutableTreeNode</code>. <br />
* <br />
* Note that this method will notify the tree to reflect any changes to
* node visibility. <br />
* <br />
* Note that this will not alter the visibility of any nodes in the
* specified node's path to the root node. Use
* <code>ensurePathToNodeVisible(Object)</code> instead to make sure the
* full path down to that node is visible. <br />
* <br />
* Note that this method will notify the tree to reflect any changes to
* node visibility.
* @param node the node
* @param v true for visible, false for hidden
* @param true if the node's visibility could actually change, else false
public boolean setNodeVisible(Object node, boolean v) {
// can't hide root
if(node != getRoot()) {
if(node instanceof HideableMutableTreeNode) {
HideableMutableTreeNode n = (HideableMutableTreeNode)node;
// don't fix what ain't broke...
if(v != n.isVisible()) {
TreeNode parent = n.getParent();
if(v) {
// need to get index after showing...
n.setVisible(v);
int index = getIndexOfChild(parent, n);
super.nodeInserted(parent, n, index);
} else {
// need to get index before hiding...
int index = getIndexOfChild(parent, n);
n.setVisible(v);
super.nodeRemoved(parent, n, index);
return true;
return false;
* Checks if the specified node is visible and all nodes above it are
* visible.
* @param node the node
* @param true if the path is visible, else false
public boolean isPathToNodeVisible(Object node) {
Object[] path = getPathToRoot(node);
for(int i = 0; i < path.length; i++) {
if(!isNodeVisible(path)) {
return false;
return true;
* Sets the specified node and all nodes above it to be visible.
* Note that this method will notify the tree to reflect any changes to
* node visibility.
* @param node the node
public void ensurePathToNodeVisible(Object node) {
Object[] path = getPathToRoot(node);
for(int i = 0; i < path.length; i++) {
setNodeVisible(path[i], true);
* Returns the child of parent at index index in the parent's child array.
* @param parent the parent node
* @param index the index
* @return the child or null if no children
public Object getChild(Object parent, int index) {
if(parent instanceof TreeNode) {
TreeNode p = (TreeNode)parent;
for(int i = 0, j = -1; i < p.getChildCount(); i++) {
TreeNode pc = (TreeNode)p.getChildAt(i);
if(isNodeVisible(pc)) {
j++;
if(j == index) {
return pc;
return null;
* Returns the number of children of parent.
* @param parent the parent node
* @return the child count
public int getChildCount(Object parent) {
int count = 0;
if(parent instanceof TreeNode) {
TreeNode p = (TreeNode)parent;
for(int i = 0; i < p.getChildCount(); i++) {
TreeNode pc = (TreeNode)p.getChildAt(i);
if(isNodeVisible(pc)) {
count++;
return count;
* Returns the index of child in parent.
* @param parent the parent node
* @param child the child node
* @return the index of the child node in the parent
public int getIndexOfChild(Object parent, Object child) {
int index = -1;
if(parent instanceof TreeNode && child instanceof TreeNode) {
TreeNode p = (TreeNode)parent;
TreeNode c = (TreeNode)child;
if(isNodeVisible(c)) {
index = 0;
for(int i = 0; i < p.getChildCount(); i++) {
TreeNode pc = (TreeNode)p.getChildAt(i);
if(pc.equals(c)) {
return index;
if(isNodeVisible(pc)) {
index++;
return index;
* Main method for testing.
* @param args the command-line arguments
public static void main(String[] args) {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
HideableMutableTreeNode root = new HideableMutableTreeNode("root");
root.add(new HideableMutableTreeNode("child_1"));
final HideableMutableTreeNode c2 = new HideableMutableTreeNode("child_2");
c2.setVisible(false);
final HideableMutableTreeNode c2a = new HideableMutableTreeNode("child_2_A");
c2.add(c2a);
c2.add(new HideableMutableTreeNode("child_2_B"));
root.add(c2);
HideableMutableTreeNode c3 = new HideableMutableTreeNode("child_3");
HideableMutableTreeNode cC = new HideableMutableTreeNode("child_3_C");
cC.setVisible(false);
c3.add(cC);
c3.add(new HideableMutableTreeNode("child_3_D"));
root.add(c3);
root.add(new HideableMutableTreeNode("child_4"));
root.add(new HideableMutableTreeNode("child_5"));
DefaultMutableTreeNode c6 = new DefaultMutableTreeNode("child_6");
c6.add(new DefaultMutableTreeNode("child_6_A"));
c6.add(new DefaultMutableTreeNode("child_6_B"));
root.add(c6);
final HideableTreeModel model = new HideableTreeModel(root);
JTree tree = new JTree(model);
f.getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER);
JButton b = new JButton("toggle");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
model.setNodeVisible(c2, !model.isNodeVisible(c2));
//model.ensurePathToNodeVisible(c2a);
f.getContentPane().add(b, BorderLayout.SOUTH);
f.pack();
f.setSize(300, 500);
f.show();
// *** HideableMutableTreeNode ***
import javax.swing.*;
import javax.swing.tree.*;
* <code>HideableMutableTreeNode</code> is a <code>DefaultMutableTreeNode</code>
* implementation that works with <code>HideableTreeModel</code>.
public class HideableMutableTreeNode extends DefaultMutableTreeNode {
* The node is visible flag.
public boolean visible = true;
* Creates a tree node that has no parent and no children, but which
* allows children.
public HideableMutableTreeNode() {
super();
* Creates a tree node with no parent, no children, but which allows
* children, and initializes it with the specified user object.
* @param userObject - an Object provided by the user that
* constitutes the node's data
public HideableMutableTreeNode(Object userObject) {
super(userObject);
* Creates a tree node with no parent, no children, initialized with the
* specified user object, and that allows children only if specified.
* @param userObject - an Object provided by the user that
* constitutes the node's data
* @param allowsChildren - if true, the node is allowed to have child
* nodes -- otherwise, it is always a leaf node
public HideableMutableTreeNode(Object userObject, boolean allowsChildren) {
super(userObject, allowsChildren);
* Checks if the node is visible.
* @return true if the node is visible, else false
public boolean isVisible() {
return this.visible;
* Sets if the node is visible.
* @param v true if the node is visible, else false
public void setVisible(boolean v) {
this.visible = v;
// *** TreeNodeTreeModel ***
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
* <code>TreeNodeTreeModel</code> is an <code>AbstractTreeModel</code>
* implementation for <code>javax.swing.tree.TreeNode</code> objects.
public class TreeNodeTreeModel extends AbstractTreeModel {
* Creates a new <code>TreeNodeTreeModel</code> object.
* @param root the root node
public TreeNodeTreeModel(TreeNode root) {
super();
setRoot(root);
* Returns the parent of the child node.
* @param node the child node
* @return the parent or null if root
public Object getParent(Object node) {
if(node != getRoot() && (node instanceof TreeNode)) {
return ((TreeNode)node).getParent();
return null;
* Returns the child of parent at index index in the parent's child array.
* @param parent the parent node
* @param index the index
* @return the child or null if no children
public Object getChild(Object parent, int index) {
if(parent instanceof TreeNode) {
return ((TreeNode)parent).getChildAt(index);
return null;
* Returns the number of children of parent.
* @param parent the parent node
* @return the child count
public int getChildCount(Object parent) {
if(parent instanceof TreeNode) {
return ((TreeNode)parent).getChildCount();
return 0;
* Returns the index of child in parent.
* @param parent the parent node
* @param child the child node
* @return the index of the child node in the parent
public int getIndexOfChild(Object parent, Object child) {
if(parent instanceof TreeNode && child instanceof TreeNode) {
return ((TreeNode)parent).getIndex((TreeNode)child);
return -1;
* Returns true if node is a leaf.
* @param node the node
* @return true if the node is a leaf
public boolean isLeaf(Object node) {
if(node instanceof TreeNode) {
return ((TreeNode)node).isLeaf();
return true;
* Main method for testing.
* @param args the command-line arguments
public static void main(String[] args) {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
root.add(new DefaultMutableTreeNode("child_1"));
DefaultMutableTreeNode c2 = new DefaultMutableTreeNode("child_2");
c2.add(new DefaultMutableTreeNode("child_2_A"));
c2.add(new DefaultMutableTreeNode("child_2_B"));
root.add(c2);
root.add(new DefaultMutableTreeNode("child_3"));
root.add(new DefaultMutableTreeNode("child_4"));
JTree tree = new JTree(new TreeNodeTreeModel(root));
f.getContentPane().add(new JScrollPane(tree));
f.pack();
f.setSize(300, 500);
f.show();
// *** AbstractTreeModel ***
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
public abstract class AbstractTreeModel implements TreeModel {
* The list of tree model listeners.
private Vector modelListeners = new Vector();
* The root object of the tree.
private Object root = null;
* Basic no-op constructor.
public AbstractTreeModel() {
* Gets the root object of the tree.
* @return the root object
public Object getRoot() {
return this.root;
* Sets the root object of the tree.
* @param r the root object
protected void setRoot(Object r) {
this.root = r;
* Gets the path to the root node for the specified object.
* @param node the root node
* @return the path to the object or <CODE>null</CODE>
public Object[] getPathToRoot(Object node) {
return getPathToRoot(node, 0);
* Gets the path to the root node for the specified object.
* @param node the root node
* @param i the current index
* @return the path to the object or <CODE>null</CODE>
private Object[] getPathToRoot(Object node, int i) {
Object anode[];
if(node == null) {
if(i == 0) {
return null;
anode = new Object[i];
} else {
i++;
if(node == getRoot()) {
anode = new Object[i];
} else {
anode = getPathToRoot(getParent(node), i);
anode[anode.length - i] = node;
return anode;
* Gets the parent object of the specified object. This method is not
* part of the <code>javax.swing.tree.TreeModel</code> interface, but is
* required to support the <code>getPathToRoot(Object)</code> method,
* which is widely used in this class. Therefore, it is important to
* correctly implement this method.
* @param obj the object
* @parma the parent object or null if no parent or invalid object
protected abstract Object getParent(Object obj);
* Adds a listener for the <CODE>TreeModelEvent</CODE> posted after the
* tree changes.
* @param l the tree model listener
public void addTreeModelListener(TreeModelListener l) {
modelListeners.addElement(l);
* Removes a listener previously added with addTreeModelListener().
* @param l the tree model listener
public void removeTreeModelListener(TreeModelListener l) {
modelListeners.removeElement(l);
* Forces the tree to reload. This is useful when many changes occur
* under the root node in the tree structure.
* <b>NOTE:</b> This will cause the tree to be collapsed. To maintain
* the expanded nodes, see the <code>getExpandedPaths(JTree)</code>
* and <code>expandPaths(JTree, ArrayList)</code> methods.
* @see #getExpandedPaths(JTree)
* @see #expandPaths(JTree, ArrayList)
public void reload() {
reload(getRoot());
* Forces the tree to repaint. This is useful when many changes occur
* under a specific node in the tree structure.
* <b>NOTE:</b> This will cause the tree to be collapsed below the
* updated node.
* @param node the node that changed
public void reload(Object node) {
if(node != null) {
TreePath tp = new TreePath(getPathToRoot(node));
fireTreeStructureChanged(new TreeModelEvent(this, tp));
* Messaged when the user has altered the value for the item identified
* by <CODE>path</CODE> to <CODE>newValue</CODE>.
* @param path the path to the changed object
* @param newValue the new value
public void valueForPathChanged(TreePath path, Object newValue) {
nodeChanged(path.getLastPathComponent());
* Notifies the tree that nodes were inserted. The index is looked up
* automatically.
* @param node the parent node
* @param child the inserted child node
public void nodeInserted(Object node, Object child) {
nodeInserted(node, child, -1);
* Notifies the tree that nodes were inserted.
* @param node the parent node
* @param child the inserted child node
* @param index the index of the child
public void nodeInserted(Object node, Object child, int index) {
if(index < 0) {
index = getIndexOfChild(node, child);
if(node != null && child != null && index >= 0) {
TreePath tp = new TreePath(getPathToRoot(node));
int[] ai = { index };
Object[] ac = { child };
fireTreeNodesInserted(new TreeModelEvent(this, tp, ai, ac));
* Notifies the tree that nodes were removed. The index is required
* since by this point, the object will no longer be in the tree.
* @param node the parent node
* @param child the removed child node
* @param index the index of the child
public void nodeRemoved(Object node, Object child, int index) {
if(node != null && child != null && index >= 0) {
TreePath tp = new TreePath(getPathToRoot(node));
int[] ai = { index };
Object[] ac = { child };
fireTreeNodesRemoved(new TreeModelEvent(this, tp, ai, ac));
* Notifies the tree that a node was changed.
* @param node the changed node
public void nodeChanged(Object node) {
if(node != null) {
TreePath tp = new TreePath(getPathToRoot(node));
fireTreeNodesChanged(new TreeModelEvent(this, tp, null, null));
* Fires "tree nodes changed" events to all listeners.
* @param event the tree model event
protected void fireTreeNodesChanged(TreeModelEvent event) {
for(int i = 0; i < modelListeners.size(); i++) {
((TreeModelListener)modelListeners.elementAt(i)).treeNodesChanged(event);
* Fires "tree nodes inserted" events to all listeners.
* @param event the tree model event
protected void fireTreeNodesInserted(TreeModelEvent event) {
for(int i = 0; i < modelListeners.size(); i++) {
((TreeModelListener)modelListeners.elementAt(i)).treeNodesInserted(event);
* Fires "tree nodes removed" events to all listeners.
* @param event the tree model event
protected void fireTreeNodesRemoved(TreeModelEvent event) {
for(int i = 0; i < modelListeners.size(); i++) {
((TreeModelListener)modelListeners.elementAt(i)).treeNodesRemoved(event);
* Fires "tree structure changed" events to all listeners.
* @param event the tree model event
protected void fireTreeStructureChanged(TreeModelEvent event) {
for(int i = 0; i < modelListeners.size(); i++) {
((TreeModelListener)modelListeners.elementAt(i)).treeStructureChanged(event);
* Records the list of currently expanded paths in the specified tree.
* This method is meant to be called before calling the
* <code>reload()</code> methods to allow the tree to store the paths.
* @param tree the tree
* @param pathlist the list of expanded paths
public ArrayList getExpandedPaths(JTree tree) {
ArrayList expandedPaths = new ArrayList();
addExpandedPaths(tree, tree.getPathForRow(0), expandedPaths);
return expandedPaths;
* Adds the expanded descendants of the specifed path in the specified
* tree to the internal expanded list.
* @param tree the tree
* @param path the path
* @param pathlist the list of expanded paths
private void addExpandedPaths(JTree tree, TreePath path, ArrayList pathlist) {
Enumeration enum = tree.getExpandedDescendants(path);
while(enum.hasMoreElements()) {
TreePath tp = (TreePath)enum.nextElement();
pathlist.add(tp);
addExpandedPaths(tree, tp, pathlist);
* Re-expands the expanded paths in the specified tree. This method is
* meant to be called before calling the <code>reload()</code> methods
* to allow the tree to store the paths.
* @param tree the tree
* @param pathlist the list of expanded paths
public void expandPaths(JTree tree, ArrayList pathlist) {
for(int i = 0; i < pathlist.size(); i++) {
tree.expandPath((TreePath)pathlist.get(i));Hey
I'm not trying to show anyone up here, but having just built a tree model for displaying an XML document in a tree, I thought this seemed like a neat exercise.
I implemented this very differently from the @OP. I only have one class, HiddenNodeTreeModel. All the hidden node data is stored in the model itself in my class. The advantage of what I've created is it will work with any TreeModel. The disadvantage is that I think it's not going to be very scalable - the additional computing to get the number of child nodes and to adjust indexes is heavy. So if you need a scalable solution definitely don't use this.
Anyway here you go
HiddenNodeTreeModel.java
======================
package tjacobs.ui.tree;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JTree;
import javax.swing.event.TreeModelListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import tjacobs.ui.WindowUtilities;
public class HiddenNodeTreeModel implements TreeModel {
TreeModel mModel;
ArrayList<Object> mHidden = new ArrayList<Object>();
public HiddenNodeTreeModel (TreeModel model) {
mModel = model;
public void addTreeModelListener(TreeModelListener arg0) {
mModel.addTreeModelListener(arg0);
private ArrayList<Integer> getHiddenChildren(Object parent) {
ArrayList<Integer> spots = new ArrayList<Integer>();
Iterator _i = mHidden.iterator();
while (_i.hasNext()) {
Object hidden = _i.next();
int idx = mModel.getIndexOfChild(parent, hidden);
if (idx != -1) {
spots.add(idx);
return spots;
public Object getChild(Object arg0, int index) {
ArrayList<Integer> spots = getHiddenChildren(arg0);
Collections.sort(spots);
Iterator<Integer> _i = spots.iterator();
while (_i.hasNext()) {
int num = _i.next();
if (num <= index) {
index++;
return mModel.getChild(arg0, index);
public int getChildCount(Object arg0) {
ArrayList list = getHiddenChildren(arg0);
System.out.println("size = " + list.size());
return mModel.getChildCount(arg0) - list.size();
public int getIndexOfChild(Object arg0, Object arg1) {
int index = mModel.getIndexOfChild(arg0, arg1);
ArrayList<Integer> spots = getHiddenChildren(arg0);
Collections.sort(spots);
Iterator<Integer> _i = spots.iterator();
int toSub = 0;
while (_i.hasNext()) {
int num = _i.next();
if (num <= index) {
toSub++;
return index - toSub;
public Object getRoot() {
// TODO Auto-generated method stub
return mModel.getRoot();
public boolean isLeaf(Object arg0) {
// TODO Auto-generated method stub
return mModel.isLeaf(arg0);
public void removeTreeModelListener(TreeModelListener arg0) {
mModel.removeTreeModelListener(arg0);
public void valueForPathChanged(TreePath arg0, Object arg1) {
mModel.valueForPathChanged(arg0, arg1);
public void hideNode(Object node) {
if (node instanceof TreePath) {
node = ((TreePath)node).getLastPathComponent();
mHidden.add(node);
public void showNode(Object node) {
mHidden.remove(node);
public void showAll() {
mHidden.clear();
* @param args
public static void main(String[] args) {
// TODO Auto-generated method stub
DefaultMutableTreeNode A = new DefaultMutableTreeNode("A");
DefaultMutableTreeNode B = new DefaultMutableTreeNode("B");
DefaultMutableTreeNode C = new DefaultMutableTreeNode("C");
DefaultMutableTreeNode D = new DefaultMutableTreeNode("D");
DefaultMutableTreeNode E = new DefaultMutableTreeNode("E");
DefaultMutableTreeNode F = new DefaultMutableTreeNode("F");
A.add(B);
B.add(C);
B.add(D);
B.add(E);
E.add(F);
DefaultTreeModel model = new DefaultTreeModel(A);
final HiddenNodeTreeModel hmodel = new HiddenNodeTreeModel(model);
final JTree tree = new JTree(hmodel);
JFrame jf = new JFrame("HiddenNodeTreeModel Test");
jf.add(tree);
JMenuBar bar = new JMenuBar();
jf.setJMenuBar(bar);
JMenu menu = new JMenu("Options");
bar.add(menu);
final JMenuItem hide = new JMenuItem("Hide");
final JMenuItem show = new JMenuItem("ShowAll");
menu.add(hide);
menu.add(show);
ActionListener al = new ActionListener() {
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == hide) {
hmodel.hideNode(tree.getSelectionPath());
tree.updateUI();
else {
hmodel.showAll();
tree.updateUI();
hide.addActionListener(al);
show.addActionListener(al);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setBounds(100,100,100,100);
jf.setVisible(true);
} -
Display tree node data in bold characters
Hi,
I have a requirement where I need to display tree nodes data in bold characters. If I click on a particular tree node, next time it should appear in normal font only which means that some task had done using that tree node. Is my question clear??
Plz help me....
thanks,
ravindra.Hi Ravindra,
I think it is possible, i have not done it but let me explain how we can do it.
In <htmlb:treeNode> tag there is an attribute 'text' in
which we specify title of that treeNode.
Now you define a page attribute 'treeNodeTitle' type
edpline and in onCreate assign it value <html><b>MyTreeNode</b></html>
When you click on this node then you do event handling
in onInputProcessing, there assign only 'MyTreeNode' to
treeNodeTitle.
sample code may look like this...
<htmlb:treeNode
id = 'treeNode1'
text = '<%=treeNodeTitle %>' >
</htmlb:treeNode>
Page Attribute
treeNodeTitle type edpline
in onCreate
treeNodeTitle = '<html><b>MyTreeNode</b></html>'
in onInputProcessing
in event-handling code for that treeNode write
treeNodeTitle = 'MyTreeNode'
I hope this will work.
Regards,
Narinder Hartala -
Highlight the selected Tree Node
Hello Everyone,
Can someone plz tell me how to highlight the selected tree node ?
After selection, user should be able to see which node was last selected.
ThanksHello,
for me it is not really clear what you have done. Sorry!
Because I have problems to paste code, I will describe how you can test that function.
Take the BSP application HTMLB_SAMPLES and copy it to ZHTMLB_SAMPLES. Take page "treeviewSample.htm" and add the following node behind node22:
<htmlb:treeNode id = "node23"
text = "Node 2.2, normal text"
selection="PRIMARYSELECTION">
Perhaps this will show you how it works and help you.
As far as I can see the attribute "selection" can't be set via table.
Best regads
Renald
Edited by: Renald Wittwer on Jan 21, 2010 1:36 PM -
Post Back Tree view when tree node check changed
Hi everyone,
I have a tree view, both child and parent have check box. I want to check all the child on the parent selection.
I try "SelectedNodeChanged" but the page doesn't post back to fire my function.
I know I can use javascript to post back the page, but is there any other way to post back my page without javascript???
Thnaks in advance.Hi everyone,
I have a tree view, both child and parent have check box. I want to check all the child on the parent selection.
I try "SelectedNodeChanged" but the page doesn't post back to fire my function.
I know I can use javascript to post back the page, but is there any other way to post back my page without javascript???
Thnaks in advance.
Assuming this is a WinForm application (it looks like it may not be), the following works pretty well:
Option Strict On
Option Explicit On
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
With TreeView1
.CheckBoxes = True
.ShowLines = True
.ShowPlusMinus = True
.ShowRootLines = True
.ExpandAll()
End With
End Sub
' Updates all child tree nodes recursively.
Private Sub CheckAllChildNodes(ByVal treeNode As TreeNode, ByVal nodeChecked As Boolean)
Dim node As TreeNode
For Each node In treeNode.Nodes
node.Checked = nodeChecked
If node.Nodes.Count > 0 Then
' If the current node has child nodes, call the CheckAllChildsNodes method recursively.
Me.CheckAllChildNodes(node, nodeChecked)
End If
Next node
End Sub
' NOTE This code can be added to the BeforeCheck event handler instead of the AfterCheck event.
' After a tree node's Checked property is changed, all its child nodes are updated to the same value.
Private Sub node_AfterCheck(ByVal sender As Object, ByVal e As TreeViewEventArgs) Handles TreeView1.AfterCheck
' The code only executes if the user caused the checked state to change.
If e.Action <> TreeViewAction.Unknown Then
If e.Node.Nodes.Count > 0 Then
' Calls the CheckAllChildNodes method, passing in the current
' Checked value of the TreeNode whose checked state changed.
Me.CheckAllChildNodes(e.Node, e.Node.Checked)
End If
End If
End Sub
End Class
The reference for that is this MSDN document.
If you're looking for a true tri-state operation though, honestly you might want to look at some third-party controls.
I hope that helps. :)
Please call me Frank :) -
RestoreViewState with HTMLB-TREES/TREENODES
Hello,
we want to achieve that our dynamic tree will
be built up in the state it was before we jumped onto another page. When navigating backwards, the tree
does not remember any more it treenodes properties.
Just the root is displayed, not any more the information which node was open and which not.
Also restoreViewState = "TRUE" did not help.
Any ideas ?
Thanks.Here is a complete (yet simplistic) example that proves that the serialization idea works.
Stateless Application
Page One called tree.htm
Page Attributes (Auto Flag is NOT set)
h1_isopen TYPE STRING
h2_isopen TYPE STRING
view_state TYPE SHSVALTAB
OnInitialization
* event handler for data retrieval
DATA: istream TYPE string,
xslt_err TYPE REF TO cx_xslt_exception.
**** Read Server cookie
CALL METHOD cl_bsp_server_side_cookie=>get_server_cookie
EXPORTING
name = 'view_state'
application_name = runtime->application_name
application_namespace = runtime->application_namespace
username = sy-uname
session_id = runtime->session_id
data_name = 'view_state'
CHANGING
data_value = istream.
**** deserialize the Class
IF istream IS NOT INITIAL.
TRY.
CALL TRANSFORMATION id
SOURCE XML istream
RESULT view_state = view_state.
CATCH cx_xslt_exception INTO xslt_err.
ENDTRY.
ENDIF.
CHECK view_state IS NOT INITIAL.
FIELD-SYMBOLS: <wa_state> LIKE LINE OF view_state.
LOOP AT view_state ASSIGNING <wa_state>.
IF <wa_state>-key CS 'Header1'.
IF <wa_state>-value = 'O'.
h1_isopen = 'TRUE'.
ENDIF.
ENDIF.
IF <wa_state>-key CS 'Header2'.
IF <wa_state>-value = 'O'.
h2_isopen = 'TRUE'.
ENDIF.
ENDIF.
ENDLOOP.
OnInputProcessing
* event handler for checking and processing user input and
* for defining navigation
DATA: fields TYPE tihttpnvp.
request->get_form_fields( CHANGING fields = fields ).
FIELD-SYMBOLS: <wa_field> LIKE LINE OF fields,
<wa_state> LIKE LINE OF view_state.
LOOP AT fields ASSIGNING <wa_field>.
IF <wa_field>-name CS 'test'. "My Tree ID
APPEND INITIAL LINE TO view_state ASSIGNING <wa_state>.
<wa_state>-key = <wa_field>-name.
<wa_state>-value = <wa_field>-value.
ENDIF.
ENDLOOP.
DATA: ostream TYPE string,
xslt_err TYPE REF TO cx_xslt_exception.
***** serialize model class
TRY.
CALL TRANSFORMATION id
SOURCE view_state = view_state
RESULT XML ostream.
****Write cookie it into the Server Cookie
cl_bsp_server_side_cookie=>set_server_cookie( name = 'view_state'
application_name = runtime->application_name
application_namespace = runtime->application_namespace
username = sy-uname
session_id = runtime->session_id
data_name = 'view_state'
data_value = ostream
expiry_time_rel = '1200' ).
CATCH cx_xslt_exception INTO xslt_err.
ENDTRY.
navigation->goto_page( 'Navigate.htm' ).
Layout of tree.htm
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
<htmlb:page title=" " >
<htmlb:form>
<htmlb:tree id = "test"
restoreViewState = "TRUE" >
<htmlb:treeNode id = "Header1"
text = "Header1"
isOpen = "<%= h1_isopen %>" >
<htmlb:treeNode id = "Header2"
text = "Header2"
isOpen = "<%= h2_isopen %>" >
<htmlb:treeNode id = "Item1"
text = "Item1" />
<htmlb:treeNode id = "Item2"
text = "Item2" />
</htmlb:treeNode>
<htmlb:treeNode id = "Item3"
text = "Item3" />
<htmlb:button text = "test"
onClick = "TEST" />
</htmlb:treeNode>
</htmlb:tree>
</htmlb:form>
</htmlb:page>
</htmlb:content>
Second Page Navigate.htm (Just a dummy page to simulate Navigation)
OnInputProcessing
* event handler for checking and processing user input and
* for defining navigation
navigation->goto_page( 'tree.htm' ).
Layout for Navigate.htm
<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>
<htmlb:content design="design2003">
<htmlb:page title = " ">
<htmlb:form>
<htmlb:textView text = "Hello World!"
design = "EMPHASIZED" />
<htmlb:button text = "Press Me"
onClick = "myClickHandler" />
</htmlb:form>
</htmlb:page>
</htmlb:content> -
Htmlb:tree: Expand All
I tried to implement an "Expand All" functionality for my htmlb:tree. Strangely, I can change the nodes in the tree table, but they are still displayed as closed on the screen.
LOOP AT me->t_tree ASSIGNING <fs> WHERE status = cl_htmlb_treenode=>c_treenode_closed
OR toggle = cl_bdv_co=>c_true.
<fs>-status = cl_htmlb_treenode=>c_treenode_open.
<fs>-toggle = cl_bdv_co=>c_false.
ENDLOOP.
Why is this? Has this anything to do with the TOGGLE functionality of the tree (which loads certain subtrees with a new server event) ?>Has anybody an explanation for this
Delta-Handling is half Black Magic Voodoo anyway. I assume that the DH server side cache doesn't see any change in those fields (since you have removed them) and therefore doesn't resend them to the client (it only sends changed values).
The Client side cache still has the old values in memory and didn't get an update from the server. Therefore it still renders the old values.
You might try placing a delta handler block around your tree coding:
<bsp:deltaHandlerBlock id="protectionR2" >
<htmlb:tree ... />
</bsp:deltaHandlerBlock>
You can try playing with the attributes of the DHBlock. Try attribute clientCacheClear when you want force a change to the tree. -
Create columns for HTMLB:TREE
Hi All,
In our appplication we are are using <htmlb:tree />. Using CL_BSP_BEE_TABLE we were able to show checkbox inside the tree node. CL_BSP_BEE_TABLE was of great help.
Now we need columns in tree. Is there a way to create columns using BEE?
Thanks and regards,
BindiyaI am using a tree with about 2500 nodes and and around 5000 final children (leaves) and we dont face any problem using the approach i have explained in my weblog.
i guess the best approach would be to just do it and check whether you are having problem.
<i>Do you know of any good alternatives to the htmlb:tree?</i>
there are other javascrip/dhtml trees but you will still face the same kind of issues.
Regards
Raja -
Displaying data in tableview on click of a tree node
Hi,
I am new to BSP. I created a tree structure having the tablenames as tree nodes, and now if I click on a node I want to display corresponding table data in a tableview. How can I acheive this....??
Thanks in advance,
Ravindra.Hi Ravindra,
You can achieve this by reading the node clicked OnInput Processing and You can assign name of your table in "onNodeClick" attribute .
then onInputprocessing you can read the name of your table from
"event->server_event" .
Check this sample code .
****************OnLayout*******************************
<htmlb:content design="design2003">
<htmlb:page title = " ">
<htmlb:form>
<htmlb:tree id = "myTree1"
title = "Tree"
tooltip = "Tooltip for myTree1">
<htmlb:treeNode id="NODE1" text="TABLE1" isOpen="true" onNodeClick="TABLE1">
</htmlb:treeNode>
<htmlb:treeNode id="NODE2" text="TABLE2" isOpen="true" onNodeClick="TABLE2">
</htmlb:treeNode>
<htmlb:treeNode id="NODE3" text="TABLE3" onNodeClick="TABLE3"/>
<htmlb:treeNode id="NODE4" text="TABLE4"onNodeClick="TABLE4" />
<htmlb:treeNode id="NODE5" text="TABLE5" isOpen="false" onNodeClick="TABLE5">
</htmlb:treeNode>
<htmlb:treeNode id="NODE6" text="TABLE6" onNodeClick="TABLE6"/>
</htmlb:tree>
</htmlb:form>
</htmlb:page>
</htmlb:content>
*****************OnInputProcessing****************
CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
Data: TABLE_NAME type STRING.
Optional: test that this is an event from HTMLB library.
IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.
Scenario 1: Read event from manager.
DATA: event TYPE REF TO CL_HTMLB_EVENT.
event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).
IF event IS NOT INITIAL AND event->name = 'tree'.
DATA: tree_event TYPE REF TO CL_HTMLB_EVENT_TREE.
tree_event ?= event.
TABLE_NAME = event->server_event.
ENDIF.
ENDIF.
Check examples given in "SBSPEXT_HTMLB" bsp application.
I hope this will help.
Regards,
Monica -
Drop on a Tree Node - Help!
On a drop on a tree node, I'd like to get the item that is
being dropped on.
Tree object being dropped on: event.currentTarget
Index of node in tree being dropped on:
event.currentTarget..calculateDropIndex(event); where event is the
DragEvent
dropTarget is a great name for a method that would do this,
but it returns a display object.
Some ideas:
1. Use the index to somehow go through the XML data provider.
I don't think this is the right way - the XML structure is not list
based.
2. The Tree creates a list from the XML. How can I leverage
that and get the item for a given node index? dropTarget seems like
the right term, but it returns a display object.
3. tree.selectedItem and tree.Selected Items return null and
an array of null, so I can't use that either.Hello Brian,
thanks for your reply.
The benefit of focusing a node in the tree is the following:
If a person only uses the keyboard to navigate (e.g. because of him/her being blind) expands a tree node, he expects the focus still being on the expanded tree node afterwards. But if a roundtrip to the server happens (because of a executed onClick-event) the focus after the reload is at the beginning of the page again. Thus the blind person hast to TAB through the whole page again until he reaches the tree node he has expanded.
I use the com.sapportals.htmlb.* package for the htmlb-elements.
Almost all elements are underclasses of com.sapportals.htmlb.Component, but Treenode is not.
I use a model to create tree nodes. TreeNodes are created like this in the Model:
mComponentsNode = new TreeNode(COMP_NODE_ID);
mComponentsNode.setComponent(new TextView(COMP_NODE_TEXT));
mComponentsNode.setOnNodeClick(MODE_ON_CLICK_EVENT);
mComponentsNode.setOnNodeExpand(TREE_NODE_EXPAND_EVENT);
mComponentsNode.setOnNodeClose(TREE_NODE_CLOSE_EVENT);
mComponentsNode.setTooltip(COMP_NODE_TOOLTIP);
mComponentsNode.setOpen(true);
mHomeNode.addChildNode(mComponentsNode);
In the JSP the tree is created like this:
<hbj:tree id="configTree"
title=""
rootNode="configTree"
rootNodeIsVisible="false">
</tree>
Do you have any idea?
Thanks!
Regards,
Bastian -
Volume won't boot: Invalid B-tree node size
My OS 10.4 volume on a G4 tower will no longer boot (I can mount it from another volume on the same machine, though).
The problem started with trying to read from a damaged CD. I powered-off the machine when it hung trying to copy a file. After I could no longer boot. Disk utility said bad leaf record count (I think). The utility could not do the repair, fsck didn't help.
I have a copy of Techtool deluxe (that came with a Tiger-loaded G5). I ran that. It found, and claimed to have repaired, the problems (though it took a looong time). Techtool now finds no errors.
However, I still cannot boot. Running diskutility get me:
Invalid B-tree node size
Error: the underlying task reported failure on exit (-9972)
Trying to boot in single-user mode gets a nasty panic.
I guess my question is: Is it worth trying to run another repair utility? If Techtool thinks everything is OK, is there any point doing more? Did I mess this up by using the Techtool that came with a G5 on my G4? (not sure I want the answer to that last question.)
Thanks for any pointers.
g4 tower Mac OS X (10.4.3)Thanks for the tips. I could have swornTechtool deluxe came with machines loaded with Tiger, but I guess not.
Before I messed things too badly with Techtool delux I made an image of the volume. It still has the bad leaf count, but at least it could mount.
I'm going to erase the volume, reinstall the system software and then copy all my files off the diskimage. One more question: If I want to copy applications from the diskimage should I copy anything besides the stuff in the Applications folder? something from the Library?
Thanks again.
Maybe you are looking for
-
Help, iTunes store wont open, Error (11333)
it won't go to iTunes store, it opens up the library but when I click iTunes store it says "iTunes could not connect tp the iTunes store. An unknown error occured (11333), help me because i just purchase a $50 iTune card and i want to buy music, than
-
Change property of a page in Weblogic Portal
Hi all, I'm new to Weblogic Portal and I'm trying to change the "Presentation class" property of a .page file, to add a css class to a div. After changing the file and starting the server, nothing seems to have changed. I'm accessing the portal throu
-
Ipod Nano/iTrip/Car charger problems.
I recently bought an itrip nano (the one that fits around your ipod) and i originally had a charger for my car, but thanks to the good people at apple I had to buy a new one because no cables would fit the old charger with the itrip plugin. *end rant
-
i dont think i backed up my photos to my pc.the right side of my screen is broken and i dont have my passcode while my phone is in recovery mode. my pc says to restore so i can get into itunes. if i didn't backup my photos will i lose them all?? how
-
Command line stop for a single service
Hi, How to stop a single service from command line mode. can any one please answer? I have tried following one but no luck... ./ccm.sh -stop SIA.InputFileRepository -cms cmsname:6400 -username xxxx -password xxxx -authentication secEnterprise Thanks