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

org.jhotdraw8.draw.key.CssDimension2DStyleableKey Maven / Gradle / Ivy

The newest version!
/*
 * @(#)CssDimension2DStyleableKey.java
 * Copyright © 2023 The authors and contributors of JHotDraw. MIT License.
 */
package org.jhotdraw8.draw.key;

import org.jhotdraw8.base.converter.Converter;
import org.jhotdraw8.css.converter.CssConverter;
import org.jhotdraw8.draw.css.converter.Dimension2DCssConverter;
import org.jhotdraw8.draw.css.value.CssDimension2D;
import org.jhotdraw8.fxbase.styleable.WritableStyleableMapAccessor;
import org.jhotdraw8.fxcollection.typesafekey.NonNullKey;

/**
 * Non-null CssDimension2DStyleableKey.
 *
 * @author Werner Randelshofer
 */
public class CssDimension2DStyleableKey extends AbstractStyleableKey
        implements WritableStyleableMapAccessor, NonNullKey {


    private final Converter converter;

    /**
     * Creates a new instance with the specified name and with 0,0 as the
     * default value.
     *
     * @param name The name of the key.
     */
    public CssDimension2DStyleableKey(String name) {
        this(name, CssDimension2D.ZERO);
    }


    /**
     * Creates a new instance with the specified name, type token class, default
     * value, and allowing or disallowing null values.
     *
     * @param key          The name of the name. type parameters are given. Otherwise
     *                     specify them in arrow brackets.
     * @param defaultValue The default value.
     */
    public CssDimension2DStyleableKey(String key, CssDimension2D defaultValue) {
        this(key, defaultValue, new Dimension2DCssConverter(false));
    }

    public CssDimension2DStyleableKey(String key, CssDimension2D defaultValue, CssConverter converter) {
        super(key, CssDimension2D.class, defaultValue);
        this.converter = converter;
    }


    @Override
    public Converter getCssConverter() {
        return converter;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy