public void appendScript(Appendable target) throws IOException { JSFunction resetMessages = new JSFunction("RichFaces.csv.clearMessage", clientId); resetMessages.appendScript(target); target.append(';'); for (Message message : messages) { JSFunction sendMessage = new JSFunction("RichFaces.csv.sendMessage", clientId, message); sendMessage.appendScript(target); target.append(';'); } } }
protected void appendValidatorCall(Appendable target) throws IOException { JSFunction callValidator = new JSFunction(VALIDATE_FUNCTION_NAME, EVENT_REF, CLIENT_ID_REF, ELEMENT_REF, PARAMS_REF); callValidator.appendScript(target); target.append(EOL); }
public void appendScript(Appendable target) throws IOException { JSFunction resetMessages = new JSFunction("RichFaces.csv.clearMessage", clientId); resetMessages.appendScript(target); target.append(';'); for (Message message : messages) { JSFunction sendMessage = new JSFunction("RichFaces.csv.sendMessage", clientId, message); sendMessage.appendScript(target); target.append(';'); } } }
protected void appendValidatorCall(Appendable target) throws IOException { JSFunction callValidator = new JSFunction(VALIDATE_FUNCTION_NAME, EVENT_REF, ELEMENT_REF, PARAMS_REF); callValidator.appendScript(target); target.append(EOL); }
protected Object chain(String firstHandler, String secondHandler) { if (isNullOrEmpty(firstHandler) && isNullOrEmpty(secondHandler)) { return null; } if (isNullOrEmpty(firstHandler)) { return secondHandler; } if (isNullOrEmpty(secondHandler)) { return firstHandler; } return new JSFunction("return jsf.util.chain", JSReference.THIS, JSReference.EVENT, firstHandler, secondHandler) .toScript(); }
protected Object chain(String firstHandler, String secondHandler) { if (isNullOrEmpty(firstHandler) && isNullOrEmpty(secondHandler)) { return null; } if (isNullOrEmpty(firstHandler)) { return secondHandler; } if (isNullOrEmpty(secondHandler)) { return firstHandler; } return new JSFunction("return jsf.util.chain", JSReference.THIS, JSReference.EVENT, firstHandler, secondHandler) .toScript(); }
public String createCallScript(String clientId, String sourceId) { JSFunction callFunction = new JSFunction(getName(), EVENT_REF, clientId, null != sourceId ? sourceId : JSReference.THIS); return callFunction.toScript(); }
public String createCallScript(String clientId, String sourceId) { JSFunction callFunction = new JSFunction(getName(), EVENT_REF, JSReference.THIS); return callFunction.toScript(); }
public static Object formatDate(Date date) { FacesContext facesContext = FacesContext.getCurrentInstance(); AbstractCalendar calendarInstance = (AbstractCalendar) AbstractCalendar.getCurrentComponent(facesContext); Calendar calendar = CalendarHelper.getCalendar(facesContext, calendarInstance); calendar.setTime(date); JSFunction result = new JSFunction("new Date"); result.addParameter(calendar.get(Calendar.YEAR)); result.addParameter(calendar.get(Calendar.MONTH)); result.addParameter(calendar.get(Calendar.DATE)); return result; }
public static Object formatDate(Date date) { FacesContext facesContext = FacesContext.getCurrentInstance(); AbstractCalendar calendarInstance = (AbstractCalendar) AbstractCalendar.getCurrentComponent(facesContext); Calendar calendar = CalendarHelper.getCalendar(facesContext, calendarInstance); calendar.setTime(date); JSFunction result = new JSFunction("new Date"); result.addParameter(calendar.get(Calendar.YEAR)); result.addParameter(calendar.get(Calendar.MONTH)); result.addParameter(calendar.get(Calendar.DATE)); return result; }
public void buildScript(ResponseWriter writer, FacesContext context, UIComponent component, Map<?, ?> buttons, Map<?, ?> digitals) throws IOException { JSFunction function = new JSFunction("new RichFaces.ui.DataScroller"); function.addParameter(component.getClientId(context)); Map<String, Object> options = new HashMap<String, Object>(); options.put("buttons", buttons); options.put("digitals", digitals); options.put("currentPage", (Integer) component.getAttributes().get("page")); function.addParameter(getSubmitFunction(context, component)); function.addParameter(options); writer.write(function.toString()); }
public void buildScript(ResponseWriter writer, FacesContext context, UIComponent component, Map<?, ?> buttons, Map<?, ?> digitals) throws IOException { JSFunction function = new JSFunction("new RichFaces.ui.DataScroller"); function.addParameter(component.getClientId(context)); Map<String, Object> options = new HashMap<String, Object>(); options.put("buttons", buttons); options.put("digitals", digitals); options.put("currentPage", (Integer) component.getAttributes().get("page")); function.addParameter(getSubmitFunction(context, component)); function.addParameter(options); writer.write(function.toString()); }
public static JSFunction createFunction(String name) { JSFunction function = new JSFunction(name); function.addParameter(request); function.addParameter(event); function.addParameter(data); return function; }
private void emitClientToggleEvent(AbstractTreeNode treeNode, TreeNodeState nodeState) { if (treeNode.getClientId(context).equals(context.getAttributes().get(TreeNodeRendererBase.AJAX_TOGGLED_NODE_ATTRIBUTE))) { TreeNodeState initialState = (TreeNodeState) context.getAttributes().get( TreeNodeRendererBase.AJAX_TOGGLED_NODE_STATE_ATTRIBUTE); if (initialState.isDifferentThan(nodeState)) { ExtendedPartialViewContext partialContext = ExtendedPartialViewContext.getInstance(context); partialContext.appendOncomplete(new JSFunction("RichFaces.ui.TreeNode.emitToggleEvent", treeNode .getClientId(context))); } } } }
private void emitClientToggleEvent(AbstractTreeNode treeNode, TreeNodeState nodeState) { if (treeNode.getClientId(context).equals(context.getAttributes().get(TreeNodeRendererBase.AJAX_TOGGLED_NODE_ATTRIBUTE))) { TreeNodeState initialState = (TreeNodeState) context.getAttributes().get( TreeNodeRendererBase.AJAX_TOGGLED_NODE_STATE_ATTRIBUTE); if (initialState.isDifferentThan(nodeState)) { ExtendedPartialViewContext partialContext = ExtendedPartialViewContext.getInstance(context); partialContext.appendOncomplete(new JSFunction("RichFaces.ui.TreeNode.emitToggleEvent", treeNode .getClientId(context))); } } } }
protected void encodeNotification(FacesContext facesContext, UIComponent component, Map<String, Object> options) throws IOException { JavaScriptService javaScriptService = ServiceTracker.getService(JavaScriptService.class); for (MessageForRender message : getVisibleMessages(facesContext, component)) { JSFunction notifyCall = new JSFunction("RichFaces.ui.Notify"); Map<String, Object> optionsCopy = new LinkedHashMap<String, Object>(options); addMessageSpecificAttributes(message, facesContext, component, optionsCopy); notifyCall.addParameter(optionsCopy); javaScriptService.addPageReadyScript(facesContext, notifyCall); message.rendered(); } }
protected void encodeNotification(FacesContext facesContext, UIComponent component, Map<String, Object> options) throws IOException { JavaScriptService javaScriptService = ServiceTracker.getService(JavaScriptService.class); for (MessageForRender message : getVisibleMessages(facesContext, component)) { JSFunction notifyCall = new JSFunction("RichFaces.ui.Notify"); Map<String, Object> optionsCopy = new LinkedHashMap<String, Object>(options); addMessageSpecificAttributes(message, facesContext, component, optionsCopy); notifyCall.addParameter(optionsCopy); javaScriptService.addPageReadyScript(facesContext, notifyCall); message.rendered(); } }
private DnDScript buildClientScript(FacesContext facesContext, UIComponent component) { DnDScript script = null; String scriptName = getScriptName(); if (!"".equals(scriptName)) { JSFunction function = new JSFunction(scriptName); function.addParameter(component.getClientId(facesContext)); function.addParameter(getOptions(facesContext, component)); script = createScript(function.toScript()); } return script; }
private DnDScript buildClientScript(FacesContext facesContext, UIComponent component) { DnDScript script = null; String scriptName = getScriptName(); if (!"".equals(scriptName)) { JSFunction function = new JSFunction(scriptName); function.addParameter(component.getClientId(facesContext)); function.addParameter(getOptions(facesContext, component)); script = createScript(function.toScript()); } return script; }
public String createClientScrollableGrid(FacesContext context, UIScrollableDataTable grid) { ScrollableDataTableOptions options = new ScrollableDataTableOptions(grid); options.addOption("normalizedId", getNormalizedId(context, grid)); composite.mergeScriptOptions(options, context, grid); JSFunction function = new JSFunction("new ClientUI.controls.grid.ScrollableGrid"); function.addParameter(options); return function.toScript(); }