|
|

楼主 |
发表于 2008/10/15 09:03:18
|
显示全部楼层
google一下,解释如下:
MTree.java文件,需要遵守license
FishEye
* Chart
* Search
* Changelog
* Browse
* Crucible
* Help
compiere:/base/src/org/compiere/model/MTree.java revision 1.15 download
Quick Search:
View
Revision:
Expand:
Diff
Diff from 1.15 to:
Annotations
Annotate by Age | Author | Mixed | None
/browse/compiere/base/src/org/compiere/model/MTree.java
Annotated File View
jjanke
1.1
1 /******************************************************************************
2 * The contents of this file are subject to the Compiere License Version 1.1
3 * ("License"); You may not use this file except in compliance with the License
4 * You may obtain a copy of the License at http://www.compiere.org/license.html
5 * Software distributed under the License is distributed on an "AS IS" basis,
6 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7 * the specific language governing rights and limitations under the License.
8 * The Original Code is Compiere ERP & CRM Business Solution
9 * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10 * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
11 * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12 * Contributor(s): ______________________________________.
13 *****************************************************************************/
14 package org.compiere.model;
15
16 import java.sql.*;
17 import java.util.*;
jjanke
1.6
18 import javax.sql.*;
jjanke
1.1
19
20 import org.compiere.util.*;
21
22 /**
23 * Builds Tree.
24 * Creates tree structure - maintained in VTreePanel
25 *
26 * @author Jorg Janke
jjanke
1.15
27 * @version $Id: MTree.java,v 1.15 2003/12/27 07:13:31 jjanke Exp $
jjanke
1.1
28 */
jjanke
1.13
29 public class MTree extends MTree_Base
jjanke
1.1
30 {
31 /**
jjanke
1.11
32 * Default Constructor.
33 * Need to call loadNodes explicitly
34 * @param ctx context for security
35 * @param AD_Tree_ID The tree to build
36 */
37 public MTree (Properties ctx, int AD_Tree_ID)
38 {
jjanke
1.13
39 super (ctx, AD_Tree_ID);
jjanke
1.11
40 } // MTree
41
42 /**
43 * Construct & Load Tree
jjanke
1.1
44 * @param AD_Tree_ID The tree to build
45 * @param editable True, if tree can be modified
46 * - includes inactive and empty summary nodes
jjanke
1.5
47 * @param ctx context for security
jjanke
1.1
48 */
jjanke
1.5
49 public MTree (Properties ctx, int AD_Tree_ID, boolean editable)
jjanke
1.1
50 {
jjanke
1.11
51 this (ctx, AD_Tree_ID);
jjanke
1.5
52 m_editable = editable;
53 int AD_User_ID = Env.getContextAsInt(ctx, "AD_User_ID");
jjanke
1.8
54 log.info("AD_Tree_ID=" + AD_Tree_ID
55 + ", AD_User_ID=" + AD_User_ID
56 + ", Editable=" + editable);
57 //
jjanke
1.5
58 loadNodes(AD_User_ID);
jjanke
1.1
59 } // MTree
60
jjanke
1.11
61
jjanke
1.5
62 /** Is Tree editable */
jjanke
1.11
63 private boolean m_editable = false;
jjanke
1.1
64 /** Root Node */
65 private MTreeNode m_root = null;
66 /** Buffer while loading tree */
67 private ArrayList m_buffer = new ArrayList();
68 /** Prepared Statement for Node Details */
jjanke
1.11
69 private RowSet m_nodeRowSet;
jjanke
1.1
70
71 /*************************************************************************/
72
73 /**
74 * Get primary AD_Tree_ID for KeyColumn.
75 * Called from GridController
76 * @param keyColumnName key column name, eg. C_Project_ID
77 * @return AD_Tree_ID
78 */
79 public static int getAD_Tree_ID (String keyColumnName)
80 {
81 Log.trace(Log.l4_Data, "MTree.getAD_Tree_ID", keyColumnName);
82 if (keyColumnName == null || keyColumnName.length() == 0)
83 return 0;
84
85 String TreeType = null;
86 if (keyColumnName.equals("AD_Menu_ID"))
jjanke
1.5
87 TreeType = TREETYPE_Menu;
jjanke
1.1
88 else if (keyColumnName.equals("C_ElementValue_ID"))
jjanke
1.14
89 TreeType = TREETYPE_ElementValue;
jjanke
1.1
90 else if (keyColumnName.equals("M_Product_ID"))
jjanke
1.5
91 TreeType = TREETYPE_Product;
jjanke
1.1
92 else if (keyColumnName.equals("C_BPartner_ID"))
jjanke
1.14
93 TreeType = TREETYPE_BPartner;
jjanke
1.1
94 else if (keyColumnName.equals("AD_Org_ID"))
jjanke
1.5
95 TreeType = TREETYPE_Organization;
jjanke
1.1
96 else if (keyColumnName.equals("C_Project_ID"))
jjanke
1.5
97 TreeType = TREETYPE_Project;
jjanke
1.1
98 else if (keyColumnName.equals("M_ProductCategory_ID"))
jjanke
1.5
99 TreeType = TREETYPE_ProductCategory;
jjanke
1.1
100 else if (keyColumnName.equals("M_BOM_ID"))
jjanke
1.5
101 TreeType = TREETYPE_BoM;
jjanke
1.1
102 else if (keyColumnName.equals("C_SalesRegion_ID"))
jjanke
1.5
103 TreeType = TREETYPE_SalesRegion;
jjanke
1.1
104 else if (keyColumnName.equals("C_Campaign_ID"))
jjanke
1.5
105 TreeType = TREETYPE_Campaign;
jjanke
1.1
106 else if (keyColumnName.equals("C_Activity_ID"))
jjanke
1.5
107 TreeType = TREETYPE_Activity;
jjanke
1.1
108 else
109 {
110 Log.error("MTree.getAD_Tree_ID - Could not map " + keyColumnName);
111 return 0;
112 }
113
114 int AD_Tree_ID = 0;
115 int AD_Client_ID = Env.getContextAsInt(Env.getCtx(), "#AD_Client_ID");
116 String sql = "SELECT AD_Tree_ID,Name FROM AD_Tree "
117 + "WHERE AD_Client_ID=? AND TreeType=? AND IsActive='Y'";
118 try
119 {
120 PreparedStatement pstmt = DB.prepareStatement(sql);
121 pstmt.setInt(1, AD_Client_ID);
122 pstmt.setString(2, TreeType);
123 ResultSet rs = pstmt.executeQuery();
124 if (rs.next())
125 AD_Tree_ID = rs.getInt(1);
126 rs.close();
127 pstmt.close();
128 }
129 catch (SQLException e)
130 {
131 Log.error("MTree.getAD_Tree_ID", e);
132 }
133
134 return AD_Tree_ID;
135 } // getAD_Tree_ID
136
137
138 /**
139 * Get Primary Tree of Tree Type
140 * @param TreeType see TREETYPE_
jjanke
1.5
141 * @param ctx context for Security
jjanke
1.1
142 * @return MTree
143 */
jjanke
1.5
144 public static MTree getTree (Properties ctx, String TreeType)
jjanke
1.1
145 {
146 int AD_Tree_ID = 0;
147 int AD_Client_ID = Env.getContextAsInt(Env.getCtx(), "#AD_Client_ID");
148 String sql = "SELECT AD_Tree_ID,Name FROM AD_Tree "
149 + "WHERE AD_Client_ID=? AND TreeType=? AND IsActive='Y'";
150 try
151 {
152 PreparedStatement pstmt = DB.prepareStatement(sql);
153 pstmt.setInt(1, AD_Client_ID);
154 pstmt.setString(2, TreeType);
155 ResultSet rs = pstmt.executeQuery();
156 if (rs.next())
157 AD_Tree_ID = rs.getInt(1);
158 rs.close();
159 pstmt.close();
160 }
161 catch (SQLException e)
162 {
163 Log.error("MTree.getTree", e);
164 }
165 // Not found
166 if (AD_Tree_ID == 0)
167 {
168 Log.trace(Log.l4_Data, "MTree.getTree - No AD_Tree_ID for TreeType=" + TreeType + ", AD_Client_ID=" + AD_Client_ID);
169 return null;
170 }
171 //
jjanke
1.5
172 MTree tree = new MTree (ctx, AD_Tree_ID, false);
jjanke
1.1
173 return tree;
174 } // getTree
175
jjanke
1.11
176 /**
177 * Get Node TableName
178 * @return node table name, e.g. AD_TreeNode
179 */
180 public String getNodeTableName()
181 {
182 return getNodeTableName(getTreeType());
183 } // getNodeTableName
184
185 /**
186 * Get Node TableName
187 * @param treeType tree type
188 * @return node table name, e.g. AD_TreeNode
189 */
190 public static String getNodeTableName(String treeType)
191 {
192 String nodeTableName = "AD_TreeNode";
193 if (TREETYPE_Menu.equals(treeType))
194 ; // m_tableName += "MM";
jjanke
1.14
195 else if (TREETYPE_BPartner.equals(treeType))
jjanke
1.11
196 nodeTableName += "BP";
197 else if (TREETYPE_Product.equals(treeType))
198 nodeTableName += "PR";
199 return nodeTableName;
200 } // getNodeTableName
201
202
203 /**
204 * Get Source TableName
205 * @return source table name, e.g. AD_Org or null
206 */
207 public String getSourceTableName()
208 {
209 return getSourceTableName(getTreeType());
210 } // getSourceTableName
211
212 /**
213 * Get Source TableName
214 * @param treeType tree typw
215 * @return source table name, e.g. AD_Org or null
216 */
217 public static String getSourceTableName(String treeType)
218 {
219 if (treeType == null)
220 return null;
221 String sourceTable = null;
222 if (treeType.equals(TREETYPE_Menu))
223 sourceTable = "AD_Menu";
224 else if (treeType.equals(TREETYPE_Organization))
225 sourceTable = "AD_Org";
226 else if (treeType.equals(TREETYPE_Product))
227 sourceTable = "M_Product";
228 else if (treeType.equals(TREETYPE_ProductCategory))
229 sourceTable = "M_Product_Category";
230 else if (treeType.equals(TREETYPE_BoM))
231 sourceTable = "M_BOM";
jjanke
1.14
232 else if (treeType.equals(TREETYPE_ElementValue))
jjanke
1.11
233 sourceTable = "C_ElementValue";
jjanke
1.14
234 else if (treeType.equals(TREETYPE_BPartner))
jjanke
1.11
235 sourceTable = "C_BPartner";
236 else if (treeType.equals(TREETYPE_Campaign))
237 sourceTable = "C_Campaign";
238 else if (treeType.equals(TREETYPE_Project))
239 sourceTable = "C_Project";
240 else if (treeType.equals(TREETYPE_Activity))
241 sourceTable = "C_Activity";
242 else if (treeType.equals(TREETYPE_SalesRegion))
243 sourceTable = "C_SalesRegion";
244 return sourceTable;
245 } // getSourceTableName
246
jjanke
1.1
247
jjanke
1.5
248 /*************************************************************************
jjanke
1.1
249
250 /**
jjanke
1.5
251 * Load Nodes and Bar
252 * @param AD_User_ID user
jjanke
1.1
253 */
jjanke
1.6
254 private void loadNodes (int AD_User_ID)
jjanke
1.1
255 {
256 // SQL for TreeNodes
jjanke
1.8
257 StringBuffer sql = new StringBuffer("SELECT "
jjanke
1.1
258 + "tn.Node_ID,tn.Parent_ID,tn.SeqNo,tb.IsActive "
jjanke
1.11
259 + "FROM ").append(getNodeTableName()).append(" tn"
jjanke
1.2
260 + " LEFT OUTER JOIN AD_TreeBar tb ON (tn.AD_Tree_ID=tb.AD_Tree_ID"
261 + " AND tn.Node_ID=tb.Node_ID AND tb.AD_User_ID=?) " // #1
262 + "WHERE tn.AD_Tree_ID=?"); // #2
jjanke
1.1
263 if (!m_editable)
jjanke
1.8
264 sql.append(" AND tn.IsActive='Y'");
265 sql.append(" ORDER BY COALESCE(tn.Parent_ID, -1), tn.SeqNo");
266 Log.trace(9, "MTree.loadNodes", sql.toString());
jjanke
1.1
267
268 // The Node Loop
269 try
270 {
jjanke
1.6
271 // load Node details - addToTree -> getNodeDetail
272 getNodeDetails();
jjanke
1.1
273 //
jjanke
1.8
274 PreparedStatement pstmt = DB.prepareStatement(sql.toString());
jjanke
1.5
275 pstmt.setInt(1, AD_User_ID);
276 pstmt.setInt(2, getAD_Tree_ID());
jjanke
1.3
277 // Get Tree & Bar
jjanke
1.1
278 ResultSet rs = pstmt.executeQuery();
jjanke
1.10
279 m_root = new MTreeNode (0, 0, getName(), getDescription(), 0, true, null, false);
jjanke
1.1
280 while (rs.next())
281 {
282 int node_ID = rs.getInt(1);
283 int parent_ID = rs.getInt(2);
284 int seqNo = rs.getInt(3);
285 boolean onBar = (rs.getString(4) != null);
286 //
287 if (node_ID == 0 && parent_ID == 0)
jjanke
1.10
288 ;
jjanke
1.1
289 else
jjanke
1.3
290 addToTree (node_ID, parent_ID, seqNo, onBar); // calls getNodeDetail
jjanke
1.1
291 }
292 rs.close();
293 pstmt.close();
294 //
jjanke
1.6
295 m_nodeRowSet.close();
296 m_nodeRowSet = null;
jjanke
1.1
297 }
298 catch (SQLException e)
299 {
300 Log.error("MTree.loadNodes", e);
jjanke
1.6
301 m_nodeRowSet = null;
jjanke
1.1
302 }
jjanke
1.10
303
jjanke
1.1
304 // Done with loading - add remainder from buffer
305 if (m_buffer.size() != 0)
306 {
jjanke
1.8
307 Log.trace(Log.l6_Database, "MTree.loadNodes - clearing buffer - Adding to " + m_root);
jjanke
1.1
308 for (int i = 0; i < m_buffer.size(); i++)
309 {
310 MTreeNode node = (MTreeNode)m_buffer.get(i);
311 MTreeNode parent = m_root.findNode(node.getParent_ID());
312 if (parent != null && parent.getAllowsChildren())
313 {
314 parent.add(node);
315 checkBuffer(node);
jjanke
1.2
316 m_buffer.remove(i);
jjanke
1.8
317 i = -1; // start again with i=0
jjanke
1.1
318 }
319 }
320 }
jjanke
1.2
321
322 // Nodes w/o parent
jjanke
1.1
323 if (m_buffer.size() != 0)
jjanke
1.2
324 {
325 Log.error ("MTree.loadNodes - Nodes w/o parent - adding to root - " + m_buffer);
326 for (int i = 0; i < m_buffer.size(); i++)
327 {
328 MTreeNode node = (MTreeNode)m_buffer.get(i);
329 m_root.add(node);
330 checkBuffer(node);
331 m_buffer.remove(i);
332 i = -1;
333 }
334 if (m_buffer.size() != 0)
335 Log.error ("MTree.loadNodes - still nodes in Buffer - " + m_buffer);
336 } // nodes w/o parents
jjanke
1.1
337
338 // clean up
339 if (!m_editable && m_root.getChildCount() > 0)
340 trimTree();
341 // diagPrintTree();
342 } // loadNodes
343
344 /**
345 * Add Node to Tree.
346 * If not found add to buffer
347 * @param node_ID Node_ID
348 * @param parent_ID Parent_ID
349 * @param seqNo SeqNo
350 * @param onBar on bar
351 */
352 private void addToTree (int node_ID, int parent_ID, int seqNo, boolean onBar)
353 {
354 // Create new Node
355 MTreeNode child = getNodeDetail (node_ID, parent_ID, seqNo, onBar);
356 if (child == null)
357 return;
358
359 // Add to Tree
360 MTreeNode parent = null;
361 if (m_root != null)
362 parent = m_root.findNode (parent_ID);
363 // Parent found
364 if (parent != null && parent.getAllowsChildren())
365 {
366 parent.add(child);
367 // see if we can add nodes from buffer
368 if (m_buffer.size() > 0)
369 checkBuffer(child);
370 }
371 else
372 m_buffer.add(child);
373 } // addToTree
374
375 /**
376 * Check the buffer for nodes which have newNode as Parents
377 * @param newNode new node
378 */
379 private void checkBuffer (MTreeNode newNode)
380 {
381 for (int i = 0; i < m_buffer.size(); i++)
382 {
383 MTreeNode node = (MTreeNode)m_buffer.get(i);
jjanke
1.12
384 if (node.getParent_ID() == newNode.getNode_ID())
jjanke
1.1
385 {
386 newNode.add(node);
387 m_buffer.remove(i);
388 i--;
389 }
390 }
391 } // checkBuffer
392
393 /*************************************************************************/
394
395 /**
jjanke
1.6
396 * Get Node Detail.
397 * Loads data into RowSet m_nodeRowSet
jjanke
1.1
398 * Columns:
jjanke
1.6
399 * - ID
jjanke
1.1
400 * - Name
401 * - Description
402 * - IsSummary
403 * - ImageIndicator
jjanke
1.6
404 * - additional for Menu
jjanke
1.1
405 * Parameter:
406 * - Node_ID
407 * The SQL contains security/access control
408 * @return SQL to get Node Detail Info
409 */
jjanke
1.6
410 private void getNodeDetails ()
jjanke
1.1
411 {
412 // SQL for Node Info
jjanke
1.6
413 StringBuffer sqlNode = new StringBuffer();
jjanke
1.11
414 String sourceTable = getSourceTableName();
jjanke
1.5
415 if (getTreeType().equals(TREETYPE_Menu))
jjanke
1.1
416 {
417 boolean base = Env.isBaseLanguage(Env.getCtx(), "AD_Menu");
jjanke
1.5
418 sourceTable = "m";
jjanke
1.1
419 if (base)
jjanke
1.6
420 sqlNode.append("SELECT m.AD_Menu_ID, m.Name,m.Description,m.IsSummary,m.Action, "
jjanke
1.5
421 + "m.AD_Window_ID, m.AD_Process_ID, m.AD_Form_ID, m.AD_Workflow_ID, m.AD_Task_ID, m.AD_Workbench_ID "
jjanke
1.1
422 + "FROM AD_Menu m");
423 else
jjanke
1.8
424 sqlNode.append("SELECT m.AD_Menu_ID, t.Name,t.Description,m.IsSummary,m.Action, "
jjanke
1.5
425 + "m.AD_Window_ID, m.AD_Process_ID, m.AD_Form_ID, m.AD_Workflow_ID, m.AD_Task_ID, m.AD_Workbench_ID "
jjanke
1.1
426 + "FROM AD_Menu m, AD_Menu_Trl t");
427 if (!base)
jjanke
1.6
428 sqlNode.append(" WHERE m.AD_Menu_ID=t.AD_Menu_ID AND t.AD_Language='")
jjanke
1.1
429 .append(Env.getAD_Language(Env.getCtx())).append("'");
430 if (!m_editable)
jjanke
1.6
431 {
432 boolean hasWhere = sqlNode.indexOf(" WHERE ") != -1;
433 sqlNode.append(hasWhere ? " AND " : " WHERE ").append(" m.IsActive='Y' ");
434 }
jjanke
1.1
435 }
436 else
437 {
438 if (sourceTable == null)
jjanke
1.5
439 throw new IllegalArgumentException("MTree.prepareNodeDetail - Unknown TreeType=" + getTreeType());
jjanke
1.6
440 sqlNode.append("SELECT ").append(sourceTable).append("_ID,Name,Description,IsSummary,NULL FROM ")
441 .append(sourceTable);
jjanke
1.1
442 if (!m_editable)
jjanke
1.6
443 sqlNode.append(" WHERE IsActive='Y'");
jjanke
1.1
444 }
jjanke
1.9
445 String sql = sqlNode.toString();
446 if (!m_editable) // editable = menu/etc. window
447 sql = MRole.getDefault(getCtx(), false).addAccessSQL(sql,
448 sourceTable, MRole.SQL_FULLYQUALIFIED, m_editable);
jjanke
1.6
449 log.debug("getNodeDetails - " + sql);
jjanke
1.15
450 m_nodeRowSet = DB.getRowSet (sql, true);
jjanke
1.6
451 } // getNodeDetails
jjanke
1.1
452
453 /**
454 * Get Node Details.
455 * As SQL contains security access, not all nodes will be found
456 * @param node_ID Key of the record
457 * @param parent_ID Parent ID of the record
458 * @param seqNo Sort index
459 * @param onBar Node also on Shortcut bar
460 * @return Node
461 */
462 private MTreeNode getNodeDetail (int node_ID, int parent_ID, int seqNo, boolean onBar)
463 {
464 MTreeNode retValue = null;
465 try
466 {
jjanke
1.6
467 m_nodeRowSet.beforeFirst();
468 while (m_nodeRowSet.next())
jjanke
1.1
469 {
jjanke
1.6
470 int node = m_nodeRowSet.getInt(1);
471 if (node_ID != node) // search for correct one
472 continue;
473 //
474 int index = 2;
475 String name = m_nodeRowSet.getString(index++);
476 String description = m_nodeRowSet.getString(index++);
477 boolean isSummary = "Y".equals(m_nodeRowSet.getString(index++));
478 String action = m_nodeRowSet.getString(index++);
jjanke
1.5
479 //
480 if (getTreeType().equals(TREETYPE_Menu) && !isSummary)
481 {
jjanke
1.6
482 int AD_Window_ID = m_nodeRowSet.getInt(index++);
483 int AD_Process_ID = m_nodeRowSet.getInt(index++);
484 int AD_Form_ID = m_nodeRowSet.getInt(index++);
485 int AD_Workflow_ID = m_nodeRowSet.getInt(index++);
486 int AD_Task_ID = m_nodeRowSet.getInt(index++);
487 int AD_Workbench_ID = m_nodeRowSet.getInt(index++);
jjanke
1.5
488 //
489 MRole role = MRole.getDefault(getCtx(), false);
490 Boolean access = null;
491 if (X_AD_Menu.ACTION_Window.equals(action))
492 access = role.getWindowAccess(AD_Window_ID);
493 else if (X_AD_Menu.ACTION_Process.equals(action) || X_AD_Menu.ACTION_Report.equals(action))
494 access = role.getProcessAccess(AD_Process_ID);
495 else if (X_AD_Menu.ACTION_Form.equals(action))
496 access = role.getFormAccess(AD_Form_ID);
497 else if (X_AD_Menu.ACTION_WorkFlow.equals(action))
498 access = role.getWorkflowAccess(AD_Workflow_ID);
499 else if (X_AD_Menu.ACTION_Task.equals(action))
500 access = role.getTaskAccess(AD_Task_ID);
501 // else if (X_AD_Menu.ACTION_Workbench.equals(action))
502 // access = role.getWorkbenchAccess(AD_Window_ID);
jjanke
1.6
503 // log.debug("getNodeDetail - " + name + " - " + action + " - " + access);
jjanke
1.5
504 //
jjanke
1.9
505 if (access != null // rw or ro for Role
506 || m_editable) // Menu Window can see all
jjanke
1.5
507 {
508 retValue = new MTreeNode (node_ID, seqNo,
509 name, description, parent_ID, isSummary,
510 action, onBar);
511 }
512 }
513 else
514 { // always add
515 retValue = new MTreeNode (node_ID, seqNo,
516 name, description, parent_ID, isSummary,
517 action, onBar);
518 }
jjanke
1.1
519 }
520 }
521 catch (SQLException e)
522 {
jjanke
1.6
523 log.error("getNodeDetails", e);
jjanke
1.1
524 }
525 return retValue;
526 } // getNodeDetails
527
528 /*************************************************************************/
529
530 /**
531 * Trim tree of empty summary nodes
532 */
533 private void trimTree()
534 {
535 boolean needsTrim = m_root != null;
536 while (needsTrim)
537 {
538 needsTrim = false;
539 Enumeration en = m_root.preorderEnumeration();
540 while (en.hasMoreElements())
541 {
542 MTreeNode nd = (MTreeNode)en.nextElement();
543 if (nd.isSummary() && nd.getChildCount() == 0)
544 {
545 nd.removeFromParent();
546 needsTrim = true;
547 }
548 }
549 }
550 } // trimTree
551
552 /**
553 * Diagnostics: Print tree
554 */
jjanke
1.12
555 private void dumpTree()
jjanke
1.1
556 {
557 Enumeration en = m_root.preorderEnumeration();
558 int count = 0;
559 while (en.hasMoreElements())
560 {
561 StringBuffer sb = new StringBuffer();
562 MTreeNode nd = (MTreeNode)en.nextElement();
563 for (int i = 0; i < nd.getLevel(); i++)
564 sb.append(" ");
jjanke
1.12
565 sb.append("ID=").append(nd.getNode_ID())
jjanke
1.1
566 .append(", SeqNo=").append(nd.getSeqNo())
567 .append(" ").append(nd.getName());
568 System.out.println(sb.toString());
569 count++;
570 }
571 System.out.println("Count=" + count);
572 } // diagPrintTree
573
574 /**
575 * Get Root node
576 * @return root
577 */
578 public MTreeNode getRoot()
579 {
580 return m_root;
581 } // getRoot
582
583 /**
584 * String representation
585 * @return info
586 */
587 public String toString()
588 {
589 StringBuffer sb = new StringBuffer("MTree[");
jjanke
1.5
590 sb.append("AD_Tree_ID=").append(getAD_Tree_ID())
591 .append(", Name=").append(getName());
jjanke
1.1
592 sb.append("]");
593 return sb.toString();
594 }
595 } // MTree
Crucible: Open Source License registered to Atlassian.
Atlassian FishEye, Subversion, CVS & Perforce analysis. (Version:1.5.4 Build:build-308 2008-07-31 ) - Administration - Page generated 2008-10-14 20:21 -0500 |
|