当前位置: 首页>>代码示例>>Java>>正文


Java ExtLibUtil.addScript方法代码示例

本文整理汇总了Java中com.ibm.xsp.extlib.util.ExtLibUtil.addScript方法的典型用法代码示例。如果您正苦于以下问题:Java ExtLibUtil.addScript方法的具体用法?Java ExtLibUtil.addScript怎么用?Java ExtLibUtil.addScript使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ibm.xsp.extlib.util.ExtLibUtil的用法示例。


在下文中一共展示了ExtLibUtil.addScript方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateFormLabelWidth

import com.ibm.xsp.extlib.util.ExtLibUtil; //导入方法依赖的package包/类
protected void calculateFormLabelWidth(FacesContext context, UIComponent component) {
    StringBuilder script = new StringBuilder();
    script.append("XSP.addOnLoad(function(){XSP.resizeForm("); //$NON-NLS-1$
    JavaScriptUtil.addString(script, component.getClientId(context));
    script.append(")});"); //$NON-NLS-1$
    ExtLibUtil.addScript(context, script.toString());
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:8,代码来源:MobileFormTableRenderer.java

示例2: renderPendingAction

import com.ibm.xsp.extlib.util.ExtLibUtil; //导入方法依赖的package包/类
/**
         * renderPendingAction is called at the end of encoding a page and allows for the use of
         * the MoveTo simple action. This method uses the MoveTo action's provided data to set up
         * the necessary JavaScript to carry out the action.
         * @param context
         * @param dlg
         */
    public static void renderPendingAction(FacesContext context, UIMobilePage dlg) {
        UIMobilePage.Action action = dlg.getPendingAction(context);
        if (action != null && UIMobilePage.ACTION_MOVETO_PAGE == action.getAction() ) {
            StringBuilder b = new StringBuilder();
            
            // TODO should not add inline script with dojo.addOnLoad, 
            // should add script collector addOnLoad script.
            b.append("dojo.addOnLoad(function(){"); // $NON-NLS-1$
            // TODO should not have to call XSP.allowSubmit
            b.append("XSP.allowSubmit();"); // $NON-NLS-1$
            
            // XSP.moveToMPage( view, moveToTargetId, dirInt, transition, params )
            b.append("XSP.moveToMPage("); // $NON-NLS-1$
            // view: dijit.byId("appPage1")
            b.append("dijit.byId("); // $NON-NLS-1$
            String pageId = dlg.getClientId(context);
            JavaScriptUtil.addString(b, pageId);
            b.append("),");
            // moveToTargetId: "#appPage2"
            JavaScriptUtil.addString(b, "#"+action.getTargetId());
            b.append(",");
            // direction: -1
            JavaScriptUtil.addInt(b, action.getDirection()); // -1 or 1
            b.append(",");
            // transition: "slide"
            JavaScriptUtil.addString(b,action.getTransitionType());
            b.append(",");
            
            // params: 'resetContent=false'
            // the params value will be passed to dojo.queryToObject
            StringBuilder paramsAsString = new StringBuilder();
            Map<String, Object> params = action.getHashParams();
            for (String k : params.keySet()) {
                String s = params.get(k).toString();
                if (StringUtil.isNotEmpty(s)){
                    paramsAsString.append("&").append(k).append("=").append(s); // $NON-NLS-1$ $NON-NLS-2$
                }
            }
            JavaScriptUtil.addString(b, paramsAsString.toString());
            b.append(");"); // $NON-NLS-1$
            
            
            // TODO should not add inline script with dojo.addOnLoad, 
            // should add script collector addOnLoad script.
            b.append("});"); // $NON-NLS-1$ // end dojo.addOnLoad(function(){
            String script = b.toString();
//          JavaScriptUtil.addScriptOnLoad(script);
            ExtLibUtil.addScript(context, script);
        }
    }
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:58,代码来源:MobilePageContentRenderer.java

示例3: writeErrorSummary

import com.ibm.xsp.extlib.util.ExtLibUtil; //导入方法依赖的package包/类
@Override
protected void writeErrorSummary(FacesContext context, ResponseWriter w, FormLayout c, ComputedFormData formData) throws IOException {
    if(!c.isDisableErrorSummary()) {
        // Should we apply a filter to retain only the message belonging to the controls within the form?
        // Easy enough with a FilteredIterator
        Iterator<FacesMessage> msg = ((DominoFacesContext)context).getMessages();
        if(msg.hasNext()) {
            String id = c.getClientId(context) + NamingContainer.SEPARATOR_CHAR + "popup"; //$NON-NLS-1$
            String shadeId = c.getClientId(context) + NamingContainer.SEPARATOR_CHAR + "shade"; //$NON-NLS-1$
            writeErrorSummaryShade(context, w, c, shadeId);
            
            //TODO: make the addition of js to the component a separate function
            //center the error dialog on the screen
            StringBuilder b = new StringBuilder();
            b.append("XSP.addOnLoad(function(){"); // $NON-NLS-1$
            b.append("XSP.centerNode(" ); // $NON-NLS-1$
            JavaScriptUtil.addString(b, id);
            b.append(");"); //$NON-NLS-1$
            b.append("});"); //$NON-NLS-1$
            String script = b.toString();
            ExtLibUtil.addScript(context, script);
            
            w.startElement("div",c); //$NON-NLS-1$
            String style = (String)getProperty(PROP_STYLEERRORSUMMARY);
            if(StringUtil.isNotEmpty(style)) {
                w.writeAttribute("style", style, null); // $NON-NLS-1$
            }
            String cls = (String)getProperty(PROP_STYLECLASSERRORSUMMARY);
            if(StringUtil.isNotEmpty(cls)) {
                w.writeAttribute("class", cls, null); // $NON-NLS-1$
            }
            if(StringUtil.isNotEmpty(id)) {
                w.writeAttribute("id", id, null); // $NON-NLS-1$
            }
            
            writeErrorSummaryContent(context, w, c, msg);
            writeErrorSummaryButton(context, w, c, id, shadeId);
            w.endElement("div"); //$NON-NLS-1$
        }
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:42,代码来源:MobileFormTableRenderer.java


注:本文中的com.ibm.xsp.extlib.util.ExtLibUtil.addScript方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。