Use disabled textbox for capacity row in monthly timesheets
Make the row more similar to the other ones. FEA: ItEr76S28UserDashboard
This commit is contained in:
parent
d960bb47cb
commit
96e926e51b
1 changed files with 23 additions and 19 deletions
|
|
@ -149,17 +149,17 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cell cell = getCenteredCell(textbox);
|
||||||
if (monthlyTimesheetModel.getResourceCapacity(day).isZero()) {
|
if (monthlyTimesheetModel.getResourceCapacity(day).isZero()) {
|
||||||
row.appendChild(getNonCapacityCell(textbox));
|
setBackgroundNonCapacityCell(cell);
|
||||||
} else {
|
|
||||||
row.appendChild(textbox);
|
|
||||||
}
|
}
|
||||||
|
row.appendChild(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void appendTotalColumn(Row row, final OrderElement orderElement) {
|
private void appendTotalColumn(Row row, final OrderElement orderElement) {
|
||||||
row.appendChild(getDisabledTextbox(getTotalColumnTextboxId(orderElement)));
|
row.appendChild(getDisabledTextboxWithId(getTotalColumnTextboxId(orderElement)));
|
||||||
updateTotalColumn(orderElement);
|
updateTotalColumn(orderElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,18 +189,25 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
private void appendTotalForDays(Row row) {
|
private void appendTotalForDays(Row row) {
|
||||||
for (LocalDate day = start; day.compareTo(end) <= 0; day = day
|
for (LocalDate day = start; day.compareTo(end) <= 0; day = day
|
||||||
.plusDays(1)) {
|
.plusDays(1)) {
|
||||||
Textbox textbox = getDisabledTextbox(getTotalRowTextboxId(day));
|
Cell cell = getCenteredCell(getDisabledTextboxWithId(getTotalRowTextboxId(day)));
|
||||||
if (monthlyTimesheetModel.getResourceCapacity(day).isZero()) {
|
if (monthlyTimesheetModel.getResourceCapacity(day).isZero()) {
|
||||||
row.appendChild(getNonCapacityCell(textbox));
|
setBackgroundNonCapacityCell(cell);
|
||||||
} else {
|
|
||||||
row.appendChild(textbox);
|
|
||||||
}
|
}
|
||||||
|
row.appendChild(cell);
|
||||||
|
|
||||||
updateTotalRow(day);
|
updateTotalRow(day);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Textbox getDisabledTextbox(String id) {
|
private Textbox getDisabledTextbox(EffortDuration effort) {
|
||||||
|
Textbox textbox = new Textbox();
|
||||||
|
textbox.setWidth(EFFORT_DURATION_TEXTBOX_WIDTH);
|
||||||
|
textbox.setValue(effort.toFormattedString());
|
||||||
|
textbox.setDisabled(true);
|
||||||
|
return textbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Textbox getDisabledTextboxWithId(String id) {
|
||||||
Textbox textbox = new Textbox();
|
Textbox textbox = new Textbox();
|
||||||
textbox.setWidth(EFFORT_DURATION_TEXTBOX_WIDTH);
|
textbox.setWidth(EFFORT_DURATION_TEXTBOX_WIDTH);
|
||||||
textbox.setId(id);
|
textbox.setId(id);
|
||||||
|
|
@ -220,7 +227,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
}
|
}
|
||||||
|
|
||||||
private void appendTotalColumn(Row row) {
|
private void appendTotalColumn(Row row) {
|
||||||
row.appendChild(getAlignLeftCell(getDisabledTextbox(getTotalTextboxId())));
|
row.appendChild(getAlignLeftCell(getDisabledTextboxWithId(getTotalTextboxId())));
|
||||||
updateTotalColumn();
|
updateTotalColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -247,18 +254,17 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
.plusDays(1)) {
|
.plusDays(1)) {
|
||||||
EffortDuration capacity = monthlyTimesheetModel
|
EffortDuration capacity = monthlyTimesheetModel
|
||||||
.getResourceCapacity(day);
|
.getResourceCapacity(day);
|
||||||
Label label = new Label(capacity.toFormattedString());
|
|
||||||
|
Cell cell = getCenteredCell(getDisabledTextbox(capacity));
|
||||||
if (monthlyTimesheetModel.getResourceCapacity(day).isZero()) {
|
if (monthlyTimesheetModel.getResourceCapacity(day).isZero()) {
|
||||||
row.appendChild(getNonCapacityCell(label));
|
setBackgroundNonCapacityCell(cell);
|
||||||
} else {
|
|
||||||
row.appendChild(label);
|
|
||||||
}
|
}
|
||||||
|
row.appendChild(cell);
|
||||||
|
|
||||||
totalCapacity = totalCapacity.plus(capacity);
|
totalCapacity = totalCapacity.plus(capacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
row.appendChild(getAlignLeftCell(new Label(totalCapacity
|
row.appendChild(getAlignLeftCell(getDisabledTextbox(totalCapacity)));
|
||||||
.toFormattedString())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Cell getCenteredCell(Component component) {
|
private Cell getCenteredCell(Component component) {
|
||||||
|
|
@ -275,10 +281,8 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Cell getNonCapacityCell(Component component) {
|
private void setBackgroundNonCapacityCell(Cell cell) {
|
||||||
Cell cell = getCenteredCell(component);
|
|
||||||
cell.setStyle("background-color: #FFEEEE");
|
cell.setStyle("background-color: #FFEEEE");
|
||||||
return cell;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue