[jbosstools-issues] [JBoss JIRA] (JBIDE-21323) EL Knowledge Base Problem with enums

Andrei Ivanov (JIRA) issues at jboss.org
Fri Dec 18 05:40:00 EST 2015


     [ https://issues.jboss.org/browse/JBIDE-21323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrei Ivanov updated JBIDE-21323:
----------------------------------
    Description: 
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.
{code:xml}
<p:dataTable value="#{page.dataModel}" var="managerData" lazy="true"
rowStyleClass="#{managerData.status.label} labor-protection-#{managerData.status.name().replace('_', '-').toLowerCase()}">
...
</p:dataTable>
{code}
{code:java}
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;
	}
}
{code}

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

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

  was:
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.
{code:xml}
<p:dataTable value="#{page.dataModel}" var="managerData" lazy="true"
rowStyleClass="#{managerData.status.label} labor-protection-#{managerData.status.name().replace('_', '-').toLowerCase()}">
...
</p:dataTable>
{code}
{code:java}
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;
	}
}
{code}

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

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



> EL Knowledge Base Problem with enums
> ------------------------------------
>
>                 Key: JBIDE-21323
>                 URL: https://issues.jboss.org/browse/JBIDE-21323
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: jsf
>    Affects Versions: 4.3.0.Final
>         Environment: Eclipse Mars.1 (4.5.1), Primefaces 5.x
>            Reporter: Andrei Ivanov
>            Assignee: Viacheslav Kabanovich
>            Priority: Minor
>             Fix For: 4.4.x
>
>
> 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.
> {code:xml}
> <p:dataTable value="#{page.dataModel}" var="managerData" lazy="true"
> rowStyleClass="#{managerData.status.label} labor-protection-#{managerData.status.name().replace('_', '-').toLowerCase()}">
> ...
> </p:dataTable>
> {code}
> {code:java}
> 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;
> 	}
> }
> {code}
> In a different page:
> {code:xml}
> <p:selectOneMenu value="#{instancePage.instanceCriteria.status}">
> 	<f:selectItem itemLabel="--select--" itemValue="#{null}" />
> 	<f:selectItems value="#{appBean.getStatuses()}" var="stat" itemLabel="#{stat.label}" />
> </p:selectOneMenu>
> {code}
> The enum has a {{getLabel()}} as the one above, but in this context it's not recognized ({{"label" cannot be resolved}}).



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jbosstools-issues mailing list