2008:SOFTENG702: Difference between revisions
No edit summary |
No edit summary |
||
Line 23: | Line 23: | ||
*2D array - Nicely laid out already, easy to deal with. | *2D array - Nicely laid out already, easy to deal with. | ||
*TableModel - Its the way JTable does it, programmers know how to deal with it. | *TableModel - Its the way JTable does it, programmers know how to deal with it. | ||
We will may have to make our own | We will may have to make our own SortedTableModel class which holds the sorted information. | ||
Line 29: | Line 29: | ||
We can maintain an array of sorted columns objects. Each object can store the dirrection of sorting and the column number. The order of objects in the array can determine the order of priority. The sorting class can maintain this array. When a new button is clicked, an additional sorting object will be created and added to the array in the | We can maintain an array of sorted columns objects. Each object can store the dirrection of sorting and the column number. The order of objects in the array can determine the order of priority. The sorting class can maintain this array. When a new button is clicked, an additional sorting object will be created and added to the array in the SortedTableModel. This will be passed into the SortedTableModelwhich will then be compare the array of already sorted elements. The point along the array where the sorting is different is where the class will start to sort from. The sorting algorithm could work by considering "buckets" of sorted rows, and sorting within those buckets. | ||
We can use https://www.cs.auckland.ac.nz/references/java/java1.5/tutorial/uiswing/components/examples/TableSorter.java as a base. | |||
Our design is based around a Model-View-Controller Architecture. Our model is the table model. The view is the TableWidged and the controller is the TableSorter class. The table sorter class can use a list of our SortingInstructions. |
Revision as of 05:17, 18 May 2008
https://www.se.auckland.ac.nz/wiki2008/index.php?title=SE702:JavaTableWidget
Initial list of objectives
- Sort the rows to a column.
- Sort by multiple columns.
- Sort according to a primary column, then according to a secondary column (reverse order too?).
- Sort by ascending and descending.
- Bucket Sort
- Search for rows.
- Searching in a column by typing in a text string - have the focus jump to matching cells as you type (For cells containing text)
- Redundancy free columns
- Having duplicate entries in a column span several rows.
- Strong border - This will likely not be implemented.
Design
The table can be built using swing components - It can extend JComponent. JButtons for columns and JTextFields or JLables for rows. Buttons would make it easy to capture the click. We can take in a table model like JTable or a 2d array.
- 2D array - Nicely laid out already, easy to deal with.
- TableModel - Its the way JTable does it, programmers know how to deal with it.
We will may have to make our own SortedTableModel class which holds the sorted information.
We can use the ALM example from class to create the areas.
We can maintain an array of sorted columns objects. Each object can store the dirrection of sorting and the column number. The order of objects in the array can determine the order of priority. The sorting class can maintain this array. When a new button is clicked, an additional sorting object will be created and added to the array in the SortedTableModel. This will be passed into the SortedTableModelwhich will then be compare the array of already sorted elements. The point along the array where the sorting is different is where the class will start to sort from. The sorting algorithm could work by considering "buckets" of sorted rows, and sorting within those buckets.
We can use https://www.cs.auckland.ac.nz/references/java/java1.5/tutorial/uiswing/components/examples/TableSorter.java as a base.
Our design is based around a Model-View-Controller Architecture. Our model is the table model. The view is the TableWidged and the controller is the TableSorter class. The table sorter class can use a list of our SortingInstructions.