alat

package module
v0.0.0-...-c4b5ad4 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 3 Imported by: 0

README

alat

Webassembly package in Go for building business oriented user interfaces

This is a work in progress!

Try online example here

Documentation

Index

Constants

View Source
const (
	NOROW              = -1
	NOTINTABLE         = -2
	ROWNUM_NOT_EXISTS  = 1
	ROWNUM_NOT_CURRENT = 2
	ROWNUM_CURRENT     = 3
)

Variables

View Source
var (
	HTMLWindow   = js.Global()
	HTMLDocument = HTMLWindow.Get("document")
	HTMLBody     = HTMLDocument.Get("body")
)

Functions

func AttachFocusEvents

func AttachFocusEvents(widget FocusableWidget, obj js.Value, rownum int)

func ClearNode

func ClearNode(node js.Value)

func NewNode

func NewNode(parent js.Value, nodeType string) js.Value

func RemoveNode

func RemoveNode(node js.Value)

Types

type BaseFocusableWidget

type BaseFocusableWidget struct {
	BaseWidget
	// contains filtered or unexported fields
}

func (*BaseFocusableWidget) ColumnCell

func (w *BaseFocusableWidget) ColumnCell(parent js.Value) js.Value

If overriden, HTMLObject should be too

func (*BaseFocusableWidget) DrawInMultiRow

func (w *BaseFocusableWidget) DrawInMultiRow(parent js.Value, rownum int) js.Value

func (*BaseFocusableWidget) HTMLObject

func (w *BaseFocusableWidget) HTMLObject() js.Value

func (*BaseFocusableWidget) Index

func (w *BaseFocusableWidget) Index() int

func (*BaseFocusableWidget) Init

func (w *BaseFocusableWidget) Init(block *Block, widget FocusableWidget, parentWidget ParentWidget, label string)

func (*BaseFocusableWidget) IsFocusable

func (w *BaseFocusableWidget) IsFocusable() bool

func (*BaseFocusableWidget) IsInMultiRow

func (w *BaseFocusableWidget) IsInMultiRow() bool

func (*BaseFocusableWidget) Label

func (w *BaseFocusableWidget) Label() string

func (*BaseFocusableWidget) RefreshCell

func (w *BaseFocusableWidget) RefreshCell(cell js.Value, rowState int, value string)

func (*BaseFocusableWidget) SelectAll

func (w *BaseFocusableWidget) SelectAll()

func (*BaseFocusableWidget) SetFocus

func (w *BaseFocusableWidget) SetFocus()

func (*BaseFocusableWidget) SetIndex

func (w *BaseFocusableWidget) SetIndex(index int)

func (*BaseFocusableWidget) SetLabel

func (w *BaseFocusableWidget) SetLabel(label string)

func (*BaseFocusableWidget) WriteIfChanged

func (w *BaseFocusableWidget) WriteIfChanged(obj js.Value, rownum int) bool

type BaseMultiRowWidget

type BaseMultiRowWidget struct {
	BaseParentWidget
}

func (*BaseMultiRowWidget) CellElement

func (w *BaseMultiRowWidget) CellElement(colnum int, rownum int) js.Value

func (*BaseMultiRowWidget) Init

func (w *BaseMultiRowWidget) Init(block *Block, widget Widget, parentWidget ParentWidget)

func (*BaseMultiRowWidget) IsMultiRow

func (w *BaseMultiRowWidget) IsMultiRow() bool

type BaseParentWidget

type BaseParentWidget struct {
	BaseWidget
	// contains filtered or unexported fields
}

func (*BaseParentWidget) AddChild

func (w *BaseParentWidget) AddChild(child Widget)

func (*BaseParentWidget) Children

func (w *BaseParentWidget) Children() []Widget

func (*BaseParentWidget) Draw

func (w *BaseParentWidget) Draw()

func (*BaseParentWidget) Init

func (w *BaseParentWidget) Init(block *Block, widget Widget, parentWidget ParentWidget)

func (*BaseParentWidget) IsParent

func (w *BaseParentWidget) IsParent() bool

func (*BaseParentWidget) Refresh

func (w *BaseParentWidget) Refresh()

func (*BaseParentWidget) RefreshCurrentRow

func (w *BaseParentWidget) RefreshCurrentRow()

func (*BaseParentWidget) Remove

func (w *BaseParentWidget) Remove()

type BaseWidget

type BaseWidget struct {
	// contains filtered or unexported fields
}

