From e9b54f8105dc439d762ed4bfcb2b5457f86ebc2c Mon Sep 17 00:00:00 2001
From: piquerez <corentin.piquerez1@etu.univ-lorraine.fr>
Date: Thu, 1 Jun 2023 12:02:05 +0200
Subject: [PATCH] double click salles et cours plus lisble

---
 shukan/ShukanData.java   |  9 +++++++++
 shukan/ShukanModule.java | 17 +++++++++++++++++
 shukan/ShukanView.java   |  7 +++++--
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/shukan/ShukanData.java b/shukan/ShukanData.java
index acfb4ff..73f58d5 100644
--- a/shukan/ShukanData.java
+++ b/shukan/ShukanData.java
@@ -704,9 +704,18 @@ public class ShukanData
   public String activityName(int number){
     return mod[selCur][selectedModule()].activityName(number);
   }
+  /** convert a number of activity into a String */
+  public String activityMainName(int number){
+    return mod[selCur][selectedModule()].activityMainName(number);
+  }
 
   /** returns the duration of an activity */
   public int activityDuration(int number){
     return mod[selCur][selectedModule()].activityDuration(number);
   }
+
+  /** returns the room of an activity */
+  public String activityRoom(int number){
+    return mod[selCur][selectedModule()].activityRoom(number);
+  }
 }
diff --git a/shukan/ShukanModule.java b/shukan/ShukanModule.java
index 972caef..0ae7f27 100644
--- a/shukan/ShukanModule.java
+++ b/shukan/ShukanModule.java
@@ -57,6 +57,14 @@ public class ShukanModule
   public final static int ACT_SP = 11;  // TP de SAE en salle ordi
   /** Specific activity : SAe practical work in standard room */
   public final static int ACT_SQ = 12;  // TQ de SAE en salle de cours
+  /** Activity main types */
+  private final static String[] MAIN_TYPES = {"CM", "EVAL", "EVAL",
+                                            "TD", "TD", "TD en //", "TD SAE", "TD SAE",
+                                            "TP", "TP", "TP", "TP SAE", "TP SAE"};
+  /** Activity rooms */
+  private final static String[] ROOMS = {"Amphi/Cours", "Amphi/Cours", "Amphi/Cours",
+                                            "Cours", "Machine", "Cours", "Cours", "Machine",
+                                            "Machine", "Machine", "Cours", "Machine", "Cours"};
   /** Activity types */
   public final static String[] TYPES = {"CM", "EV2", "EV1",
                                          "TD", "TM", "TV", "SD", "SM",
@@ -542,9 +550,18 @@ public class ShukanModule
   public String activityName(int number){
     return TYPES[number];
   }
+  /** convert a number of activity into a String */
+  public String activityMainName(int number){
+    return MAIN_TYPES[number];
+  }
 
   /** returns the duration of an activity */
   public int activityDuration(int number){
     return SLOAD[number];
   }
+
+  /** returns the room of an activity */
+  public String activityRoom(int number){
+    return ROOMS[number];
+  }
 }
diff --git a/shukan/ShukanView.java b/shukan/ShukanView.java
index a3408a9..31490fb 100644
--- a/shukan/ShukanView.java
+++ b/shukan/ShukanView.java
@@ -430,6 +430,7 @@ public class ShukanView extends JPanel
       JLabel[] noms_cours = new JLabel[nb_cours];
       JLabel[] duree = new JLabel[nb_cours];
       JLabel[] profs = new JLabel[nb_cours];
+      JLabel[] salles = new JLabel[nb_cours];
       String nom_profs;
       for (int i =0; i<nb_cours; i++)
       {
@@ -446,17 +447,19 @@ public class ShukanView extends JPanel
         }
         else nom_profs = data.subtitle(num_module);
 
-        noms_cours[i] =  new JLabel("Cours : "+data.activityName(activities[week_activities[i]]));
+        noms_cours[i] =  new JLabel("Cours : "+data.activityMainName(activities[week_activities[i]]));
         noms_cours[i].setFont(new Font(noms_cours[i].getFont().getFamily(), noms_cours[i].getFont().getStyle()+Font.BOLD, noms_cours[i].getFont().getSize()+10));
         duree[i] = new JLabel("   Durée : "+data.activityDuration(activities[week_activities[i]])+"h");
         profs[i] = new JLabel("   Professeur : "+ nom_profs);
+        salles[i] = new JLabel("   Salle : "+ data.activityRoom(activities[week_activities[i]]));
         cours.add(noms_cours[i]);
         cours.add(duree[i]);
         cours.add(profs[i]);
+        cours.add(salles[i]);
       }
 
       spec.add(cours);
-      spec.setSize(new Dimension(300, 100*nb_cours));
+      spec.setSize(new Dimension(350, 100*nb_cours));
       spec.setVisible(true);
     }
   }
-- 
GitLab