Skip to main content
summaryrefslogtreecommitdiffstats
blob: dbbde06361ec9e42abdbb150be54c07be3eec0c5 (plain) (blame)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*******************************************************************************
 * Copyright (c) 2006 Oracle Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Gerry Kessler/Oracle - initial API and implementation
 *    
 ********************************************************************************/

package org.eclipse.jst.jsf.metadataprocessors.features;

import org.eclipse.jface.resource.ImageDescriptor;


/**
 * Implements {@link IPossibleValues}
 * 
 * <p><b>Provisional API - subject to change</b></p>
 *
 */
public class PossibleValue implements IPossibleValue {
	private String value;
	private String displayValue;
	private ImageDescriptor smallIcon;
	private boolean isDefault = false;
	private String additionalInfo;

	/**
	 * Constructor when display value is same as stored value
	 * @param value
	 */
	public PossibleValue(String value){
		this.value = value;
	}
	
	/**
	 * Constructor when display-value may be different than stored value
	 * @param value
	 * @param displayValue
	 */
	public PossibleValue(String value, String displayValue){
		this.value = value;
		this.displayValue = displayValue;
	}

	/**
	 * Constructor when display-value may be different than stored value 
	 * and a default value is known
	 * @param value
	 * @param displayValue
	 * @param isDefaultValue
	 */
	public PossibleValue(String value, String displayValue, boolean isDefaultValue) {
		this.value = value;
		this.displayValue = displayValue;
		this.isDefault = isDefaultValue;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#getValue()
	 */
	public String getValue() { 
		return value;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#getDisplayValue()
	 */
	public String getDisplayValue() {
		if (displayValue == null)
			return value;
		return displayValue;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#getIcon()
	 */
	public ImageDescriptor getIcon() {		
		return smallIcon;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#isDefaultValue()
	 */
	public boolean isDefaultValue() {
		return isDefault;
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#getAdditionalInformation()
	 */
	public String getAdditionalInformation() {
		return additionalInfo;
	}
	
	/**
	 * @param value
	 */
	public void setValue(String value) {
		this.value = value;
	}

	/**
	 * @param displayValue
	 */
	public void setDisplayValue(String displayValue) {
		this.displayValue = displayValue;
	}

	/**
	 * @param smallIcon
	 */
	public void setIcon(ImageDescriptor smallIcon) {
		this.smallIcon = smallIcon;
	}

	/**
	 * @param isDefault
	 */
	public void setIsDefault(boolean isDefault) {
		this.isDefault = isDefault;
	}
	
	/**
	 * @param additionalInfo
	 */
	public void setAdditionalInformation(String additionalInfo){
		this.additionalInfo = additionalInfo;
	}

	
}

Back to the top