001package systems.dmx.core;
002
003import systems.dmx.core.model.TopicModel;
004import systems.dmx.core.model.ViewConfigurationModel;
005
006
007
008/**
009 * A container for config topics.
010 * <p>
011 * Config topics can be accessed by their type URI.
012 * A view config can contain only one config topic with a certain type URI.
013 *
014 * @author <a href="mailto:jri@deepamehta.de">Jörg Richter</a>
015 */
016public interface ViewConfiguration {
017
018    Iterable<Topic> getConfigTopics();
019
020    /**
021     * @return  the config topic for the given type URI, or <code>null</code> if there is none.
022     */
023    Topic getConfigTopic(String configTypeUri);
024
025    /**
026     * Adds a config topic to this view config.
027     *
028     * @return  the (instantiated) config topic.
029     *
030     * @throws  RuntimeException    if this view config already contains a config topic with the same type URI.
031     */
032    Topic addConfigTopic(TopicModel configTopic);
033
034    /**
035     * Sets a single value of a certain config topic.
036     * If no such config topic exists in this view config it is created.
037     *
038     * @param   configTypeUri   The type URI of the config topic, e.g. "dmx.webclient.view_config"
039     * @param   childTypeUri    The child type URI of the config value to set, e.g. "dmx.webclient.icon"
040     * @param   value           The config value (String, Integer, Long, Double, or Boolean)
041     */
042    ViewConfiguration setConfigValue(String configTypeUri, String childTypeUri, Object value);
043
044    ViewConfiguration setConfigValueRef(String configTypeUri, String childTypeUri, Object topicIdOrUri);
045
046    // ---
047
048    ViewConfigurationModel getModel();
049}