Examples of LengthValue


Examples of com.volantis.mcs.build.themes.definitions.values.LengthValue

            }
        } else if (name.equals("lengthValue")) {
            String valStr = element.getText();
            try {
                int intVal = Integer.parseInt(valStr);
                LengthValue value = definitionsFactory.createLengthValue();
                value.setInteger(intVal);
                value.setUnits(element.getAttributeValue("units"));
                ValueContainer container =
                        (ValueContainer) findObject(ValueContainer.class);
                container.addValue(value);
            } catch (NumberFormatException nfe) {
                System.out.println("Invalid number: '" + valStr + "'");
            }
        } else if (name.equals("angleValue")) {
            String valStr = element.getText();

            try {
                double doubleVal = Double.parseDouble(valStr);
                String units = element.getAttributeValue("units");
                ValueContainer container =
                        (ValueContainer) findObject(ValueContainer.class);
                AngleValue value = definitionsFactory.createAngleValue();
                value.setAngle(doubleVal);
                value.setUnits(units);
                container.addValue(value);
            } catch (NumberFormatException nfe) {
                System.out.println("Invalid angle: '" + valStr + "'");
            }
        } else if (name.equals("stringValue")) {
            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            StringValue value = definitionsFactory.createStringValue();
            value.setString(element.getText());
            container.addValue(value);
        } else if (name.equals("colorValue")) {
            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            ColorValue value = definitionsFactory.createColorValue();
            value.setColorName(element.getText());
            container.addValue(value);
        } else if (name.equals("inheritValue")) {
            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            InheritValue value = definitionsFactory.createInheritValue();
            container.addValue(value);
        } else if (name.equals("percentageValue")) {
            String valStr = element.getText();
            try {
                double percentVal = Double.parseDouble(valStr);
                PercentageValue value =
                        definitionsFactory.createPercentageValue();
                value.setPercentage(percentVal);
                ValueContainer container =
                        (ValueContainer) findObject(ValueContainer.class);
                container.addValue(value);
            } catch (NumberFormatException nfe) {
                System.out.println("Invalid percentage: '" + valStr + "'");
            }
        } else if (name.equals("timeValue")) {
            String valStr = element.getText();

            try {
                double doubleVal = Double.parseDouble(valStr);
                String units = element.getAttributeValue("units");
                ValueContainer container =
                        (ValueContainer) findObject(ValueContainer.class);
                TimeValue value = definitionsFactory.createTimeValue();
                value.setTime(doubleVal);
                value.setUnits(units);
                container.addValue(value);
            } catch (NumberFormatException nfe) {
                System.out.println("Invalid time: '" + valStr + "'");
            }
        } else if (name.equals("pairValue")) {
            PairValueContainer pair = new PairValueContainer();

            pushObject(pair);
            processThemePropertyChildren(element);
            popObject();

            PairValue value = definitionsFactory.createPairValue();
            value.setFirst(pair.getFirst());
            value.setSecond(pair.getSecond());

            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            container.addValue(value);
        } else if (name.equals("listValue")) {
            ListValueContainer pair = new ListValueContainer();

            pushObject(pair);
            processThemePropertyChildren(element);
            popObject();

            ListValue value = definitionsFactory.createListValue();
            Value next = null;
            while((next = pair.getNext())!=null){
                value.setNext(next);
            }
           
            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            container.addValue(value);
        } else if (name.equals("frequencyValue")) {
            String valStr = element.getText();

            try {
                double doubleVal = Double.parseDouble(valStr);
                String units = element.getAttributeValue("units");
                ValueContainer container =
                        (ValueContainer) findObject(ValueContainer.class);
                FrequencyValue value = definitionsFactory.createFrequencyValue();
                value.setNumber(doubleVal);
                value.setUnits(units);
                container.addValue(value);
            } catch (NumberFormatException nfe) {
                System.out.println("Invalid frequency: '" + valStr + "'");
            }
        } else if (name.equals("fractionValue")) {
            PairValueContainer pair = new PairValueContainer();

            pushObject(pair);
            processThemePropertyChildren(element);
            popObject();

            FractionValue value = definitionsFactory.createFractionValue();
            value.setNumerator(pair.getFirst());
            value.setDenominator(pair.getSecond());

            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            container.addValue(value);
        } else if (name.equals("keywordRef")) {
View Full Code Here

Examples of javax.swing.text.html.CSS.LengthValue

        BorderStyle bs = (BorderStyle) attrs.getAttribute(
                                                    ATTRIBUTES[STYLE][side]);
        if ((bs != null) && (bs.getValue() != Value.NONE)) {
            // The 'border-style' value of "none" forces the computed value
            // of 'border-width' to be 0 (CSS2 8.5.3)
            LengthValue bw = (LengthValue) attrs.getAttribute(
                                                    ATTRIBUTES[WIDTH][side]);
            if (bw == null) {
                bw = (LengthValue) DEFAULTS[WIDTH];
            }
            width = (int) bw.getValue(true);
        }
        return width;
    }
View Full Code Here

Examples of org.xhtmlrenderer.css.style.derived.LengthValue

        setRight(fromVal, style, second, ctx);
        //_right = style.getFloatPropertyProportionalHeight(fromVal, 0, ctx);
        //_left = style.getFloatPropertyProportionalWidth(fromVal, 0, ctx);
      }
    } else if(value instanceof LengthValue){
      LengthValue lv = (LengthValue)value;
     
      if(lv.getStringValue().contains("%")) {
        _leftPercent = _rightPercent = true;
        _left = _right = value.asFloat() / 100.0f;
      } else {
        _left = _right = (int) lv.getFloatProportionalTo(fromVal, 0, ctx);
      }
      //first = second = (LengthValue)value;
    }
      //System.out.println(fromVal + " " + _left + " " + _right);
      //this._right = this._left = ((PropertyValue)((ListValue)fromVal).getValues().get(0)).getFloatValue();
View Full Code Here

Examples of org.xhtmlrenderer.css.style.derived.LengthValue

            CalculatedStyle style = root.getStyle();
            PropertyValue fontFamilyProp = new PropertyValue(CSSPrimitiveValue.CSS_STRING, getFont().getFamily(),
                    getFont().getFamily());
            fontFamilyProp.setStringArrayValue(new String[] { fontFamilyProp.getStringValue() });
            style.setDefaultValue(CSSName.FONT_FAMILY, new StringValue(CSSName.FONT_FAMILY, fontFamilyProp));
            style.setDefaultValue(CSSName.FONT_SIZE, new LengthValue(style, CSSName.FONT_SIZE,
                    new PropertyValue(CSSPrimitiveValue.CSS_PX, getFont().getSize(), Integer
                            .toString(getFont().getSize()))));
            Color c = getForeground();
            style.setDefaultValue(CSSName.COLOR, new ColorValue(CSSName.COLOR,
                    new PropertyValue(new FSRGBColor(c.getRed(), c.getGreen(), c.getBlue()))));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.