annotate src/treecms/gui/AddChildDialog.java @ 8:f96193babac0

changed byte[] to ByteBuffer added TreeEditor.updateTree(Node,NodeData,Node[]) for node path is known. added GUIEditor
author shoshi
date Thu, 31 Mar 2011 02:08:44 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
1 package treecms.gui;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
2
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
3 import java.awt.BorderLayout;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
4 import java.awt.Container;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
5 import java.awt.event.ActionEvent;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
6 import java.awt.event.ActionListener;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
7 import java.awt.event.WindowAdapter;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
8 import java.awt.event.WindowEvent;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
9 import java.nio.ByteBuffer;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
10 import java.util.Map;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
11 import javax.swing.JButton;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
12 import javax.swing.JDialog;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
13 import javax.swing.JFrame;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
14 import javax.swing.JLabel;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
15 import javax.swing.JScrollPane;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
16
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
17 class AddChildDialog
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
18 {
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
19 private JDialog m_dialog;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
20 private AttributeEditorTable m_table;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
21 private JButton m_submit;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
22 private Map<ByteBuffer,ByteBuffer> m_data;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
23 private JFrame m_parent;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
24
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
25 public AddChildDialog(JFrame _parent,boolean _modal)
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
26 {
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
27 m_dialog = new JDialog(_parent,_modal);
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
28 m_dialog.setSize(300,200);
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
29 m_dialog.setTitle("Add new child");
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
30 m_parent = _parent;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
31 m_table = new AttributeEditorTable();
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
32 m_submit = new JButton("submit");
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
33 m_submit.addActionListener(new ActionListener(){
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
34 @Override
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
35 public void actionPerformed(ActionEvent _e)
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
36 {
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
37 m_data = m_table.getAttributeMap();
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
38 m_dialog.setVisible(false);
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
39 }
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
40 });
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
41 m_dialog.addWindowListener(new WindowAdapter(){
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
42 @Override
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
43 public void windowClosing(WindowEvent _e)
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
44 {
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
45 m_data = null;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
46 }
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
47 });
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
48
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
49 Container cnt = m_dialog.getContentPane();
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
50 cnt.setLayout(new BorderLayout());
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
51 cnt.add(new JLabel("Attributes"),BorderLayout.NORTH);
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
52 cnt.add(new JScrollPane(m_table),BorderLayout.CENTER);
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
53 cnt.add(m_submit,BorderLayout.SOUTH);
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
54 }
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
55
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
56 public Map<ByteBuffer,ByteBuffer> setVisible(boolean _show)
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
57 {
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
58 m_dialog.setLocationRelativeTo(m_parent);
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
59 m_dialog.setVisible(_show);
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
60
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
61 return m_data;
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
62 }
f96193babac0 changed byte[] to ByteBuffer
shoshi
parents:
diff changeset
63 }