Allow configuration of a default value for a label.

This change allows a project admin or owner to define a default value
(or score) for a label. The default value is set in the project configurations
file with a 'defaultValue' key.  The defaultValue must be within the range of
valid label values.  It is an optional label setting, if not defined the
defaultValue for the label will be 0.  When a defaultValue is defined, that
value will get set in the Reply dialog by default.  A defaultValue can be set
to a score that is outside of the permissible range for a user.  In that case
the score that will get set in the Reply box will be the next closes score
to the defaultValue.

feature: Issue 2041
Change-Id: I12dece29b043e09eaab62cdcf56146a1380041bc
This commit is contained in:
Khai Do
2014-04-06 23:27:43 -07:00
parent 2b3a5badc9
commit 4c91b000fa
12 changed files with 153 additions and 1 deletions

View File

@@ -112,6 +112,7 @@ public class LabelType {
protected boolean copyMaxScore;
protected boolean copyAllScoresOnTrivialRebase;
protected boolean copyAllScoresIfNoCodeChange;
protected short defaultValue;
protected List<LabelValue> values;
protected short maxNegative;
@@ -129,6 +130,7 @@ public class LabelType {
this.name = checkName(name);
canOverride = true;
values = sortValues(valueList);
defaultValue = 0;
abbreviation = defaultAbbreviation(name);
functionName = "MaxWithBlock";
@@ -204,6 +206,14 @@ public class LabelType {
return v.getValue() > 0 ? v : null;
}
public short getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(short defaultValue) {
this.defaultValue = defaultValue;
}
public boolean isCopyMinScore() {
return copyMinScore;
}