Example usage for com.vaadin.shared.ui.colorpicker Color getAlpha

List of usage examples for com.vaadin.shared.ui.colorpicker Color getAlpha

Introduction

In this page you can find the example usage for com.vaadin.shared.ui.colorpicker Color getAlpha.

Prototype

public int getAlpha() 

Source Link

Document

Returns the alpha value of the color.

Usage

From source file:eu.maxschuster.vaadin.colorpickerfield.converter.AbstractRgbaColorConverter.java

License:Apache License

@Override
protected String serializeColor(Color color) throws ConversionException {
    double alpha = intToDouble(color.getAlpha());
    String alphaString;//from   w w  w .j av a2  s  . c o  m
    if (alpha == (long) alpha) {
        alphaString = String.format("%d", (long) alpha);
    } else {
        alphaString = String.format("%s", alpha);
    }
    return String.format("rgba(%d,%d,%d,%s)", color.getRed(), color.getGreen(), color.getBlue(), alphaString);
}