Package org.openfaces.component.output

Examples of org.openfaces.component.output.LevelIndicator


        setDoubleProperty(component, "inactiveSegmentIntensity");
    }

    private void validateAndSetColorsProperty(UIComponent component, String colorsPropertyValue) {
        LevelIndicator levelIndicator = (LevelIndicator) component;
        Collection<String> colors = new ArrayList<String>();
        String[] colorsArray = colorsPropertyValue.split(",");

        for (String color : colorsArray) {
            try {
                colors.add(CSSUtil.normalizeCssColor(color));
            } catch (Exception e) {
                throw new IllegalArgumentException("'colors' attribute of <o:levelIndicator> tag should contain either an array or a collection of color representation strings, but the following value encountered: " + color);
            }
        }

        levelIndicator.setColors(colors);
    }
View Full Code Here


        levelIndicator.setColors(colors);
    }

    private void validateAndSetTransitionLevelsProperty(UIComponent component, String transitionLevelsPropertyValue) {
        LevelIndicator levelIndicator = (LevelIndicator) component;

        String[] transitionLevels = transitionLevelsPropertyValue.split(",");
        Collection<Double> levels = new ArrayList<Double>();

        for (String level : transitionLevels) {
            try {
                final double levelDoubleValue = Double.parseDouble(level);
                levels.add(levelDoubleValue);
            } catch (NumberFormatException e) {
                throw new IllegalArgumentException("'transitionLevels' attribute of <o:levelIndicator> tag should contain either an array or a collection of double values, but the following value encountered: " + level);
            }
        }

        levelIndicator.setTransitionLevels(levels);
    }
View Full Code Here

    private static final String DEFAULT_WIDTH = "250";
    private static final String DEFAULT_HEIGHT = "22";

    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        LevelIndicator levelIndicator = (LevelIndicator) component;
        Resources.includeJQuery(context);

        String clientId = levelIndicator.getClientId(context);

        // Render first tag
        final ResponseWriter writer = context.getResponseWriter();
        writer.startElement("div", levelIndicator);
        writer.writeAttribute("id", clientId, "id");
        final boolean verticallyOriented = levelIndicator.getOrientation().equals(Orientation.VERTICAL);
        String defaultOrientationClass = verticallyOriented ? " vertical" : " horizontal";
        writer.writeAttribute("class", Styles.getCSSClass(context,
                levelIndicator, levelIndicator.getStyle(), DEFAULT_CLASS + defaultOrientationClass,
                levelIndicator.getStyleClass()), null);
        Rendering.writeStandardEvents(writer, levelIndicator);

        writer.startElement("div", levelIndicator);
        writer.writeAttribute("id", getComponentSubPartClientId(context, levelIndicator, DISPLAY_AREA_SUFFIX), "id");
        writer.writeAttribute("class", Styles.getCSSClass(context,
                levelIndicator, levelIndicator.getDisplayAreaStyle(), DEFAULT_DISPLAY_AREA_CLASS, levelIndicator.getDisplayAreaClass()), null);
        writer.endElement("div");

        writer.startElement("div", levelIndicator);
        writer.writeAttribute("id", getComponentSubPartClientId(context, levelIndicator, LABEL_SUFFIX), "id");
        writer.writeAttribute("class", Styles.getCSSClass(context,
                levelIndicator, levelIndicator.getLabelStyle(), DEFAULT_LABEL_CLASS, levelIndicator.getLabelClass()), null);
        writer.endElement("div");

        writer.startElement("div", levelIndicator);
        writer.writeAttribute("id", getComponentSubPartClientId(context, levelIndicator, SEGMENT_SUFFIX), "id");
        writer.writeAttribute("class", DEFAULT_SEGMENT_CLASS, "class");
View Full Code Here

        encodeScriptsAndStyles(context, levelIndicator);
    }

    protected void encodeScriptsAndStyles(FacesContext context, UIComponent component) throws IOException {
        LevelIndicator levelIndicator = (LevelIndicator) component;

        String styleClass = getInitialStyleClass(context, levelIndicator);
        String rolloverStyleClass = Styles.getCSSClass(context, levelIndicator, levelIndicator.getRolloverStyle(),
                StyleGroup.rolloverStyleGroup(), levelIndicator.getRolloverClass());

        ScriptBuilder buf = new ScriptBuilder().initScript(context, levelIndicator,
                "O$.LevelIndicator._init",
                getValue(levelIndicator),
                levelIndicator.getSegmentSize(),
                levelIndicator.getOrientation().toString(),
                levelIndicator.getFillDirection().toString(),
                DEFAULT_WIDTH,
                DEFAULT_HEIGHT,
                getColors(levelIndicator),
                getTransitionLevels(levelIndicator),
                levelIndicator.getInactiveSegmentIntensity(),
                styleClass,
                rolloverStyleClass);

        InitScript commonInitScript = new InitScript(buf, new String[]{
                Resources.utilJsURL(context),
View Full Code Here

TOP

Related Classes of org.openfaces.component.output.LevelIndicator

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.