func (*BaseWidget) Block

func (w *BaseWidget) Block() *Block

func (*BaseWidget) Draw

func (w *BaseWidget) Draw()

func (*BaseWidget) HTMLObject

func (w *BaseWidget) HTMLObject() js.Value

func (*BaseWidget) Init

func (w *BaseWidget) Init(block *Block, widget Widget, parentWidget ParentWidget)

func (*BaseWidget) IsFocusable

func (w *BaseWidget) IsFocusable() bool

func (*BaseWidget) IsMultiRow

func (w *BaseWidget) IsMultiRow() bool

func (*BaseWidget) IsParent

func (w *BaseWidget) IsParent() bool

func (*BaseWidget) ParentHTMLObject

func (w *BaseWidget) ParentHTMLObject() js.Value

func (*BaseWidget) ParentWidget

func (w *BaseWidget) ParentWidget() Widget

func (*BaseWidget) Refresh

func (w *BaseWidget) Refresh()

func (*BaseWidget) RefreshCurrentRow

func (w *BaseWidget) RefreshCurrentRow()

func (*BaseWidget) Remove

func (w *BaseWidget) Remove()

func (*BaseWidget) SetHTMLObject

func (w *BaseWidget) SetHTMLObject(obj js.Value)

type Block

type Block struct {
	// contains filtered or unexported fields
}

func NewBlock

func NewBlock(mainHtmlObject js.Value, visibleRows int) *Block

func (*Block) AddToFocusList

func (b *Block) AddToFocusList(widget FocusableWidget)

func (*Block) Buffer

func (b *Block) Buffer() *Buffer

func (*Block) BufferPos2ViewRow

func (b *Block) BufferPos2ViewRow(bufferPos int) (int, bool)

func (*Block) Close

func (b *Block) Close(msg string)

func (*Block) Connect

func (b *Block) Connect(widget FocusableWidget, column string)

func (*Block) Draw

func (b *Block) Draw()

func (*Block) FirstWidget

func (b *Block) FirstWidget() FocusableWidget

func (*Block) FocusCurrent

func (b *Block) FocusCurrent()

func (*Block) GotoRequest

func (b *Block) GotoRequest(newWidget FocusableWidget, newPos int) bool

func (*Block) LastWidget

func (b *Block) LastWidget() FocusableWidget

func (*Block) NextWidget

func (b *Block) NextWidget() FocusableWidget

func (*Block) OnFocusToWidget

func (b *Block) OnFocusToWidget(widget FocusableWidget)

func (*Block) Pos

func (b *Block) Pos() int

func (*Block) PrevWidget

func (b *Block) PrevWidget() FocusableWidget

func (*Block) Refresh

func (b *Block) Refresh()

func (*Block) RefreshCurrentRow

func (b *Block) RefreshCurrentRow()

func (*Block) RownumState

func (b *Block) RownumState(rownum int) int

func (*Block) Send

func (b *Block) Send(msg string)

func (*Block) ViewRow2BufferPos

func (b *Block) ViewRow2BufferPos(viewRow int) (int, bool)

func (*Block) Wait

func (b *Block) Wait() string

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) CalcView

func (b *Buffer) CalcView(begin int, end int, rows int) (int, int)

func (*Buffer) Field

func (b *Buffer) Field(name string) (*Field, error)

func (*Buffer) Fields

func (b *Buffer) Fields() map[string]*Field

func (*Buffer) Get

func (b *Buffer) Get(column string) (string, error)

func (*Buffer) GetAt

func (b *Buffer) GetAt(pos int, column string) (string, error)

func (*Buffer) Goto

func (b *Buffer) Goto(newPos int) int

func (*Buffer) InsertRow

func (b *Buffer) InsertRow() int

func (*Buffer) Set

func (b *Buffer) Set(column string, value string) error

func (*Buffer) SetAt

func (b *Buffer) SetAt(pos int, column string, value string) error

type Button

type Button struct {
	BaseFocusableWidget
	// contains filtered or unexported fields
}

func NewButton

func NewButton(block *Block, parentWidget ParentWidget, label string) *Button

func (*Button) Draw

func (w *Button) Draw()

func (*Button) DrawInMultiRow

func (w *Button) DrawInMultiRow(parent js.Value, rownum int) js.Value

func (*Button) RefreshCell

func (w *Button) RefreshCell(cell js.Value, rowState int, value string)

func (*Button) Remove

func (w *Button) Remove()

