* @see HtmlGeneratorElement#generateHtml(org.openmrs.module.htmlformentry.FormEntryContext)
*/
@Override
public String generateHtml(FormEntryContext context) {
StringBuilder ret = new StringBuilder();
MessageSourceService mss = Context.getMessageSourceService();
if (drugWidget != null) {
if (drugWidget instanceof CheckboxWidget == false)
ret.append(mss.getMessage("DrugOrder.drug") + " ");
ret.append(drugWidget.generateHtml(context) + " ");
if (context.getMode() != Mode.VIEW)
ret.append(drugErrorWidget.generateHtml(context));
ret.append(" | ");
}
ret.append(generateHtmlForAdditionalWidgets(context));
if (frequencyWidget != null) {
ret.append(mss.getMessage("DrugOrder.frequency") + " ");
ret.append(frequencyWidget.generateHtml(context));
if (context.getMode() != Mode.VIEW)
ret.append(frequencyErrorWidget.generateHtml(context));
}
if (frequencyWeekWidget != null) {
ret.append(" x ");
ret.append(frequencyWeekWidget.generateHtml(context) + " ");
if (context.getMode() != Mode.VIEW)
ret.append(frequencyWeekErrorWidget.generateHtml(context));
}
if (startDateWidget != null) {
ret.append(" | ");
ret.append(mss.getMessage("general.dateStart") + " ");
ret.append(startDateWidget.generateHtml(context) + " ");
if (context.getMode() != Mode.VIEW)
ret.append(startDateErrorWidget.generateHtml(context));
}
if (orderDurationWidget != null){
ret.append(mss.getMessage("htmlformentry.general.for") + " ");
ret.append(orderDurationWidget.generateHtml(context));
ret.append(" " + mss.getMessage("htmlformentry.general.days") + " ");
if (context.getMode() != Mode.VIEW)
ret.append(orderDurationErrorWidget.generateHtml(context));
}
//duration and discontinuedDate are now mutually exclusive
if (discontinuedDateWidget != null) {
ret.append(mss.getMessage("general.dateDiscontinued") + " ");
ret.append(discontinuedDateWidget.generateHtml(context) + " ");
if (context.getMode() != Mode.VIEW)
ret.append(discontinuedDateErrorWidget.generateHtml(context));
}
if (discontinuedReasonWidget != null){
ret.append(" | " + mss.getMessage("general.discontinuedReason") + " ");
ret.append(discontinuedReasonWidget.generateHtml(context) + " ");
if (context.getMode() != Mode.VIEW)
ret.append(discontinuedReasonErrorWidget.generateHtml(context));
}