forked from mbk-lab/rui_orig
2
0
Fork 0

Removed Init function from View interface

This commit is contained in:
Alexei Anoshenko 2022-09-01 11:04:50 +03:00
parent 69fcfa0839
commit dcf8240235
28 changed files with 82 additions and 88 deletions

View File

@ -14,7 +14,7 @@ type absoluteLayoutData struct {
// NewAbsoluteLayout create new AbsoluteLayout object and return it // NewAbsoluteLayout create new AbsoluteLayout object and return it
func NewAbsoluteLayout(session Session, params Params) AbsoluteLayout { func NewAbsoluteLayout(session Session, params Params) AbsoluteLayout {
view := new(absoluteLayoutData) view := new(absoluteLayoutData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -24,8 +24,8 @@ func newAbsoluteLayout(session Session) View {
} }
// Init initialize fields of ViewsContainer by default values // Init initialize fields of ViewsContainer by default values
func (layout *absoluteLayoutData) Init(session Session) { func (layout *absoluteLayoutData) init(session Session) {
layout.viewsContainerData.Init(session) layout.viewsContainerData.init(session)
layout.tag = "AbsoluteLayout" layout.tag = "AbsoluteLayout"
layout.systemClass = "ruiAbsoluteLayout" layout.systemClass = "ruiAbsoluteLayout"
} }

View File

@ -11,7 +11,7 @@ type audioPlayerData struct {
// NewAudioPlayer create new MediaPlayer object and return it // NewAudioPlayer create new MediaPlayer object and return it
func NewAudioPlayer(session Session, params Params) AudioPlayer { func NewAudioPlayer(session Session, params Params) AudioPlayer {
view := new(audioPlayerData) view := new(audioPlayerData)
view.Init(session) view.init(session)
view.tag = "AudioPlayer" view.tag = "AudioPlayer"
setInitParams(view, params) setInitParams(view, params)
return view return view
@ -21,8 +21,8 @@ func newAudioPlayer(session Session) View {
return NewAudioPlayer(session, nil) return NewAudioPlayer(session, nil)
} }
func (player *audioPlayerData) Init(session Session) { func (player *audioPlayerData) init(session Session) {
player.mediaPlayerData.Init(session) player.mediaPlayerData.init(session)
player.tag = "AudioPlayer" player.tag = "AudioPlayer"
} }

View File

@ -21,7 +21,7 @@ type canvasViewData struct {
// NewCanvasView creates the new custom draw view // NewCanvasView creates the new custom draw view
func NewCanvasView(session Session, params Params) CanvasView { func NewCanvasView(session Session, params Params) CanvasView {
view := new(canvasViewData) view := new(canvasViewData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -31,8 +31,8 @@ func newCanvasView(session Session) View {
} }
// Init initialize fields of ViewsContainer by default values // Init initialize fields of ViewsContainer by default values
func (canvasView *canvasViewData) Init(session Session) { func (canvasView *canvasViewData) init(session Session) {
canvasView.viewData.Init(session) canvasView.viewData.init(session)
canvasView.tag = "CanvasView" canvasView.tag = "CanvasView"
} }

View File

@ -23,7 +23,7 @@ type checkboxData struct {
// NewCheckbox create new Checkbox object and return it // NewCheckbox create new Checkbox object and return it
func NewCheckbox(session Session, params Params) Checkbox { func NewCheckbox(session Session, params Params) Checkbox {
view := new(checkboxData) view := new(checkboxData)
view.Init(session) view.init(session)
setInitParams(view, Params{ setInitParams(view, Params{
ClickEvent: checkboxClickListener, ClickEvent: checkboxClickListener,
KeyDownEvent: checkboxKeyListener, KeyDownEvent: checkboxKeyListener,
@ -36,8 +36,8 @@ func newCheckbox(session Session) View {
return NewCheckbox(session, nil) return NewCheckbox(session, nil)
} }
func (button *checkboxData) Init(session Session) { func (button *checkboxData) init(session Session) {
button.viewsContainerData.Init(session) button.viewsContainerData.init(session)
button.tag = "Checkbox" button.tag = "Checkbox"
button.systemClass = "ruiGridLayout ruiCheckbox" button.systemClass = "ruiGridLayout ruiCheckbox"
button.checkedListeners = []func(Checkbox, bool){} button.checkedListeners = []func(Checkbox, bool){}

View File

@ -23,7 +23,7 @@ type colorPickerData struct {
// NewColorPicker create new ColorPicker object and return it // NewColorPicker create new ColorPicker object and return it
func NewColorPicker(session Session, params Params) ColorPicker { func NewColorPicker(session Session, params Params) ColorPicker {
view := new(colorPickerData) view := new(colorPickerData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -32,8 +32,8 @@ func newColorPicker(session Session) View {
return NewColorPicker(session, nil) return NewColorPicker(session, nil)
} }
func (picker *colorPickerData) Init(session Session) { func (picker *colorPickerData) init(session Session) {
picker.viewData.Init(session) picker.viewData.init(session)
picker.tag = "ColorPicker" picker.tag = "ColorPicker"
picker.colorChangedListeners = []func(ColorPicker, Color){} picker.colorChangedListeners = []func(ColorPicker, Color){}
picker.properties[Padding] = Px(0) picker.properties[Padding] = Px(0)

View File

@ -47,7 +47,7 @@ type columnLayoutData struct {
// NewColumnLayout create new ColumnLayout object and return it // NewColumnLayout create new ColumnLayout object and return it
func NewColumnLayout(session Session, params Params) ColumnLayout { func NewColumnLayout(session Session, params Params) ColumnLayout {
view := new(columnLayoutData) view := new(columnLayoutData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -57,8 +57,8 @@ func newColumnLayout(session Session) View {
} }
// Init initialize fields of ColumnLayout by default values // Init initialize fields of ColumnLayout by default values
func (ColumnLayout *columnLayoutData) Init(session Session) { func (ColumnLayout *columnLayoutData) init(session Session) {
ColumnLayout.viewsContainerData.Init(session) ColumnLayout.viewsContainerData.init(session)
ColumnLayout.tag = "ColumnLayout" ColumnLayout.tag = "ColumnLayout"
//ColumnLayout.systemClass = "ruiColumnLayout" //ColumnLayout.systemClass = "ruiColumnLayout"
} }

View File

@ -87,10 +87,6 @@ func (customView *CustomViewData) Clear() {
customView.superView.Clear() customView.superView.Clear()
} }
// Init initializes fields of View by default values
func (customView *CustomViewData) Init(session Session) {
}
func (customView *CustomViewData) cssViewStyle(buffer cssBuilder, session Session) { func (customView *CustomViewData) cssViewStyle(buffer cssBuilder, session Session) {
customView.superView.cssViewStyle(buffer, session) customView.superView.cssViewStyle(buffer, session)
} }

View File

@ -29,7 +29,7 @@ type datePickerData struct {
// NewDatePicker create new DatePicker object and return it // NewDatePicker create new DatePicker object and return it
func NewDatePicker(session Session, params Params) DatePicker { func NewDatePicker(session Session, params Params) DatePicker {
view := new(datePickerData) view := new(datePickerData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -38,8 +38,8 @@ func newDatePicker(session Session) View {
return NewDatePicker(session, nil) return NewDatePicker(session, nil)
} }
func (picker *datePickerData) Init(session Session) { func (picker *datePickerData) init(session Session) {
picker.viewData.Init(session) picker.viewData.init(session)
picker.tag = "DatePicker" picker.tag = "DatePicker"
picker.dateChangedListeners = []func(DatePicker, time.Time){} picker.dateChangedListeners = []func(DatePicker, time.Time){}
} }

View File

@ -24,7 +24,7 @@ type detailsViewData struct {
// NewDetailsView create new DetailsView object and return it // NewDetailsView create new DetailsView object and return it
func NewDetailsView(session Session, params Params) DetailsView { func NewDetailsView(session Session, params Params) DetailsView {
view := new(detailsViewData) view := new(detailsViewData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -34,8 +34,8 @@ func newDetailsView(session Session) View {
} }
// Init initialize fields of DetailsView by default values // Init initialize fields of DetailsView by default values
func (detailsView *detailsViewData) Init(session Session) { func (detailsView *detailsViewData) init(session Session) {
detailsView.viewsContainerData.Init(session) detailsView.viewsContainerData.init(session)
detailsView.tag = "DetailsView" detailsView.tag = "DetailsView"
//detailsView.systemClass = "ruiDetailsView" //detailsView.systemClass = "ruiDetailsView"
} }

View File

@ -27,7 +27,7 @@ type dropDownListData struct {
// NewDropDownList create new DropDownList object and return it // NewDropDownList create new DropDownList object and return it
func NewDropDownList(session Session, params Params) DropDownList { func NewDropDownList(session Session, params Params) DropDownList {
view := new(dropDownListData) view := new(dropDownListData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -36,8 +36,8 @@ func newDropDownList(session Session) View {
return NewDropDownList(session, nil) return NewDropDownList(session, nil)
} }
func (list *dropDownListData) Init(session Session) { func (list *dropDownListData) init(session Session) {
list.viewData.Init(session) list.viewData.init(session)
list.tag = "DropDownList" list.tag = "DropDownList"
list.items = []string{} list.items = []string{}
list.disabledItems = []any{} list.disabledItems = []any{}

View File

@ -48,7 +48,7 @@ type editViewData struct {
// NewEditView create new EditView object and return it // NewEditView create new EditView object and return it
func NewEditView(session Session, params Params) EditView { func NewEditView(session Session, params Params) EditView {
view := new(editViewData) view := new(editViewData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -57,8 +57,8 @@ func newEditView(session Session) View {
return NewEditView(session, nil) return NewEditView(session, nil)
} }
func (edit *editViewData) Init(session Session) { func (edit *editViewData) init(session Session) {
edit.viewData.Init(session) edit.viewData.init(session)
edit.textChangeListeners = []func(EditView, string){} edit.textChangeListeners = []func(EditView, string){}
edit.tag = "EditView" edit.tag = "EditView"
} }

View File

@ -72,7 +72,7 @@ func (file *FileInfo) initBy(node DataValue) {
// NewFilePicker create new FilePicker object and return it // NewFilePicker create new FilePicker object and return it
func NewFilePicker(session Session, params Params) FilePicker { func NewFilePicker(session Session, params Params) FilePicker {
view := new(filePickerData) view := new(filePickerData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -81,8 +81,8 @@ func newFilePicker(session Session) View {
return NewFilePicker(session, nil) return NewFilePicker(session, nil)
} }
func (picker *filePickerData) Init(session Session) { func (picker *filePickerData) init(session Session) {
picker.viewData.Init(session) picker.viewData.init(session)
picker.tag = "FilePicker" picker.tag = "FilePicker"
picker.files = []FileInfo{} picker.files = []FileInfo{}
picker.loader = map[int]func(FileInfo, []byte){} picker.loader = map[int]func(FileInfo, []byte){}

View File

@ -17,7 +17,7 @@ type gridLayoutData struct {
// NewGridLayout create new GridLayout object and return it // NewGridLayout create new GridLayout object and return it
func NewGridLayout(session Session, params Params) GridLayout { func NewGridLayout(session Session, params Params) GridLayout {
view := new(gridLayoutData) view := new(gridLayoutData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -27,8 +27,8 @@ func newGridLayout(session Session) View {
} }
// Init initialize fields of GridLayout by default values // Init initialize fields of GridLayout by default values
func (gridLayout *gridLayoutData) Init(session Session) { func (gridLayout *gridLayoutData) init(session Session) {
gridLayout.viewsContainerData.Init(session) gridLayout.viewsContainerData.init(session)
gridLayout.tag = "GridLayout" gridLayout.tag = "GridLayout"
gridLayout.systemClass = "ruiGridLayout" gridLayout.systemClass = "ruiGridLayout"
} }

View File

@ -54,7 +54,7 @@ type imageViewData struct {
// NewImageView create new ImageView object and return it // NewImageView create new ImageView object and return it
func NewImageView(session Session, params Params) ImageView { func NewImageView(session Session, params Params) ImageView {
view := new(imageViewData) view := new(imageViewData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -64,8 +64,8 @@ func newImageView(session Session) View {
} }
// Init initialize fields of imageView by default values // Init initialize fields of imageView by default values
func (imageView *imageViewData) Init(session Session) { func (imageView *imageViewData) init(session Session) {
imageView.viewData.Init(session) imageView.viewData.init(session)
imageView.tag = "ImageView" imageView.tag = "ImageView"
//imageView.systemClass = "ruiImageView" //imageView.systemClass = "ruiImageView"

View File

@ -33,7 +33,7 @@ type listLayoutData struct {
// NewListLayout create new ListLayout object and return it // NewListLayout create new ListLayout object and return it
func NewListLayout(session Session, params Params) ListLayout { func NewListLayout(session Session, params Params) ListLayout {
view := new(listLayoutData) view := new(listLayoutData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -43,8 +43,8 @@ func newListLayout(session Session) View {
} }
// Init initialize fields of ViewsAlignContainer by default values // Init initialize fields of ViewsAlignContainer by default values
func (listLayout *listLayoutData) Init(session Session) { func (listLayout *listLayoutData) init(session Session) {
listLayout.viewsContainerData.Init(session) listLayout.viewsContainerData.init(session)
listLayout.tag = "ListLayout" listLayout.tag = "ListLayout"
listLayout.systemClass = "ruiListLayout" listLayout.systemClass = "ruiListLayout"
} }

View File

@ -69,7 +69,7 @@ type listViewData struct {
// NewListView creates the new list view // NewListView creates the new list view
func NewListView(session Session, params Params) ListView { func NewListView(session Session, params Params) ListView {
view := new(listViewData) view := new(listViewData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -79,8 +79,8 @@ func newListView(session Session) View {
} }
// Init initialize fields of ViewsContainer by default values // Init initialize fields of ViewsContainer by default values
func (listView *listViewData) Init(session Session) { func (listView *listViewData) init(session Session) {
listView.viewData.Init(session) listView.viewData.init(session)
listView.tag = "ListView" listView.tag = "ListView"
listView.systemClass = "ruiListView" listView.systemClass = "ruiListView"
listView.items = []View{} listView.items = []View{}

View File

@ -163,8 +163,8 @@ type MediaSource struct {
MimeType string MimeType string
} }
func (player *mediaPlayerData) Init(session Session) { func (player *mediaPlayerData) init(session Session) {
player.viewData.Init(session) player.viewData.init(session)
player.tag = "MediaPlayer" player.tag = "MediaPlayer"
} }

View File

@ -36,7 +36,7 @@ type numberPickerData struct {
// NewNumberPicker create new NumberPicker object and return it // NewNumberPicker create new NumberPicker object and return it
func NewNumberPicker(session Session, params Params) NumberPicker { func NewNumberPicker(session Session, params Params) NumberPicker {
view := new(numberPickerData) view := new(numberPickerData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -45,8 +45,8 @@ func newNumberPicker(session Session) View {
return NewNumberPicker(session, nil) return NewNumberPicker(session, nil)
} }
func (picker *numberPickerData) Init(session Session) { func (picker *numberPickerData) init(session Session) {
picker.viewData.Init(session) picker.viewData.init(session)
picker.tag = "NumberPicker" picker.tag = "NumberPicker"
picker.numberChangedListeners = []func(NumberPicker, float64){} picker.numberChangedListeners = []func(NumberPicker, float64){}
} }

View File

@ -22,7 +22,7 @@ type progressBarData struct {
// NewProgressBar create new ProgressBar object and return it // NewProgressBar create new ProgressBar object and return it
func NewProgressBar(session Session, params Params) ProgressBar { func NewProgressBar(session Session, params Params) ProgressBar {
view := new(progressBarData) view := new(progressBarData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -31,8 +31,8 @@ func newProgressBar(session Session) View {
return NewProgressBar(session, nil) return NewProgressBar(session, nil)
} }
func (progress *progressBarData) Init(session Session) { func (progress *progressBarData) init(session Session) {
progress.viewData.Init(session) progress.viewData.init(session)
progress.tag = "ProgressBar" progress.tag = "ProgressBar"
} }

View File

@ -45,7 +45,7 @@ type resizableData struct {
// NewResizable create new Resizable object and return it // NewResizable create new Resizable object and return it
func NewResizable(session Session, params Params) Resizable { func NewResizable(session Session, params Params) Resizable {
view := new(resizableData) view := new(resizableData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -54,8 +54,8 @@ func newResizable(session Session) View {
return NewResizable(session, nil) return NewResizable(session, nil)
} }
func (resizable *resizableData) Init(session Session) { func (resizable *resizableData) init(session Session) {
resizable.viewData.Init(session) resizable.viewData.init(session)
resizable.tag = "Resizable" resizable.tag = "Resizable"
resizable.systemClass = "ruiGridLayout" resizable.systemClass = "ruiGridLayout"
resizable.content = []View{} resizable.content = []View{}

View File

@ -41,7 +41,7 @@ type stackLayoutData struct {
// NewStackLayout create new StackLayout object and return it // NewStackLayout create new StackLayout object and return it
func NewStackLayout(session Session, params Params) StackLayout { func NewStackLayout(session Session, params Params) StackLayout {
view := new(stackLayoutData) view := new(stackLayoutData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -51,8 +51,8 @@ func newStackLayout(session Session) View {
} }
// Init initialize fields of ViewsContainer by default values // Init initialize fields of ViewsContainer by default values
func (layout *stackLayoutData) Init(session Session) { func (layout *stackLayoutData) init(session Session) {
layout.viewsContainerData.Init(session) layout.viewsContainerData.init(session)
layout.tag = "StackLayout" layout.tag = "StackLayout"
layout.systemClass = "ruiStackLayout" layout.systemClass = "ruiStackLayout"
layout.properties[TransitionEndEvent] = []func(View, string){layout.pushFinished, layout.popFinished} layout.properties[TransitionEndEvent] = []func(View, string){layout.pushFinished, layout.popFinished}

View File

@ -245,7 +245,7 @@ type tableCellView struct {
// NewTableView create new TableView object and return it // NewTableView create new TableView object and return it
func NewTableView(session Session, params Params) TableView { func NewTableView(session Session, params Params) TableView {
view := new(tableViewData) view := new(tableViewData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -255,8 +255,8 @@ func newTableView(session Session) View {
} }
// Init initialize fields of TableView by default values // Init initialize fields of TableView by default values
func (table *tableViewData) Init(session Session) { func (table *tableViewData) init(session Session) {
table.viewData.Init(session) table.viewData.init(session)
table.tag = "TableView" table.tag = "TableView"
table.cellViews = []View{} table.cellViews = []View{}
table.cellFrame = []Frame{} table.cellFrame = []Frame{}
@ -828,7 +828,7 @@ func (table *tableViewData) htmlSubviews(self View, buffer *strings.Builder) {
defer freeStringBuilder(cssBuilder.buffer) defer freeStringBuilder(cssBuilder.buffer)
var view tableCellView var view tableCellView
view.Init(session) view.init(session)
ignorCells := []struct{ row, column int }{} ignorCells := []struct{ row, column int }{}
selectionMode := GetTableSelectionMode(table) selectionMode := GetTableSelectionMode(table)

View File

@ -81,7 +81,7 @@ type tabsLayoutData struct {
// NewTabsLayout create new TabsLayout object and return it // NewTabsLayout create new TabsLayout object and return it
func NewTabsLayout(session Session, params Params) TabsLayout { func NewTabsLayout(session Session, params Params) TabsLayout {
view := new(tabsLayoutData) view := new(tabsLayoutData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -91,8 +91,8 @@ func newTabsLayout(session Session) View {
} }
// Init initialize fields of ViewsContainer by default values // Init initialize fields of ViewsContainer by default values
func (tabsLayout *tabsLayoutData) Init(session Session) { func (tabsLayout *tabsLayoutData) init(session Session) {
tabsLayout.viewsContainerData.Init(session) tabsLayout.viewsContainerData.init(session)
tabsLayout.tag = "TabsLayout" tabsLayout.tag = "TabsLayout"
tabsLayout.systemClass = "ruiTabsLayout" tabsLayout.systemClass = "ruiTabsLayout"
tabsLayout.tabListener = []func(TabsLayout, int, int){} tabsLayout.tabListener = []func(TabsLayout, int, int){}

View File

@ -17,7 +17,7 @@ type textViewData struct {
// NewTextView create new TextView object and return it // NewTextView create new TextView object and return it
func NewTextView(session Session, params Params) TextView { func NewTextView(session Session, params Params) TextView {
view := new(textViewData) view := new(textViewData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -27,8 +27,8 @@ func newTextView(session Session) View {
} }
// Init initialize fields of TextView by default values // Init initialize fields of TextView by default values
func (textView *textViewData) Init(session Session) { func (textView *textViewData) init(session Session) {
textView.viewData.Init(session) textView.viewData.init(session)
textView.tag = "TextView" textView.tag = "TextView"
} }

View File

@ -29,7 +29,7 @@ type timePickerData struct {
// NewTimePicker create new TimePicker object and return it // NewTimePicker create new TimePicker object and return it
func NewTimePicker(session Session, params Params) TimePicker { func NewTimePicker(session Session, params Params) TimePicker {
view := new(timePickerData) view := new(timePickerData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
@ -38,8 +38,8 @@ func newTimePicker(session Session) View {
return NewTimePicker(session, nil) return NewTimePicker(session, nil)
} }
func (picker *timePickerData) Init(session Session) { func (picker *timePickerData) init(session Session) {
picker.viewData.Init(session) picker.viewData.init(session)
picker.tag = "TimePicker" picker.tag = "TimePicker"
picker.timeChangedListeners = []func(TimePicker, time.Time){} picker.timeChangedListeners = []func(TimePicker, time.Time){}
} }

View File

@ -29,7 +29,7 @@ type videoPlayerData struct {
// NewVideoPlayer create new MediaPlayer object and return it // NewVideoPlayer create new MediaPlayer object and return it
func NewVideoPlayer(session Session, params Params) VideoPlayer { func NewVideoPlayer(session Session, params Params) VideoPlayer {
view := new(videoPlayerData) view := new(videoPlayerData)
view.Init(session) view.init(session)
view.tag = "VideoPlayer" view.tag = "VideoPlayer"
setInitParams(view, params) setInitParams(view, params)
return view return view
@ -39,8 +39,8 @@ func newVideoPlayer(session Session) View {
return NewVideoPlayer(session, nil) return NewVideoPlayer(session, nil)
} }
func (player *videoPlayerData) Init(session Session) { func (player *videoPlayerData) init(session Session) {
player.mediaPlayerData.Init(session) player.mediaPlayerData.init(session)
player.tag = "VideoPlayer" player.tag = "VideoPlayer"
} }

12
view.go
View File

@ -33,14 +33,10 @@ type View interface {
ViewStyle ViewStyle
fmt.Stringer fmt.Stringer
// Init initializes fields of View by default values
Init(session Session)
// Session returns the current Session interface // Session returns the current Session interface
Session() Session Session() Session
// Parent returns the parent view // Parent returns the parent view
Parent() View Parent() View
parentHTMLID() string
setParentID(parentID string)
// Tag returns the tag of View interface // Tag returns the tag of View interface
Tag() string Tag() string
// ID returns the id of the view // ID returns the id of the view
@ -65,6 +61,8 @@ type View interface {
htmlTag() string htmlTag() string
closeHTMLTag() bool closeHTMLTag() bool
htmlID() string htmlID() string
parentHTMLID() string
setParentID(parentID string)
htmlSubviews(self View, buffer *strings.Builder) htmlSubviews(self View, buffer *strings.Builder)
htmlProperties(self View, buffer *strings.Builder) htmlProperties(self View, buffer *strings.Builder)
htmlDisabledProperties(self View, buffer *strings.Builder) htmlDisabledProperties(self View, buffer *strings.Builder)
@ -100,7 +98,7 @@ type viewData struct {
func newView(session Session) View { func newView(session Session) View {
view := new(viewData) view := new(viewData)
view.Init(session) view.init(session)
return view return view
} }
@ -122,12 +120,12 @@ func setInitParams(view View, params Params) {
// NewView create new View object and return it // NewView create new View object and return it
func NewView(session Session, params Params) View { func NewView(session Session, params Params) View {
view := new(viewData) view := new(viewData)
view.Init(session) view.init(session)
setInitParams(view, params) setInitParams(view, params)
return view return view
} }
func (view *viewData) Init(session Session) { func (view *viewData) init(session Session) {
view.viewStyle.init() view.viewStyle.init()
view.tag = "View" view.tag = "View"
view.session = session view.session = session

View File

@ -25,8 +25,8 @@ type viewsContainerData struct {
} }
// Init initialize fields of ViewsContainer by default values // Init initialize fields of ViewsContainer by default values
func (container *viewsContainerData) Init(session Session) { func (container *viewsContainerData) init(session Session) {
container.viewData.Init(session) container.viewData.init(session)
container.tag = "ViewsContainer" container.tag = "ViewsContainer"
container.views = []View{} container.views = []View{}
} }