Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/ui/treetable/SimpleTreeTableModel.java @ 6831:d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
Summary: Capitalize these metadata types (and objArrayKlass)
Reviewed-by: stefank, twisti, kvn
author | coleenp |
---|---|
date | Sat, 29 Sep 2012 06:40:00 -0400 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.ui.treetable; | |
26 | |
27 import javax.swing.tree.*; | |
28 import sun.jvm.hotspot.ui.tree.*; | |
29 | |
30 /** An extension of SimpleTreeModel which implements the | |
31 TreeTableModel interface. It supports a two-column "Name, Value" | |
32 interface and disabling of editing of the "Value" column. Because | |
33 of a bug in the implementation of JTreeTable, it always returns | |
34 "true" for isCellEditable of cells in the "Name" column; | |
35 otherwise, mouse clicks to open handles are not dispatched | |
36 properly. Users are responsible for calling setTreeEditable(false) | |
37 on the JTreeTable to make the names uneditable. */ | |
38 | |
39 public class SimpleTreeTableModel extends SimpleTreeModel implements TreeTableModel { | |
40 private boolean valuesEditable = true; | |
41 | |
42 public int getColumnCount() { | |
43 return 2; | |
44 } | |
45 public String getColumnName(int column) { | |
46 switch (column) { | |
47 case 0: return "Name"; | |
48 case 1: return "Value"; | |
49 default: throw new RuntimeException("Index " + column + " out of bounds"); | |
50 } | |
51 } | |
52 public Class getColumnClass(int column) { | |
53 switch (column) { | |
54 case 0: return TreeTableModel.class; | |
55 case 1: return String.class; | |
56 default: throw new RuntimeException("Index " + column + " out of bounds"); | |
57 } | |
58 } | |
59 public Object getValueAt(Object node, int column) { | |
60 SimpleTreeNode realNode = (SimpleTreeNode) node; | |
61 switch (column) { | |
62 case 0: return realNode.getName(); | |
63 case 1: return realNode.getValue(); | |
64 default: throw new RuntimeException("Index " + column + " out of bounds"); | |
65 } | |
66 } | |
67 public boolean isCellEditable(Object node, int column) { | |
68 switch (column) { | |
69 // This must return true in order for the JTreeTable's handles to | |
70 // work properly | |
71 case 0: return true; | |
72 case 1: return valuesEditable; | |
73 default: throw new RuntimeException("Index " + column + " out of bounds"); | |
74 } | |
75 } | |
76 public void setValueAt(Object aValue, Object node, int column) { | |
77 // FIXME: figure out how to handle this | |
78 throw new RuntimeException("FIXME: figure out how to handle editing of SimpleTreeNodes"); | |
79 } | |
80 | |
81 /** Defaults to true */ | |
82 public boolean getValuesEditable() { | |
83 return valuesEditable; | |
84 } | |
85 | |
86 /** Defaults to true */ | |
87 public void setValuesEditable(boolean val) { | |
88 valuesEditable = val; | |
89 } | |
90 } |