Author: kmorin Date: 2014-01-28 19:42:42 +0100 (Tue, 28 Jan 2014) New Revision: 36 Url: http://forge.codelutin.com/projects/wlo/repository/revisions/36 Log: fixes #4248 Ajouter un champ commentaire ?\195?\160 chaque ?\195?\169tape Modified: trunk/res/layout/commercial_species_form.xml trunk/res/layout/context_form.xml trunk/res/layout/location_form.xml trunk/res/layout/metier_form.xml trunk/res/layout/scientific_species_form.xml trunk/res/layout/vessel_form.xml trunk/res/values-fr/strings.xml trunk/res/values/strings.xml trunk/src/fr/ifremer/wlo/CommercialSpeciesFormActivity.java trunk/src/fr/ifremer/wlo/ContextFormActivity.java trunk/src/fr/ifremer/wlo/LocationFormActivity.java trunk/src/fr/ifremer/wlo/MetierFormActivity.java trunk/src/fr/ifremer/wlo/ScientificSpeciesFormActivity.java trunk/src/fr/ifremer/wlo/VesselFormActivity.java trunk/src/fr/ifremer/wlo/WloModelEditionActivity.java trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java trunk/src/fr/ifremer/wlo/models/CommercialSpeciesModel.java trunk/src/fr/ifremer/wlo/models/ContextModel.java trunk/src/fr/ifremer/wlo/models/LocationModel.java trunk/src/fr/ifremer/wlo/models/MetierModel.java trunk/src/fr/ifremer/wlo/models/ScientificSpeciesModel.java trunk/src/fr/ifremer/wlo/models/VesselModel.java trunk/src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java Modified: trunk/res/layout/commercial_species_form.xml =================================================================== --- trunk/res/layout/commercial_species_form.xml 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/res/layout/commercial_species_form.xml 2014-01-28 18:42:42 UTC (rev 36) @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> - <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" @@ -85,6 +84,16 @@ android:singleLine="true" android:hint="@string/undefined"/> + <TextView android:text="@string/form_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + + <EditText android:id="@+id/form_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="top" + android:minLines="5"/> + </LinearLayout> </ScrollView> Modified: trunk/res/layout/context_form.xml =================================================================== --- trunk/res/layout/context_form.xml 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/res/layout/context_form.xml 2014-01-28 18:42:42 UTC (rev 36) @@ -1,44 +1,61 @@ <?xml version="1.0" encoding="utf-8"?> -<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fillViewport="true"> - - <LinearLayout android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <TextView android:text="@string/context_form_name" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" android:layout_width="match_parent" - android:layout_height="wrap_content"/> + android:layout_height="match_parent"> - <EditText android:id="@+id/context_form_name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:singleLine="true" - android:hint="@string/undefined"/> + <ScrollView android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:fillViewport="true"> - <LinearLayout android:orientation="horizontal" + <LinearLayout android:orientation="vertical" android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:gravity="bottom"> + android:layout_height="wrap_content"> - <Button android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@android:string/cancel" - android:onClick="cancel" /> + <TextView android:text="@string/context_form_name" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> - <Button android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@android:string/ok" - android:onClick="validate" /> + <EditText android:id="@+id/context_form_name" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:hint="@string/undefined"/> + <TextView android:text="@string/form_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + + <EditText android:id="@+id/form_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="top" + android:minLines="5"/> + </LinearLayout> + </ScrollView> + + <LinearLayout android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:gravity="bottom"> + + <Button android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@android:string/cancel" + android:onClick="cancel" /> + + <Button android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@android:string/ok" + android:onClick="validate" /> + </LinearLayout> -</ScrollView> \ No newline at end of file +</LinearLayout> \ No newline at end of file Modified: trunk/res/layout/location_form.xml =================================================================== --- trunk/res/layout/location_form.xml 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/res/layout/location_form.xml 2014-01-28 18:42:42 UTC (rev 36) @@ -87,6 +87,16 @@ android:singleLine="true" android:hint="@string/undefined"/> + <TextView android:text="@string/form_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + + <EditText android:id="@+id/form_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="top" + android:minLines="5"/> + </LinearLayout> </ScrollView> Modified: trunk/res/layout/metier_form.xml =================================================================== --- trunk/res/layout/metier_form.xml 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/res/layout/metier_form.xml 2014-01-28 18:42:42 UTC (rev 36) @@ -46,6 +46,16 @@ android:layout_height="wrap_content" android:singleLine="true"/> + <TextView android:text="@string/form_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + + <EditText android:id="@+id/form_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="top" + android:minLines="5"/> + </LinearLayout> </ScrollView> Modified: trunk/res/layout/scientific_species_form.xml =================================================================== --- trunk/res/layout/scientific_species_form.xml 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/res/layout/scientific_species_form.xml 2014-01-28 18:42:42 UTC (rev 36) @@ -31,6 +31,16 @@ android:layout_width="match_parent" android:layout_height="wrap_content"/> + <TextView android:text="@string/form_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + + <EditText android:id="@+id/form_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="top" + android:minLines="5"/> + </LinearLayout> </ScrollView> Modified: trunk/res/layout/vessel_form.xml =================================================================== --- trunk/res/layout/vessel_form.xml 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/res/layout/vessel_form.xml 2014-01-28 18:42:42 UTC (rev 36) @@ -59,6 +59,16 @@ android:layout_height="wrap_content" android:singleLine="true"/> + <TextView android:text="@string/form_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + + <EditText android:id="@+id/form_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="top" + android:minLines="5"/> + </LinearLayout> </ScrollView> Modified: trunk/res/values/strings.xml =================================================================== --- trunk/res/values/strings.xml 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/res/values/strings.xml 2014-01-28 18:42:42 UTC (rev 36) @@ -24,6 +24,7 @@ <string name="one_required_field_error_message">At least one these fields is required</string> <string name="delete">Delete</string> <string name="edit">Edit</string> + <string name="form_comment">Comment</string> <!-- BigFin communication service --> <string name="bigfin_no_ichtyometer_connected_title">No ichtyometer connected</string> Modified: trunk/res/values-fr/strings.xml =================================================================== --- trunk/res/values-fr/strings.xml 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/res/values-fr/strings.xml 2014-01-28 18:42:42 UTC (rev 36) @@ -24,6 +24,7 @@ <string name="one_required_field_error_message">Au moins un de ces champs doit être saisi</string> <string name="delete">Supprimer</string> <string name="edit">Éditer</string> + <string name="form_comment">Commentaire</string> <!-- BigFin communication service --> <string name="bigfin_no_ichtyometer_connected_title">Aucun ichtyomètre connecté</string> Modified: trunk/src/fr/ifremer/wlo/CommercialSpeciesFormActivity.java =================================================================== --- trunk/src/fr/ifremer/wlo/CommercialSpeciesFormActivity.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/CommercialSpeciesFormActivity.java 2014-01-28 18:42:42 UTC (rev 36) @@ -126,6 +126,8 @@ } }); + initEditText(R.id.form_comment, CommercialSpeciesModel.COLUMN_COMMENT); + } @Override Modified: trunk/src/fr/ifremer/wlo/ContextFormActivity.java =================================================================== --- trunk/src/fr/ifremer/wlo/ContextFormActivity.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/ContextFormActivity.java 2014-01-28 18:42:42 UTC (rev 36) @@ -62,6 +62,7 @@ super.onCreate(savedInstanceState); initEditText(R.id.context_form_name, ContextModel.COLUMN_NAME); + initEditText(R.id.form_comment, ContextModel.COLUMN_COMMENT); } Modified: trunk/src/fr/ifremer/wlo/LocationFormActivity.java =================================================================== --- trunk/src/fr/ifremer/wlo/LocationFormActivity.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/LocationFormActivity.java 2014-01-28 18:42:42 UTC (rev 36) @@ -107,6 +107,7 @@ endTimeTextView.setText(getString(R.string.time_format, endDate.getTime())); } + initEditText(R.id.form_comment, LocationModel.COLUMN_COMMENT); } public void pickDate(View v) { Modified: trunk/src/fr/ifremer/wlo/MetierFormActivity.java =================================================================== --- trunk/src/fr/ifremer/wlo/MetierFormActivity.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/MetierFormActivity.java 2014-01-28 18:42:42 UTC (rev 36) @@ -75,6 +75,7 @@ initEditText(R.id.metier_form_zone, MetierModel.COLUMN_ZONE); initEditText(R.id.metier_form_sample_row_code, MetierModel.COLUMN_SAMPLE_ROW_CODE); + initEditText(R.id.form_comment, MetierModel.COLUMN_COMMENT); } } Modified: trunk/src/fr/ifremer/wlo/ScientificSpeciesFormActivity.java =================================================================== --- trunk/src/fr/ifremer/wlo/ScientificSpeciesFormActivity.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/ScientificSpeciesFormActivity.java 2014-01-28 18:42:42 UTC (rev 36) @@ -86,6 +86,8 @@ model.setTakingActivation(b); } }); + + initEditText(R.id.form_comment, ScientificSpeciesModel.COLUMN_COMMENT); } @Override Modified: trunk/src/fr/ifremer/wlo/VesselFormActivity.java =================================================================== --- trunk/src/fr/ifremer/wlo/VesselFormActivity.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/VesselFormActivity.java 2014-01-28 18:42:42 UTC (rev 36) @@ -98,6 +98,8 @@ String dateFormat = UIUtils.getDateFormat(this); landingDateEditor.setText(String.format(dateFormat, landingDate.getTime())); } + + initEditText(R.id.form_comment, VesselModel.COLUMN_COMMENT); } /* Method called by the view */ Modified: trunk/src/fr/ifremer/wlo/WloModelEditionActivity.java =================================================================== --- trunk/src/fr/ifremer/wlo/WloModelEditionActivity.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/WloModelEditionActivity.java 2014-01-28 18:42:42 UTC (rev 36) @@ -235,13 +235,10 @@ } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { Log.e(TAG, "Error on set" + firtsLetterUpperCaseAttribute + " for class " + clazz, e); } + editText.setError(null); + editText.setSelection(start + count); } - @Override - public void afterTextChanged(Editable s) { - editText.setError(null); - editText.setSelection(s.length()); - } }); addModelPropertyChangeListener(editText, attribute, true); @@ -253,7 +250,7 @@ return autoCompleteTextView; } - protected <R> void initAutoCompleteTextView(AutoCompleteTextView autoCompleteTextView, final String attribute, Collection<R> data) { + protected <R> void initAutoCompleteTextView(final AutoCompleteTextView autoCompleteTextView, final String attribute, Collection<R> data) { final Class clazz = model.getClass(); final String firtsLetterUpperCaseAttribute = attribute.substring(0, 1).toUpperCase() + attribute.substring(1); @@ -265,14 +262,19 @@ autoCompleteTextView.setThreshold(0); autoCompleteTextView.setTag(attribute); + autoCompleteTextView.addTextChangedListener(new BaseTextWatcher() { + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + autoCompleteTextView.setError(null); + autoCompleteTextView.setSelection(start + count); + } + }); try { R value = (R) clazz.getMethod("get" + firtsLetterUpperCaseAttribute).invoke(model); if (value != null) { String text = value.toString(); autoCompleteTextView.setText(text); - autoCompleteTextView.setSelection(text.length()); - autoCompleteTextView.setError(null); autoCompleteTextView.dismissDropDown(); } @@ -305,7 +307,6 @@ Object newValue = event.getNewValue(); String text = newValue != null ? newValue.toString() : getString(fr.ifremer.wlo.R.string.undefined); editText.setText(text); - editText.setSelection(text.length()); } } }); Modified: trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java =================================================================== --- trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java 2014-01-28 18:42:42 UTC (rev 36) @@ -182,6 +182,11 @@ sizeText.addTextChangedListener(new BaseTextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { + sizeText.setSelection(start + count); + } + + @Override + public void afterTextChanged(Editable s) { Mensuration.Precision precision = measurements.getPrecision(); int multiplier = precision.getUnitDivider(); try { @@ -196,11 +201,6 @@ measurement.setSize(null); } } - - @Override - public void afterTextChanged(Editable s) { - sizeText.setSelection(s.length()); - } }); Spinner genderSpinner = (Spinner) findViewById(R.id.gender_spinner); Modified: trunk/src/fr/ifremer/wlo/models/CommercialSpeciesModel.java =================================================================== --- trunk/src/fr/ifremer/wlo/models/CommercialSpeciesModel.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/models/CommercialSpeciesModel.java 2014-01-28 18:42:42 UTC (rev 36) @@ -53,6 +53,7 @@ public static final String COLUMN_SORT_CATEGORY = "sortCategory"; public static final String COLUMN_STATE = "state"; public static final String COLUMN_PRESENTATION = "presentation"; + public static final String COLUMN_COMMENT = "comment"; public static final String COLUMN_METIER_ID = "metierId"; public static final String[] ALL_COLUMNS = new String[] { _ID, @@ -63,6 +64,7 @@ COLUMN_SORT_CATEGORY, COLUMN_STATE, COLUMN_PRESENTATION, + COLUMN_COMMENT, COLUMN_METIER_ID }; @@ -73,6 +75,7 @@ protected String sortCategory; protected State state; protected Presentation presentation; + protected String comment; public CommercialSpeciesModel() { } @@ -92,6 +95,7 @@ state = DataCache.getStateById(context, stateId); String presentationId = cursor.getString(7); presentation = DataCache.getPresentationById(context, presentationId); + comment = cursor.getString(8); } public CommercialSpecies getFaoCode() { @@ -165,6 +169,16 @@ firePropertyChange(_ID, oldValue, id); } + public String getComment() { + return comment; + } + + public void setComment(String comment) { + Object oldValue = this.comment; + this.comment = comment; + firePropertyChange(COLUMN_COMMENT, oldValue, comment); + } + @Override public String getTableName() { return TABLE_NAME; @@ -185,6 +199,7 @@ putValue(value, COLUMN_SORT_CATEGORY, sortCategory); putValue(value, COLUMN_STATE, state != null ? state.getId() : null); putValue(value, COLUMN_PRESENTATION, presentation != null ? presentation.getId() : null); + putValue(value, COLUMN_COMMENT, comment); putValue(value, COLUMN_METIER_ID, getParentId()); return value; } Modified: trunk/src/fr/ifremer/wlo/models/ContextModel.java =================================================================== --- trunk/src/fr/ifremer/wlo/models/ContextModel.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/models/ContextModel.java 2014-01-28 18:42:42 UTC (rev 36) @@ -41,12 +41,15 @@ public static final String TABLE_NAME = "contexts"; public static final String COLUMN_NAME = "name"; + public static final String COLUMN_COMMENT = "comment"; public static final String[] ALL_COLUMNS = new String[] { _ID, - COLUMN_NAME + COLUMN_NAME, + COLUMN_COMMENT }; protected String name; + protected String comment; public ContextModel() { } @@ -54,6 +57,7 @@ public ContextModel(Cursor cursor) { super(cursor); name = cursor.getString(1); + comment = cursor.getString(2); } public String getName() { @@ -66,6 +70,16 @@ firePropertyChange(COLUMN_NAME, oldValue, name); } + public String getComment() { + return comment; + } + + public void setComment(String comment) { + Object oldValue = this.comment; + this.comment = comment; + firePropertyChange(COLUMN_COMMENT, oldValue, comment); + } + @Override public String getTableName() { return TABLE_NAME; @@ -80,6 +94,7 @@ public ContentValues convertIntoContentValues() { ContentValues value = super.convertIntoContentValues(); putValue(value, COLUMN_NAME, name); + putValue(value, COLUMN_COMMENT, comment); return value; } Modified: trunk/src/fr/ifremer/wlo/models/LocationModel.java =================================================================== --- trunk/src/fr/ifremer/wlo/models/LocationModel.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/models/LocationModel.java 2014-01-28 18:42:42 UTC (rev 36) @@ -47,6 +47,7 @@ public static final String COLUMN_START_DATE = "startDate"; public static final String COLUMN_END_DATE = "endDate"; public static final String COLUMN_LOCATION = "location"; + public static final String COLUMN_COMMENT = "comment"; public static final String COLUMN_CONTEXT_ID = "contextId"; public static final String[] ALL_COLUMNS = new String[] { _ID, @@ -54,6 +55,7 @@ COLUMN_START_DATE, COLUMN_END_DATE, COLUMN_LOCATION, + COLUMN_COMMENT, COLUMN_CONTEXT_ID }; @@ -61,6 +63,7 @@ protected Calendar startDate; protected Calendar endDate; protected Location location; + protected String comment; public LocationModel() { } @@ -72,6 +75,7 @@ endDate = UIUtils.getCalendarFromCursor(cursor, 3); String locationId = cursor.getString(4); location = DataCache.getLocationById(context, locationId); + comment = cursor.getString(5); } public String getOperator() { @@ -114,6 +118,16 @@ firePropertyChange(COLUMN_LOCATION, oldValue, location); } + public String getComment() { + return comment; + } + + public void setComment(String comment) { + Object oldValue = this.comment; + this.comment = comment; + firePropertyChange(COLUMN_COMMENT, oldValue, comment); + } + @Override public String getTableName() { return TABLE_NAME; @@ -131,6 +145,7 @@ putValue(value, COLUMN_START_DATE, startDate != null ? startDate.getTimeInMillis() : null); putValue(value, COLUMN_END_DATE, endDate != null ? endDate.getTimeInMillis() : null); putValue(value, COLUMN_LOCATION, location != null ? location.getId() : null); + putValue(value, COLUMN_COMMENT, comment); putValue(value, COLUMN_CONTEXT_ID, getParentId()); return value; } Modified: trunk/src/fr/ifremer/wlo/models/MetierModel.java =================================================================== --- trunk/src/fr/ifremer/wlo/models/MetierModel.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/models/MetierModel.java 2014-01-28 18:42:42 UTC (rev 36) @@ -43,18 +43,21 @@ public static final String COLUMN_GEAR_SPECIES = "gearSpecies"; public static final String COLUMN_ZONE = "zone"; public static final String COLUMN_SAMPLE_ROW_CODE = "sampleRowCode"; + public static final String COLUMN_COMMENT = "comment"; public static final String COLUMN_VESSEL_ID = "vesselId"; public static final String[] ALL_COLUMNS = new String[] { _ID, COLUMN_GEAR_SPECIES, COLUMN_ZONE, COLUMN_SAMPLE_ROW_CODE, + COLUMN_COMMENT, COLUMN_VESSEL_ID }; protected Metier gearSpecies; protected String zone; protected String sampleRowCode; + protected String comment; public MetierModel() { } @@ -65,6 +68,7 @@ gearSpecies = DataCache.getMetierById(context, gearSpeciesId); zone = cursor.getString(2); sampleRowCode = cursor.getString(3); + comment = cursor.getString(4); } public Metier getGearSpecies() { @@ -97,6 +101,16 @@ firePropertyChange(COLUMN_SAMPLE_ROW_CODE, oldValue, sampleRowCode); } + public String getComment() { + return comment; + } + + public void setComment(String comment) { + Object oldValue = this.comment; + this.comment = comment; + firePropertyChange(COLUMN_COMMENT, oldValue, comment); + } + @Override public String getTableName() { return TABLE_NAME; @@ -113,6 +127,7 @@ putValue(value, COLUMN_GEAR_SPECIES, gearSpecies != null ? gearSpecies.getId() : null); putValue(value, COLUMN_ZONE, zone); putValue(value, COLUMN_SAMPLE_ROW_CODE, sampleRowCode); + putValue(value, COLUMN_COMMENT, comment); putValue(value, COLUMN_VESSEL_ID, getParentId()); return value; } Modified: trunk/src/fr/ifremer/wlo/models/ScientificSpeciesModel.java =================================================================== --- trunk/src/fr/ifremer/wlo/models/ScientificSpeciesModel.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/models/ScientificSpeciesModel.java 2014-01-28 18:42:42 UTC (rev 36) @@ -43,16 +43,19 @@ public static final String TABLE_NAME = "scientific_species"; public static final String COLUMN_NAME = "name"; public static final String COLUMN_TAKING_ACTIVATION = "takingActivation"; + public static final String COLUMN_COMMENT = "comment"; public static final String COLUMN_COMMERCIAL_SPECIES_ID = "commercialSpeciesId"; public static final String[] ALL_COLUMNS = new String[] { _ID, COLUMN_NAME, COLUMN_TAKING_ACTIVATION, + COLUMN_COMMENT, COLUMN_COMMERCIAL_SPECIES_ID }; protected ScientificSpecies name; protected boolean takingActivation; + protected String comment; public ScientificSpeciesModel() { } @@ -62,6 +65,7 @@ String nameId = cursor.getString(1); name = DataCache.getScientificSpeciesById(context, nameId); takingActivation = cursor.getShort(2) > 0; + comment = cursor.getString(3); } public ScientificSpecies getName() { @@ -84,6 +88,16 @@ firePropertyChange(COLUMN_TAKING_ACTIVATION, oldValue, takingActivation); } + public String getComment() { + return comment; + } + + public void setComment(String comment) { + Object oldValue = this.comment; + this.comment = comment; + firePropertyChange(COLUMN_COMMENT, oldValue, comment); + } + @Override public String getTableName() { return TABLE_NAME; @@ -99,6 +113,7 @@ ContentValues value = super.convertIntoContentValues(); putValue(value, COLUMN_NAME, name != null ? name.getId() : null); putValue(value, COLUMN_TAKING_ACTIVATION, takingActivation ? 1 : 0); + putValue(value, COLUMN_COMMENT, comment); putValue(value, COLUMN_COMMERCIAL_SPECIES_ID, getParentId()); return value; } Modified: trunk/src/fr/ifremer/wlo/models/VesselModel.java =================================================================== --- trunk/src/fr/ifremer/wlo/models/VesselModel.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/models/VesselModel.java 2014-01-28 18:42:42 UTC (rev 36) @@ -51,6 +51,7 @@ public static final String COLUMN_NAME = "name"; public static final String COLUMN_LANDING_DATE = "landingDate"; public static final String COLUMN_LANDING_LOCATION = "landingLocation"; + public static final String COLUMN_COMMENT = "comment"; public static final String COLUMN_LOCATION_ID = "location_id"; public static final String[] ALL_COLUMNS = new String[] { _ID, @@ -58,6 +59,7 @@ COLUMN_NAME, COLUMN_LANDING_DATE, COLUMN_LANDING_LOCATION, + COLUMN_COMMENT, COLUMN_LOCATION_ID }; @@ -65,6 +67,7 @@ protected String name; protected Calendar landingDate; protected Location landingLocation; + protected String comment; public VesselModel() { } @@ -76,6 +79,7 @@ landingDate = UIUtils.getCalendarFromCursor(cursor, 3); String landingLocationId = cursor.getString(4); landingLocation = DataCache.getLocationById(context, landingLocationId); + comment = cursor.getString(5); } public String getRegistrationNumber() { @@ -130,6 +134,16 @@ firePropertyChange(COLUMN_LANDING_LOCATION, oldValue, landingLocation); } + public String getComment() { + return comment; + } + + public void setComment(String comment) { + Object oldValue = this.comment; + this.comment = comment; + firePropertyChange(COLUMN_COMMENT, oldValue, comment); + } + @Override public String getTableName() { return TABLE_NAME; @@ -148,6 +162,7 @@ putValue(value, COLUMN_NAME, name); putValue(value, COLUMN_LANDING_DATE, landingDate != null ? landingDate.getTimeInMillis() : null); putValue(value, COLUMN_LANDING_LOCATION, landingLocation != null ? landingLocation.getId() : null); + putValue(value, COLUMN_COMMENT, comment); putValue(value, COLUMN_LOCATION_ID, getParentId()); return value; } Modified: trunk/src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java =================================================================== --- trunk/src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java 2014-01-28 17:58:49 UTC (rev 35) +++ trunk/src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java 2014-01-28 18:42:42 UTC (rev 36) @@ -66,7 +66,7 @@ private static final String TAG = "WloOpenHelper"; public static final String DATABASE_NAME = "wlo.db"; - public static final int DATABASE_VERSION = 13; + public static final int DATABASE_VERSION = 14; public static final String TEXT_TYPE = " TEXT"; public static final String BIGINT_TYPE = " BIGINT"; @@ -78,7 +78,8 @@ protected static final String SQL_CREATE_CONTEXTS = "CREATE TABLE " + ContextModel.TABLE_NAME + " (" + ContextModel._ID + TEXT_TYPE + " PRIMARY KEY" + COMMA_SEP + - ContextModel.COLUMN_NAME + TEXT_TYPE + NOT_NULL + + ContextModel.COLUMN_NAME + TEXT_TYPE + NOT_NULL + COMMA_SEP + + ContextModel.COLUMN_COMMENT + TEXT_TYPE + " )"; protected static final String SQL_DELETE_CONTEXTS = @@ -93,6 +94,7 @@ LocationModel.COLUMN_START_DATE + BIGINT_TYPE + COMMA_SEP + LocationModel.COLUMN_END_DATE + BIGINT_TYPE + COMMA_SEP + LocationModel.COLUMN_LOCATION + TEXT_TYPE + NOT_NULL + COMMA_SEP + + LocationModel.COLUMN_COMMENT + TEXT_TYPE + COMMA_SEP + LocationModel.COLUMN_CONTEXT_ID + TEXT_TYPE + NOT_NULL + COMMA_SEP + "FOREIGN KEY(" + LocationModel.COLUMN_CONTEXT_ID + ") REFERENCES " + ContextModel.TABLE_NAME + "(" + ContextModel._ID + ") ON DELETE CASCADE" + COMMA_SEP + @@ -111,6 +113,7 @@ VesselModel.COLUMN_NAME + TEXT_TYPE + COMMA_SEP + VesselModel.COLUMN_LANDING_DATE + BIGINT_TYPE + COMMA_SEP + VesselModel.COLUMN_LANDING_LOCATION + TEXT_TYPE + COMMA_SEP + + VesselModel.COLUMN_COMMENT + TEXT_TYPE + COMMA_SEP + VesselModel.COLUMN_LOCATION_ID + TEXT_TYPE + NOT_NULL + COMMA_SEP + "FOREIGN KEY(" + VesselModel.COLUMN_LOCATION_ID + ") REFERENCES " + LocationModel.TABLE_NAME + "(" + LocationModel._ID + ") ON DELETE CASCADE" + COMMA_SEP + @@ -128,6 +131,7 @@ MetierModel.COLUMN_GEAR_SPECIES + TEXT_TYPE + COMMA_SEP + MetierModel.COLUMN_ZONE + TEXT_TYPE + COMMA_SEP + MetierModel.COLUMN_SAMPLE_ROW_CODE + TEXT_TYPE + COMMA_SEP + + MetierModel.COLUMN_COMMENT + TEXT_TYPE + COMMA_SEP + MetierModel.COLUMN_VESSEL_ID + TEXT_TYPE + NOT_NULL + COMMA_SEP + "FOREIGN KEY(" + MetierModel.COLUMN_VESSEL_ID + ") REFERENCES " + VesselModel.TABLE_NAME + "(" + VesselModel._ID + ") ON DELETE CASCADE" + COMMA_SEP + @@ -149,6 +153,7 @@ CommercialSpeciesModel.COLUMN_SORT_CATEGORY + TEXT_TYPE + COMMA_SEP + CommercialSpeciesModel.COLUMN_STATE + TEXT_TYPE + COMMA_SEP + CommercialSpeciesModel.COLUMN_PRESENTATION + TEXT_TYPE + COMMA_SEP + + CommercialSpeciesModel.COLUMN_COMMENT + TEXT_TYPE + COMMA_SEP + CommercialSpeciesModel.COLUMN_METIER_ID + TEXT_TYPE + NOT_NULL + COMMA_SEP + "FOREIGN KEY(" + CommercialSpeciesModel.COLUMN_METIER_ID + ") REFERENCES " + MetierModel.TABLE_NAME + "(" + MetierModel._ID + ") ON DELETE CASCADE" + COMMA_SEP + @@ -171,6 +176,7 @@ ScientificSpeciesModel._ID + TEXT_TYPE + " PRIMARY KEY" + COMMA_SEP + ScientificSpeciesModel.COLUMN_NAME + TEXT_TYPE + COMMA_SEP + ScientificSpeciesModel.COLUMN_TAKING_ACTIVATION + BYTE_TYPE + COMMA_SEP + + ScientificSpeciesModel.COLUMN_COMMENT + TEXT_TYPE + COMMA_SEP + ScientificSpeciesModel.COLUMN_COMMERCIAL_SPECIES_ID + TEXT_TYPE + NOT_NULL + COMMA_SEP + "FOREIGN KEY(" + ScientificSpeciesModel.COLUMN_COMMERCIAL_SPECIES_ID + ") REFERENCES " + CommercialSpeciesModel.TABLE_NAME + "(" + CommercialSpeciesModel._ID + ") ON DELETE CASCADE" + COMMA_SEP +