Refine search
protected String exportColumnByFunction(FacesContext context, org.primefaces.component.api.UIColumn column) { MethodExpression exportFunction = column.getExportFunction(); if (exportFunction != null) { return (String) exportFunction.invoke(context.getELContext(), new Object[]{column}); } return ""; }
@Override public void processAjaxBehavior(AjaxBehaviorEvent event) throws AbortProcessingException { FacesContext context = FacesContext.getCurrentInstance(); final ELContext elContext = context.getELContext(); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Try to invoke listener: " + listener.getExpressionString()); } try { listener.invoke(elContext, new Object[]{}); } catch (MethodNotFoundException | IllegalArgumentException | ArrayIndexOutOfBoundsException mnfe) { processArgListener(context, elContext, event); } }
@Override public void export(FacesContext context, List<String> clientIds, String filename, boolean pageOnly, boolean selectionOnly, String encodingType, MethodExpression preProcessor, MethodExpression postProcessor, ExporterOptions options, MethodExpression onTableRender) throws IOException { Workbook wb = createWorkBook(); if (preProcessor != null) { preProcessor.invoke(context.getELContext(), new Object[]{wb}); } VisitContext visitContext = VisitContext.createVisitContext(context, clientIds, null); VisitCallback visitCallback = new ExcelExportVisitCallback(this, wb, pageOnly, selectionOnly); context.getViewRoot().visitTree(visitContext, visitCallback); if (postProcessor != null) { postProcessor.invoke(context.getELContext(), new Object[]{wb}); } writeExcelToResponse(context.getExternalContext(), wb, filename); }
@Override public void broadcast(javax.faces.event.FacesEvent event) throws javax.faces.event.AbortProcessingException { super.broadcast(event); FacesContext facesContext = getFacesContext(); MethodExpression me = getFileUploadListener(); if (me != null && event instanceof org.primefaces.event.FileUploadEvent) { me.invoke(facesContext.getELContext(), new Object[]{event}); } } }
protected void encodeSummaryRow(FacesContext context, DataTable table, SummaryRow summaryRow) throws IOException { MethodExpression me = summaryRow.getListener(); if (me != null) { me.invoke(context.getELContext(), new Object[]{table.getSortBy()}); } summaryRow.encodeAll(context); }
@Override public void broadcast(javax.faces.event.FacesEvent event) throws javax.faces.event.AbortProcessingException { super.broadcast(event); FacesContext facesContext = getFacesContext(); MethodExpression me = getListener(); if (me != null && event instanceof org.primefaces.event.CaptureEvent) { me.invoke(facesContext.getELContext(), new Object[]{event}); } } }
protected void handleCommand(FacesContext context, Terminal terminal) throws IOException { String[] tokens = getValueTokens(context, terminal); String command = tokens[0]; String[] args = Arrays.copyOfRange(tokens, 1, tokens.length); MethodExpression commandHandler = terminal.getCommandHandler(); String result = (String) commandHandler.invoke(context.getELContext(), new Object[]{command, args}); ResponseWriter writer = context.getResponseWriter(); writer.writeText(result, null); }
Object value1 = sortBy.getValue(context.getELContext()); context.getExternalContext().getRequestMap().put(var, obj2); Object value2 = sortBy.getValue(context.getELContext()); result = (Integer) sortFunction.invoke(context.getELContext(), new Object[]{value1, value2});
Object value1 = sortBy.getValue(context.getELContext()); context.getExternalContext().getRequestMap().put(var, ((TreeNode) obj2).getData()); Object value2 = sortBy.getValue(context.getELContext()); result = (Integer) sortFunction.invoke(context.getELContext(), new Object[]{value1, value2});
preProcessor.invoke(context.getELContext(), new Object[]{builder}); postProcessor.invoke(context.getELContext(), new Object[]{builder});
@Override public void broadcast(javax.faces.event.FacesEvent event) throws javax.faces.event.AbortProcessingException { super.broadcast(event); FacesContext facesContext = getFacesContext(); MethodExpression me = getCompleteMethod(); if (me != null && event instanceof org.primefaces.event.AutoCompleteEvent) { suggestions = (List) me.invoke(facesContext.getELContext(), new Object[]{((org.primefaces.event.AutoCompleteEvent) event).getQuery()}); if (suggestions == null) { suggestions = new ArrayList(); } facesContext.renderResponse(); } }
@Override public void broadcast(javax.faces.event.FacesEvent event) throws javax.faces.event.AbortProcessingException { super.broadcast(event); FacesContext facesContext = getFacesContext(); MethodExpression me = getCompleteMethod(); if (me != null && event instanceof org.primefaces.event.AutoCompleteEvent) { suggestions = (List) me.invoke(facesContext.getELContext(), new Object[]{((org.primefaces.event.AutoCompleteEvent) event).getQuery()}); if (suggestions == null) { suggestions = new ArrayList(); } facesContext.renderResponse(); } }
preProcessor.invoke(context.getELContext(), new Object[]{builder}); postProcessor.invoke(context.getELContext(), new Object[]{builder});
@Override public void decode(FacesContext context, DataTable table) { MethodExpression me = table.getDraggableRowsFunction(); if (me != null) { me.invoke(context.getELContext(), new Object[]{table}); } else { Map<String, String> params = context.getExternalContext().getRequestParameterMap(); String clientId = table.getClientId(context); int fromIndex = Integer.parseInt(params.get(clientId + "_fromIndex")); int toIndex = Integer.parseInt(params.get(clientId + "_toIndex")); table.setRowIndex(fromIndex); Object value = table.getValue(); if (value instanceof List) { List list = (List) value; if (toIndex >= fromIndex) { Collections.rotate(list.subList(fromIndex, toIndex + 1), -1); } else { Collections.rotate(list.subList(toIndex, fromIndex + 1), 1); } } else { LOGGER.info("Row reordering is only available for list backed datatables, " + "use rowReorder ajax behavior with listener for manual handling of model update."); } } }
@Override public void export(FacesContext context, String filename, List<DataTable> tables, boolean pageOnly, boolean selectionOnly, String encodingType, MethodExpression preProcessor, MethodExpression postProcessor, ExporterOptions options, MethodExpression onTableRender) throws IOException { Workbook wb = createWorkBook(); if (preProcessor != null) { preProcessor.invoke(context.getELContext(), new Object[]{wb}); } for (int i = 0; i < tables.size(); i++) { DataTable table = tables.get(i); String sheetName = getSheetName(context, table); if (sheetName == null) { sheetName = table.getId(); } sheetName = WorkbookUtil.createSafeSheetName(sheetName); if (sheetName.equals("empty") || sheetName.equals("null")) { sheetName = "Sheet" + String.valueOf(i + 1); } Sheet sheet = createSheet(wb, sheetName); applyOptions(wb, table, sheet, options); exportTable(context, table, sheet, pageOnly, selectionOnly); for (int j = 0; j < table.getColumnsCount(); j++) { sheet.autoSizeColumn((short) j); } } if (postProcessor != null) { postProcessor.invoke(context.getELContext(), new Object[]{wb}); } writeExcelToResponse(context.getExternalContext(), wb, filename); }
@Override public void broadcast(javax.faces.event.FacesEvent event) throws javax.faces.event.AbortProcessingException { super.broadcast(event); //backward compatibility FacesContext facesContext = getFacesContext(); MethodExpression me = getListener(); if (me != null) { me.invoke(facesContext.getELContext(), new Object[]{}); } ValueExpression expr = getValueExpression(PropertyKeys.stop.toString()); if (expr != null) { Boolean stop = (Boolean) expr.getValue(facesContext.getELContext()); if (Boolean.TRUE.equals(stop)) { String widgetVar = resolveWidgetVar(); PrimeFaces.current().executeScript("PF('" + widgetVar + "').stop();"); } } }
@Override public void export(FacesContext context, DataTable table, String filename, boolean pageOnly, boolean selectionOnly, String encodingType, MethodExpression preProcessor, MethodExpression postProcessor, ExporterOptions options, MethodExpression onTableRender) throws IOException { try { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); this.onTableRender = onTableRender; if (preProcessor != null) { preProcessor.invoke(context.getELContext(), new Object[]{document}); } if (!document.isOpen()) { document.open(); } if (options != null) { expOptions = options; } document.add(exportPDFTable(context, table, pageOnly, selectionOnly, encodingType)); if (postProcessor != null) { postProcessor.invoke(context.getELContext(), new Object[]{document}); } document.close(); writePDFToResponse(context.getExternalContext(), baos, filename); } catch (DocumentException e) { throw new IOException(e.getMessage()); } }
@Override public void export(FacesContext context, DataTable table, String filename, boolean pageOnly, boolean selectionOnly, String encodingType, MethodExpression preProcessor, MethodExpression postProcessor, ExporterOptions options, MethodExpression onTableRender) throws IOException { Workbook wb = createWorkBook(); String sheetName = getSheetName(context, table); if (sheetName == null) { sheetName = table.getId(); } sheetName = WorkbookUtil.createSafeSheetName(sheetName); if (sheetName.equals("empty") || sheetName.equals("null")) { sheetName = "Sheet"; } Sheet sheet = createSheet(wb, sheetName); if (preProcessor != null) { preProcessor.invoke(context.getELContext(), new Object[]{wb}); } applyOptions(wb, table, sheet, options); exportTable(context, table, sheet, pageOnly, selectionOnly); for (int i = 0; i < table.getColumnsCount(); i++) { sheet.autoSizeColumn((short) i); } if (postProcessor != null) { postProcessor.invoke(context.getELContext(), new Object[]{wb}); } writeExcelToResponse(context.getExternalContext(), wb, filename); }
@Override public void broadcast(FacesEvent event) throws AbortProcessingException { super.broadcast(event); if (event instanceof TabEvent) { MethodExpression me = getTabController(); if (me != null) { boolean retVal = (Boolean) me.invoke(getFacesContext().getELContext(), new Object[]{event}); PrimeFaces.current().ajax().addCallbackParam("access", retVal); } } } }
preProcessor.invoke(context.getELContext(), new Object[]{document}); postProcessor.invoke(context.getELContext(), new Object[]{document});