Skip to content
Snippets Groups Projects
Commit da496456 authored by PIQUEREZ Corentin's avatar PIQUEREZ Corentin
Browse files

rajout cours fonctionnel mais change disposition autres cours du module (haut...

rajout cours fonctionnel mais change disposition autres cours du module (haut bas milieu dans les cases)
parent 5f518b89
Branches
Tags
No related merge requests found
20
230525
23
230527
......@@ -207,7 +207,10 @@ public class ShukanController
else if (e.getSource()== bar.buttons[1])
System.out.println("back");
else if (e.getSource()==bar.buttons[2])
System.out.println("plus");
{
canvas.getNewActivity();
canvas.repaint();
}
else if (e.getSource()==bar.buttons[3])
System.out.println("delete");
else if (e.getSource()==bar.buttons[4]) {if (data.followLeft ()) canvas.repaint ();}
......
......@@ -438,6 +438,11 @@ public class ShukanData
{
this.mod[curs][mod].setOnLeft (act);
}
/** Sets an activity to be displayed on right */
public void setOnMiddle (int curs, int mod, int act)
{
this.mod[curs][mod].setOnMiddle (act);
}
/** Sets an activity to be displayed on right */
public void setOnRight (int curs, int mod, int act)
......
......@@ -58,7 +58,7 @@ public class ShukanModule
/** Specific activity : SAe practical work in standard room */
public final static int ACT_SQ = 12; // TQ de SAE en salle de cours
/** Activity types */
private final static String[] TYPES = {"CM", "EV2", "EV1",
public final static String[] TYPES = {"CM", "EV2", "EV1",
"TD", "TM", "TV", "SD", "SM",
"TP4", "TP2", "TQ2", "SP", "SQ"};
/** Activity symbol */
......@@ -91,8 +91,8 @@ public class ShukanModule
if (numT == -1) return (false);
if (num == activ.length)
{
int[] tmp = new int[activ.length + DEFAULT_ACTIVITY_NUMBER];
int[][] tmpaff = new int[activ.length + DEFAULT_ACTIVITY_NUMBER][];
int[] tmp = new int[activ.length + 1];
int[][] tmpaff = new int[activ.length + 1][];
for (int i = 0; i < activ.length; i++)
{
tmp[i] = activ[i];
......@@ -311,7 +311,27 @@ public class ShukanModule
onRight[act] = false;
onLeft[act] = true;
}
/** Sets an activity to be displayed on middle */
public void setOnMiddle (int act) {
for (int i =0; i<onLeft.length; i++) System.out.println("left : "+onLeft[i]+" right : "+onRight[i]);
if (act >= onLeft.length) {
boolean[] tmpRight = new boolean[onLeft.length + 1];
boolean[] tmpLeft = new boolean[onLeft.length + 1];
for (int i = 0; i < onLeft.length; i++) {
tmpLeft[i] = onLeft[i];
tmpRight[i] = onRight[i];
}
tmpRight[act] = false;
tmpLeft[act] = false;
onLeft = tmpLeft;
onRight = tmpRight;
} else {
onLeft[act] = false;
onRight[act] = false;
}
System.out.println("---------------------");
for (int i =0; i<onLeft.length; i++) System.out.println("left : "+onLeft[i]+" right : "+onRight[i]);
}
/** Sets an activity to be displayed on right */
public void setOnRight (int act)
{
......
......@@ -3,6 +3,8 @@ import javax.swing.*;
import javax.swing.plaf.ColorUIResource;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** Graphical view for Shukan planner.
......@@ -448,4 +450,45 @@ public class ShukanView extends JPanel
BACK_COLOR = c;
repaint();
}
/** Creates a new activity with window */
public void getNewActivity(){
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 act = new JLabel("Quel cours voulez vous ajouter? ");
JComboBox mod_info = new JComboBox(data.moduleNames(data.cursusNumber()));
JComboBox act_info = new JComboBox(ShukanModule.TYPES);
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 cursus = data.cursusNumber();
int mod_start = data.moduleStart(cursus, num_mod);
data.addActivity(cursus, num_mod, data.activityCount(cursus, num_mod), ShukanModule.TYPES[num_act]);
data.scheduleActivity(cursus, num_mod, data.activityCount(cursus, num_mod)-1, mod_start);
data.setOnMiddle(cursus, num_mod, data.activityCount(cursus, num_mod)-1);
repaint();
f.dispose();
}
});
global_mod.add(mod);
global_mod.add(mod_info);
global_act.add(act);
global_act.add(act_info);
f.add(global_mod, BorderLayout.NORTH);
f.add(global_act, BorderLayout.CENTER);
f.add(valider, BorderLayout.SOUTH);
f.setVisible(true);
f.setSize(new Dimension(400, 150));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment