KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quickserver > net > qsadmin > gui > SimpleActionListener


1 /*
2  * This file is part of the QuickServer library
3  * Copyright (C) 2003-2005 QuickServer.org
4  *
5  * Use, modification, copying and distribution of this software is subject to
6  * the terms and conditions of the GNU Lesser General Public License.
7  * You should have received a copy of the GNU LGP License along with this
8  * library; if not, you can download a copy from <http://www.quickserver.org/>.
9  *
10  * For questions, suggestions, bug-reports, enhancement-requests etc.
11  * visit http://www.quickserver.org
12  *
13  */

14
15 package org.quickserver.net.qsadmin.gui;
16
17 import java.awt.event.ActionListener JavaDoc;
18 import java.awt.event.ActionEvent JavaDoc;
19
20 public class SimpleActionListener implements ActionListener JavaDoc {
21     private SimpleCommand sm;
22     private MainCommandPanel mcp;
23     private QSAdminMain qsadminMain;
24
25     public SimpleActionListener(QSAdminMain qsadminMain, SimpleCommand sm,
26             MainCommandPanel mcp) {
27         this.qsadminMain = qsadminMain;
28         this.sm = sm;
29         this.mcp = mcp;
30     }
31     public void actionPerformed(ActionEvent JavaDoc e) {
32         Thread JavaDoc performer = new Thread JavaDoc(new Runnable JavaDoc() {
33             public void run() {
34                 sm.setTarget(mcp.getTarget());
35                 boolean multiLine = sm.getMultiLineResponse().equals("yes");
36                 if(qsadminMain.getServerVersionNo()>=sm.getVersionNo()) {
37                     qsadminMain.sendCommunication(sm.getSimpleCommand(),
38                         multiLine, true);
39                 } else {
40                     qsadminMain.getGUI().setResponse("-ERR "+"Host does not support this command");
41                 }
42             }
43         }, "QsAdminGUI-SimpleThread");
44         performer.start();
45     }
46 }
47
Popular Tags