
Inspector subclass: #CalendarInspector
  instanceVariableNames: 
    'dictionary instList selectedString '
  classVariableNames: ''
  poolDictionaries: '' !

!CalendarInspector class methods !

new
          "Answer a new CalendarInspector."

          ^super new initialize! !


!CalendarInspector methods !

accept: aString from: aDispatcher
          "Set the text entered for a given date."

          dictionary at: selectedString put: aString.
          ^true!

initialize
          "Initialize the dictionary to hold text."

          dictionary := Dictionary new!

instance
          "Return the text associated with the selected
            date selectedString."

          ^ dictionary at: selectedString ifAbsent: [String new]!

instVarList
    "Private - Answer an OrderedCollection of dates
      for the list pane."

          ^ instList!

selectInstance: aString
    "Private - the user selected this date."

          selectedString := aString.
          self changed: #instance!

setInstList
    "Private - Initialize an OrderedCollection of dates
      in the year object."

    |firstDay|
    firstDay := Date newDay: 1 year: object.
    instList := OrderedCollection new.
    0 to: (Date daysInYear: object) - 1 do: [ :i | instList add: (firstDay  addDays: i) printString]! !
