Package com.liferay.faces.bridge.component.primefaces

Examples of com.liferay.faces.bridge.component.primefaces.PrimeFacesFileUpload


    if (isMultiPartForm(uiComponent)) {
      boolean hasPrimeFacesAjaxFileUploadChild = false;
      UIComponent childComponent = getChildWithRendererType(uiComponent, PrimeFacesFileUpload.RENDERER_TYPE);

      if (childComponent != null) {
        PrimeFacesFileUpload primeFacesFileUpload = new PrimeFacesFileUpload((UIInput) childComponent);

        if (!primeFacesFileUpload.getMode().equals(PrimeFacesFileUpload.MODE_SIMPLE)) {
          hasPrimeFacesAjaxFileUploadChild = true;
          facesContext.getAttributes().put(PrimeFacesFileUpload.AJAX_FILE_UPLOAD, Boolean.TRUE);
        }
      }
View Full Code Here


            Constructor<?> constructor = defaultUploadedFileClass.getDeclaredConstructor(FileItem.class);
            Object defaultUploadedFile = constructor.newInstance(fileItem);

            // If the PrimeFaces FileUpload component is in "simple" mode, then simply set the submitted
            // value of the component to the DefaultUploadedFile instance.
            PrimeFacesFileUpload primeFacesFileUpload = new PrimeFacesFileUpload((UIInput) uiComponent);

            if (primeFacesFileUpload.getMode().equals(PrimeFacesFileUpload.MODE_SIMPLE)) {
              logger.debug("Setting submittedValue=[{0}]", submittedValue);
              primeFacesFileUpload.setSubmittedValue(defaultUploadedFile);
            }

            // Otherwise,
            else {
              logger.debug("Queuing FileUploadEvent for submittedValue=[{0}]", submittedValue);

              // Reflectively create an instance of the PrimeFaces FileUploadEvent class.
              Class<?> uploadedFileClass = Class.forName(FQCN_UPLOADED_FILE);
              Class<?> fileUploadEventClass = Class.forName(FQCN_FILE_UPLOAD_EVENT);
              constructor = fileUploadEventClass.getConstructor(UIComponent.class, uploadedFileClass);

              FacesEvent fileUploadEvent = (FacesEvent) constructor.newInstance(uiComponent,
                  defaultUploadedFile);

              // Queue the event.
              primeFacesFileUpload.queueEvent(fileUploadEvent);
            }
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of com.liferay.faces.bridge.component.primefaces.PrimeFacesFileUpload

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.