diff --git a/src/calendar/view/EditEventContainer.mjs b/src/calendar/view/EditEventContainer.mjs index d12ced55f..6da2d380a 100644 --- a/src/calendar/view/EditEventContainer.mjs +++ b/src/calendar/view/EditEventContainer.mjs @@ -250,7 +250,7 @@ class EditEventContainer extends FormContainer { onDeleteButtonClick(data) { let me = this; - me.getModel().getStore('events').remove(me.record); + me.getStateProvider().getStore('events').remove(me.record); me.unmount() } diff --git a/src/calendar/view/MainContainer.mjs b/src/calendar/view/MainContainer.mjs index baa78d93b..ca548223a 100644 --- a/src/calendar/view/MainContainer.mjs +++ b/src/calendar/view/MainContainer.mjs @@ -1,11 +1,11 @@ -import CalendarsContainer from './calendars/Container.mjs'; -import Container from '../../container/Base.mjs'; -import DateSelector from '../../component/DateSelector.mjs'; -import DateUtil from '../../util/Date.mjs'; -import EditCalendarContainer from './calendars/EditContainer.mjs'; -import EditEventContainer from './EditEventContainer.mjs'; -import MainContainerModel from './MainContainerModel.mjs'; -import Toolbar from '../../toolbar/Base.mjs'; +import CalendarsContainer from './calendars/Container.mjs'; +import Container from '../../container/Base.mjs'; +import DateSelector from '../../component/DateSelector.mjs'; +import DateUtil from '../../util/Date.mjs'; +import EditCalendarContainer from './calendars/EditContainer.mjs'; +import EditEventContainer from './EditEventContainer.mjs'; +import MainContainerStateProvider from './MainContainerStateProvider.mjs'; +import Toolbar from '../../toolbar/Base.mjs'; const todayDate = new Date(); @@ -102,10 +102,6 @@ class MainContainer extends Container { * @protected */ layout: {ntype: 'vbox', align: 'stretch'}, - /** - * @member {Neo.calendar.view.MainContainerModel} model=MainContainerModel - */ - model: MainContainerModel, /** * @member {Neo.calendar.view.Component|null} monthComponent=null */ @@ -139,6 +135,10 @@ class MainContainer extends Container { * @member {Number} sideBarWidth=220 */ sideBarWidth: 220, + /** + * @member {Neo.calendar.view.MainContainerStateProvider} stateProvider=MainContainerStateProvider + */ + stateProvider: MainContainerStateProvider, /** * @member {Boolean} useSettingsContainer_=true */ @@ -326,12 +326,12 @@ class MainContainer extends Container { let me = this; me._editCalendarContainer = value = Neo.create({ - module : EditCalendarContainer, - appName : me.appName, - model : {parent: me.getModel()}, - owner : me, - width : 250, - windowId: me.windowId, + module : EditCalendarContainer, + appName : me.appName, + owner : me, + stateProvider: {parent: me.getStateProvider()}, + width : 250, + windowId : me.windowId, ...me.editCalendarContainerConfig }) } @@ -349,12 +349,12 @@ class MainContainer extends Container { let me = this; me._editEventContainer = value = Neo.create({ - module : EditEventContainer, - appName : me.appName, - model : {parent: me.getModel()}, - owner : me, - width : 250, - windowId: me.windowId, + module : EditEventContainer, + appName : me.appName, + owner : me, + stateProvider: {parent: me.getStateProvider()}, + width : 250, + windowId : me.windowId, ...me.editEventContainerConfig }) } @@ -600,7 +600,7 @@ class MainContainer extends Container { * @param {String} data.value */ onDateSelectorChange(data) { - data.oldValue !== undefined && this.getModel().setData('currentDate', new Date(`${data.value}T00:00:00.000Z`)) + data.oldValue !== undefined && this.getStateProvider().setData('currentDate', new Date(`${data.value}T00:00:00.000Z`)) } /** @@ -621,7 +621,7 @@ class MainContainer extends Container { * @param data */ onTodayButtonClick(data) { - this.model.setData({ + this.stateProvider.setData({ currentDate: todayDate }) } @@ -656,7 +656,7 @@ class MainContainer extends Container { map[me.activeView](); - me.model.setData({currentDate}) + me.stateProvider.setData({currentDate}) } } diff --git a/src/calendar/view/MainContainerModel.mjs b/src/calendar/view/MainContainerStateProvider.mjs similarity index 93% rename from src/calendar/view/MainContainerModel.mjs rename to src/calendar/view/MainContainerStateProvider.mjs index 2a2631972..3b537ebe9 100644 --- a/src/calendar/view/MainContainerModel.mjs +++ b/src/calendar/view/MainContainerStateProvider.mjs @@ -1,21 +1,21 @@ import CalendarsStore from '../store/Calendars.mjs'; import ColorsStore from '../store/Colors.mjs'; import EventsStore from '../store/Events.mjs'; -import Component from '../../../src/model/Component.mjs'; +import StateProvider from '../../../src/state/Provider.mjs'; const todayDate = new Date(); /** - * @class Neo.calendar.view.MainContainerModel - * @extends Neo.model.Component + * @class Neo.calendar.view.MainContainerStateProvider + * @extends Neo.state.Provider */ -class MainContainerModel extends Component { +class MainContainerStateProvider extends StateProvider { static config = { /** - * @member {String} className='Neo.calendar.view.MainContainerModel' + * @member {String} className='Neo.calendar.view.MainContainerStateProvider' * @protected */ - className: 'Neo.calendar.view.MainContainerModel', + className: 'Neo.calendar.view.MainContainerStateProvider', /** * @member {Object} data */ @@ -168,4 +168,4 @@ class MainContainerModel extends Component { } } -export default Neo.setupClass(MainContainerModel); +export default Neo.setupClass(MainContainerStateProvider); diff --git a/src/calendar/view/calendars/EditContainer.mjs b/src/calendar/view/calendars/EditContainer.mjs index 118dcd29b..49c5a1217 100644 --- a/src/calendar/view/calendars/EditContainer.mjs +++ b/src/calendar/view/calendars/EditContainer.mjs @@ -166,7 +166,7 @@ class EditContainer extends FormContainer { // todo: we could add a confirm dialog - me.getModel().getStore('calendars').remove(me.record); + me.getStateProvider().getStore('calendars').remove(me.record); me.unmount(); } diff --git a/src/calendar/view/calendars/List.mjs b/src/calendar/view/calendars/List.mjs index 3cb4bd290..624a500e7 100644 --- a/src/calendar/view/calendars/List.mjs +++ b/src/calendar/view/calendars/List.mjs @@ -148,7 +148,7 @@ class List extends ComponentList { * @param {String[]} items */ onSelect(items) { - this.getModel().setData('activeCalendarId', this.getItemRecordId(items[0])) + this.getStateProvider().setData('activeCalendarId', this.getItemRecordId(items[0])) } /** diff --git a/src/calendar/view/settings/GeneralContainer.mjs b/src/calendar/view/settings/GeneralContainer.mjs index 72253aed5..557922498 100644 --- a/src/calendar/view/settings/GeneralContainer.mjs +++ b/src/calendar/view/settings/GeneralContainer.mjs @@ -273,7 +273,7 @@ class GeneralContainer extends Container { * @param {Object} data */ onDataChange(data) { - this.getModel().setData(data.component.name, data.value) + this.getStateProvider().setData(data.component.name, data.value) } /** @@ -281,7 +281,7 @@ class GeneralContainer extends Container { */ onRadioDataChange(data) { if (data.value) { - this.getModel().setData(data.component.name, data.component.fieldValue) + this.getStateProvider().setData(data.component.name, data.component.fieldValue) } } } diff --git a/src/calendar/view/week/EventDragZone.mjs b/src/calendar/view/week/EventDragZone.mjs index f3ad41456..312f41051 100644 --- a/src/calendar/view/week/EventDragZone.mjs +++ b/src/calendar/view/week/EventDragZone.mjs @@ -252,7 +252,7 @@ class EventDragZone extends DragZone { // todo: updating a record field which is included inside a sorter should trigger collection.doSort() // see: https://github.com/neomjs/neo/issues/2392 - owner.getModel().getStore('events').doSort(); + owner.getStateProvider().getStore('events').doSort(); owner.updateEvents() }