private void appendAddMeasurement(final Hbox hbox, final Listitem listItem,
Boolean readOnly) {
final AdvanceAssignment advance = (AdvanceAssignment) listItem
.getValue();
final Button addMeasurementButton = createAddMeasurementButton();
addMeasurementButton.addEventListener(Events.ON_CLICK,
new EventListener() {
@Override
public void onEvent(Event event) {
if (!listItem.equals(editAdvances.getSelectedItem())) {
selectAdvanceLine(listItem);
}
goToCreateLineAdvanceMeasurement();
}
});
if ((advance.getAdvanceType() != null)
&& (advance.getAdvanceType().isQualityForm())) {
addMeasurementButton.setDisabled(true);
addMeasurementButton
.setTooltiptext(_("Progress that are reported by quality forms can not be modified"));
} else if ((advance.getAdvanceType() != null)
&& (advance.getAdvanceType().isReadOnly())) {
addMeasurementButton.setDisabled(true);
addMeasurementButton
.setTooltiptext(_("This progress type cannot be modified"));
} else if (advance instanceof IndirectAdvanceAssignment) {
addMeasurementButton.setDisabled(true);
addMeasurementButton
.setTooltiptext(_("Calculated progress can not be modified"));
} else if (readOnly) {
addMeasurementButton.setDisabled(true);
addMeasurementButton
.setTooltiptext(_("Subcontractor values are read only because they were reported by the subcontractor company."));
}
hbox.appendChild(addMeasurementButton);
}