summaryrefslogtreecommitdiff
path: root/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java
blob: fdde09f1300e5e5d5596f8017b216b351ce6e996 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.smartdevicelink.proxy.rpc;

import androidx.annotation.NonNull;

import com.smartdevicelink.proxy.RPCStruct;

import java.util.Hashtable;

/**
 * Used to set an alternate template layout to a window.
 * @since 6.0
 */
public class TemplateConfiguration extends RPCStruct {
    public static final String KEY_TEMPLATE = "template";
    public static final String KEY_DAY_COLOR_SCHEME = "dayColorScheme";
    public static final String KEY_NIGHT_COLOR_SCHEME = "nightColorScheme";

    /**
     * Constructs a new TemplateConfiguration object
     * @param template Predefined or dynamically created window template.
     *         Currently only predefined window template layouts are defined.
     */
    public TemplateConfiguration(@NonNull String template) {
        this();
        setTemplate(template);
    }

    /**
     * Constructs a new TemplateConfiguration object indicated by the Hashtable
     * parameter
     *
     * @param hash The Hashtable to use
     */
    public TemplateConfiguration(Hashtable<String, Object> hash) {
        super(hash);
    }

    /**
     * Constructs a new TemplateConfiguration object
     */
    public TemplateConfiguration() {
    }

    /**
     * Gets the template.
     *
     * @return String -an Predefined or dynamically created window template. Currently only predefined window template layouts are defined.
     */
    public String getTemplate() {
        return getString(KEY_TEMPLATE);
    }

    /**
     * Sets the template. It can be Predefined or dynamically created window template. Currently only predefined window template layouts are defined.
     *
     * @param template Predefined or dynamically created window template. Currently only predefined window template layouts are defined.
     */
    public TemplateConfiguration setTemplate(@NonNull String template) {
        setValue(KEY_TEMPLATE, template);
        return this;
    }

    /**
     * Gets the dayColorScheme.
     *
     * @return TemplateColorScheme
     */
    public TemplateColorScheme getDayColorScheme() {
        return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_DAY_COLOR_SCHEME);
    }

    /**
     * Sets the dayColorScheme.
     *
     * @param dayColorScheme TemplateColorScheme for the day
     */
    public TemplateConfiguration setDayColorScheme( TemplateColorScheme dayColorScheme) {
        setValue(KEY_DAY_COLOR_SCHEME, dayColorScheme);
        return this;
    }

    /**
     * Gets the nightColorScheme.
     *
     * @return TemplateColorScheme
     */
    public TemplateColorScheme getNightColorScheme() {
        return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_NIGHT_COLOR_SCHEME);
    }

    /**
     * Sets the nightColorScheme.
     *
     * @param nightColorScheme TemplateColorScheme for the night
     */
    public TemplateConfiguration setNightColorScheme( TemplateColorScheme nightColorScheme) {
        setValue(KEY_NIGHT_COLOR_SCHEME, nightColorScheme);
        return this;
    }
}