|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectscheduler.view.ListView
public class ListView
The List View model class. This class filters the data from ViewSettings and passes it to its companion view class ListViewUI. This class contains a table model that serves as an adaptor between a schedule and a table object that is displayed.
Nested Class Summary | |
---|---|
(package private) class |
ListView.ListViewRow
The inner class ListViewRow is a container of a ScheduleItem and its form as row data in the list view table. |
Field Summary | |
---|---|
protected javax.swing.table.TableColumn[] |
columns
The columns of the table. |
protected FilterOptions |
filterOptions
FilterOptions for the view. |
protected ListViewUI |
listViewUI
The companion view object. |
protected java.util.ArrayList<ListView.ListViewRow> |
rows
The rows of the table. |
protected Schedule |
schedule
The Schedule to be drawn. |
protected javax.swing.JTable |
table
The JTable to be displayed. |
protected javax.swing.table.DefaultTableModel |
tableModel
The TableModel of viewable data. |
View |
view
The parent view. |
Constructor Summary | |
---|---|
ListView(View view,
Schedule schedule)
Construct this class using its parent view object. |
Method Summary | |
---|---|
protected void |
createColumns()
Saves the column objects from the table |
protected void |
createRows()
Creates rows for the Table Model using a Schedule's ScheduleItems. |
protected void |
defaultRowSort()
Sets the default column to sort by. |
ListViewUI |
getListViewUI()
Returns the companion View object. |
ScheduleItem |
getScheduleItemOf(java.lang.String courseName,
int section)
Returns the visible row with the given course name and section. |
javax.swing.JTable |
getTable()
Returns the table of data. |
protected boolean |
unFiltered(ListView.ListViewRow row)
Takes a list view and check if it has been filtered out based on its course, instructor, or location. |
void |
update()
Redraws the entire JTable. |
void |
updateColumn(int col,
boolean visible)
Removes the column if it has been deselected in the filter options pane and turns on auto column resize if column is below 12, otherwise add the column and turns auto-column resize off if the column count has exceeded 11. |
protected void |
updateColumns()
All columns have been created. |
void |
updateCourseFilter(CourseFilterObj cfo)
updateCourseFilter finds all rows that have a course matching the course in the CourseFilterObj. |
void |
updateInstructorFilter(InstructorFilterObj ifo)
updateInstructorFilter finds all rows that have a course matching the instructor in the InstructorFilterObj. |
void |
updateLocationFilter(LocationFilterObj lfo)
updateCourseFilter finds all rows that have a location matching the location in the LocationFilterObj. |
protected void |
updateRows()
Initializes table rows by adding all unfiltered rows to the table. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public View view
protected javax.swing.table.DefaultTableModel tableModel
protected Schedule schedule
protected javax.swing.table.TableColumn[] columns
protected java.util.ArrayList<ListView.ListViewRow> rows
protected javax.swing.JTable table
protected FilterOptions filterOptions
protected ListViewUI listViewUI
Constructor Detail |
---|
public ListView(View view, Schedule schedule) throws Instructor.NullUserIDException
pre: ; post: this.view' == view && this.schedule' == schedule && this.filterOptions' == view.getViewSettings().getFilterOptions() && this.tableModel' != null && this.listViewUI' != null;
view
- the scheduler's view objectschedule
- the schedule to be viewed
Instructor.NullUserIDException
- check instructor validityMethod Detail |
---|
protected void createRows() throws Instructor.NullUserIDException
pre:; post: this.rows' != null && forall (ScheduleItem s | s in schedule) exists (ListViewRow lvr) (lvr in rows) && (lvr.schedulteItem == s)
Instructor.NullUserIDException
- check instructor validityprotected void createColumns()
pre: ; post: this.columns' != null && forall (TableColumn tc | table) tc in columns;
protected void defaultRowSort()
pre: ; post: if (view.getViewSettings().getViewType() == ViewType.COURSE) then if (view.getViewSettings().getViewLevel().getLevel() == ViewLevel.Level.WEEKLY) then for(int x = 0; x < table.getRowCount()-1; x++) table.getValueAt(x, 20) <= table.getValueAt(x + 1, 20) else for(int x = 0; x < table.getRowCount()-1; x++) table.getValueAt(x, 1) <= table.getValueAt(x + 1, 1) else if (view.getViewSettings().getViewType() == ViewType.INSTRUCTOR) then for(int x = 0; x < table.getRowCount()-1; x++) table.getValueAt(x, 8) <= table.getValueAt(x + 1, 8) else if (view.getViewSettings().getViewLevel().getLevel() == ViewLevel.Level.WEEKLY) then for(int x = 0; x < table.getRowCount()-1; x++) table.getValueAt(x, 20) <= table.getValueAt(x + 1, 20) else for(int x = 0; x < table.getRowCount()-1; x++) table.getValueAt(x, 13) <= table.getValueAt(x + 1, 13);
protected boolean unFiltered(ListView.ListViewRow row)
pre: ; post: if (view.getViewSettings().getViewType() == ViewType.COURSE) then if (exists (CourseFilterObj x) (x in courseFil ) && (x.getCourse.toString() == row.scheduleItem.c.toString()) && (x.isSelected()) then return true else return false else if (view.getViewSettings().getViewType() == ViewType.INSTRUCTOR) then if (exists (InstructorFilterObj x) (x in instrFil ) && (x.getInstructor().getId() == row.scheduleItem.getInstructor().getId()) && (x.isSelected()) then return true else return false else if (exists (LocationFilterObj x) (x in locationFil) && (x.getLocation().getBuilding() == row.rowData[13]) && (x.getLocation().getRoom() == row.rowData[14]) && (x.isSelected()) then return true else return false;
row
- check if this row is filtered
protected void updateRows()
pre: ; post: forall (ListViewRow r | r in rows && unFiltered(r) == true && Time.isWithin(r.start, r.end, advancedFilters.start, advancedFilters.end) && ((weekly && r.days.semiEquals(advancedFilters.days)) || (daily && r.day == daily.day))) r.rowData in table;
protected void updateColumns()
pre:; post: forall (TableColumn c | c in columns && !filterOptionsArray[c.index]) !(c in table) && if (table.getColumnCount() >= 12) then table.autoResizeMode == JTable.AUTO_RESIZE_OFF else table.autoResizeMode == JTable.AUTO_RESIZE_LAST_COLUMN;
public void updateColumn(int col, boolean visible)
pre: ; post: if (visibile == true) then columns[col] in table else !(columns[col] in table) && if (table.getColumnCount() >= 12) then table.autoResizeMode == JTable.AUTO_RESIZE_OFF else table.autoResizeMode == JTable.AUTO_RESIZE_LAST_COLUMN
col
- the column index to be added or removedvisible
- boolean to determine whether column is added or removedpublic void updateCourseFilter(CourseFilterObj cfo)
pre: ; post: forall (ListViewRow r : r in rows && cfo.course == row.scheduleItem.course) if (cfo.isSelected()) then r.rowData in table else !(r.rowData in table;
cfo
- course filter object to determine if course is hiddenpublic void updateInstructorFilter(InstructorFilterObj ifo)
pre: ; post: forall (ListViewRow r : r in rows && ifo.instructor == row.scheduleItem.instructor) if (ifo.isSelected()) then r.rowData in table else !(r.rowData in table;
ifo
- determine if instructor is hiddenpublic void updateLocationFilter(LocationFilterObj lfo)
pre: ; post: forall (ListViewRow r : r in rows && lfo.location == row.scheduleItem.location) if (lfo.isSelected()) then r.rowData in table else !(r.rowData in table;
lfo
- determine if location is hiddenpublic void update()
pre:; post: this.tableModel' != null;
public javax.swing.JTable getTable()
post: return == table;
public ScheduleItem getScheduleItemOf(java.lang.String courseName, int section)
pre: ; post: if exists (ListViewRow r) (r in rows) && (r.scheduleItem.c.courseName == courseName) && (r.scheduleItem.c.section == section) then return == r.scheduleItem else return == null
courseName
- name of the course in the tablesection
- section of the course in the table
public ListViewUI getListViewUI()
post: return == listViewUI;
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |