Skip to content
Snippets Groups Projects
Commit 007a50d8 authored by CHEVALIER Noemy's avatar CHEVALIER Noemy
Browse files

Correction de compatibilité

parent d52ad020
No related branches found
No related tags found
No related merge requests found
......@@ -98,14 +98,12 @@ public class ShukanView extends JPanel
/** Displayed data */
private ShukanData data = null;
/** Creates the shukan viewer.
*/
public ShukanView (ShukanData data, ShukanIO myIO)
{
this.data = data;
this.myIO = myIO;
this.myIO = myIO;
}
/** Saves Shukan data in a file.
......@@ -149,7 +147,7 @@ public class ShukanView extends JPanel
fontMetrics = g2.getFontMetrics ();
fontHeight = fontMetrics.getAscent ();
int i;
for (i = 0; i <= nbModules; i++)
for (i = 0; i <= nbModules + 2; i++)
{
int y = appliHeight - (i + 1) * 3 * textHeight + 2*textHeight;
......@@ -217,26 +215,29 @@ public class ShukanView extends JPanel
/** Updates the application size.
*/
private void adaptSize(int width, int height) {
if (data != null) {
nbWeeks = data.semesterSize();
nbModules = data.numberOfModules();
private void adaptSize (int width, int height)
{
if (data != null)
{
nbWeeks = data.semesterSize ();
nbModules = data.numberOfModules ();
// Height
textHeight = (int) (height / (3.0f * nbModules + 2));
textHeight = (int) (height / (3.0f * (nbModules + 2)));
appliHeight = textHeight * 3 * (nbModules + 2);
// Width
activWidth = width / (ShukanModule.MAX_ACTIV_PER_WEEK * (nbWeeks + 2));
weekWidth = activWidth * ShukanModule.MAX_ACTIV_PER_WEEK;
appliWidth = weekWidth * (nbWeeks + 2);
} else {
}
else
{
appliWidth = STD_APPLI_WIDTH;
appliHeight = STD_APPLI_HEIGHT;
}
}
/** Displays the calendar grid background.
*/
private void displayCalendar (Graphics2D g2)
......@@ -289,7 +290,7 @@ public class ShukanView extends JPanel
if (durations[i] != wd)
{
int start = (int) ((durations[i] * weekWidth) / (float) wd);
drawBox (g2, (2 + i) * weekWidth + start, 2 * textHeight,
drawBox (g2, (2 + i) * weekWidth + start, 5* textHeight,
weekWidth - start, appliHeight - 3 * textHeight);
}
......@@ -298,24 +299,38 @@ public class ShukanView extends JPanel
for (int i = 2; i <= nbWeeks + 1; i++)
drawVLine (g2, i * weekWidth, 0, appliHeight);
// Lines
for (int i = 0; i <= nbModules ; i++)
for (int i = 0; i <= nbModules +1 ; i++)
drawHLine (g2, 0, (2 + 3 * i) * textHeight, appliWidth);
// Texts : semester and load name
drawText (g2, 0, appliHeight - textHeight,
2 * weekWidth, textHeight, data.cursusName ());
// drawText (g2, 0, textHeight,
// 2 * weekWidth, textHeight, data.loadName ());
drawText (g2, 0, appliHeight - textHeight, 2 * weekWidth, textHeight, data.cursusName ());
drawText (g2, 0, textHeight - 1, 2 * weekWidth, textHeight, data.loadName ());
drawText (g2, 0, 3 * textHeight, 2* weekWidth, textHeight, data.studentName());
for (int i = 0; i < nbWeeks; i++)
{
int[] weekNumbers = data.weekNumbers ();
int[] hour = data.weekDurations ();
drawText (g2, (i + 2) * weekWidth, 61,
weekWidth, textHeight, "" + data.studentLoad(i));
drawText (g2, (2 + i) * weekWidth, 0,
weekWidth, 106, "/" + hour[i]);
}
// Texts : weeks
int[] weekNumbers = data.weekNumbers ();
for (int i = 0; i < nbWeeks; i++)
{
drawText (g2, (i + 2) * weekWidth, appliHeight - textHeight,
weekWidth, textHeight, "S" + weekNumbers[i]);
// drawText (g2, (i + 2) * weekWidth, textHeight,
// weekWidth, textHeight, "" + data.computeLoad (i));
// drawText (g2, (2 + i) * weekWidth, 0,
// weekWidth, textHeight, "/" + durations[i]);
drawText (g2, (i + 2) * weekWidth, textHeight,
weekWidth, textHeight, "" + data.computeLoad (i));
drawText (g2, (2 + i) * weekWidth, 0,
weekWidth, textHeight, "/" + durations[i]);
}
// Texts : modules
String[] modNames = data.moduleNames ();
......@@ -462,6 +477,7 @@ public class ShukanView extends JPanel
repaint();
}
/** Creates a new activity with window */
public void getNewActivity(){
JFrame f = new JFrame("Informations concernant le nouveau cours");
......@@ -506,6 +522,5 @@ public class ShukanView extends JPanel
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.
Finish editing this message first!
Please register or to comment