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

jfxtras.icalendarfx.properties.calendar.CalendarScale Maven / Gradle / Ivy

There is a newer version: 17-r1
Show newest version
package jfxtras.icalendarfx.properties.calendar;

import jfxtras.icalendarfx.VCalendar;
import jfxtras.icalendarfx.VElement;
import jfxtras.icalendarfx.properties.VPropertyBase;
import jfxtras.icalendarfx.properties.calendar.CalendarScale;
import jfxtras.icalendarfx.properties.calendar.CalendarScale.CalendarScaleType;
import jfxtras.icalendarfx.utilities.StringConverter;

/**
 * CALSCALE
 * Calendar Scale
 * RFC 5545, 3.7.1, page 76
 * 
 * This property defines the calendar scale used for the
 * calendar information specified in the iCalendar object.
 * 
 * Only allowed value is GREGORIAN
 * It is expected that other calendar scales will be defined in other specifications or by
 * future versions of this memo. 
 * 
 * Example:
 * CALSCALE:GREGORIAN
 * 
 * @author David Bal
 * @see VCalendar
 */
public class CalendarScale extends VPropertyBase implements VElement
{
    public static final CalendarScaleType DEFAULT_CALENDAR_SCALE = CalendarScaleType.GREGORIAN;
    
    private final static StringConverter CONVERTER = new StringConverter()
    {
        @Override
        public String toString(CalendarScaleType object)
        {
            return object.toString();
        }

        @Override
        public CalendarScaleType fromString(String string)
        {
            return CalendarScaleType.valueOf(string);
        }
    };
    
    public CalendarScale(CalendarScale source)
    {
        super(source);
    }

    /** sets default value of GREGORIAN */
    public CalendarScale()
    {
       super();
       setConverter(CONVERTER);
    }
    
    public CalendarScale(CalendarScaleType calendarScaleType)
    {
       super(calendarScaleType);
       setConverter(CONVERTER);
    }

    
    public enum CalendarScaleType
    {
        GREGORIAN;
    }

    public static CalendarScale parse(String content)
    {
    	return CalendarScale.parse(new CalendarScale(), content);
    }    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy