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

jfxtras.icalendarfx.components.VCommon Maven / Gradle / Ivy

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import jfxtras.icalendarfx.components.VCommon;
import jfxtras.icalendarfx.components.VComponent;
import jfxtras.icalendarfx.components.VComponentBase;
import jfxtras.icalendarfx.properties.component.misc.NonStandardProperty;

/**
 * 

{@link VComponent} with the following properties *

    *
  • {@link NonStandardProperty X-PROP} *
*

* * @author David Bal * * @param concrete subclass */ public abstract class VCommon extends VComponentBase { /** * Provides a framework for defining non-standard properties. * *

Example: *

    * X-ABC-MMSUBJ;VALUE=URI;FMTTYPE=audio/basic:http://www.example. org/mysubj.au *
*/ private List nonStandardProps; public List getNonStandard() { return nonStandardProps; } public void setNonStandard(List nonStandardProps) { if (this.nonStandardProps != null) { this.nonStandardProps.forEach(e -> orderChild(e, null)); // remove old elements } this.nonStandardProps = nonStandardProps; if (nonStandardProps != null) { nonStandardProps.forEach(c -> orderChild(c)); } } /** * Sets the value of the {@link #nonStandardProperty()} * * @return - this class for chaining */ public T withNonStandard(List nonStandardProps) { if (getNonStandard() == null) { setNonStandard(new ArrayList<>()); } getNonStandard().addAll(nonStandardProps); if (nonStandardProps != null) { nonStandardProps.forEach(c -> orderChild(c)); } return (T) this; } /** * Sets the value of the {@link #nonStandardProperty()} by parsing a vararg of * iCalendar content text representing individual {@link NonStandardProperty} objects. * * @return - this class for chaining */ public T withNonStandard(String...nonStandardProps) { List newElements = Arrays.stream(nonStandardProps) .map(c -> NonStandardProperty.parse(c)) .collect(Collectors.toList()); return withNonStandard(newElements); } /** * Sets the value of the {@link #nonStandardProperty()} from a vararg of {@link NonStandardProperty} objects. * * @return - this class for chaining */ public T withNonStandard(NonStandardProperty...nonStandardProps) { return withNonStandard(Arrays.asList(nonStandardProps)); } /* * CONSTRUCTORS */ VCommon() { super(); } VCommon(VCommon source) { super(source); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy