1 16 package net.sf.jftp.gui.tasks; 17 18 import net.sf.jftp.*; 19 20 import net.sf.jftp.config.*; 22 import net.sf.jftp.gui.framework.*; 23 import net.sf.jftp.net.*; 24 25 import java.awt.*; 26 import java.awt.event.*; 27 28 import javax.swing.*; 29 30 31 public class AdvancedOptions extends HPanel implements ActionListener 33 { 34 public static boolean listOptionSet = false; 36 private HTextField listCommand = new HTextField("FTP LIST command:", 37 FtpConnection.LIST, 15); 38 private JButton setListCommand = new JButton("Set"); 39 40 private JButton saveCommand = new JButton("Set and Save"); 42 43 private JLabel text = new JLabel(); 52 54 private JLabel statusText = new JLabel(); 56 private String listOptionText = new String (); 58 public AdvancedOptions() 60 { 61 setLayout(new BorderLayout(5, 5)); 62 63 text.setText("Default values for commands can be overidden here."); 66 statusText.setText("Note: The FTP LIST command should be \"LIST\" when connecting to an OS/2 server."); 67 68 text.setPreferredSize(new Dimension(400, 30)); 69 70 statusText.setPreferredSize(new Dimension(400, 30)); 73 74 if(listOptionSet) 79 { 80 listOptionText = FtpConnection.LIST; 81 } 82 else 83 { 84 if(LoadSet.loadSet(Settings.adv_settings) != null) 87 { 88 listOptionText = LoadSet.loadSet(Settings.adv_settings)[0]; 89 } 90 else 91 { 92 listOptionText = FtpConnection.LIST_DEFAULT; 93 94 SaveSet s = new SaveSet(Settings.adv_settings, 95 FtpConnection.LIST_DEFAULT); 96 } 97 } 98 99 listCommand.setText(listOptionText); 100 101 HPanel content = new HPanel(); 102 HPanel panel = new HPanel(); 103 panel.add(listCommand); 104 panel.add(setListCommand); 105 106 panel.add(saveCommand); 108 109 content.add(panel); 111 112 add("North", text); 113 add("Center", content); 114 115 add("South", statusText); 116 117 setListCommand.addActionListener(this); 118 saveCommand.addActionListener(this); 119 } 120 121 public void actionPerformed(ActionEvent e) 122 { 123 if(e.getSource() == setListCommand) 124 { 125 FtpConnection.LIST = listCommand.getText().trim(); 126 127 statusText.setText("LIST command set."); 130 listOptionSet = true; 131 132 } 134 135 else 137 { 138 FtpConnection.LIST = listCommand.getText().trim(); 142 143 listOptionSet = true; 144 145 SaveSet s = new SaveSet(Settings.adv_settings, 148 listCommand.getText().trim()); 149 150 statusText.setText("LIST command set and saved."); 153 154 } 156 } 157 158 public Insets getInsets() 159 { 160 return new Insets(super.getInsets().top+5,super.getInsets().left+5,super.getInsets().bottom+5,super.getInsets().right+5); 161 } 162 } 163 | Popular Tags |