made changes according to 2nd batch of comments
This commit is contained in:
@@ -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
|
||||
*
|
||||
*/
|
||||
|
@@ -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));
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -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
|
||||
*
|
||||
*/
|
||||
|
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* Concrete implementation of filter
|
||||
*
|
||||
*
|
||||
* This checks for the deposit code, returns null when deposit field is empty
|
||||
* @author joshzambales
|
||||
*
|
||||
*/
|
||||
|
@@ -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
|
||||
*
|
||||
*/
|
||||
|
@@ -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;
|
||||
|
@@ -9,7 +9,7 @@ import java.awt.event.*;
|
||||
*
|
||||
*/
|
||||
public class FilterManager{
|
||||
FilterChain filterChain;
|
||||
private FilterChain filterChain;
|
||||
|
||||
public FilterManager(Target target){
|
||||
filterChain = new FilterChain(target);
|
||||
|
@@ -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]+.*")){
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Concrete implementation of filter
|
||||
* This checks for the order field, returns null when order field is empty
|
||||
*
|
||||
* @author joshzambales
|
||||
*
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user