示例#1
0
func (db DataBinder) create() (*walk.DataBinder, error) {
	if db.DataSource == nil {
		return nil, nil
	}

	b := walk.NewDataBinder()

	if db.ErrorPresenter != nil {
		ep, err := db.ErrorPresenter.Create()
		if err != nil {
			return nil, err
		}
		b.SetErrorPresenter(ep)
	}

	b.SetDataSource(db.DataSource)

	b.SetAutoSubmit(db.AutoSubmit)

	if db.OnSubmitted != nil {
		b.Submitted().Attach(db.OnSubmitted)
	}

	if db.AssignTo != nil {
		*db.AssignTo = b
	}

	return b, nil
}
示例#2
0
文件: databinder.go 项目: yahame/walk
func (db DataBinder) create() (*walk.DataBinder, error) {
	if db.DataSource == nil {
		return nil, nil
	}

	b := walk.NewDataBinder()

	b.SetDataSource(db.DataSource)

	if db.AssignTo != nil {
		*db.AssignTo = b
	}

	return b, nil
}
示例#3
0
文件: databinder.go 项目: karlma/walk
func (db DataBinder) create() (*walk.DataBinder, error) {
	if db.DataSource == nil {
		return nil, nil
	}

	b := walk.NewDataBinder()

	if db.ErrorPresenter != nil {
		ep, err := db.ErrorPresenter.Create()
		if err != nil {
			return nil, err
		}
		b.SetErrorPresenter(ep)
	}

	b.SetDataSource(db.DataSource)

	if db.AssignTo != nil {
		*db.AssignTo = b
	}

	return b, nil
}