func (*Button) SelectAll

func (w *Button) SelectAll()

func (*Button) SetHandler

func (w *Button) SetHandler(hnd func(*Button))

type Container

type Container struct {
	BaseParentWidget
}

func NewContainer

func NewContainer(block *Block, parentWidget ParentWidget) *Container

func (*Container) Draw

func (w *Container) Draw()

func (*Container) Remove

func (w *Container) Remove()

type Edit

type Edit struct {
	BaseFocusableWidget
	// contains filtered or unexported fields
}

func NewEdit

func NewEdit(block *Block, parentWidget ParentWidget, label string) *Edit

func (*Edit) Draw

func (w *Edit) Draw()

func (*Edit) DrawInMultiRow

func (w *Edit) DrawInMultiRow(parent js.Value, rownum int) js.Value

func (*Edit) Refresh

func (w *Edit) Refresh()

func (*Edit) RefreshCurrentRow

func (w *Edit) RefreshCurrentRow()

func (*Edit) Remove

func (w *Edit) Remove()

func (*Edit) WriteIfChanged

func (w *Edit) WriteIfChanged(obj js.Value, rownum int) bool

type Field

type Field struct {
	// contains filtered or unexported fields
}

func NewBlockField

func NewBlockField(block *Block, name string) *Field

func NewRowField

func NewRowField(block *Block, name string) *Field

func (*Field) IsRowField

func (f *Field) IsRowField() bool

func (*Field) Name

func (f *Field) Name() string

type FocusableWidget

type FocusableWidget interface {
	Widget
	SetFocus()
	WriteIfChanged(obj js.Value, rownum int) bool
	SelectAll()
	Label() string
	SetLabel(string)
	Index() int
	SetIndex(int)
	IsInMultiRow() bool
	DrawInMultiRow(js.Value, int) js.Value
	ColumnCell(js.Value) js.Value
	RefreshCell(js.Value, int, string)
}

type Label

type Label struct {
	BaseWidget
	// contains filtered or unexported fields
}

func NewLabel

func NewLabel(block *Block, parentWidget ParentWidget, text string) *Label

func (*Label) Draw

func (w *Label) Draw()

func (*Label) Remove

func (w *Label) Remove()
type ModalWindow struct {
	BaseParentWidget

	BackupDocumentOnMouseUp   js.Value
	BackupDocumentOnMouseMove js.Value
	// contains filtered or unexported fields
}

func NewModalWindow

func NewModalWindow(block *Block, title string) *ModalWindow

func (*ModalWindow) Draw

func (w *ModalWindow) Draw()

func (*ModalWindow) Remove

func (w *ModalWindow) Remove()

func (*ModalWindow) SetCloseHandler

func (w *ModalWindow) SetCloseHandler(hnd func(*ModalWindow))

type MultiRowWidget

type MultiRowWidget interface {
	ParentWidget
	CellElement(int, int) js.Value
}

type ParentWidget

type ParentWidget interface {
	Widget
	AddChild(Widget)
	Children() []Widget
}

type Row

type Row struct {
	Values map[string]string
}

func MakeRow

func MakeRow() Row

type Table

type Table struct {
	BaseMultiRowWidget
	// contains filtered or unexported fields
}

func NewTable

func NewTable(block *Block, parentWidget ParentWidget) *Table

func (*Table) CellElement

func (w *Table) CellElement(colnum int, rownum int) js.Value

func (*Table) Draw

func (w *Table) Draw()

func (*Table) DrawContent

func (w *Table) DrawContent()

func (*Table) DrawRow

func (w *Table) DrawRow(rownum int)

func (*Table) Refresh

func (w *Table) Refresh()

func (*Table) RefreshColumnAtRownum

func (w *Table) RefreshColumnAtRownum(widgetColumn FocusableWidget, rownum int)

func (*Table) RefreshCurrentRow

func (w *Table) RefreshCurrentRow()

func (*Table) RefreshRownum

func (w *Table) RefreshRownum(rownum int)

func (*Table) Remove

func (w *Table) Remove()

type Widget

type Widget interface {
	Block() *Block
	ParentWidget() Widget
	ParentHTMLObject() js.Value
	HTMLObject() js.Value
	SetHTMLObject(js.Value)
	Draw()
	Refresh()
	RefreshCurrentRow()
	Remove()

	IsFocusable() bool
	IsParent() bool
	IsMultiRow() bool
}

Jump to

Keyboard shortcuts

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