Code example for Formatter

Methods: formattoString, x 1

0
 
        FacesContext context = FacesContext.getCurrentInstance();
        String text = getItemText(context, component, true);
        String handler = getHandler(context, component);
 
        Formatter fmt = new Formatter();
        fmt.format("%s.addItem(new Ext.menu.Item({", FacesUtils.getJsvar(context, menu));
        encodeItemConfig(fmt, context, component, text);
        if (handler != null)
            fmt.format(",handler:function(){%s}", handler);
        fmt.format("}));\n");
 
        YuiExtResource.register(rm).addInitScript(fmt.toString());
    } 
 
    private String getHandler(FacesContext context, UIComponent component) {
        UIForm form = getParentForm(component);
        if (form != null) {
            return super.getOnclickScript(context, form, component, false);
        } else { 
Experience pair programming with AI  Get Codota for Java