Search in sources :

Example 1 with OutputTooltip

use of com.liferay.faces.alloy.component.outputtooltip.OutputTooltip in project liferay-faces-alloy by liferay.

the class OutputTooltipRenderer method encodeJavaScriptCustom.

@Override
public void encodeJavaScriptCustom(FacesContext facesContext, UIComponent uiComponent) throws IOException {
    ClientComponent clientComponent = (ClientComponent) uiComponent;
    String clientVarName = getClientVarName(facesContext, clientComponent);
    String clientKey = clientComponent.getClientKey();
    if (clientKey == null) {
        clientKey = clientVarName;
    }
    ResponseWriter responseWriter = facesContext.getResponseWriter();
    OutputTooltip tooltip = (OutputTooltip) uiComponent;
    encodeOverlayJavaScriptCustom(responseWriter, facesContext, tooltip, clientKey);
    if ((tooltip.getFor() == null) && facesContext.isProjectStage(ProjectStage.Development)) {
        logger.error("The 'for' attribute is required for alloy:outputTooltip");
    }
    // In order to workaround a bug where the tooltip appears in the incorrect place, set the trigger again after
    // the tooltip has been initialized
    encodeLiferayComponentVar(responseWriter, clientVarName, clientKey);
    responseWriter.write(clientVarName);
    responseWriter.write(".set('trigger',");
    responseWriter.write(clientVarName);
    responseWriter.write(".get('trigger'));");
}
Also used : ResponseWriter(javax.faces.context.ResponseWriter) OutputTooltip(com.liferay.faces.alloy.component.outputtooltip.OutputTooltip) ClientComponent(com.liferay.faces.util.component.ClientComponent)

Example 2 with OutputTooltip

use of com.liferay.faces.alloy.component.outputtooltip.OutputTooltip in project liferay-faces-alloy by liferay.

the class OutputTooltipRendererBase method encodeAlloyAttributes.

@Override
public void encodeAlloyAttributes(FacesContext facesContext, ResponseWriter responseWriter, UIComponent uiComponent) throws IOException {
    OutputTooltip outputTooltip = (OutputTooltip) uiComponent;
    boolean first = true;
    String for_ = outputTooltip.getFor();
    if (for_ != null) {
        encodeTrigger(responseWriter, outputTooltip, for_, first);
        first = false;
    }
    String opacity = outputTooltip.getOpacity();
    if (opacity != null) {
        encodeOpacity(responseWriter, outputTooltip, opacity, first);
        first = false;
    }
    String position = outputTooltip.getPosition();
    if (position != null) {
        encodePosition(responseWriter, outputTooltip, position, first);
        first = false;
    }
    Integer zIndex = outputTooltip.getzIndex();
    if (zIndex != null) {
        encodeZIndex(responseWriter, outputTooltip, zIndex, first);
        first = false;
    }
    encodeHiddenAttributes(facesContext, responseWriter, outputTooltip, first);
}
Also used : OutputTooltip(com.liferay.faces.alloy.component.outputtooltip.OutputTooltip)

Aggregations

OutputTooltip (com.liferay.faces.alloy.component.outputtooltip.OutputTooltip)2 ClientComponent (com.liferay.faces.util.component.ClientComponent)1 ResponseWriter (javax.faces.context.ResponseWriter)1