當前位置: 首頁>>代碼示例>>Java>>正文


Java IconRenderer.encodeIcon方法代碼示例

本文整理匯總了Java中net.bootsfaces.component.icon.IconRenderer.encodeIcon方法的典型用法代碼示例。如果您正苦於以下問題:Java IconRenderer.encodeIcon方法的具體用法?Java IconRenderer.encodeIcon怎麽用?Java IconRenderer.encodeIcon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.bootsfaces.component.icon.IconRenderer的用法示例。


在下文中一共展示了IconRenderer.encodeIcon方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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");
}
 
開發者ID:stephanrauh,項目名稱:JSFLibraryGenerator,代碼行數:69,代碼來源:ButtonRenderer.java

示例2: 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");
	}
}
 
開發者ID:TheCoder4eu,項目名稱:BootsFaces-OSP,代碼行數:50,代碼來源:CommandButtonRenderer.java


注:本文中的net.bootsfaces.component.icon.IconRenderer.encodeIcon方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。