本文整理汇总了Java中net.bootsfaces.component.icon.IconRenderer类的典型用法代码示例。如果您正苦于以下问题:Java IconRenderer类的具体用法?Java IconRenderer怎么用?Java IconRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IconRenderer类属于net.bootsfaces.component.icon包,在下文中一共展示了IconRenderer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testStyleClass
import net.bootsfaces.component.icon.IconRenderer; //导入依赖的package包/类
@Test
public void testStyleClass() throws IOException{
Icon icon = new Icon();
icon.setName("prueba");
String expected="<span><i> id=\"clientId1\" class=\"glyphicon glyphicon-prueba\"</i></span>";
jsfMock.generateAndTest(icon, expected, new IconAwesomeRenderer());
this.jsfMock.resetResponseWriter();
icon = new Icon();
icon.getAttributes().put("styleClass", "styleClass1");
icon.setName("prueba");
expected="<span><i> id=\"clientId1\" class=\"styleClass1 glyphicon glyphicon-prueba\"</i></span>";
jsfMock.generateAndTest(icon, expected, new IconRenderer());
}
示例2: encodeHTML
import net.bootsfaces.component.icon.IconRenderer; //导入依赖的package包/类
/**
* Encode the HTML code of the button.
*
* @param context
* the current FacesContext
* @throws IOException
* thrown if something's wrong with the ResponseWriter
*/
public void encodeHTML(FacesContext context, Button button) throws IOException {
ResponseWriter rw = context.getResponseWriter();
String clientId = button.getClientId();
Object value = button.getValue();
String style = button.getStyle();
rw.startElement("button", button);
rw.writeAttribute("id", clientId, "id");
rw.writeAttribute("name", clientId, "name");
rw.writeAttribute("type", "button", null);
if (BsfUtils.isStringValued(button.getDir())) {
rw.writeAttribute("dir", button.getDir(), "dir");
}
if (style != null) {
rw.writeAttribute("style", style, "style");
}
rw.writeAttribute("class", getStyleClasses(button), "class");
Tooltip.generateTooltip(context, button, rw);
final String clickHandler = encodeClick(context, button);
if (null != clickHandler && clickHandler.length() > 0) {
rw.writeAttribute("onclick", clickHandler, null);
}
if (BsfUtils.isStringValued(button.getDismiss())) {
rw.writeAttribute("data-dismiss", button.getDismiss(), null);
}
if (button.isDisabled()) {
rw.writeAttribute("disabled", "disabled", null);
}
// Encode attributes (HTML 4 pass-through + DHTML)
renderPassThruAttributes(context, button, H.ALLBUTTON);
String icon = button.getIcon();
String faicon = button.getIconAwesome();
boolean fa = false; // flag to indicate wether the selected icon set is
// Font Awesome or not.
if (faicon != null) {
icon = faicon;
fa = true;
}
if (icon != null) {
Object ialign = button.getIconAlign(); // Default Left
if (ialign != null && ialign.equals("right")) {
rw.writeText(value + " ", null);
IconRenderer.encodeIcon(rw, button, icon, fa);
} else {
IconRenderer.encodeIcon(rw, button, icon, fa);
rw.writeText(" " + value, null);
}
} else {
rw.writeText(value, null);
}
Tooltip.activateTooltips(context, button);
rw.endElement("button");
}
示例3: encodeEnd
import net.bootsfaces.component.icon.IconRenderer; //导入依赖的package包/类
@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
ResponseWriter rw = context.getResponseWriter();
// Map<String, Object> attrs = component.getAttributes();
CommandButton commandButton = (CommandButton) component;
Object value = commandButton.getValue();
String icon = commandButton.getIcon();
String faicon = commandButton.getIconAwesome();
boolean fa = false; // flag to indicate whether the selected icon set is
// Font Awesome or not.
if (faicon != null) {
icon = faicon;
fa = true;
}
if (icon != null) {
Object ialign = commandButton.getIconAlign(); // Default Left
if (ialign != null && ialign.equals("right")) {
value = value != null ? value + " " : null;
writeText(rw, value, null);
IconRenderer.encodeIcon(rw, component, icon, fa, commandButton.getIconSize(), commandButton.getIconRotate(), commandButton.getIconFlip(), commandButton.isIconSpin(), null, null, false, false, false, false);
} else {
IconRenderer.encodeIcon(rw, component, icon, fa, commandButton.getIconSize(), commandButton.getIconRotate(), commandButton.getIconFlip(), commandButton.isIconSpin(), null, null, false, false, false, false);
value = value != null ? " " + value : null;
writeText(rw, value, null);
}
} else {
if (component.getChildCount() > 0) {
value = value != null ? " " + value : null;
writeText(rw, value, null);
} else {
writeText(rw, value, null);
}
}
Tooltip.activateTooltips(context, component);
rw.endElement("button");
String clazz = Responsive.getResponsiveStyleClass(commandButton, false).trim();
boolean isResponsive = clazz.length() > 0;
if (isResponsive) {
rw.endElement("div");
}
}