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

jfxtras.icalendarfx.properties.component.alarm.Action Maven / Gradle / Ivy

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

import jfxtras.icalendarfx.components.VAlarm;
import jfxtras.icalendarfx.properties.VPropertyBase;
import jfxtras.icalendarfx.properties.component.alarm.Action.ActionType;
import jfxtras.icalendarfx.utilities.StringConverter;

/**
 * 

ACTION

*

RFC 5545, 3.8.6.1, page 132

* *

This property defines the action to be invoked when an alarm is triggered.

* *

actionvalue = "AUDIO" / "DISPLAY" / "EMAIL" / iana-token / x-name

* *

Applications MUST ignore alarms with x-name and iana-token values they don't recognize.

* *

Examples: *

    *
  • ACTION:AUDIO *
  • ACTION:DISPLAY *
*

* * @author David Bal * * @see VAlarm */ public class Action extends VPropertyBase { // private static final Collection ALLOWED_VALUE_TYPES = Arrays.asList(ValueType.TEXT); // private static final ValueType DEFAULT_VALUE_TYPE = ValueType.TEXT; private final static StringConverter CONVERTER = new StringConverter() { @Override public String toString(ActionType object) { // null means value is unknown and non-converted string in PropertyBase unknownValue should be used instead return (object == ActionType.UNKNOWN) ? null: object.toString(); } @Override public ActionType fromString(String string) { return ActionType.valueOf2(string.toUpperCase()); } }; public Action(ActionType type) { // super(ALLOWED_VALUE_TYPES, DEFAULT_VALUE_TYPE); super(); setConverter(CONVERTER); setValue(type); } public Action(Action source) { super(source); } public Action() { // super(ALLOWED_VALUE_TYPES, DEFAULT_VALUE_TYPE); super(); setConverter(CONVERTER); } public static Action parse(String content) { return Action.parse(new Action(), content); } public enum ActionType { AUDIO, DISPLAY, EMAIL, UNKNOWN; // must ignore static ActionType valueOf2(String value) { try { return valueOf(value); } catch (IllegalArgumentException e) { return UNKNOWN; } } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy