/Users/detro/workspace-nb/JAEBI-SwingClient/src/clientswing/UI/DeletePanel.java

Vai alla documentazione di questo file.
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     //imposto il valore dell'etichetta della tabella
00045     tableName.setText("Inserisci la Tabella");
00046     //imposto il posizionamento e la dimensione dell'etichetta della tabella
00047     tableName.setBounds(new Rectangle(10, 60, 130, 20));
00048     //imposto il colore dell'etichetta della tabella
00049     tableName.setForeground(Color.black);
00050 
00051     //imposto il posizionamento e la dimensione del textField della tabella
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     //catturo l'evento
00067     okWhere.addMouseListener(new DeletePanel_okWhere_mouseAdapter(this));
00068 
00069     service="delete";
00070     //aggiungo i componenti SWING al frame di Login
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     //chiamata al metodo init (ereditato da RequestPanel)per impostare le proprità al frame
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     //vengono impostati dimensione e posizionamento del pannello
00101     pannello.setBounds(new Rectangle(30, 20, 280, 150));
00102     //viene utilizzato il posizionamento assoluto quindi non viene
00103     //impostato alcun LayoutManager
00104     pannello.setLayout(null);
00105     //viene impostato il colore di sfondo
00106     pannello.setBackground(Color.lightGray);
00107   }
00108 
00118   public XRequestQuery getXRequest(String service) {
00119 
00120     //istanza di XRequestQuery in cui si andranno a conservare i dati inseriti dall'utente
00121     XRequestQuery request = new XRequestQuery();
00122     //conservo il tipo di servizio (delete) in request
00123     request.setService(service);
00124     //conservo il nome della tabella da eliminare
00125     request.setTableName(tableList.getText());
00126     //conservo la stringa rappresentante la clausola where opzionale
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     //ritorna la richiesta
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 }

Generato il Wed Jun 22 16:42:58 2005 per JAEBI - Swing Client da  doxygen 1.4.3