Mercurial > hg > RemoteEditor > REPSessionManager
comparison rep/RPanel.java @ 222:18d6a7140fa3
*** empty log message ***
author | pin |
---|---|
date | Sun, 31 Aug 2008 12:31:00 +0900 |
parents | 827c439d0da4 |
children | cbd67817e9cd |
comparison
equal
deleted
inserted
replaced
221:6cd4aab9fea3 | 222:18d6a7140fa3 |
---|---|
8 import javax.swing.JPanel; | 8 import javax.swing.JPanel; |
9 import javax.swing.JScrollPane; | 9 import javax.swing.JScrollPane; |
10 import javax.swing.JTable; | 10 import javax.swing.JTable; |
11 import javax.swing.JTextArea; | 11 import javax.swing.JTextArea; |
12 import javax.swing.JTextField; | 12 import javax.swing.JTextField; |
13 import javax.swing.SwingUtilities; | |
14 import javax.swing.table.DefaultTableModel; | 13 import javax.swing.table.DefaultTableModel; |
15 | 14 |
16 import rep.channel.REPSocketChannel; | 15 import rep.channel.REPSocketChannel; |
17 | 16 |
18 import java.util.*; | 17 import java.util.*; |
44 private String s_file; | 43 private String s_file; |
45 private String s_sid; | 44 private String s_sid; |
46 private String s_eid; | 45 private String s_eid; |
47 private String e_eid; | 46 private String e_eid; |
48 private String e_socketchannel; | 47 private String e_socketchannel; |
49 private SessionManager listener; | |
50 //private JComboBox comboEditor; | |
51 //private JComboBox comboSession; | |
52 private JButton buttonSelect; | 48 private JButton buttonSelect; |
53 private REPActionListener<REPCommand> actionListener; | 49 //private SessionManager manager; |
54 private List<Session> sessionList; | 50 private SessionManagerEventListener listener; |
55 private List<Editor> editorList; | |
56 private SessionManager manager; | |
57 | 51 |
58 public RPanel() { | 52 public RPanel() { |
59 button = new JButton("Connect"); | 53 button = new JButton("Connect"); |
60 textField = new JTextField("firefly.cr.ie.u-ryukyu.ac.jp"); | 54 textField = new JTextField("firefly.cr.ie.u-ryukyu.ac.jp"); |
61 textArea = new JTextArea(); | 55 textArea = new JTextArea(); |
89 | 83 |
90 button.addActionListener(this); | 84 button.addActionListener(this); |
91 buttonSelect.addActionListener(this); | 85 buttonSelect.addActionListener(this); |
92 | 86 |
93 } | 87 } |
94 | |
95 public RPanel(SessionManager manager) { | |
96 this(); | |
97 this.manager = manager; | |
98 sessionList = manager.getSessionList(); | |
99 editorList = manager.getEditorList(); | |
100 } | |
101 | 88 |
102 public void actionPerformed(ActionEvent event) { | 89 public void actionPerformed(ActionEvent event) { |
103 if (event.getSource() == button) { | 90 if (event.getSource() == button) { |
104 host = textField.getText(); | 91 host = textField.getText(); |
105 listener.connectionOccured(new ConnectionEvent(listener, host)); | 92 listener.buttonPressed(new ConnectButtonEvent(listener, host)); |
106 }else if(event.getSource() == buttonSelect){ | 93 }else if(event.getSource() == buttonSelect){ |
107 /* | 94 listener.buttonPressed(new SelectButtonEvent<REPCommand>((EditorPlus<REPCommand>) e_list.get(editor_table.getSelectedRow()), |
108 actionListener.ActionOccured(new REPActionEvent((EditorPlus) comboEditor.getSelectedItem(), | 95 (SessionPlus)s_list.get(session_table.getSelectedRow()), listener)); |
109 (SessionPlus)comboSession.getSelectedItem())); | |
110 */ | |
111 //actionListener.selectOccured(new REPActionEvent<REPCommand>((EditorPlus<REPCommand>) e_list.get(editor_table.getSelectedRow()), | |
112 // (SessionPlus)s_list.get(session_table.getSelectedRow()), listener)); | |
113 manager.selectOccured(new REPActionEvent<REPCommand>((EditorPlus<REPCommand>) e_list.get(editor_table.getSelectedRow()), | |
114 (SessionPlus)s_list.get(session_table.getSelectedRow()), manager)); | |
115 } | 96 } |
116 } | |
117 | |
118 public void addConnectionListener(ConnectionListener listener) { | |
119 System.out.println(listener.toString()); | |
120 this.listener = (SessionManager) listener; | |
121 } | |
122 | |
123 | |
124 public void setComboEditor(int eid, REPSocketChannel<REPCommand> channel) { | |
125 //comboEditor.addItem("Editor:"+eid); | |
126 //comboEditor.addItem(new EditorPlus<REPCommand>(eid, channel)); | |
127 } | |
128 | |
129 public void addREPActionListener(REPActionListener<REPCommand> listener2) { | |
130 this.actionListener = listener2; | |
131 } | |
132 | |
133 public void setComboSession(int sessionID, String string) { | |
134 //comboSession.addItem(new SessionPlus(sessionID, string)); | |
135 } | 97 } |
136 | 98 |
137 public void setTableEditor(int eid, REPSocketChannel<REPCommand> channel) { | 99 public void setTableEditor(int eid, REPSocketChannel<REPCommand> channel) { |
138 System.out.println("RPanel.setTableEditor()"); | 100 System.out.println("RPanel.setTableEditor()"); |
139 EditorPlus<REPCommand> ep = new EditorPlus<REPCommand>(eid, channel); | 101 EditorPlus<REPCommand> ep = new EditorPlus<REPCommand>(eid, channel); |
179 for(Editor editor : list){ | 141 for(Editor editor : list){ |
180 setTableEditor(editor.getEID(), editor.getChannel()); | 142 setTableEditor(editor.getEID(), editor.getChannel()); |
181 } | 143 } |
182 } | 144 } |
183 | 145 |
146 public void addREPActionListener(SessionManagerEventListener listener) { | |
147 this.listener = listener; | |
148 } | |
149 | |
184 } | 150 } |