Package io.guise.framework.model
Class CalendarMonthTableModel
java.lang.Object
com.globalmentor.beans.BoundPropertyObject
io.guise.framework.model.AbstractModel
io.guise.framework.model.AbstractTableModel
io.guise.framework.model.CalendarMonthTableModel
- All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,Model
,TableModel
A table model representing the days of a calendar month. Each cell contains a
Date
value.- Author:
- Garret Wilson
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
A day-of-week column in a calendar month table.Nested classes/interfaces inherited from interface io.guise.framework.model.TableModel
TableModel.Cell<C>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The column style bound property.static final String
The date bound property.Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
-
Constructor Summary
ConstructorDescriptionDefault constructor for current month using the current date.CalendarMonthTableModel
(Date date) Date constructor. -
Method Summary
Modifier and TypeMethodDescription<C> C
getCellValue
(int rowIndex, TableColumnModel<C> column) Returns the cell value at the given row and column.protected DateFormat
getDate()
protected int
protected Calendar
int
<C> void
setCellValue
(int rowIndex, TableColumnModel<C> column, C newCellValue) Sets the cell value at the given row and column.void
setColumnLabelDateStyle
(DateStringLiteralStyle newColumnLabelStyle) Sets the style of the column label.void
Sets the date this calendar represents.protected void
Updates the column label date format based upon the column label date style and current locale.protected void
Updates the model based upon the current calendar.Methods inherited from class io.guise.framework.model.AbstractTableModel
addColumn, clearColumns, getCellValue, getColumnCount, getColumnIndex, getColumns, setCellValue
Methods inherited from class io.guise.framework.model.AbstractModel
getEventListenerManager, getPlainText
Methods inherited from class com.globalmentor.beans.BoundPropertyObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from interface com.globalmentor.beans.PropertyConstrainable
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
Field Details
-
COLUMN_LABEL_DATE_STYLE_PROPERTY
The column style bound property. -
DATE_PROPERTY
The date bound property.
-
-
Constructor Details
-
CalendarMonthTableModel
public CalendarMonthTableModel()Default constructor for current month using the current date. -
CalendarMonthTableModel
Date constructor.- Parameters:
date
- The date this calendar is to represent.- Throws:
NullPointerException
- if the given date isnull
.
-
-
Method Details
-
getSession
- Returns:
- The Guise session that owns this object.
-
getDayOffset
protected int getDayOffset()- Returns:
- The number of days this calendar should be offset left (negative) or right (positive) so that the days align with the correct day-of-the-week column.
-
getRowCount
public int getRowCount()- Returns:
- The number of rows in this table.
-
getMonthCalendar
- Returns:
- A clone of the calendar representing the first day of the month.
-
getDate
- Returns:
- The date this calendar represents.
-
setDate
Sets the date this calendar represents. A copy will be made of the date before it is stored. This is a bound property.- Parameters:
newDate
- The date this calendar is to represent.- Throws:
NullPointerException
- if the given date isnull
.- See Also:
-
getColumnLabelDateStyle
- Returns:
- The style of the column label.
-
setColumnLabelDateStyle
Sets the style of the column label. Note that this property is experimental, and may eventually be replaced with a style specification in the table component rather than the table model. This is a bound property.- Parameters:
newColumnLabelStyle
- The style of the column label.- Throws:
NullPointerException
- if the given label style isnull
.- See Also:
-
getColumnLabelDateFormat
- Returns:
- The date format object for formatting the column labels.
-
updateModel
protected void updateModel()Updates the model based upon the current calendar. The column label date format is also updated.- See Also:
-
updateColumnLabelDateFormat
protected void updateColumnLabelDateFormat()Updates the column label date format based upon the column label date style and current locale.- See Also:
-
getCellValue
Description copied from interface:TableModel
Returns the cell value at the given row and column.- Type Parameters:
C
- The type of cell values in the given column.- Parameters:
rowIndex
- The zero-based row index.column
- The column for which a value should be returned.- Returns:
- The value in the cell at the given row and column, or
null
if there is no value in that cell.
-
setCellValue
Description copied from interface:TableModel
Sets the cell value at the given row and column.- Type Parameters:
C
- The type of cell values in the given column.- Parameters:
rowIndex
- The zero-based row index.column
- The column for which a value should be returned.newCellValue
- The value to place in the cell at the given row and column, ornull
if there should be no value in that cell.
-