I was checking out the PrimeFaces code when I came across the following situation (import java.util.List;
import java.util.Map;
import org.primefaces.util.HTML;
import java.util.logging.Logger;
import org.primefaces.util.ComponentUtils;
private final static Logger logger = Logger.getLogger(Button.class.getName());
public String resolveIcon() {
String icon = getIcon();
if(icon == null) {
icon = getImage();
if(icon != null)
logger.info("image attribute is deprecated to define an icon, use icon attribute instead.");
}
return icon;
}
public String resolveStyleClass() {
String icon = resolveIcon();
Object value = getValue();
String styleClass = "";
if(value != null && ComponentUtils.isValueBlank(icon)) {
styleClass = HTML.BUTTON_TEXT_ONLY_BUTTON_CLASS;
}
else if(value != null && !ComponentUtils.isValueBlank(icon)) {
styleClass = getIconPos().equals("left") ? HTML.BUTTON_TEXT_ICON_LEFT_BUTTON_CLASS : HTML.BUTTON_TEXT_ICON_RIGHT_BUTTON_CLASS;
}
else if(value == null && !ComponentUtils.isValueBlank(icon)) {
styleClass = HTML.BUTTON_ICON_ONLY_BUTTON_CLASS;
}
if(isDisabled()) {
styleClass = styleClass + " ui-state-disabled";
}
String userStyleClass = getStyleClass();
if(userStyleClass != null) {
styleClass = styleClass + " " + userStyleClass;
}
return styleClass;
}
public Map<String, List<String>> getParams() {
return ComponentUtils.getUIParams(this);
}
In this file there is no "declaration" of a class (ex: public class ButtonTemplate { }
).
-
What is this?
-
How does this work?