ResponseWriter writer = context.getResponseWriter(); CommandLink link = (CommandLink) component; String clientId = link.getClientId(context); Object label = link.getValue(); if (!link.isDisabled()) { String request; boolean ajax = link.isAjax(); String styleClass = link.getStyleClass(); styleClass = styleClass == null ? CommandLink.STYLE_CLASS : CommandLink.STYLE_CLASS + " " + styleClass; PrimeRequestContext requestContext = PrimeRequestContext.getCurrentInstance(context); boolean csvEnabled = requestContext.getApplicationContext().getConfig().isClientSideValidationEnabled() && link.isValidateClient(); if (link.getOnclick() != null) { onclick.append(link.getOnclick()).append(";"); writer.writeAttribute("href", "#", null); writer.writeAttribute("class", styleClass, null); if (link.getAriaLabel() != null) { writer.writeAttribute(HTML.ARIA_LABEL, link.getAriaLabel(), null); else if (link.getTitle() != null) { writer.writeAttribute(HTML.ARIA_LABEL, link.getTitle(), null); request = csvb.init().source("this").ajax(ajax).process(link, link.getProcess()).update(link, link.getUpdate()).command(request).build(); if (link.requiresConfirmation()) { writer.writeAttribute("data-pfconfirmcommand", onclick.toString(), null); writer.writeAttribute("onclick", link.getConfirmationScript(), "onclick");
@Override public void queueEvent(FacesEvent event) { FacesContext context = getFacesContext(); if (event instanceof AjaxBehaviorEvent) { Map<String, String> params = context.getExternalContext().getRequestParameterMap(); String eventName = params.get(Constants.RequestParams.PARTIAL_BEHAVIOR_EVENT_PARAM); if (eventName.equals("dialogReturn")) { AjaxBehaviorEvent behaviorEvent = (AjaxBehaviorEvent) event; Map<String, Object> session = context.getExternalContext().getSessionMap(); String dcid = params.get(getClientId(context) + "_pfdlgcid"); Object selectedValue = session.get(dcid); session.remove(dcid); event = new SelectEvent(this, behaviorEvent.getBehavior(), selectedValue); super.queueEvent(event); } else if (eventName.equals("click")) { super.queueEvent(event); } } else { super.queueEvent(event); } }
public static <T extends ICrudDataAction<?, ?>, E extends IBaseEntity> CommandLink createCommandLink(T action, E entity, String id, String title, StyleClassMasterType styleClass, String nameMethod, Class<? extends Predicate> predicateRendered, Class<? extends Predicate> predicateDisabled) { CommandLink commandLink = new CommandLink(); commandLink.setId("commandLinkDynamic_" + id); commandLink.setValue(BundleUtils.messageBundle(title)); commandLink.setStyleClass(styleClass.getStyleClass()); commandLink.setStyle(STYLE_COMMANDLINK); commandLink.setUpdate("@composite, @(.base-messageheader)"); commandLink.setOnstart("showMessageProcess(true)"); commandLink.setOnerror("hideMessageProcess(false)"); commandLink.setOncomplete("hideMessageProcess(false)"); String methodExpressionLanguage = "" + "#{" + action.getClass().getSimpleName().substring(0, 1).toLowerCase() + action.getClass().getSimpleName().substring(1) + ".callMethodDynamic('" + nameMethod + "')}"; commandLink.setActionExpression(createMethodExpression(methodExpressionLanguage)); evaluateRenderDisabled(entity, commandLink, predicateRendered, predicateDisabled); return commandLink; }
panel.setStyleClass("ui-widget-header filter-item"); CommandLink link = new CommandLink(); link.setId(id + "-link"); link.setValue(hierarchy.getCaption()); link.setTitle(hierarchy.getUniqueName()); .getExpressionFactory(); link.setActionExpression(factory.createMethodExpression( context.getELContext(), "#{filterHandler.show}", Void.class, new Class<?>[0])); link.setUpdate(":filter-form"); link.setOncomplete("PF('filterDialog').show();"); parameter.setValue(hierarchy.getName()); link.getChildren().add(parameter);
@Override public void queueEvent(FacesEvent event) { FacesContext context = getFacesContext(); if(event instanceof AjaxBehaviorEvent) { Map<String,String> params = context.getExternalContext().getRequestParameterMap(); String eventName = params.get(Constants.RequestParams.PARTIAL_BEHAVIOR_EVENT_PARAM); if(eventName.equals("dialogReturn")) { AjaxBehaviorEvent behaviorEvent = (AjaxBehaviorEvent) event; Map<String,Object> session = context.getExternalContext().getSessionMap(); String dcid = params.get(this.getClientId(context) + "_pfdlgcid"); Object selectedValue = session.get(dcid); session.remove(dcid); event = new SelectEvent(this, behaviorEvent.getBehavior(), selectedValue); super.queueEvent(event); } else if(eventName.equals("click")) { super.queueEvent(event); } } else { super.queueEvent(event); } }
ResponseWriter writer = context.getResponseWriter(); CommandLink link = (CommandLink) component; String clientId = link.getClientId(context); Object label = link.getValue(); if (!link.isDisabled()) { String request; boolean ajax = link.isAjax(); String styleClass = link.getStyleClass(); styleClass = styleClass == null ? CommandLink.STYLE_CLASS : CommandLink.STYLE_CLASS + " " + styleClass; RequestContext requestContext = RequestContext.getCurrentInstance(context); boolean csvEnabled = requestContext.getApplicationContext().getConfig().isClientSideValidationEnabled() && link.isValidateClient(); if (link.getOnclick() != null) { onclick.append(link.getOnclick()).append(";"); writer.writeAttribute("href", "#", null); writer.writeAttribute("class", styleClass, null); if (link.getTitle() != null) { writer.writeAttribute("aria-label", link.getTitle(), null); request = csvb.init().source("this").ajax(ajax).process(link, link.getProcess()).update(link, link.getUpdate()).command(request).build(); if (link.requiresConfirmation()) { writer.writeAttribute("data-pfconfirmcommand", onclick.toString(), null); writer.writeAttribute("onclick", link.getConfirmationScript(), "onclick"); String styleClass = link.getStyleClass(); styleClass = styleClass == null ? CommandLink.DISABLED_STYLE_CLASS : CommandLink.DISABLED_STYLE_CLASS + " " + styleClass;