diff --git a/out/production/sae2.01-developpement-application/data/2223_S2/version.txt b/out/production/sae2.01-developpement-application/data/2223_S2/version.txt index d4517629743afc47a2004d0fbb34a0a5f299ef23..d82a4c13f0b161d574599a905a6bb992cf9b08d0 100644 --- a/out/production/sae2.01-developpement-application/data/2223_S2/version.txt +++ b/out/production/sae2.01-developpement-application/data/2223_S2/version.txt @@ -1,2 +1,2 @@ -24 -230530 +26 +230531 diff --git "a/r\303\251partition des taches.docx" "b/r\303\251partition des taches.docx" new file mode 100644 index 0000000000000000000000000000000000000000..cb559a7f0caaf371ed7119878be67974b7621d1a Binary files /dev/null and "b/r\303\251partition des taches.docx" differ diff --git a/shukan/ShukanController.java b/shukan/ShukanController.java index e8bf2210bfbaf2390daff100fc6fbb5574d8c967..206ad70af805def6cca4e654a5588377532d07f3 100644 --- a/shukan/ShukanController.java +++ b/shukan/ShukanController.java @@ -205,11 +205,11 @@ public class ShukanController System.out.println("back"); else if (e.getSource()==bar.buttons[2]) { - canvas.getNewActivity(); + canvas.newActivity(); canvas.repaint(); } - else if (e.getSource()==bar.buttons[3]) - System.out.println("delete"); + else if (e.getSource()==bar.buttons[3]) canvas.deleteActivity(); + else if (e.getSource()==bar.buttons[4]) {if (data.followLeft ()) canvas.repaint ();} else if (e.getSource()==bar.buttons[5]) {if (data.followRight ()) canvas.repaint ();} diff --git a/shukan/ShukanData.java b/shukan/ShukanData.java index 5f7fef5ce64ff31d6f5f5358b43933d04b648c33..f67b27bc45a140d6780305298a7ef0e46639d03d 100644 --- a/shukan/ShukanData.java +++ b/shukan/ShukanData.java @@ -113,6 +113,9 @@ public class ShukanData mod[cursNum][modNum].closeActivities (size); } + /** Delete the activity of a module */ + public void deleteActivity (int cursNum, int modNum, int index) {mod[cursNum][modNum].deleteActivity (index);}; + /** Automatically plans a free module */ public void autoPlan (int cursNum, int modNum) { @@ -131,6 +134,11 @@ public class ShukanData { mod[cursNum][modNum].unschedule (); } + /** Unschedules an activity of a module */ + public void unscheduleActivity (int cursNum, int modNum, int index, int week, int nb_week) + { + mod[cursNum][modNum].unschedule (index, week, nb_week); + } /** Schedules an activity of a module */ public void scheduleActivity (int cursNum, int modNum, int activity, int week) diff --git a/shukan/ShukanModule.java b/shukan/ShukanModule.java index 34f03430769be5fc60215cd151566c8733bfaecf..973c98c260a4b3a89476806aad4570a5c16ec054 100644 --- a/shukan/ShukanModule.java +++ b/shukan/ShukanModule.java @@ -161,6 +161,37 @@ public class ShukanModule } } + /** deletes an activity */ + public void deleteActivity (int index) + { + + int size = activ.length-1; + int[] tmp = new int[size]; + int[][] tmpaff = new int[size][]; + boolean[] tmponLeft = new boolean[activ.length-1]; + boolean[] tmponRight = new boolean[activ.length-1]; + for (int i = 0; i < index; i++) + { + tmp[i] = activ[i]; + tmpaff[i] = affect[i]; + tmponLeft[i] = onLeft[i]; + tmponRight[i] = onRight[i]; + } + for (int i = index+1; i < size; i++) + { + tmp[i-1] = activ[i]; + tmpaff[i-1] = affect[i]; + tmponLeft[i-1] = onLeft[i]; + tmponRight[i-1] = onRight[i]; + } + + activ = tmp; + affect = tmpaff; + onLeft = tmponLeft; + onRight = tmponRight; + + + } /** Automatically plans a free module */ public void autoPlan () @@ -211,6 +242,12 @@ public class ShukanModule scheduled = false; } + /** Unschedules an activity of the module */ + public void unschedule (int index, int week, int nb_week) + { + sched.delete(index, week, nb_week); + } + /** Schedules an activity */ public void schedule (int num, int week) { diff --git a/shukan/ShukanParameters.java b/shukan/ShukanParameters.java index ea3f223dc4e53e732c5aeeb98e730983dba588fe..c89774960db7140a9da31006bdc18f2864f4c5a2 100644 --- a/shukan/ShukanParameters.java +++ b/shukan/ShukanParameters.java @@ -171,7 +171,7 @@ class ShukanParameters extends JFrame { Lableft = new JLabel("← : Professeur précédent"); Labright = new JLabel("→ : Professeur suivant"); LabE = new JLabel("E : Exporter en format .tex"); - LabX = new JLabel("CTRL + X : Echanger les extrémités"); + LabX = new JLabel("CTRL + X : Echanger les extrémités d'une séléction"); retour = new JButton("Retour"); diff --git a/shukan/ShukanQueue.java b/shukan/ShukanQueue.java index 7fb44d5eb317e1501cfadb94989ae804994c5920..febdf3f681f64fa981a65d69a972bab788790e01 100644 --- a/shukan/ShukanQueue.java +++ b/shukan/ShukanQueue.java @@ -26,6 +26,34 @@ public class ShukanQueue length = 0; } + /** delete the nth element in the queue */ + public void delete (int index){ + if (index<=queue.length){ + int tmp[] = new int[queue.length-1]; + for (int i =0; i<index; i++){ + tmp[i] = queue[i]; + } + for (int i =index+1; i<queue.length; i++){ + tmp[i-1] = queue[i]; + } + queue = tmp; + length--; + } + else System.out.println("index trop grand"); + } + + /** remove 1 from an element of the queue */ + public void removeOne(int index){ + queue[index]--; + } + + /** remove 1 from an element of the queue */ + public void removeAllOne(){ + if (queue != null){ + for (int i =0; i<queue.length; i++)queue[i]--; + } + + } /** Pushes a token at the right of the queue */ public void pushRight (int token) { diff --git a/shukan/ShukanSchedule.java b/shukan/ShukanSchedule.java index 6c94de62117f5b036e4f07deb1524754cc9465e7..1d858b020d33a1683e74fb19297b7594f4ff408a 100644 --- a/shukan/ShukanSchedule.java +++ b/shukan/ShukanSchedule.java @@ -61,6 +61,15 @@ public class ShukanSchedule for (int i = 0; i < binSet.length; i++) binSet[i].clear (); } + /** delete one element of one queue and update all the queues */ + public void delete(int index, int week, int nb_week){ + binSet[week].delete(index); + for (int i =index; i<binSet[week].length(); i++){ + binSet[week].removeOne(i); + } + for(int i =week+1; i<nb_week; i++) binSet[i].removeAllOne(); + } + /** Add a token to the nth queue */ public void add (int n, int token) { diff --git a/shukan/ShukanView.java b/shukan/ShukanView.java index 9dc7f5029a0c95c7ed3b447bc4b7d37c8123a047..858bb23f2260eb22e08210809f9e3042f2b3f9a0 100644 --- a/shukan/ShukanView.java +++ b/shukan/ShukanView.java @@ -478,11 +478,11 @@ public class ShukanView extends JPanel /** Creates a new activity with window */ - public void getNewActivity(){ + public void newActivity(){ JFrame f = new JFrame("Informations concernant le nouveau cours"); JPanel global_mod = new JPanel(); JPanel global_act = new JPanel(); - JLabel mod = new JLabel("A quel matiere voulez vous rajouter un cours ?"); + JLabel mod = new JLabel("A quelle matiere voulez vous rajouter un cours ?"); JLabel act = new JLabel("Quel cours voulez vous ajouter? "); JComboBox mod_info = new JComboBox(data.moduleNames(data.cursusNumber())); JComboBox act_info = new JComboBox(ShukanModule.TYPES); @@ -498,7 +498,6 @@ public class ShukanView extends JPanel if (mod_start!=0) mod_start-=data.startWeekNumber(); int nb_act = data.scheduleInWeek(num_mod, mod_start).length; - data.addNewActivity(cursus, num_mod, nb_act, ShukanModule.TYPES[num_act]); data.scheduleActivity(cursus, num_mod, nb_act, mod_start); data.setOnMiddle(cursus, num_mod, nb_act, true); @@ -506,7 +505,6 @@ public class ShukanView extends JPanel data.unscheduleActivities(cursus, num_mod); data.setSchedule(cursus, num_mod, weeks); - repaint(); f.dispose(); } @@ -522,4 +520,60 @@ public class ShukanView extends JPanel f.setVisible(true); f.setSize(new Dimension(400, 150)); } + + /** Creates a new activity with window */ + public void deleteActivity(){ + JFrame f = new JFrame("Informations concernant le cours à supprimer"); + String[] s = new String[data.semesterSize()]; + for (int i =0; i<data.semesterSize(); i++) + s[i] = (data.startWeekNumber()+i)+""; + JPanel global_mod = new JPanel(); + JPanel global_act = new JPanel(); + JPanel global_sem = new JPanel(); + JPanel global = new JPanel(new GridLayout(3,0)); + JLabel mod = new JLabel("A quelle matiere voulez vous supprimer un cours ?"); + JLabel act = new JLabel("Quel cours voulez vous supprimer ? "); + JLabel sem = new JLabel("Pendant quelle semaine le cours se déroule t-il ?"); + JComboBox mod_info = new JComboBox(data.moduleNames(data.cursusNumber())); + JComboBox act_info = new JComboBox(ShukanModule.TYPES); + JComboBox sem_info = new JComboBox(s); + JButton valider = new JButton("Valider"); + + valider.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + int num_mod = mod_info.getSelectedIndex(); + int num_act = act_info.getSelectedIndex(); + int num_sem = sem_info.getSelectedIndex()+data.startWeekNumber(); + int cursus = data.cursusNumber(); + int mod_start = data.moduleStart(cursus, num_mod); + if (mod_start!=0) mod_start-=data.startWeekNumber(); + int nb_act = data.scheduleInWeek(num_mod, mod_start).length; + + data.unscheduleActivity(cursus, num_mod, nb_act, num_sem, data.semesterSize()); + data.deleteActivity(cursus, num_mod, nb_act); + + int[] weeks = data.schedule(num_mod); + data.unscheduleActivities(cursus, num_mod); + data.setSchedule(cursus, num_mod, weeks); + + repaint(); + f.dispose(); + } + }); + + global_mod.add(mod); + global_mod.add(mod_info); + global_act.add(act); + global_act.add(act_info); + global_sem.add(sem); + global_sem.add(sem_info); + global.add(global_mod); + global.add(global_act); + global.add(global_sem); + f.add(global, BorderLayout.NORTH); + f.add(valider, BorderLayout.SOUTH); + f.setVisible(true); + f.setSize(new Dimension(400, 200)); + } }