Package org.openfaces.component.input

Examples of org.openfaces.component.input.SingleFileUpload


    private static final String DEFAULT_UPLOADED_MIN_URL = "output/uploadedProgressBarMin.png";
    private SingleFileUploadLayoutMode layoutMode;

    @Override
    protected void writeStructure(FacesContext context, AbstractFileUpload abstractFileUpload, ResponseWriter writer, String clientId) throws IOException {
        SingleFileUpload fileUpload = (SingleFileUpload) abstractFileUpload;
        layoutMode = fileUpload.getLayoutMode();
        setLayoutSettings(fileUpload, layoutMode);
        boolean showInPopup = fileUpload.getShowInPopup();
        boolean hasExternalBrowseButton = fileUpload.getExternalBrowseButton() != null;

        String defaultStyleClass = (layoutMode == SingleFileUploadLayoutMode.FULL ? "o_s_file_upload" : "o_s_file_upload_compact")
                + (showInPopup ? " o_file_upload_popup" : "");
        Rendering.writeStyleAndClassAttributes(writer, fileUpload.getStyle(), fileUpload.getStyleClass(),
                defaultStyleClass);

        writer.startElement("table", fileUpload);
        writer.writeAttribute("style", "width:100%", null);
View Full Code Here


        return null;
    }

    @Override
    protected void encodeScriptAndStyles(FacesContext context, AbstractFileUpload abstractFileUpload, String clientId, String uniqueId) throws IOException {
        SingleFileUpload fileUpload = (SingleFileUpload) abstractFileUpload;
        String addButtonClass = Styles.getCSSClass(context, fileUpload, fileUpload.getBrowseButtonStyle(), StyleGroup.regularStyleGroup(), fileUpload.getBrowseButtonClass(), null);
        String addButtonOnMouseOverClass = Styles.getCSSClass(context, fileUpload, fileUpload.getBrowseButtonRolloverStyle(), StyleGroup.regularStyleGroup(), fileUpload.getBrowseButtonRolloverClass(), null);
        String addButtonOnMouseDownClass = Styles.getCSSClass(context, fileUpload, fileUpload.getBrowseButtonPressedStyle(), StyleGroup.regularStyleGroup(), fileUpload.getBrowseButtonPressedClass(), null);
        String addButtonOnFocusClass = Styles.getCSSClass(context, fileUpload, fileUpload.getBrowseButtonFocusedStyle(), StyleGroup.regularStyleGroup(), fileUpload.getBrowseButtonFocusedClass(), null);
        String addButtonDisabledClass = Styles.getCSSClass(context, fileUpload, fileUpload.getBrowseButtonDisabledStyle(), StyleGroup.regularStyleGroup(), fileUpload.getBrowseButtonDisabledClass(), "o_file_upload_addBtn_dis");
        String dropTargetDragoverClass = Styles.getCSSClass(context, fileUpload, fileUpload.getDropTargetDragoverStyle(), StyleGroup.regularStyleGroup(), fileUpload.getDropTargetDragoverClass(), "o_file_drop_target_dragover");
        Styles.renderStyleClasses(context, fileUpload);

        int uploadedSize = 0;
        boolean duplicateAllowed = true;//fileUpload.isDuplicateAllowed();

        Position popupPosition = fileUpload.getPosition();

        List<String> listOfImages = new LinkedList<String>();
        String defStopUrl = null;
        if (fileUpload.getStopButtonNearProgress()) {
            if (stopButton == null) {
                defStopUrl = Resources.getURL(context, null, null, DEFAULT_STOP_URL);
                listOfImages.add(defStopUrl);
                Rendering.renderPreloadImagesScript(context, listOfImages, false);
            }
        }
        Script initScript = new ScriptBuilder().initScript(context, fileUpload, "O$.SingleFileUpload._init",
                uploadedSize,
                fileUpload.getNotUploadedStatusText(),
                fileUpload.getInProgressStatusText(),
                fileUpload.getUploadedStatusText(),
                fileUpload.getFileSizeLimitErrorText(),
                fileUpload.getUnexpectedErrorText(),
                fileUpload.getAcceptedFileTypes(),
                duplicateAllowed,
                clientId + BROWSE_BTN_ID,
                addButtonClass,
                addButtonOnMouseOverClass,
                addButtonOnMouseDownClass,
                addButtonOnFocusClass,
                addButtonDisabledClass,
                fileUpload.isDisabled(),
                fileUpload.getTabindex(),
                progressBar.getClientId(context),
                fileUpload.getStoppedStatusText(),
                fileUpload.getStoppingStatusText(),
                uniqueId,
                Utilities.getFunctionOfEvent(fileUpload.getOnchange()),
                Utilities.getFunctionOfEvent(fileUpload.getOnstart()),
                Utilities.getFunctionOfEvent(fileUpload.getOnend()),
                Utilities.getFunctionOfEvent(fileUpload.getOnfilestart()),
                Utilities.getFunctionOfEvent(fileUpload.getOnfileinprogress()),
                Utilities.getFunctionOfEvent(fileUpload.getOnfileend()),
                Utilities.getFunctionOfEvent(fileUpload.getOnwrongfiletype()),
                Utilities.getFunctionOfEvent(fileUpload.getOndirectorydropped()),
                dropTargetDragoverClass,
                getRender(context, fileUpload),
                getExternalDropTargetId(context, fileUpload),
                fileUpload.getAcceptedMimeTypes(),
                fileUpload.getLayoutMode(),
                defStopUrl,
                getIconStyle(fileUpload, layoutMode),
                fileUpload.getShowInfoAfterUpload(),
                fileUpload.getBrowseButtonDuringUpload(),
                fileUpload.getStopButtonNearProgress(),
                fileUpload.getDirectoryDroppedText(),
                fileUpload.getWrongFileTypeText(),
                getExternalButtonId(context, fileUpload),
                fileUpload.getShowInPopup(),
                getPositionedBy(context, fileUpload),
                popupPosition.getHorizontalAlignment(),
                popupPosition.getVerticalAlignment(),
                popupPosition.getHorizontalDistance(),
                popupPosition.getVerticalDistance()
View Full Code Here

    }

    @Override
    protected void writeHelpfulButtons(FacesContext context, AbstractFileUpload abstractFileUpload, ResponseWriter
            writer, String elementId) throws IOException {
        SingleFileUpload fileUpload = (SingleFileUpload) abstractFileUpload;
        if (fileUpload.getStopButtonNearProgress() && fileUpload.getBrowseButtonDuringUpload() != SingleFileUploadBtnBehavior.SHOW_STOP) {
            facetRenderer.writeDivByDefault(stopButton, elementId + STOP_BTN_CONTAINER, "", getIconStyle(fileUpload, layoutMode));
        } else {
            String stopButtonClass = (fileUpload.getShowInPopup() || fileUpload.getExternalBrowseButton() != null )
                    ? "o_s_close_popup_btn" : "o_s_file_clear_btn";
            facetRenderer.writeButtonByDefault(stopButton, elementId + STOP_BTN_CONTAINER, abstractFileUpload.getStopButtonText(), stopButtonClass);
        }
        if (abstractFileUpload.getShowInPopup())
            facetRenderer.writeButtonByDefault(closeButton, elementId + CLOSE_BTN_CONTAINER, fileUpload.getCloseButtonText(), "o_s_close_popup_btn");
    }
View Full Code Here

TOP

Related Classes of org.openfaces.component.input.SingleFileUpload

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.