X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FField.java;h=fa4600d8888fe7f4c85dd3f0a25da7414cdc9205;hp=5d0adc4563d25fd5465465226958eb59ebded0ca;hb=f35b6d628f68e3b5ef19965ad8988d0dd1eb8efa;hpb=3745d70b1427bb8ac1a085e47cbdc566936784e1 diff --git a/tim/prune/data/Field.java b/tim/prune/data/Field.java index 5d0adc4..fa4600d 100644 --- a/tim/prune/data/Field.java +++ b/tim/prune/data/Field.java @@ -4,41 +4,44 @@ import tim.prune.I18nManager; /** * Class to represent a field of a data point - * including its type */ public class Field { private String _labelKey = null; private String _customLabel = null; - private FieldType _type = null; private boolean _builtin = false; - public static final Field LATITUDE = new Field("fieldname.latitude", FieldType.COORD); - public static final Field LONGITUDE = new Field("fieldname.longitude", FieldType.COORD); - public static final Field ALTITUDE = new Field("fieldname.altitude", FieldType.INT); - public static final Field TIMESTAMP = new Field("fieldname.timestamp", FieldType.TIME); - public static final Field WAYPT_NAME = new Field("fieldname.waypointname", FieldType.NONE); - public static final Field WAYPT_TYPE = new Field("fieldname.waypointtype", FieldType.NONE); - public static final Field NEW_SEGMENT = new Field("fieldname.newsegment", FieldType.BOOL); + public static final Field LATITUDE = new Field("fieldname.latitude", true); + public static final Field LONGITUDE = new Field("fieldname.longitude", true); + public static final Field ALTITUDE = new Field("fieldname.altitude", true); + public static final Field TIMESTAMP = new Field("fieldname.timestamp", true); + public static final Field WAYPT_NAME = new Field("fieldname.waypointname", true); + public static final Field WAYPT_TYPE = new Field("fieldname.waypointtype", true); + public static final Field NEW_SEGMENT = new Field("fieldname.newsegment", true); // TODO: Field for photo filename, ability to load (from text) and save (to text) private static final Field[] ALL_AVAILABLE_FIELDS = { LATITUDE, LONGITUDE, ALTITUDE, TIMESTAMP, WAYPT_NAME, WAYPT_TYPE, NEW_SEGMENT, - new Field("fieldname.custom", FieldType.NONE) + new Field(I18nManager.getText("fieldname.custom")) }; /** * Private constructor * @param inLabelKey Key for label texts - * @param inType type of field + * @param inBuiltin true for built-in types, false for custom */ - private Field(String inLabelKey, FieldType inType) + private Field(String inLabelKey, boolean inBuiltin) { - _labelKey = inLabelKey; - _customLabel = null; - _type = inType; - _builtin = true; + if (inBuiltin) { + _labelKey = inLabelKey; + _customLabel = null; + } + else { + _labelKey = null; + _customLabel = inLabelKey; + } + _builtin = inBuiltin; } @@ -48,9 +51,7 @@ public class Field */ public Field(String inLabel) { - _labelKey = null; - _customLabel = inLabel; - _type = FieldType.NONE; + this(inLabel, false); } /** @@ -80,14 +81,6 @@ public class Field return _builtin; } - /** - * @return field type - */ - public FieldType getType() - { - return _type; - } - /** * Checks if the two fields are equal * @param inOther other Field object @@ -105,7 +98,8 @@ public class Field */ public static Field getField(String inFieldName) { - for (int i=0; i