Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SAE2.01 - Developpement application
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PIQUEREZ Corentin
SAE2.01 - Developpement application
Commits
d52ad020
Commit
d52ad020
authored
1 year ago
by
BERRADA Louise
Browse files
Options
Downloads
Patches
Plain Diff
Correction de bugs
parent
7a6961e0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shukan/ShukanView.java
+30
-39
30 additions, 39 deletions
shukan/ShukanView.java
with
30 additions
and
39 deletions
shukan/ShukanView.java
+
30
−
39
View file @
d52ad020
...
...
@@ -98,12 +98,14 @@ 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.
...
...
@@ -147,7 +149,7 @@ public class ShukanView extends JPanel
fontMetrics
=
g2
.
getFontMetrics
();
fontHeight
=
fontMetrics
.
getAscent
();
int
i
;
for
(
i
=
0
;
i
<=
nbModules
+
2
;
i
++)
for
(
i
=
0
;
i
<=
nbModules
;
i
++)
{
int
y
=
appliHeight
-
(
i
+
1
)
*
3
*
textHeight
+
2
*
textHeight
;
...
...
@@ -215,29 +217,26 @@ 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
)
...
...
@@ -290,7 +289,7 @@ public class ShukanView extends JPanel
if
(
durations
[
i
]
!=
wd
)
{
int
start
=
(
int
)
((
durations
[
i
]
*
weekWidth
)
/
(
float
)
wd
);
drawBox
(
g2
,
(
2
+
i
)
*
weekWidth
+
start
,
5
*
textHeight
,
drawBox
(
g2
,
(
2
+
i
)
*
weekWidth
+
start
,
2
*
textHeight
,
weekWidth
-
start
,
appliHeight
-
3
*
textHeight
);
}
...
...
@@ -299,38 +298,24 @@ 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
+
1
;
i
++)
for
(
int
i
=
0
;
i
<=
nbModules
;
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
-
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
]);
}
drawText
(
g2
,
0
,
appliHeight
-
textHeight
,
2
*
weekWidth
,
textHeight
,
data
.
cursusName
());
// drawText (g2, 0, textHeight,
// 2 * weekWidth, textHeight, data.loadName ());
// 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
();
...
...
@@ -498,9 +483,15 @@ public class ShukanView extends JPanel
if
(
mod_start
!=
0
)
mod_start
-=
data
.
startWeekNumber
();
int
nb_act
=
data
.
scheduleInWeek
(
num_mod
,
mod_start
).
length
;
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
,
nb_act
);
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
);
int
[]
weeks
=
data
.
schedule
(
num_mod
);
data
.
unscheduleActivities
(
cursus
,
num_mod
);
data
.
setSchedule
(
cursus
,
num_mod
,
weeks
);
repaint
();
f
.
dispose
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment