Package javax.faces.component.html

Examples of javax.faces.component.html.HtmlOutputText


    public void renderView() {
        HtmlDiv constraintEditorDiv = new HtmlDiv();
        constraintEditorDiv.setId("constraintEditor" + UUID.randomUUID().toString());
        HtmlDiv constraintHeader = new HtmlDiv();
        constraintHeader.setStyle("text-align: center; border-bottom: 1px solid black;");
        HtmlOutputText output = new HtmlOutputText();
        output.setValue(properties.getValues());
        output.setTransient(true);
        constraintHeader.getChildren().add(output);
        getChildren().add(constraintHeader);
        if (getProperties().getRenderEditor()) {
            HtmlOutputText show = new HtmlOutputText();
            show.setEscape(false);
            String showStyle = "";
            if (getProperties().getMaximise()) {
                showStyle = "display:none;";
            }
            String showLinkId = "link" + UUID.randomUUID().toString();
            String hideLinkId = "link" + UUID.randomUUID().toString();
            show.setValue("<a style=\"" + showStyle + "\" class=\"max\" "
                    + "id=\"" + showLinkId + "\" href=\"#\" onclick=\"$('#" + constraintEditorDiv.getId() + "').show("
                    + "{complete:function(){"
                    + "$('#" + showLinkId + "').hide();"
                    + "$('#" + hideLinkId + "').show();"
                    + "}});\"></a>");
            String hideStyle = "display:none;";
            if (getProperties().getMaximise()) {
                hideStyle = "";
            }
            HtmlOutputText hide = new HtmlOutputText();
            hide.setEscape(false);
            hide.setValue("<a style=\"" + hideStyle + "\" class=\"min\""
                    + "id=\"" + hideLinkId + "\" href=\"#\" onclick=\"$('#" + constraintEditorDiv.getId() + "').hide("
                    + "{complete:function(){"
                    + "$('#" + showLinkId + "').show();"
                    + "$('#" + hideLinkId + "').hide();"
                    + "}});\"></a>");
            getChildren().add(show);
            getChildren().add(hide);
            constraintEditorDiv.setStyle("text-align:center;font-size:10pt;" + hideStyle);
            output = new HtmlOutputText();
            output.setEscape(false);
            output.setValue(Messages.getStringJSF("constraint.info.new") + "<br />");
            constraintEditorDiv.getChildren().add(output);
            HtmlPanelGrid panel = new HtmlPanelGrid();
            panel.setStyle("font-size:10pt;text-align:left;");
            panel.setColumns(2);
            if (workflowStates != null) {
                HtmlOutputText outputWorkflowState = new HtmlOutputText();
                outputWorkflowState.setValue(Messages.getStringJSF("constraint.info.workflowState"));
                panel.getChildren().add(outputWorkflowState);
                HtmlSelectOneMenu select = new HtmlSelectOneMenu();
                UISelectItem item = new UISelectItem();
                item.setItemValue(null);
                item.setItemLabel(Messages.getStringJSF("constraint.workflowstate.all"));
                select.getChildren().add(item);
                select.setId("workflowState" + getItemUuid());
                for (WorkflowState workflowState : workflowStates) {
                    item = new UISelectItem();
                    item.setItemValue(workflowState.getUuid());
                    item.setItemLabel(workflowState.getDisplayName());
                    select.getChildren().add(item);
                }
                panel.getChildren().add(select);
            }
            HtmlOutputText outputConstraintType = new HtmlOutputText();
            outputConstraintType.setValue(Messages.getStringJSF("constraint.info.constraintType"));
            panel.getChildren().add(outputConstraintType);
            HtmlSelectOneMenu select = new HtmlSelectOneMenu();
            select.setId("constraintType" + getItemUuid());
            for (ConstraintType constraintType : ConstraintType.values()) {
                if (constraintType != ConstraintType.DEFAULT) {
                    UISelectItem item = new UISelectItem();
                    item.setItemValue(constraintType);
                    item.setItemLabel(Messages.getStringJSF("ConstraintType." + constraintType.name()));
                    select.getChildren().add(item);
                }
            }
            panel.getChildren().add(select);
            if (constraintClients != null) {
                HtmlOutputText outputConstraintClient = new HtmlOutputText();
                outputConstraintClient.setValue(Messages.getStringJSF("constraint.info.constraintClient"));
                panel.getChildren().add(outputConstraintClient);
                select = new HtmlSelectOneMenu();
                select.setId("constraintClient" + getItemUuid());
                UISelectItem item = new UISelectItem();
                item.setItemValue(null);
                item.setItemLabel(Messages.getStringJSF("constraint.constraintclient.all"));
                select.getChildren().add(item);
                for (ConstraintClient constraintClient : constraintClients) {
                    item = new UISelectItem();
                    item.setItemValue(constraintClient.getUuid());
                    item.setItemLabel(constraintClient.getDisplayName());
                    select.getChildren().add(item);
                }
                panel.getChildren().add(select);
            }
            HtmlOutputText empty = new HtmlOutputText();
            panel.getChildren().add(empty);
            HtmlOutputText save = new HtmlOutputText();
            save.setEscape(false);
            save.setValue("<button href=\"#\" onclick=\"addConstraint('" + getItemUuid() + "','" + getItemUuid() + "');\">"
                    + Messages.getStringJSF("constraint.button.add")
                    + "</button>");
            panel.getChildren().add(save);
            constraintEditorDiv.getChildren().add(panel);
            HtmlPanelGrid listPanel = new HtmlPanelGrid();
            listPanel.setStyle("font-size:10pt;text-align:left;");
            int columns = 7;
            if (workflowStates == null) {
                columns = columns - 2;
            }
            if (constraintClients == null) {
                columns = columns - 2;
            }
            listPanel.setColumns(columns);
            if (constraints != null) {
                if (!constraints.isEmpty()) {
                    output = new HtmlOutputText();
                    output.setEscape(false);
                    output.setValue("<br />" + Messages.getStringJSF("constraint.info.current") + "<br />");
                    constraintEditorDiv.getChildren().add(output);
                }
                for (Constraint constraint : constraints) {
                    if (workflowStates != null) {
                        HtmlOutputText tmpOutput = new HtmlOutputText();
                        if (constraint.getWorkflowState() != null) {
                            tmpOutput.setValue(constraint.getWorkflowState().getDisplayName() + ",");
                        } else {
                            tmpOutput.setValue(Messages.getStringJSF("constraint.workflowstate.all") + ",");
                        }
                        HtmlOutputText outputWorkflowState = new HtmlOutputText();
                        outputWorkflowState.setValue(Messages.getStringJSF("constraint.info.workflowState"));
                        listPanel.getChildren().add(outputWorkflowState);
                        listPanel.getChildren().add(tmpOutput);
                    }
                    HtmlOutputText tmpOutput = new HtmlOutputText();
                    String comma = ",";
                    if (constraintClients == null) {
                        comma = "";
                    }
                    tmpOutput.setValue(Messages.getStringJSF("ConstraintType." + constraint.getConstraintType().name()) + comma);
                    outputConstraintType = new HtmlOutputText();
                    outputConstraintType.setValue(Messages.getStringJSF("constraint.info.constraintType"));
                    listPanel.getChildren().add(outputConstraintType);
                    listPanel.getChildren().add(tmpOutput);
                    if (constraintClients != null) {
                        tmpOutput = new HtmlOutputText();
                        if (constraint.getConstraintClient() != null) {
                            tmpOutput.setValue(constraint.getConstraintClient().getDisplayName());
                        } else {
                            tmpOutput.setValue(Messages.getStringJSF("constraint.constraintclient.all"));
                        }
                        HtmlOutputText outputConstraintClient = new HtmlOutputText();
                        outputConstraintClient.setValue(Messages.getStringJSF("constraint.info.constraintClient"));
                        listPanel.getChildren().add(outputConstraintClient);
                        listPanel.getChildren().add(tmpOutput);
                    }
                    tmpOutput = new HtmlOutputText();
                    tmpOutput.setEscape(false);
                    tmpOutput.setValue("<div class=\"deleteConstraint\" onclick=\"deleteConstraint('" + constraint.hashCode() + "','" + getItemUuid() + "');\"></div>");
                    listPanel.getChildren().add(tmpOutput);
                }
            }
View Full Code Here


                li.setTransient(true);
                formBuilder.getFormContent().getChildren().add(li);
            }
        } else {
            formBuilder.getChildren().clear();
            HtmlOutputText output = new HtmlOutputText();
            output.setValue("ERROR: Model of form builder is null.");
            formBuilder.getChildren().add(output);
        }
    }
View Full Code Here

    public static String getFormContentStringId(UIComponent component) {
        return getForm(component).getId() + Constants.sep + FormBuilderInternal.FORMCONTENTSTRING;
    }

    private void addPlaceholder(FormBuilderInternal formBuilder) {
        HtmlOutputText placeholderText = new HtmlOutputText();
        placeholderText.setValue(Messages.getStringJSF("emptyform.info"));

        HtmlListItem placeholder = new HtmlListItem();
        placeholder.setClassString("placeholder");
        placeholder.getChildren().add(placeholderText);
        placeholder.setTransient(true);
View Full Code Here

       
    }

    @Override
    public void renderView() {
        HtmlOutputText output = new HtmlOutputText();
        output.setValue("<hr />");
        output.setEscape(false);
        output.setTransient(true);
        getChildren().add(output);
    }
View Full Code Here

*/
public class HtmlFormBuilderImage extends HtmlFormBuilderItem {

    @Override
    public void renderView() {
        HtmlOutputText output = new HtmlOutputText();
        output.setValue(Messages.getStringJSF("image.label.default"));

        if (properties.getFile() == null || properties.getFile().getFilesize() == 0) {
            HtmlInputFile input = new HtmlInputFile();
            input.setId("image" + getItemUuid());
            addLabeledComponent(output, input);
View Full Code Here

        HtmlPanelGrid panelGrid = new HtmlPanelGrid();
        panelGrid.setColumns(2);
        Collection<FormDataResult> formDataResults = FormDataResultFactory.getFormDataResults(formDatasResult.getFormDatas());
        for(FormDataResult formDataResult : formDataResults) {
            String description = formDataResult.getFormBuilderItem().getProperties().getLabel();
            HtmlOutputText descriptionHtmlOutputText = new HtmlOutputText();
            descriptionHtmlOutputText.setValue(description);
            panelGrid.getChildren().add(descriptionHtmlOutputText);
            if(formDataResult instanceof FormDataPieChartResult) {
                FormDataResultPieChart pieChartComponent = new FormDataResultPieChart();
                pieChartComponent.setPieChart((FormDataPieChartResult)formDataResult);
                panelGrid.getChildren().add(pieChartComponent);
View Full Code Here

            throws IOException
    {
        Converter converter = getConverter(component);
        Application application = facesContext.getApplication();

        HtmlOutputText text
                = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
        text.setValue(content);
        text.setId(component.getId() + "_" + valueForLink.getTime() + "_text");
        text.setTransient(true);

        HtmlInputCalendar calendar = (HtmlInputCalendar)component;
        if (isDisabled(facesContext, component) || calendar.isReadonly())
        {
            component.getChildren().add(text);
View Full Code Here

        Assert.assertNotNull(panelGroup1);
        UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
        Assert.assertNotNull(compositeComponent1);
        UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
        Assert.assertNotNull(facet1);
        HtmlOutputText text1 = (HtmlOutputText) facet1.findComponent("text");
        Assert.assertNotNull(text1);
       
        compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
        facet1.pushComponentToEL(facesContext, facet1);
        text1.pushComponentToEL(facesContext, text1);
        //set on tag
        Assert.assertEquals("class1", text1.getStyleClass());
        //set as default
        Assert.assertEquals("background:red", text1.getStyle());
        //Check coercion of attribute using type value
        Assert.assertEquals(5, compositeComponent1.getAttributes().get("index"));
        //Check default coercion
        ValueExpression ve = facesContext.getApplication().getExpressionFactory().createValueExpression(
                facesContext.getELContext(), "#{cc.attrs.cols}", Object.class);
        Assert.assertEquals(1, ve.getValue(facesContext.getELContext()));
        text1.popComponentFromEL(facesContext);
        facet1.popComponentFromEL(facesContext);
        compositeComponent1.popComponentFromEL(facesContext);
       
        UIComponent panelGroup2 = root.findComponent("testGroup2");
        Assert.assertNotNull(panelGroup2);
        UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
        Assert.assertNotNull(compositeComponent2);
        UIComponent facet2 = compositeComponent2.getFacet(UIComponent.COMPOSITE_FACET_NAME);
        Assert.assertNotNull(facet2);       
        HtmlOutputText text2 = (HtmlOutputText) facet2.findComponent("text");
        Assert.assertNotNull(text2);
       
        compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
        facet2.pushComponentToEL(facesContext, facet2);
        text2.pushComponentToEL(facesContext, text2);
        //set on tag
        Assert.assertEquals("background:green", text2.getStyle());
        // not set, should return null, but since there is a ValueExpression indirection,
        // coercing rules apply here, so null is converted as ""
        Assert.assertEquals("", text2.getStyleClass());
        text2.popComponentFromEL(facesContext);
        facet2.popComponentFromEL(facesContext);
        compositeComponent2.popComponentFromEL(facesContext);

        StringWriter sw = new StringWriter();
        MockResponseWriter mrw = new MockResponseWriter(sw);
View Full Code Here

        // required
        if (required)
        {
            HtmlPanelGroup span = new HtmlPanelGroup();
            span.setStyleClass("required");
            HtmlOutputText text = new HtmlOutputText();
            text.setValue("*");
            span.getChildren().add(text);
            label.getChildren().add(span);
        }

        return label;
View Full Code Here

        link.setImmediate(true);
        //link.addActionListener(new ChangeCollapsedHandler());

        List children = link.getChildren();
        // Create the indicator. You could later make this conditional and render optional images instead
        HtmlOutputText uiText = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
        uiText.setTransient(true);
        uiText.setValue(collapsiblePanel.isCollapsed() ? "&gt;" : "&#957;");
        uiText.setEscape(false);
        uiText.setStyleClass(collapsiblePanel.getStyleClass());
        uiText.setStyle(collapsiblePanel.getStyle());
        children.add(uiText);
       
        // Create the optional label
        String label = collapsiblePanel.getValue();
        if (label != null) {
          uiText = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
          uiText.setTransient(true);
          uiText.setValue(" " + label);
          uiText.setStyleClass(collapsiblePanel.getStyleClass());
          uiText.setStyle(collapsiblePanel.getStyle());
          children.add(uiText);
        }
        return link;
    }
View Full Code Here

TOP

Related Classes of javax.faces.component.html.HtmlOutputText

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.