Completata l'interfaccia utente e buon avanzamento per l'admin. Mancano da definire le politiche nei menu settando i giusti metodi global e modificando i valori fissi nei prezziscontati delle singole classi. Mancano le implementazioni dell'aggiungi prodotto,rimozione.
This commit is contained in:
@@ -13,6 +13,7 @@ import java.awt.event.ActionListener;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
/**
|
||||
@@ -95,7 +96,7 @@ public class UserInterface extends JFrame{
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try{
|
||||
offers.setText("");
|
||||
load_catalogo.offerteAttive(login_data.getUsername(),offers);
|
||||
load_catalogo.offerteAttive(login_data.getUsername(),offers,"0");
|
||||
|
||||
}
|
||||
catch (FileNotFoundException err){}
|
||||
@@ -107,12 +108,176 @@ public class UserInterface extends JFrame{
|
||||
private UserInterface location;
|
||||
private JTextArea offers;
|
||||
}
|
||||
//action listner for tutti_gli_articoli_attivi added at offers declaration
|
||||
//action listner added at offers declaration
|
||||
|
||||
JMenuItem articoli_con_scadenza_menu_item = new JMenuItem("Articoli con Scadenza");
|
||||
class tutti_gli_articoli_con_scadenza_action implements ActionListener {
|
||||
|
||||
|
||||
public tutti_gli_articoli_con_scadenza_action (UserInterface in_location, JTextArea in_offers){
|
||||
location= in_location;
|
||||
offers = in_offers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try{
|
||||
offers.setText("");
|
||||
|
||||
|
||||
JPanel showInput = new JPanel();
|
||||
JLabel field1l = new JLabel("Data Start");
|
||||
JTextField field1 = new JTextField(10);
|
||||
field1.setText("GG/MM/AAAA");
|
||||
JLabel field2l = new JLabel("Data Fine");
|
||||
JTextField field2 = new JTextField(10);
|
||||
field2.setText("GG/MM/AAAA");
|
||||
showInput.add(field1l);
|
||||
showInput.add(field1);
|
||||
showInput.add(field2l);
|
||||
showInput.add(field2);
|
||||
JOptionPane.showMessageDialog(location, showInput);
|
||||
|
||||
String marcatore="/";
|
||||
String data = field1.getText();
|
||||
String temp[];
|
||||
temp = data.split(marcatore);
|
||||
GregorianCalendar dataPartenza = new GregorianCalendar((Integer.parseInt(temp[2])),(Integer.parseInt(temp[1]))-1,(Integer.parseInt(temp[0])));
|
||||
|
||||
String data2 = field2.getText();
|
||||
String temp2[];
|
||||
temp2 = data2.split(marcatore);
|
||||
GregorianCalendar dataScad = new GregorianCalendar((Integer.parseInt(temp2[2])),(Integer.parseInt(temp2[1]))-1,(Integer.parseInt(temp2[0])));
|
||||
|
||||
|
||||
|
||||
load_catalogo.offerteAttiveConScadenza(login_data.getUsername(), offers, "0",dataPartenza,dataScad);
|
||||
|
||||
}
|
||||
catch (FileNotFoundException err){}
|
||||
catch (IOException err){}
|
||||
catch (ClassNotFoundException err){}
|
||||
|
||||
}
|
||||
|
||||
private UserInterface location;
|
||||
private JTextArea offers;
|
||||
}
|
||||
//action listner added at offers declaration
|
||||
|
||||
JMenuItem articoli_senza_scadenza_menu_item = new JMenuItem("Articoli senza Scadenza");
|
||||
class tutti_gli_articoli_senza_scadenza_action implements ActionListener {
|
||||
|
||||
|
||||
public tutti_gli_articoli_senza_scadenza_action (UserInterface in_location, JTextArea in_offers){
|
||||
location= in_location;
|
||||
offers = in_offers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try{
|
||||
offers.setText("");
|
||||
|
||||
|
||||
int valutazione = Integer.parseInt(
|
||||
JOptionPane.showInputDialog(
|
||||
location, "Inserire valutazione fornitore","Valutazione"));
|
||||
|
||||
|
||||
|
||||
load_catalogo.offerteAttiveSenzaScadenza(login_data.getUsername(), offers, "0", valutazione);
|
||||
|
||||
}
|
||||
catch (FileNotFoundException err){}
|
||||
catch (IOException err){}
|
||||
catch (ClassNotFoundException err){}
|
||||
|
||||
}
|
||||
|
||||
private UserInterface location;
|
||||
private JTextArea offers;
|
||||
}
|
||||
//action listner added at offers declaration
|
||||
JMenu visualizzamenu = new JMenu("Visualizza");
|
||||
JMenuItem storico_menu_item = new JMenuItem("Storico Utente");
|
||||
JMenuItem storico_data_menu_item = new JMenuItem("Storico Utente per Data");
|
||||
class storico_data_menu_item_action implements ActionListener {
|
||||
|
||||
|
||||
public storico_data_menu_item_action (UserInterface in_location){
|
||||
location= in_location;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try{
|
||||
|
||||
|
||||
|
||||
JPanel show_storico = new JPanel();
|
||||
JTextArea area_storico = new JTextArea(10,15);
|
||||
|
||||
|
||||
show_storico.add(area_storico);
|
||||
load_catalogo.visualizzaStorico(login_data.getUsername(),"1",area_storico);
|
||||
|
||||
JOptionPane.showMessageDialog(location, show_storico);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (FileNotFoundException err){}
|
||||
catch (IOException err){}
|
||||
catch (ClassNotFoundException err){}
|
||||
|
||||
}
|
||||
|
||||
private UserInterface location;
|
||||
|
||||
}
|
||||
storico_data_menu_item.addActionListener(new storico_data_menu_item_action(this));
|
||||
JMenuItem storico_costo_menu_item = new JMenuItem("Storico Utente per Costo");
|
||||
class storico_costo_menu_item_action implements ActionListener {
|
||||
|
||||
|
||||
public storico_costo_menu_item_action (UserInterface in_location){
|
||||
location= in_location;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try{
|
||||
|
||||
|
||||
|
||||
JPanel show_storico = new JPanel();
|
||||
JTextArea area_storico = new JTextArea(10,15);
|
||||
|
||||
|
||||
show_storico.add(area_storico);
|
||||
load_catalogo.visualizzaStorico(login_data.getUsername(),"2",area_storico);
|
||||
|
||||
JOptionPane.showMessageDialog(location, show_storico);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (FileNotFoundException err){}
|
||||
catch (IOException err){}
|
||||
catch (ClassNotFoundException err){}
|
||||
|
||||
}
|
||||
|
||||
private UserInterface location;
|
||||
|
||||
}
|
||||
storico_costo_menu_item.addActionListener(new storico_costo_menu_item_action(this));
|
||||
|
||||
mainmenu.add(filemenu);
|
||||
mainmenu.add(searchmenu);
|
||||
@@ -126,7 +291,8 @@ public class UserInterface extends JFrame{
|
||||
searchmenu.add(articoli_senza_scadenza_menu_item);
|
||||
|
||||
|
||||
visualizzamenu.add(storico_menu_item);
|
||||
visualizzamenu.add(storico_data_menu_item);
|
||||
visualizzamenu.add(storico_costo_menu_item);
|
||||
|
||||
|
||||
|
||||
@@ -203,6 +369,8 @@ public class UserInterface extends JFrame{
|
||||
offers.setText("Utilizza il menu Cerca per popolare questa lista");
|
||||
mainWindow.add(offers,BorderLayout.CENTER);
|
||||
tutti_gli_articoli_attivi.addActionListener(new tutti_gli_articoli_attivi_action(this,offers));
|
||||
articoli_con_scadenza_menu_item.addActionListener(new tutti_gli_articoli_con_scadenza_action(this,offers));
|
||||
articoli_senza_scadenza_menu_item.addActionListener(new tutti_gli_articoli_senza_scadenza_action(this,offers));
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user