All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vaadin.ui.ColorPickerArea Maven / Gradle / Ivy

There is a newer version: 8.27.3
Show newest version
/*
 * Copyright (C) 2000-2024 Vaadin Ltd
 *
 * This program is available under Vaadin Commercial License and Service Terms.
 *
 * See  for the full
 * license.
 */
package com.vaadin.ui;

import com.vaadin.shared.ui.colorpicker.Color;
import com.vaadin.shared.ui.colorpicker.ColorPickerAreaState;

/**
 * A class that defines area-like implementation for a color picker component.
 *
 * @since 7.0.0
 *
 * @see ColorPicker
 *
 */
public class ColorPickerArea extends AbstractColorPicker {

    /**
     * Instantiates a new color picker.
     */
    public ColorPickerArea() {
        super();
    }

    /**
     * Instantiates a new color picker.
     *
     * @param popupCaption
     *            caption of the color select popup
     */
    public ColorPickerArea(String popupCaption) {
        super(popupCaption);
    }

    /**
     * Instantiates a new color picker.
     *
     * @param popupCaption
     *            caption of the color select popup
     * @param initialColor
     *            the initial color
     */
    public ColorPickerArea(String popupCaption, Color initialColor) {
        super(popupCaption, initialColor);
        setDefaultCaptionEnabled(false);
    }

    @Override
    protected void setDefaultStyles() {
        // state already has correct default
    }

    @Override
    public void beforeClientResponse(boolean initial) {
        super.beforeClientResponse(initial);

        if ("".equals(getState().height)) {
            getState().height = "30px";
        }
        if ("".equals(getState().width)) {
            getState().width = "30px";
        }
    }

    @Override
    protected ColorPickerAreaState getState() {
        return (ColorPickerAreaState) super.getState();
    }

    @Override
    protected ColorPickerAreaState getState(boolean markAsDirty) {
        return (ColorPickerAreaState) super.getState(markAsDirty);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy