Mercurial > hg > Members > shoshi > TreeCMSv2
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/treecms/gui/AddChildDialog.java Thu Mar 31 02:08:44 2011 +0900 @@ -0,0 +1,63 @@ +package treecms.gui; + +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.nio.ByteBuffer; +import java.util.Map; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JScrollPane; + +class AddChildDialog +{ + private JDialog m_dialog; + private AttributeEditorTable m_table; + private JButton m_submit; + private Map<ByteBuffer,ByteBuffer> m_data; + private JFrame m_parent; + + public AddChildDialog(JFrame _parent,boolean _modal) + { + m_dialog = new JDialog(_parent,_modal); + m_dialog.setSize(300,200); + m_dialog.setTitle("Add new child"); + m_parent = _parent; + m_table = new AttributeEditorTable(); + m_submit = new JButton("submit"); + m_submit.addActionListener(new ActionListener(){ + @Override + public void actionPerformed(ActionEvent _e) + { + m_data = m_table.getAttributeMap(); + m_dialog.setVisible(false); + } + }); + m_dialog.addWindowListener(new WindowAdapter(){ + @Override + public void windowClosing(WindowEvent _e) + { + m_data = null; + } + }); + + Container cnt = m_dialog.getContentPane(); + cnt.setLayout(new BorderLayout()); + cnt.add(new JLabel("Attributes"),BorderLayout.NORTH); + cnt.add(new JScrollPane(m_table),BorderLayout.CENTER); + cnt.add(m_submit,BorderLayout.SOUTH); + } + + public Map<ByteBuffer,ByteBuffer> setVisible(boolean _show) + { + m_dialog.setLocationRelativeTo(m_parent); + m_dialog.setVisible(_show); + + return m_data; + } +}