@Override public Map<String, Object> getOptions(FacesContext facesContext, UIComponent component) { Map<String, Object> options = new HashMap<String, Object>(); if (component instanceof AbstractDropTarget) { JSReference dragSourceId = new JSReference("dragSourceId"); JSFunctionDefinition function = new JSFunctionDefinition(JSReference.EVENT, dragSourceId); AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(facesContext, component); ajaxFunction.getOptions().setParameter("dragSource", dragSourceId); ajaxFunction.getOptions().setParameter(component.getClientId(facesContext), component.getClientId(facesContext)); ajaxFunction.setSource(new JSReference("event", "target")); ajaxFunction.getOptions().setAjaxComponent(component.getClientId(facesContext)); function.addToBody(ajaxFunction); AbstractDropTarget dropTarget = (AbstractDropTarget) component; Set<String> acceptedTypes = Sets.asSet(dropTarget.getAcceptedTypes()); if (acceptedTypes != null) { if (acceptedTypes.contains("@none")) { acceptedTypes = NONE_SET; } else if (acceptedTypes.contains("@all")) { acceptedTypes = ALL_SET; } } options.put("acceptedTypes", acceptedTypes); options.put("ajaxFunction", function); options.put("parentId", getParentClientId(facesContext, component)); } return options; }
@Override public Map<String, Object> getOptions(FacesContext facesContext, UIComponent component) { Map<String, Object> options = new HashMap<String, Object>(); if (component instanceof AbstractDropTarget) { JSReference dragSourceId = new JSReference("dragSourceId"); JSFunctionDefinition function = new JSFunctionDefinition(JSReference.EVENT, dragSourceId); AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(facesContext, component); ajaxFunction.getOptions().setParameter("dragSource", dragSourceId); ajaxFunction.getOptions().setParameter(component.getClientId(facesContext), component.getClientId(facesContext)); ajaxFunction.setSource(new JSReference("event", "target")); ajaxFunction.getOptions().setAjaxComponent(component.getClientId(facesContext)); function.addToBody(ajaxFunction); AbstractDropTarget dropTarget = (AbstractDropTarget) component; Set<String> acceptedTypes = CoreAjaxRendererUtils.asSimpleSet(dropTarget.getAcceptedTypes()); if (acceptedTypes != null) { if (acceptedTypes.contains("@none")) { acceptedTypes = NONE_SET; } else if (acceptedTypes.contains("@all")) { acceptedTypes = ALL_SET; } } options.put("acceptedTypes", acceptedTypes); options.put("ajaxFunction", function); options.put("parentId", getParentClientId(facesContext, component)); } return options; }
@Override public Map<String, Object> getOptions(FacesContext facesContext, UIComponent component) { Map<String, Object> options = new HashMap<String, Object>(); if (component instanceof AbstractDropTarget) { JSReference dragSourceId = new JSReference("dragSourceId"); JSFunctionDefinition function = new JSFunctionDefinition(JSReference.EVENT, dragSourceId); AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(facesContext, component); ajaxFunction.getOptions().setParameter("dragSource", dragSourceId); ajaxFunction.getOptions().setParameter(component.getClientId(facesContext), component.getClientId(facesContext)); ajaxFunction.setSource(new JSReference("event", "target")); ajaxFunction.getOptions().setAjaxComponent(component.getClientId(facesContext)); function.addToBody(ajaxFunction); AbstractDropTarget dropTarget = (AbstractDropTarget) component; Set<String> acceptedTypes = Sets.asSet(dropTarget.getAcceptedTypes()); if (acceptedTypes != null) { if (acceptedTypes.contains("@none")) { acceptedTypes = NONE_SET; } else if (acceptedTypes.contains("@all")) { acceptedTypes = ALL_SET; } } options.put("acceptedTypes", acceptedTypes); options.put("ajaxFunction", function); options.put("parentId", getParentClientId(facesContext, component)); } return options; }
public static AjaxFunction buildAjaxFunction(ClientBehaviorContext behaviorContext, AjaxClientBehavior behavior) { Object source; AjaxOptions options = buildAjaxOptions(behaviorContext, behavior); if (behaviorContext.getSourceId() != null) { source = behaviorContext.getSourceId(); } else { source = JSReference.THIS; FacesContext facesContext = behaviorContext.getFacesContext(); UIComponent component = behaviorContext.getComponent(); options.setAjaxComponent(component.getClientId(facesContext)); options.set("sourceId", source); } return new AjaxFunction(source, options); }
public static AjaxFunction buildAjaxFunction(ClientBehaviorContext behaviorContext, AjaxClientBehavior behavior) { Object source; AjaxOptions options = buildAjaxOptions(behaviorContext, behavior); if (behaviorContext.getSourceId() != null) { source = behaviorContext.getSourceId(); } else { source = JSReference.THIS; FacesContext facesContext = behaviorContext.getFacesContext(); UIComponent component = behaviorContext.getComponent(); options.setAjaxComponent(component.getClientId(facesContext)); options.set("sourceId", source); } return new AjaxFunction(source, options); }
public static AjaxFunction buildAjaxFunction(ClientBehaviorContext behaviorContext, AjaxClientBehavior behavior) { Object source; AjaxOptions options = buildAjaxOptions(behaviorContext, behavior); if (behaviorContext.getSourceId() != null) { source = behaviorContext.getSourceId(); } else { source = JSReference.THIS; FacesContext facesContext = behaviorContext.getFacesContext(); UIComponent component = behaviorContext.getComponent(); options.setAjaxComponent(component.getClientId(facesContext)); options.set("sourceId", source); } return new AjaxFunction(source, options); }
public AjaxFunction buildAjaxFunction(ClientBehaviorContext behaviorContext, AjaxClientBehavior behavior) { Object source; AjaxOptions options = buildAjaxOptions(behaviorContext, behavior); if (behaviorContext.getSourceId() != null) { source = behaviorContext.getSourceId(); } else { source = JSReference.THIS; FacesContext facesContext = behaviorContext.getFacesContext(); UIComponent component = behaviorContext.getComponent(); options.setAjaxComponent(component.getClientId(facesContext)); options.set("sourceId", source); } if (behavior.isResetValues()) { options.setParameter(AjaxConstants.RESET_VALUES_PARAMETER, true); } return new AjaxFunction(source, options); }