01: /*
02: This library is free software; you can redistribute it and/or
03: modify it under the terms of the GNU General Public
04: License as published by the Free Software Foundation; either
05: version 2 of the license, or (at your option) any later version.
06: */
07: package org.gjt.jclasslib.browser.detail;
08:
09: import org.gjt.jclasslib.browser.BrowserServices;
10: import org.gjt.jclasslib.browser.BrowserTreeNode;
11: import org.gjt.jclasslib.structures.elementvalues.AnnotationElementValue;
12: import org.gjt.jclasslib.structures.elementvalues.ElementValue;
13: import org.gjt.jclasslib.util.ExtendedJLabel;
14:
15: import javax.swing.tree.TreePath;
16:
17: /**
18: * Class for showing an annotation node.
19: *
20: * @author <a href="mailto:vitor.carreira@gmail.com">Vitor Carreira</a>
21: * @version $Revision: 1.1 $ $Date: 2004/12/28 13:04:31 $
22: */
23: public class AnnotationDetailPane extends FixedListDetailPane {
24:
25: private ExtendedJLabel lblTag;
26: private ExtendedJLabel lblTagVerbose;
27:
28: private ExtendedJLabel lblType;
29: private ExtendedJLabel lblTypeVerbose;
30:
31: private ExtendedJLabel lblValuePairEntries;
32:
33: public AnnotationDetailPane(BrowserServices services) {
34: super (services);
35: }
36:
37: protected void setupLabels() {
38: addDetailPaneEntry(normalLabel("Tag:"),
39: lblTag = highlightLabel(),
40: lblTagVerbose = highlightLabel());
41:
42: addDetailPaneEntry(normalLabel("Type:"), lblType = linkLabel(),
43: lblTypeVerbose = highlightLabel());
44:
45: addDetailPaneEntry(normalLabel("Number of entries:"),
46: lblValuePairEntries = highlightLabel());
47: }
48:
49: public void show(TreePath treePath) {
50: AnnotationElementValue annotation = (AnnotationElementValue) ((BrowserTreeNode) treePath
51: .getLastPathComponent()).getElement();
52:
53: lblTag.setText(String.valueOf((char) annotation.getTag()));
54: lblTagVerbose.setText("<"
55: + ElementValue.getTagDescription(annotation.getTag())
56: + ">");
57:
58: constantPoolHyperlink(lblType, lblTypeVerbose, annotation
59: .getTypeIndex());
60:
61: lblValuePairEntries.setText(String.valueOf(annotation
62: .getElementValuePairEntries().length));
63:
64: super.show(treePath);
65: }
66: }
|