views

package
v0.0.0-...-2b35e24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2019 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootStrap

func BootStrap()

BootStrap makes the necessary updates to view definitions. In particular: - sets the type of the view from the arch root. - populates the fields map from the views arch.

func LoadFromEtree

func LoadFromEtree(element *etree.Element)

LoadFromEtree reads the view given etree.Element, creates or updates the view and adds it to the view registry if it not already.

Types

type Collection

type Collection struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

A Collection is a view collection

var Registry *Collection

Registry is the views collection of the application

func NewCollection

func NewCollection() *Collection

NewCollection returns a pointer to a new Collection instance

func (*Collection) Add

func (vc *Collection) Add(v *View)

Add adds the given view to our Collection

func (*Collection) GetAllViewsForModel

func (vc *Collection) GetAllViewsForModel(model string) []*View

GetAllViewsForModel returns a list with all views for the given model

func (*Collection) GetByID

func (vc *Collection) GetByID(id string) *View

GetByID returns the View with the given id

func (*Collection) GetFirstViewForModel

func (vc *Collection) GetFirstViewForModel(model string, viewType ViewType) *View

GetFirstViewForModel returns the first view of type viewType for the given model

type View

type View struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Model       string   `json:"model"`
	Type        ViewType `json:"type"`
	Priority    uint8    `json:"priority"`
	Arch        string   `json:"arch"`
	FieldParent string   `json:"field_parent"`
	//Toolbar     actions.Toolbar `json:"toolbar"`
	Fields []models.FieldName
}

View is the internal definition of a view in the application

type ViewRef

type ViewRef [2]string

ViewRef is an array of two strings representing a view: - The first one is the ID of the view - The second one is the name of the view

func MakeViewRef

func MakeViewRef(id string) ViewRef

MakeViewRef creates a ViewRef from a view id

func (ViewRef) MarshalJSON

func (vr ViewRef) MarshalJSON() ([]byte, error)

MarshalJSON is the JSON marshalling method of ViewRef. It marshals empty ViewRef into null instead of ["", ""].

func (*ViewRef) Scan

func (vr *ViewRef) Scan(src interface{}) error

Scan fetches the name of our view from the ID stored in the database to fill the ViewRef.

func (*ViewRef) UnmarshalJSON

func (vr *ViewRef) UnmarshalJSON(data []byte) error

UnmarshalJSON is the JSON unmarshalling method of ViewRef. It unmarshals null into an empty ViewRef.

func (*ViewRef) UnmarshalXMLAttr

func (vr *ViewRef) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr is the XML unmarshalling method of ViewRef. It unmarshals null into an empty ViewRef.

func (ViewRef) Value

func (vr ViewRef) Value() (driver.Value, error)

Value extracts ID of our ViewRef for storing in the database.

type ViewTuple

type ViewTuple struct {
	ID   string
	Type ViewType
}

ViewTuple is an array of two strings representing a view: - The first one is the ID of the view - The second one is the view type corresponding to the view ID

func (ViewTuple) MarshalJSON

func (vt ViewTuple) MarshalJSON() ([]byte, error)

MarshalJSON is the JSON marshalling method of ViewTuple. It marshals ViewTuple into a list [id, type].

type ViewType

type ViewType string

A ViewType defines the type of a view

const (
	VIEW_TYPE_TREE     ViewType = "tree"
	VIEW_TYPE_LIST     ViewType = "list"
	VIEW_TYPE_FORM     ViewType = "form"
	VIEW_TYPE_GRAPH    ViewType = "graph"
	VIEW_TYPE_CALENDAR ViewType = "calendar"
	VIEW_TYPE_DIAGRAM  ViewType = "diagram"
	VIEW_TYPE_GANTT    ViewType = "gantt"
	VIEW_TYPE_KANBAN   ViewType = "kanban"
	VIEW_TYPE_SEARCH   ViewType = "search"
	VIEW_TYPE_QWEB     ViewType = "qweb"
)

View types

type ViewXML

type ViewXML struct {
	ID          string `xml:"id,attr"`
	Name        string `xml:"name,attr"`
	Model       string `xml:"model,attr"`
	Priority    uint8  `xml:"priority,attr"`
	Arch        string `xml:",innerxml"`
	InheritID   string `xml:"inherit_id,attr"`
	FieldParent string `xml:"field_parent,attr"`
}

ViewXML is used to unmarshal the XML definition of a View

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL