edesiocs / ingatan

Automatically exported from code.google.com/p/ingatan
Other
0 stars 0 forks source link

When editing a Flashcard (Table) type question, deleting an entry does not delete the corresponding entry records. #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
A flashcard question is represented by 2 String arrays, and the records such as 
timesAsked, marksAwarded, marksAchieved. The String data is edited by the user 
in the GUI, and when saving, the internal data is synched up with the GUI data.

Currently, if entries have been deleted from the table, then the corresponding 
records are not deleted from the internal arrays (i.e. timesAsked, etc.) When 
saving, these arrays are found to be longer than the String arrays, and are 
truncated. This means that if just 1 table entry is deleted, all the records 
for the table prior to that point are misaligned.

This can easily be fixed by adding code in DeleteRowAction.actionPerformed() of 
the DataTable class to update the internal data with the current GUI data, then 
delete the row and corresponding records internally and on the GUI.

Original issue reported on code.google.com by tom.eve...@gmail.com on 3 Feb 2011 at 2:58

GoogleCodeExporter commented 9 years ago
A new release of Ingatan will be put out within the next few days.

Original comment by tom.eve...@gmail.com on 3 Feb 2011 at 2:59

GoogleCodeExporter commented 9 years ago

Original comment by tom.eve...@gmail.com on 3 Feb 2011 at 3:00

GoogleCodeExporter commented 9 years ago

Original comment by tom.eve...@gmail.com on 3 Feb 2011 at 3:00

GoogleCodeExporter commented 9 years ago
Harder than first thought as the code for row deletion is in the DataTable 
column, as well as other identified methods that are problematic for the same 
reason, including: copy, paste, cut, etc.

To solve this, a 2D array of doubles will be encapsulated by the DataTable. 
There can be as many columns as required, with each column representing a 
record of interest, e.g. timesAsked, etc. The table will be referred to in the 
interface as "synchronisedData", with the javadoc explaining that this table 
will have values removed correspondingly when the DataTable is mutated.

When the QuestionList calls its updateQuestionsWithContent() method, it will 
pull the synchronisedData from the DataTable and use this.

Original comment by tom.eve...@gmail.com on 3 Feb 2011 at 5:40

GoogleCodeExporter commented 9 years ago
This has been implemented in revision 64e5121eeb, revision e35536df0a, revision 
031dfa1c20, and revision 9e67460d63, chronologically.

A 2D array is not used, instead an ArrayList is 'registered' with the DataTable 
through it's registerSynchronisedData() method. This is then added to a nested 
class within DataTable, SynchronisedData, which puts it in an array of 
ArrayLists.

This encapsulation means that all registered ArrayLists can be altered equally 
by a single (i.e. not in a for loop) call to the SynchronisedData object, for 
example syncrhonisedData.add(index, 0);

Original comment by tom.eve...@gmail.com on 4 Feb 2011 at 12:44

GoogleCodeExporter commented 9 years ago

Original comment by tom.eve...@gmail.com on 4 Feb 2011 at 12:44