Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
default value of render-label can now be configured in the web.xml again
  • Loading branch information
stephanrauh committed May 5, 2016
1 parent 1200bd5 commit 2c6f87f
Show file tree
Hide file tree
Showing 12 changed files with 4,207 additions and 4,193 deletions.
29 changes: 29 additions & 0 deletions src/main/java/net/bootsfaces/component/ComponentUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.bootsfaces.component;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;

import net.bootsfaces.beans.ELTools;

@ManagedBean
@RequestScoped
public class ComponentUtils {
private boolean renderLabelDefault = true;

public ComponentUtils() {
String renderLabel = FacesContext.getCurrentInstance().getExternalContext()
.getInitParameter("net.bootsfaces.defaults.renderLabel");
if (null != renderLabel && renderLabel.contains("#{")) {
renderLabelDefault = (Boolean) ELTools.evalAsObject(renderLabel);
}
else if (null != renderLabel) {
renderLabelDefault = Boolean.valueOf(renderLabel);
}
}

public static boolean isRenderLabelDefault() {
ComponentUtils cu = (ComponentUtils) ELTools.evalAsObject("#{componentUtils}");
return cu.renderLabelDefault;
}
}
Loading

0 comments on commit 2c6f87f

Please sign in to comment.