summaryrefslogtreecommitdiff
path: root/SDL_Android/SmartDeviceLinkProxyAndroid/src/com/smartdevicelink/proxy/rpc/SoftButton.java
blob: d0f46de06a0c88940688284239afb0b9b7f52ef9 (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
101
102
103
104
105
106
107
108
109
110
111
package com.smartdevicelink.proxy.rpc;

import java.util.Hashtable;

import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.constants.Names;
import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.enums.SystemAction;
import com.smartdevicelink.util.DebugTool;

public class SoftButton extends RPCStruct {

    public SoftButton() { }
    public SoftButton(Hashtable hash) {
        super(hash);
    }
    public void setType(SoftButtonType type) {
        if (type != null) {
            store.put(Names.type, type);
        } else {
        	store.remove(Names.type);
        }
    }
    public SoftButtonType getType() {
    	Object obj = store.get(Names.type);
        if (obj instanceof SoftButtonType) {
            return (SoftButtonType) obj;
        } else if (obj instanceof String) {
        	SoftButtonType theCode = null;
            try {
                theCode = SoftButtonType.valueForString((String) obj);
            } catch (Exception e) {
            	DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.type, e);
            }
            return theCode;
        }
        return null;
    }
    public void setText(String text) {
        if (text != null) {
            store.put(Names.text, text);
        } else {
        	store.remove(Names.text);
        }
    }
    public String getText() {
        return (String) store.get(Names.text);
    }
    public void setImage(Image image) {
        if (image != null) {
            store.put(Names.image, image);
        } else {
        	store.remove(Names.image);
        }
    }
    public Image getImage() {
    	Object obj = store.get(Names.image);
        if (obj instanceof Image) {
            return (Image) obj;
        } else if (obj instanceof Hashtable) {
        	try {
        		return new Image((Hashtable) obj);
            } catch (Exception e) {
            	DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.image, e);
            }
        }
        return null;
    }
    public void setIsHighlighted(Boolean isHighlighted) {
        if (isHighlighted != null) {
            store.put(Names.isHighlighted, isHighlighted);
        } else {
        	store.remove(Names.isHighlighted);
        }
    }
    public Boolean getIsHighlighted() {
        return (Boolean) store.get(Names.isHighlighted);
    }
    public void setSoftButtonID(Integer softButtonID) {
        if (softButtonID != null) {
            store.put(Names.softButtonID, softButtonID);
        } else {
        	store.remove(Names.softButtonID);
        }
    }
    public Integer getSoftButtonID() {
        return (Integer) store.get(Names.softButtonID);
    }
    public void setSystemAction(SystemAction systemAction) {
        if (systemAction != null) {
            store.put(Names.systemAction, systemAction);
        } else {
        	store.remove(Names.systemAction);
        }
    }
    public SystemAction getSystemAction() {
    	Object obj = store.get(Names.systemAction);
        if (obj instanceof SystemAction) {
            return (SystemAction) obj;
        } else if (obj instanceof String) {
        	SystemAction theCode = null;
            try {
                theCode = SystemAction.valueForString((String) obj);
            } catch (Exception e) {
            	DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.systemAction, e);
            }
            return theCode;
        }
        return null;
    }
}