made changes according to 2nd batch of comments

This commit is contained in:
Josh
2015-04-04 21:37:36 +08:00
parent 5383eb9f56
commit 10be0b0b10
12 changed files with 33 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
/**
* Concrete implementation of filter
*
* This filter is responsible for checking/filtering the input in the address field, returns null if field is empty
* @author joshzambales
*
*/

View File

@@ -12,11 +12,11 @@ import java.awt.event.*;
*
*/
public class Client extends JFrame{
FilterManager filterManager;
JLabel jl;
JTextField[] jtFields;
JTextArea[] jtAreas;
JButton clearButton, processButton;
private FilterManager filterManager;
private JLabel jl;
private JTextField[] jtFields;
private JTextArea[] jtAreas;
private JButton clearButton, processButton;
public Client(){
super("Client System");
setDefaultCloseOperation(EXIT_ON_CLOSE);
@@ -69,7 +69,9 @@ public class Client extends JFrame{
processButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
jl.setText(sendRequest(jtFields[0].getText()+"&"+jtFields[1].getText()+"&"+jtAreas[0].getText()+"&"+jtFields[2].getText()+"&"+jtAreas[1].getText()));
String request = String.format("%s&%s&%s&%s&%s",jtFields[0].getText(),jtFields[1].getText(),jtAreas[0].getText(),jtFields[2].getText(),jtAreas[1].getText());
jl.setText(sendRequest(request));
}
});

View File

@@ -1,6 +1,6 @@
/**
* Concrete implementation of filter
*
* This filter checks for the contact field in which it checks if the input consist of numbers and it also checks if the input follows the length constraint (11 digits)
* @author joshzambales
*
*/

View File

@@ -1,6 +1,7 @@
/**
* Concrete implementation of filter
*
*
* This checks for the deposit code, returns null when deposit field is empty
* @author joshzambales
*
*/

View File

@@ -1,5 +1,7 @@
/**
* Filter interface
* Filter interface
* Filters perform certain tasks prior or after execution of request by request handler.
* In this case, before the request is handled by the target, the request undergoes through each Filter
* @author joshzambales
*
*/

View File

@@ -6,7 +6,7 @@
*/
public class FilterChain{
private ArrayList<Filter> filters = new ArrayList<Filter>();
private Target target;
private final Target target;
public FilterChain(Target target){
this.target = target;

View File

@@ -9,7 +9,7 @@ import java.awt.event.*;
*
*/
public class FilterManager{
FilterChain filterChain;
private FilterChain filterChain;
public FilterManager(Target target){
filterChain = new FilterChain(target);

View File

@@ -1,3 +1,10 @@
/**
* Concrete implementation of filter
* This filter checks if the input in the Name field is valid. (alphanumeric)
* @author joshzambales
*
*/
public class NameFilter implements Filter{
public String execute(String[] request){
if(request[0].equals("") || request[0].matches(".*[^\\w|\\s]+.*")){

View File

@@ -1,5 +1,6 @@
/**
* Concrete implementation of filter
* This checks for the order field, returns null when order field is empty
*
* @author joshzambales
*

View File

@@ -10,10 +10,10 @@ import java.awt.event.*;
*
*/
public class Target extends JFrame{
JTable jt;
JScrollPane jsp;
DefaultTableModel dtm;
JButton del;
private JTable jt;
private JScrollPane jsp;
private DefaultTableModel dtm;
private JButton del;
public Target(){
super("Order System");
setDefaultCloseOperation(EXIT_ON_CLOSE);