00001 package clientswing.UI;
00002
00003 import javax.swing.*;
00004 import java.awt.*;
00005 import clientswing.model.*;
00006 import java.awt.event.MouseEvent;
00007
00008
00009
00014 public class DeletePanel
00015 extends JPanel
00016 implements RequestPanel {
00017
00019 JLabel tableName = new JLabel();
00021 JTextField tableList = new JTextField();
00023 JLabel whereClause = new JLabel();
00026 String service;
00027
00029 JTextField columnNumSetWhere = new JTextField();
00030
00031
00033 JButton okWhere = new JButton();
00034
00036 OptionPanelInsertUpdate optionPanel;
00038 OptionPanelInsertUpdate optionPanelWhere;
00039
00040
00042 public DeletePanel() {
00043
00044
00045 tableName.setText("Inserisci la Tabella");
00046
00047 tableName.setBounds(new Rectangle(10, 60, 130, 20));
00048
00049 tableName.setForeground(Color.black);
00050
00051
00052 tableList.setBounds(new Rectangle(200, 60, 75, 20));
00053
00054 whereClause.setText("Where");
00055 whereClause.setBounds(new Rectangle(10, 90, 55, 20));
00056 whereClause.setForeground(Color.black);
00057
00058 whereClause.setText("Inserisci i campi della where:");
00059 whereClause.setBounds(new Rectangle(10, 90, 180, 20));
00060 whereClause.setForeground(Color.black);
00061 columnNumSetWhere.setBounds(new Rectangle(200, 90, 20, 20));
00062 okWhere.setBounds(new Rectangle(230, 90, 45, 20));
00063 okWhere.setText("ok");
00064 okWhere.setFont(new java.awt.Font("Dialog", 0, 11));
00065
00066
00067 okWhere.addMouseListener(new DeletePanel_okWhere_mouseAdapter(this));
00068
00069 service="delete";
00070
00071 this.add(tableName, null);
00072 this.add(tableList, null);
00073 this.add(whereClause, null);
00074
00075 this.add(whereClause, null);
00076 this.add(columnNumSetWhere, null);
00077 this.add(okWhere, null);
00078
00079
00080
00081 init(this);
00082 }
00083
00089 public String getTableList(JTextField tableList) {
00090 return tableList.getText();
00091 }
00092
00098 public void init(JPanel pannello)
00099 {
00100
00101 pannello.setBounds(new Rectangle(30, 20, 280, 150));
00102
00103
00104 pannello.setLayout(null);
00105
00106 pannello.setBackground(Color.lightGray);
00107 }
00108
00118 public XRequestQuery getXRequest(String service) {
00119
00120
00121 XRequestQuery request = new XRequestQuery();
00122
00123 request.setService(service);
00124
00125 request.setTableName(tableList.getText());
00126
00127 Column[] columnsWhere = optionPanelWhere.getColumns();
00128 for (int i = 0; i < columnsWhere.length; i++)
00129 {
00130 request.addColumnWhere(columnsWhere[i]);
00131 System.out.println("\n" + columnsWhere[i] + "\n");
00132 }
00133
00134
00135
00136
00137 return request;
00138 }
00139
00145 public String getService() {
00146 return service;
00147 }
00151 void okWhere_mouseClicked(MouseEvent e) {
00152
00153 optionPanelWhere = new OptionPanelInsertUpdate(columnNumSetWhere);
00154 if (optionPanelWhere.getIsError() == false)
00155 optionPanelWhere.show();
00156 }
00157
00158 }
00160 class DeletePanel_okWhere_mouseAdapter
00161 extends java.awt.event.MouseAdapter {
00162 DeletePanel adaptee;
00163
00164 DeletePanel_okWhere_mouseAdapter(DeletePanel adaptee) {
00165 this.adaptee = adaptee;
00166 }
00167
00168 public void mouseClicked(MouseEvent e) {
00169 adaptee.okWhere_mouseClicked(e);
00170 }
00171 }