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

eu.hansolo.steelseries.gauges.AbstractLinearBargraph Maven / Gradle / Ivy

Go to download

The SteelSeries is a javabeans component library that contains gauges. You will find linear and radial gauges. In addition you will also find digital displays, indicators from cars and some instruments from airplanes and sailboats.

There is a newer version: 3.9.30
Show newest version
package eu.hansolo.steelseries.gauges;


/**
 *
 * @author hansolo
 */
public abstract class AbstractLinearBargraph extends AbstractLinear
{
    // 
    private int tickLabelPeriod = 10; // Draw value at every nth tickmark
    private eu.hansolo.steelseries.tools.ColorDef barGraphColor = eu.hansolo.steelseries.tools.ColorDef.RED;  
    private eu.hansolo.steelseries.tools.CustomColorDef customBarGraphColor = new eu.hansolo.steelseries.tools.CustomColorDef(java.awt.Color.RED);
    private boolean peakValueEnabled = false;
    // 
    
    // 
    public AbstractLinearBargraph()
    {
        super();        
    }
    // 
    
    // 
//    @Override
//    public void setMinValue(final double MIN_VALUE)
//    {
//        super.setMinValue(MIN_VALUE);
//        if (MIN_VALUE < 0)
//        {
//            setValue(MIN_VALUE);
//        }
//    }

    /**
     * Returns the period between tickmarks.
     * Means if the ticklabel period = 10 => every 10th tickmark will
     * be painted
     * @return integer that represents the period between the tickmarks
     */
    public int getTickLabelPeriod()
    {
        return this.tickLabelPeriod;
    }

    /**
     * Sets the period between tickmarks.
     * Means if the ticklabel period = 10 => every 10th tickmark will
     * be painted
     * @param TICK_LABEL_PERIOD
     */
    public void setTickLabelPeriod(final int TICK_LABEL_PERIOD)
    {
        this.tickLabelPeriod = TICK_LABEL_PERIOD;        
        init(getInnerBounds().width, getInnerBounds().height);
        repaint(getInnerBounds());
    }

    /**
     * Returns the enum colordef that is defined for the current bargraph
     * @return enum colordef that represents the current bargraph color
     */
    public eu.hansolo.steelseries.tools.ColorDef getBarGraphColor()
    {
        return this.barGraphColor;
    }

    /**
     * Sets the current bargraph color to the given enum colordef
     * @param BARGRAPH_COLOR
     */
    public void setBarGraphColor(final eu.hansolo.steelseries.tools.ColorDef BARGRAPH_COLOR)
    {
        this.barGraphColor = BARGRAPH_COLOR;        
        init(getInnerBounds().width, getInnerBounds().height);
        repaint(getInnerBounds());
    }

    /**
     * Returns the color that will be used to calculate the custom bargraph color
     * @return the color that will be used to calculate the custom bargraph color
     */
    public java.awt.Color getCustomBargraphColor()
    {
        return this.customBarGraphColor.COLOR;
    }
    
    /**
     * Sets the color that will be used to calculate the custom bargraph color
     * @param COLOR 
     */
    public void setCustomBarGraphColor(final java.awt.Color COLOR)
    {
        this.customBarGraphColor = new eu.hansolo.steelseries.tools.CustomColorDef(COLOR);
        init(getInnerBounds().width, getInnerBounds().width);
        repaint(getInnerBounds());
    }
    
    /**
     * Returns the object that represents holds the custom bargraph color
     * @return the object that represents the custom bargraph color
     */
    public eu.hansolo.steelseries.tools.CustomColorDef getCustomBarGraphColorObject()
    {
        return this.customBarGraphColor;
    }
    
    /**
     * Returns true if the peak value is visible
     * @return true if the park value is visible
     */
    public boolean isPeakValueEnabled()
    {
        return this.peakValueEnabled;
    }

    /**
     * Enables/Disables the visibility of the peak value
     * @param PEAK_VALUE_ENABLED
     */
    public void setPeakValueEnabled(final boolean PEAK_VALUE_ENABLED)
    {
        this.peakValueEnabled = PEAK_VALUE_ENABLED;
    }
    //     
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy