You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Joost Schouten <jo...@jsportal.com> on 2007/05/08 06:33:06 UTC
scedule suggestion - move getWorking***Hour() to ScheduleDay
Hi,
Hi,
I have the following suggestion for the t:schedule. I would find it useful
to define the workingStartHour and workingEndHour on a per day basis. My
main reason for this is that it can then represent the correct workweek for
part-time workers as well.
The per day differences can be loaded in the
SimpleScheduleModel.loadDayAttributes(Day day) if required. I would also
like to change the value from Integer to Float so that a day can also start
at 8:30. The following is my suggestion.
In ScheduleDetailedDayRenderer call getWorking***Hour() on ScheduleDay in
stead of HtmlSchedule:
protected String getCellClass(HtmlSchedule schedule, int column, int row,
int hour)
{
String cellClass = "free";
ScheduleDay day = (ScheduleDay) schedule.getModel().get(column);
if (!day.isWorkingDay())
{
return getStyleClass(schedule, cellClass);
}
/**here we will retreive the .getWorkingStartHour() and
.getWorkingEndHour() from the day and not the entire scedule
* so that we can properly represent part time work weeks as well
*/
if ((float)hour >= day.getWorkingStartHour(scedule).floatValue()
&& (float)hour <
day.getWorkingEndHour(scedule).floatValue())
{
cellClass = ((row % 2) == 0) ? "even" : "uneven";
}
return getStyleClass(schedule, cellClass);
}
In ScheduleDay add:
private Float workingEndHour;
private Float workingStartHour;
public float getWorkingEndHour(HtmlSchedule scedule) {
if(this.workingEndHour==null)
return scedule.getWorkingEndHour();
else
return workingEndHour.floatValue();
}
public void setWorkingEndHour(float workingEndHour) {
this.workingEndHour = new Float(workingEndHour);
}
public float getWorkingStartHour(HtmlSchedule scedule) {
if(this.workingStartHour==null)
return scedule.getWorkingStartHour();
else
return workingStartHour.floatValue();
}
public void setWorkingStartHour(float workingStartHour) {
this.workingStartHour = new Float(workingStartHour);
}
In UIScedule change the workingEndHour to Float:
private Float workingEndHour;
private Float workingStartHour;
public float getWorkingEndHour()
{
return ScheduleUtil.getIntegerProperty(this, workingEndHour,
"workingEndHour", 17);
}
public float getWorkingStartHour()
{
return ScheduleUtil.getIntegerProperty(this, workingStartHour,
"workingStartHour", 9);
}
public void setWorkingEndHour(float workingEndHour)
{
this.workingEndHour = new Float(workingEndHour);
}
public void setWorkingStartHour(float workingStartHour)
{
this.workingStartHour = new Float(workingStartHour);
}
Is there any support for this change, or is it too specific to my needs.
Regards,
Joost