Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo RC committed Jan 18, 2016
1 parent f235822 commit 265dc93
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
9 changes: 7 additions & 2 deletions src/main/java/org/erc/pftps/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.awt.Dimension;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JScrollPane;


public class MainWindow extends JFrame{
Expand All @@ -48,6 +49,7 @@ public class MainWindow extends JFrame{
private MessageConsole messageConsole;

private FTPServer ftpServer;
private JScrollPane scrollPane;

/**
* Create the application.
Expand Down Expand Up @@ -119,17 +121,20 @@ public void actionPerformed(ActionEvent e) {
txtPort.setColumns(5);
txtPort.setBounds(66, 43, 46, 20);
getContentPane().add(txtPort);

scrollPane = new JScrollPane();
scrollPane.setBounds(10, 71, 503, 227);
getContentPane().add(scrollPane);

txtLog = new JTextArea();
scrollPane.setViewportView(txtLog);
txtLog.setText("Ready.");
txtLog.setForeground(Color.LIGHT_GRAY);
txtLog.setBackground(Color.BLACK);
txtLog.setFont(new Font("Monospaced", Font.PLAIN, 10));
txtLog.setColumns(20);
txtLog.setRows(20);
txtLog.setEditable(false);
txtLog.setBounds(10, 71, 503, 227);
getContentPane().add(txtLog);

messageConsole = new MessageConsole(txtLog);
setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{getContentPane(), lblFolder, btStartStop, lblPort, txtPort, lblUser, txtUser, lblPassword, txtPassword, btnStart}));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/erc/pftps/MessageConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public void flush() {
}

private void handleAppend(String message){
if (document.getLength() == 0)
if (document.getLength() == 0){
buffer.setLength(0);

}
if (EOL.equals(message)){
buffer.append(message);
} else {
Expand Down
14 changes: 11 additions & 3 deletions src/main/java/org/erc/pftps/Start.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@ public void run() {
}
});
}else{
FTPServer server = new FTPServer();
server.setUser(args[0], args[1], args[2]);
server.start();
if (args.length == 4){
FTPServer server = new FTPServer();
server.setPort(Integer.parseInt(args[0]));
server.setUser(args[1], args[2], args[3]);
server.start();
} else{
System.out.println("Invalid arguments");
System.out.println("");
System.out.println("Use without arguments for GUI or call with:");
System.out.println("<port> <user> <password> <folder>");
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/erc/pftps/services/FTPServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public FTPServer(){
userManager = new InMemoryUserManager();
}

public void setPort(int port){
this.port = port;
}

public void setUser(String login,String password,String home){
BaseUser user = new BaseUser();
user.setName(login);
Expand Down

0 comments on commit 265dc93

Please sign in to comment.