raimund@3629: package de.intevation.flys.artifacts.states.minfo; raimund@3629: raimund@3722: import java.util.ArrayList; raimund@3722: import java.util.List; raimund@3722: raimund@3722: import org.apache.log4j.Logger; raimund@3629: raimund@3629: import de.intevation.artifacts.Artifact; raimund@3629: import de.intevation.artifacts.CallContext; raimund@3629: import de.intevation.artifacts.CallMeta; raimund@3722: import de.intevation.artifacts.common.model.KVP; raimund@3629: import de.intevation.flys.artifacts.resources.Resources; raimund@3722: import de.intevation.flys.artifacts.states.MultiStringArrayState; raimund@3629: raimund@3722: public class CharDiameter extends MultiStringArrayState { raimund@3629: raimund@3722: private static final Logger logger = Logger.getLogger(CharDiameter.class); raimund@3722: raimund@3722: public static final String UI_PROVIDER = "parameter-matrix"; raimund@3629: raimund@3629: private static final String CHAR_DIAMETER_MIN = "calc.bed.dmin"; raimund@3629: private static final String CHAR_DIAMETER_MAX = "calc.bed.dmax"; raimund@3629: private static final String CHAR_DIAMETER_90 = "calc.bed.d90"; raimund@3629: private static final String CHAR_DIAMETER_84 = "calc.bed.d84"; raimund@3629: private static final String CHAR_DIAMETER_80 = "calc.bed.d80"; raimund@3629: private static final String CHAR_DIAMETER_75 = "calc.bed.d75"; raimund@3629: private static final String CHAR_DIAMETER_70 = "calc.bed.d70"; raimund@3629: private static final String CHAR_DIAMETER_60 = "calc.bed.d60"; raimund@3629: private static final String CHAR_DIAMETER_50 = "calc.bed.d50"; raimund@3629: private static final String CHAR_DIAMETER_40 = "calc.bed.d40"; raimund@3629: private static final String CHAR_DIAMETER_30 = "calc.bed.d30"; raimund@3629: private static final String CHAR_DIAMETER_25 = "calc.bed.d25"; raimund@3629: private static final String CHAR_DIAMETER_20 = "calc.bed.d20"; raimund@3629: private static final String CHAR_DIAMETER_16 = "calc.bed.d16"; raimund@3629: private static final String CHAR_DIAMETER_10 = "calc.bed.d10"; raimund@3629: raimund@3629: public static final String[] CHAR_DIAMETER = { raimund@3629: CHAR_DIAMETER_10, raimund@3629: CHAR_DIAMETER_16, raimund@3629: CHAR_DIAMETER_20, raimund@3629: CHAR_DIAMETER_25, raimund@3629: CHAR_DIAMETER_30, raimund@3629: CHAR_DIAMETER_40, raimund@3629: CHAR_DIAMETER_50, raimund@3629: CHAR_DIAMETER_60, raimund@3629: CHAR_DIAMETER_70, raimund@3629: CHAR_DIAMETER_75, raimund@3629: CHAR_DIAMETER_80, raimund@3629: CHAR_DIAMETER_84, raimund@3629: CHAR_DIAMETER_90, raimund@3629: CHAR_DIAMETER_MAX, raimund@3629: CHAR_DIAMETER_MIN raimund@3629: }; raimund@3629: raimund@3629: @Override raimund@3629: public String getUIProvider() { raimund@3629: return UI_PROVIDER; raimund@3629: } raimund@3629: raimund@3629: @Override raimund@3722: protected KVP[] getOptions( raimund@3722: Artifact artifact, raimund@3722: String parameterName, raimund@3722: CallContext context raimund@3722: ) raimund@3722: throws IllegalArgumentException raimund@3629: { raimund@3629: CallMeta meta = context.getMeta(); raimund@3629: raimund@3722: List> rows = new ArrayList>(); raimund@3722: String key = parameterName; raimund@3629: for (int i = 0; i < CHAR_DIAMETER.length; ++i) { raimund@3629: String calc = CHAR_DIAMETER[i]; raimund@3722: rows.add(new KVP (calc, raimund@3722: Resources.getMsg(meta, calc, calc))); raimund@3629: } raimund@3629: raimund@3722: return rows.toArray(new KVP[rows.size()]); raimund@3722: } raimund@3722: raimund@3722: @Override raimund@3722: protected String getLabelFor(CallContext cc, String parameterName, raimund@3722: String value) throws IllegalArgumentException { raimund@3722: raimund@3722: return Resources.getMsg(cc.getMeta(), value, value); raimund@3629: } raimund@3629: raimund@3629: }