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

jfxtras.icalendarfx.properties.component.descriptive.Status Maven / Gradle / Ivy

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

import java.util.HashMap;
import java.util.Map;

import jfxtras.icalendarfx.components.VEvent;
import jfxtras.icalendarfx.components.VJournal;
import jfxtras.icalendarfx.components.VTodo;
import jfxtras.icalendarfx.properties.VPropertyBase;
import jfxtras.icalendarfx.properties.component.descriptive.Status;
import jfxtras.icalendarfx.properties.component.descriptive.Status.StatusType;
import jfxtras.icalendarfx.utilities.StringConverter;

/**
 * STATUS
 * RFC 5545 iCalendar 3.8.1.11. page 92
 * 
 * This property defines the overall status or confirmation for the calendar component.
 * 
 * Example:
 * STATUS:TENTATIVE
 *
 * @author David Bal
 * 
 * The property can be specified in following components:
 * @see VEvent
 * @see VTodo
 * @see VJournal
 */
public class Status extends VPropertyBase
{
    private final static StringConverter CONVERTER = new StringConverter()
    {
        @Override
        public String toString(StatusType object)
        {
            return object.toString();
        }

        @Override
        public StatusType fromString(String string)
        {
            return StatusType.enumFromName(string);
        }
    };
    
    public Status(StatusType value)
    {
        this();
        setValue(value);
    }
    
    public Status(Status source)
    {
        super(source);
    }
    
    public Status()
    {
        super();
        setConverter(CONVERTER);
    }
    
    public static Status parse(String content)
    {
    	return Status.parse(new Status(), content);
    }
    
    public enum StatusType
    {
        TENTATIVE ("TENTATIVE"),
        CONFIRMED ("CONFIRMED"),
        CANCELLED ("CANCELLED"),
        NEEDS_ACTION ("NEEDS-ACTION"),
        COMPLETED ("COMPLETED"),
        IN_PROCESS ("IN-PROCESS"),
        DRAFT ("DRAFT"),
        FINAL ("FINAL");
        
        private static Map enumFromNameMap = makeEnumFromNameMap();
        private static Map makeEnumFromNameMap()
        {
            Map map = new HashMap<>();
            StatusType[] values = StatusType.values();
            for (int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy