1 14 15 package org.quickserver.net.qsadmin.gui; 16 17 import java.awt.event.ActionListener ; 18 import java.awt.event.ActionEvent ; 19 20 public class SaveActionListener implements ActionListener { 21 private Propertie propertie; 22 private QSAdminMain qsadminMain; 23 24 public SaveActionListener(QSAdminMain qsadminMain, Propertie propertie) { 25 this.qsadminMain = qsadminMain; 26 this.propertie = propertie; 27 } 28 29 public void actionPerformed(ActionEvent e) { 30 Thread performer = new Thread (new Runnable () { 31 public void run() { 32 String temp = null; 33 if(propertie.getType().equals("edit")) { 34 temp = propertie.getEditField().getText(); 35 } else if(propertie.getType().equals("select")) { 36 temp = (String )propertie.getComboBox().getSelectedItem(); 37 } 38 39 40 if(qsadminMain.getServerVersionNo() < propertie.getVersionNo()) { 41 qsadminMain.getGUI().setResponse("-ERR "+"Host does not support this command"); 42 return; 43 } 44 45 try { 46 temp = qsadminMain.sendCommunicationSilent( 47 propertie.getSetCommand(temp), false, true); 48 propertie.getSaveButton().setEnabled(false); 49 } catch(Exception ex) { 50 temp = "-ERR Could not set parameter : "+ex.getMessage(); 51 } 52 if(temp==null) return; 53 54 if(temp.indexOf(" ")==-1) { 55 qsadminMain.getGUI().setResponse("-ERR "+temp); 56 return; 57 } 58 qsadminMain.getGUI().setResponse(temp); 59 } 60 }, "QsAdminGUI-SaveThread"); 61 performer.start(); 62 } 63 } 64 | Popular Tags |