Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-21378

EL Knowledge Base Problem with enums

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 4.3.1.Beta2
    • None
    • jsf
    • None

      Enum properties and method are not recognized:
      In this case, label is recognized and shows up in the completion suggestions, but name() is not and marked as unrecognized.

      <p:dataTable value="#{page.dataModel}" var="managerData" lazy="true"
      rowStyleClass="#{managerData.status.label} labor-protection-#{managerData.status.name().replace('_', '-').toLowerCase()}">
      ...
      </p:dataTable>
      
      public enum SignOffStatus {
      	VALID("Valid"),
      	ALMOST_EXPIRED("Almost expired"),
      	EXPIRED("Expired");
      
      	private final String label;
      
      	private SignOffStatus(String label) {
      		this.label = label;
      	}
      
      	public String getLabel() {
      		return label;
      	}
      }
      

      In a different page:

      <p:selectOneMenu value="#{instancePage.instanceCriteria.status}">
      	<f:selectItem itemLabel="--select--" itemValue="#{null}" />
      	<f:selectItems value="#{appBean.getStatuses()}" var="stat" itemLabel="#{stat.label}" />
      </p:selectOneMenu>
      

      The enum has a getLabel() as the one above, but in this context it's not recognized ("label" cannot be resolved).

            scabanovich Viacheslav Kabanovich (Inactive)
            andrei.ivanov@gmail.com Andrei Ivanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: