Search in sources :

Example 6 with CSSPrimitiveValue

use of org.w3c.dom.css.CSSPrimitiveValue in project webtools.sourceediting by eclipse.

the class AbstractModelTest method checkPrimitiveRgb.

/* for rgb */
protected void checkPrimitiveRgb(CSSValue actual, Object[] expectedArray) {
    assertTrue(actual instanceof CSSPrimitiveValue);
    assertEquals(CSSPrimitiveValue.CSS_RGBCOLOR, ((CSSPrimitiveValue) actual).getPrimitiveType());
    RGBColor color = ((CSSPrimitiveValue) actual).getRGBColorValue();
    CSSPrimitiveValue value;
    Object expected;
    value = color.getRed();
    expected = expectedArray[0];
    if (expected instanceof PrimitiveNumber) {
        checkPrimitiveNumber(value, (PrimitiveNumber) expected);
    } else {
        checkPrimitiveString(value, (PrimitiveString) expected);
    }
    value = color.getGreen();
    expected = expectedArray[1];
    if (expected instanceof PrimitiveNumber) {
        checkPrimitiveNumber(value, (PrimitiveNumber) expected);
    } else {
        checkPrimitiveString(value, (PrimitiveString) expected);
    }
    value = color.getBlue();
    expected = expectedArray[2];
    if (expected instanceof PrimitiveNumber) {
        checkPrimitiveNumber(value, (PrimitiveNumber) expected);
    } else {
        checkPrimitiveString(value, (PrimitiveString) expected);
    }
}
Also used : RGBColor(org.w3c.dom.css.RGBColor) CSSPrimitiveValue(org.w3c.dom.css.CSSPrimitiveValue)

Example 7 with CSSPrimitiveValue

use of org.w3c.dom.css.CSSPrimitiveValue in project webtools.sourceediting by eclipse.

the class AbstractModelTest method checkPrimitiveRect.

/* for rect */
protected void checkPrimitiveRect(CSSValue actual, Object[] expectedArray) {
    assertTrue(actual instanceof CSSPrimitiveValue);
    assertEquals(CSSPrimitiveValue.CSS_RECT, ((CSSPrimitiveValue) actual).getPrimitiveType());
    Rect rect = ((CSSPrimitiveValue) actual).getRectValue();
    CSSPrimitiveValue value;
    Object expected;
    value = rect.getTop();
    expected = expectedArray[0];
    if (expected instanceof PrimitiveNumber) {
        checkPrimitiveNumber(value, (PrimitiveNumber) expected);
    } else {
        checkPrimitiveString(value, (PrimitiveString) expected);
    }
    value = rect.getRight();
    expected = expectedArray[1];
    if (expected instanceof PrimitiveNumber) {
        checkPrimitiveNumber(value, (PrimitiveNumber) expected);
    } else {
        checkPrimitiveString(value, (PrimitiveString) expected);
    }
    value = rect.getBottom();
    expected = expectedArray[2];
    if (expected instanceof PrimitiveNumber) {
        checkPrimitiveNumber(value, (PrimitiveNumber) expected);
    } else {
        checkPrimitiveString(value, (PrimitiveString) expected);
    }
    value = rect.getLeft();
    expected = expectedArray[3];
    if (expected instanceof PrimitiveNumber) {
        checkPrimitiveNumber(value, (PrimitiveNumber) expected);
    } else {
        checkPrimitiveString(value, (PrimitiveString) expected);
    }
}
Also used : Rect(org.w3c.dom.css.Rect) CSSPrimitiveValue(org.w3c.dom.css.CSSPrimitiveValue)

Aggregations

CSSPrimitiveValue (org.w3c.dom.css.CSSPrimitiveValue)7 CSSValue (org.w3c.dom.css.CSSValue)3 Iterator (java.util.Iterator)1 List (java.util.List)1 CSSStylableElement (org.eclipse.e4.ui.css.core.dom.CSSStylableElement)1 Gradient (org.eclipse.e4.ui.css.core.dom.properties.Gradient)1 CSS2FontProperties (org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties)1 CSSElementContext (org.eclipse.e4.ui.css.core.engine.CSSElementContext)1 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)1 IOverlayPainter (org.eclipse.nebula.widgets.nattable.painter.IOverlayPainter)1 NatTableBorderOverlayPainter (org.eclipse.nebula.widgets.nattable.painter.NatTableBorderOverlayPainter)1 ICellPainter (org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)1 ColumnSizeConfigurationCommand (org.eclipse.nebula.widgets.nattable.resize.command.ColumnSizeConfigurationCommand)1 RowSizeConfigurationCommand (org.eclipse.nebula.widgets.nattable.resize.command.RowSizeConfigurationCommand)1 BorderStyle (org.eclipse.nebula.widgets.nattable.style.BorderStyle)1 HorizontalAlignmentEnum (org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum)1 VerticalAlignmentEnum (org.eclipse.nebula.widgets.nattable.style.VerticalAlignmentEnum)1 CellEdgeEnum (org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum)1 Color (org.eclipse.swt.graphics.Color)1 Image (org.eclipse.swt.graphics.Image)1