Package org.openmrs.messagesource

Examples of org.openmrs.messagesource.MessageSourceService


    careSettingWidget = DrugOrderSubmissionElement1_10.createCareSettingWidget(context, true);
  }
 
  @Override
  public String generateHtml(FormEntryContext context) {
    MessageSourceService mss = Context.getMessageSourceService();
    String html = super.generateHtml(context);
    html += DrugOrderSubmissionElement.generateHtmlForWidget(context, mss.getMessage("htmlformentry.drugOrder.careSetting") + " ",
        careSettingWidget, null);
    return html;
  }
View Full Code Here


    setInitialValue(personAddress);
  }

  @Override
    public String generateHtml(FormEntryContext context) {
    MessageSourceService messageSourceService = Context.getMessageSourceService();
    AddressTemplate defaultLayoutTemplate = AddressSupport.getInstance().getDefaultLayoutTemplate();
    TextFieldWidget textFieldWidget;
    Map<String, String> fieldMap;
   
    if (!isRegistered) {
      registerWidgets(context);
      isRegistered = true;
    }

    // have the date and time widgets generate their HTML
    StringBuilder sb = new StringBuilder();
   
    sb.append("<table>");
   
    List<List<Map<String, String>>> fieldLines = defaultLayoutTemplate.getLines();
   
    for (List<Map<String, String>> line : fieldLines) {
      sb.append("<tr>");
      int colIndex = 0;     
      for (Iterator<Map<String, String>> iterator = line.iterator(); iterator.hasNext();colIndex++ ) {       
       
        fieldMap = iterator.next();       
       
        if (fieldMap.get("isToken").equals(defaultLayoutTemplate.getLayoutToken())) {
         
          String label = messageSourceService.getMessage(fieldMap.get("displayText"));
          textFieldWidget = widgetMap.get(fieldMap.get("codeName"));
          textFieldWidget.setTextFieldSize(Integer.parseInt(fieldMap.get("displaySize")));
          sb.append("<td>").append(label).append("</td>");
          if(!iterator.hasNext() && colIndex < defaultLayoutTemplate.getMaxTokens()){
            sb.append("<td colspan='").append(defaultLayoutTemplate.getMaxTokens()-colIndex).append("'>");
View Full Code Here

  protected List<Drug> drugsUsedAsKey;


  public DrugOrderSubmissionElement(FormEntryContext context, Map<String, String> parameters) {
    ConceptService conceptService = Context.getConceptService();
    MessageSourceService mss = Context.getMessageSourceService();

    Boolean usingDurationField = false;
    String orderDurationStr = parameters.get(FIELD_SHOW_ORDER_DURATION);
    if (!StringUtils.isEmpty(orderDurationStr) && orderDurationStr.equals("true"))
        usingDurationField = true;
View Full Code Here

   * @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));
        }
   
View Full Code Here

   
    return ret.toString();
    }
 
  protected String generateHtmlForAdditionalWidgets(FormEntryContext context) {
    MessageSourceService mss = Context.getMessageSourceService();
   
      return generateHtmlForWidget(context, mss.getMessage("DrugOrder.dose") + " ", doseWidget, doseErrorWidget);
    }
View Full Code Here

      nameErrorWidget = new ErrorWidget();
      createWidgets(context, nameWidget, nameErrorWidget,
          existingPatient != null && existingPatient.getPersonName() != null ? existingPatient.getPersonName() : null);
    }
    else if (FIELD_GENDER.equalsIgnoreCase(field)) {
      MessageSourceService msg = Context.getMessageSourceService();
      genderWidget = new DropdownWidget();
      genderErrorWidget = new ErrorWidget();
      genderWidget.addOption(new Option(msg.getMessage("Patient.gender.male"), "M", false));
      genderWidget.addOption(new Option(msg.getMessage("Patient.gender.female"), "F", false));
      createWidgets(context, genderWidget, genderErrorWidget, existingPatient != null ? existingPatient.getGender() : null);
    }
    else if (FIELD_AGE.equalsIgnoreCase(field)) {
      ageWidget = new NumberFieldWidget(0d, 200d, false);
      ageErrorWidget = new ErrorWidget();
View Full Code Here

  }

  @Override
  public String generateHtml(FormEntryContext context) {
    StringBuilder sb = new StringBuilder();
    MessageSourceService mss = Context.getMessageSourceService();

    if (nameWidget != null) {
      sb.append(nameWidget.generateHtml(context));
      if (context.getMode() != Mode.VIEW)
        sb.append(nameErrorWidget.generateHtml(context));
    }

    if (genderWidget != null) {
      sb.append(genderWidget.generateHtml(context));
      if (context.getMode() != Mode.VIEW)
        sb.append(genderErrorWidget.generateHtml(context));
    }

    if (birthDateWidget != null) {
      if (ageWidget != null) {
        sb.append(mss.getMessage("Person.birthdate")).append(" ");
      }
      sb.append(birthDateWidget.generateHtml(context));
      if (context.getMode() != Mode.VIEW)
        sb.append(birthDateErrorWidget.generateHtml(context));
    }

    if (ageWidget != null) {
      if (birthDateWidget != null) {
        sb.append(" ").append(mss.getMessage("Person.age.or")).append(" ");
      }     
      sb.append(ageWidget.generateHtml(context));
      if (context.getMode() != Mode.VIEW)
        sb.append(ageErrorWidget.generateHtml(context));
    }

   

    if (identifierTypeValueWidget != null) {
      sb.append(identifierTypeValueWidget.generateHtml(context));
      if (context.getMode() != Mode.VIEW) {
        // if value is required
        if (required) {
          sb.append("<span class='required'>*</span>");
        }

        sb.append(" ");
        sb.append(identifierTypeValueErrorWidget.generateHtml(context));
      }
    }
   
    if (identifierTypeWidget != null) {
      if (identifierTypeValueWidget instanceof DropdownWidget){       
        sb.append(" ").append(mss.getMessage("PatientIdentifier.identifierType")).append(" ");
      }
      sb.append(identifierTypeWidget.generateHtml(context)).append(" ");
    }

    if (identifierLocationWidget != null) {
View Full Code Here

    setInitialValue(personName);
  }

  @Override
    public String generateHtml(FormEntryContext context) {
    MessageSourceService messageSourceService = Context.getMessageSourceService();
    NameTemplate defaultLayoutTemplate = NameSupport.getInstance().getDefaultLayoutTemplate();
    TextFieldWidget textFieldWidget;
    Map<String, String> fieldMap;

    if (!isRegistered) {
      registerWidgets(context);
      isRegistered = true;
    }

    // have the date and time widgets generate their HTML
    StringBuilder sb = new StringBuilder();

    sb.append("<table>");

    List<List<Map<String, String>>> fieldLines = defaultLayoutTemplate.getLines();

    for (List<Map<String, String>> line : fieldLines) {
      sb.append("<tr>");
      int colIndex = 0;
      for (Iterator<Map<String, String>> iterator = line.iterator(); iterator.hasNext(); colIndex++) {

        fieldMap = iterator.next();

        if (fieldMap.get("isToken").equals(defaultLayoutTemplate.getLayoutToken())) {

          String label = messageSourceService.getMessage(fieldMap.get("displayText"));
          textFieldWidget = widgetMap.get(fieldMap.get("codeName"));
          textFieldWidget.setTextFieldSize(Integer.parseInt(fieldMap.get("displaySize")));
          sb.append("<td>").append(label).append("</td>");
          if (!iterator.hasNext() && colIndex < defaultLayoutTemplate.getMaxTokens()) {
            sb.append("<td colspan='").append(defaultLayoutTemplate.getMaxTokens() - colIndex).append("'>");
View Full Code Here

      }
 
 
    public String generateHtml(FormEntryContext context) {
      StringBuilder ret = new StringBuilder();
    MessageSourceService mss = Context.getMessageSourceService();
   
    if (regWidget != null) {
        ret.append(mss.getMessage("htmlformentry.standardRegimen") + " ");
      ret.append(regWidget.generateHtml(context) + " ");
      if (context.getMode() != Mode.VIEW)
        ret.append(regErrorWidget.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));
    }
    //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));
        }
   
View Full Code Here

 
  private void createDosingTypeWidget(FormEntryContext context) {
    dosingTypeWidget = new DropdownWidget();
   
    List<Option> options = new ArrayList<Option>();
        MessageSourceService mss = Context.getMessageSourceService();
        options.add(new Option(mss.getMessage("htmlformentry.drugOrder.dosingType.simple"), SimpleDosingInstructions.class.getName(), true));
        //options.add(new Option(mss.getMessage("htmlformentry.drugOrder.dosingType.freetext"), FreeTextDosingInstructions.class.getName(), false));
   
    setupDropdownWidget(context, dosingTypeWidget, options);
  }
View Full Code Here

TOP

Related Classes of org.openmrs.messagesource.MessageSourceService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.