00001
00002
00003
00004
00005
00006
00007 package GuiComponents.Inspector;
00008
00009 import Sct.Serializable;
00010 import GuiComponents.Inspector.TreeTable.JTreeTable;
00011
00016 public class InspectorPanel extends javax.swing.JPanel {
00017 String isName;
00018 Serializable isObj;
00019
00021 public InspectorPanel(String name, Serializable ob) {
00022 initComponents();
00023 isName = name;
00024 isObj = ob;
00025 myInitComponents();
00026 }
00027
00029 public InspectorPanel() {
00030 initComponents();
00031 isName = "Unnamed";
00032 isObj = null;
00033 myInitComponents();
00034 }
00035
00036 public static void main(String [] args) {
00037 javax.swing.JFrame f = new javax.swing.JFrame("Inspector panel test");
00038
00039 f.getContentPane().add(new InspectorPanel());
00040 f.pack();
00041 f.setVisible(true);
00042 }
00043
00045 public void setData(Serializable ob) {
00046 isObj = ob;
00047 myInitComponents();
00048 }
00049
00050 public void setName(String name) {
00051 isName = name;
00052 myInitComponents();
00053 }
00054
00055 private void myInitComponents() {
00056 StreamableRep rep = null;
00057 if(isObj != null) {
00058 rep = new StreamableRep(isName, isObj);
00059 }
00060 treeTable = new JTreeTable(new SerializableModel(rep));
00061 spScrollPane.setViewportView(treeTable);
00062 }
00063
00069 private void initComponents() {
00070 spScrollPane = new javax.swing.JScrollPane();
00071
00072 setLayout(new java.awt.BorderLayout());
00073
00074 setPreferredSize(new java.awt.Dimension(600, 600));
00075 add(spScrollPane, java.awt.BorderLayout.CENTER);
00076
00077 }
00078
00079
00080
00081 private javax.swing.JScrollPane spScrollPane;
00082
00083 public JTreeTable treeTable;
00084 }