Documentation
¶
Overview ¶
Package control contains the implementations of the standard controls in goradd. These controls generally fall under the following categories: - Standard html tags. For example, div, input, select, table, img - Controls specifically designed to edit database data, like INT, FLOAT or DATE fields - Controls that we need to support the manipulation of database relationships, like one-to-many links - Useful utility controls
Controls in this package should function and be usable even if javascript is turned off.
Index ¶
- Constants
- Variables
- func SetAlertFunction(f AlertFuncType)
- func SortIds(ids []string)
- type AlertFuncType
- type Button
- func (b *Button) Init(self page.ControlI, parent page.ControlI, id string)
- func (b *Button) On(e page.EventI, actions ...action.ActionI) page.EventI
- func (b *Button) OnSubmit(actions ...action.ActionI) page.EventI
- func (b *Button) SetLabel(label string) page.ControlI
- func (b *Button) ΩDrawingAttributes() *html.Attributes
- type ButtonI
- type Canvas
- type CanvasI
- type CellTexter
- type Checkbox
- type CheckboxBase
- func (c *CheckboxBase) Checked() bool
- func (c *CheckboxBase) Deserialize(d page.Decoder, p *page.Page) (err error)
- func (c *CheckboxBase) Init(self page.ControlI, parent page.ControlI, id string)
- func (c *CheckboxBase) InputLabelAttributes() *html.Attributes
- func (c *CheckboxBase) Serialize(e page.Encoder) (err error)
- func (c *CheckboxBase) SetChecked(v bool) CheckboxI
- func (c *CheckboxBase) SetCheckedNoRefresh(v interface{})
- func (c *CheckboxBase) SetLabelDrawingMode(m html.LabelDrawingMode)
- func (c *CheckboxBase) SetValue(v interface{}) CheckboxI
- func (c *CheckboxBase) TextIsLabel() bool
- func (c *CheckboxBase) UpdateCheckboxFormValues(ctx *page.Context)
- func (c *CheckboxBase) UpdateRadioFormValues(ctx *page.Context, group string)
- func (c *CheckboxBase) Value() interface{}
- func (c *CheckboxBase) ΩDrawTag(ctx context.Context) (ctrl string)
- func (c *CheckboxBase) ΩDrawingAttributes() *html.Attributes
- func (c *CheckboxBase) ΩGetDrawingLabelAttributes() *html.Attributes
- func (c *CheckboxBase) ΩMarshalState(m maps.Setter)
- func (c *CheckboxBase) ΩUnmarshalState(m maps.Loader)
- func (c *CheckboxBase) ΩisSerializer(i page.ControlI) bool
- type CheckboxI
- type CheckboxList
- func (l *CheckboxList) ColumnCount() int
- func (l *CheckboxList) Direction() LayoutDirection
- func (l *CheckboxList) Init(self CheckboxListI, parent page.ControlI, id string)
- func (l *CheckboxList) SetColumnCount(columns int) *CheckboxList
- func (l *CheckboxList) SetDirection(direction LayoutDirection) *CheckboxList
- func (l *CheckboxList) SetIsScrolling(s bool) *CheckboxList
- func (l *CheckboxList) SetLabelDrawingMode(mode html.LabelDrawingMode) *CheckboxList
- func (l *CheckboxList) ΩDrawInnerHtml(ctx context.Context, buf *bytes.Buffer) (err error)
- func (l *CheckboxList) ΩDrawingAttributes() *html.Attributes
- func (l *CheckboxList) ΩRenderItem(item ListItemI) (h string)
- func (l *CheckboxList) ΩRenderItems(items []ListItemI) string
- func (l *CheckboxList) ΩUpdateFormValues(ctx *page.Context)
- type CheckboxListI
- type ColumnBase
- func (c *ColumnBase) Action(ctx context.Context, params page.ActionParams)
- func (c *ColumnBase) AddActions(ctrl page.ControlI)
- func (c *ColumnBase) CellAttributes(ctx context.Context, row int, col int, data interface{}) *html.Attributes
- func (c *ColumnBase) CellText(ctx context.Context, row int, col int, data interface{}) string
- func (c *ColumnBase) CellTexter() CellTexter
- func (c *ColumnBase) ColTagAttributes() *html.Attributes
- func (c *ColumnBase) DrawCell(ctx context.Context, row int, col int, data interface{}, buf *bytes.Buffer)
- func (c *ColumnBase) DrawColumnTag(ctx context.Context, buf *bytes.Buffer)
- func (c *ColumnBase) DrawFooterCell(ctx context.Context, row int, col int, count int, buf *bytes.Buffer)
- func (c *ColumnBase) FooterAttributes(row int, col int) *html.Attributes
- func (c *ColumnBase) FooterCellHtml(ctx context.Context, row int, col int) string
- func (c *ColumnBase) HeaderAttributes(row int, col int) *html.Attributes
- func (c *ColumnBase) HeaderCellHtml(ctx context.Context, row int, col int) (h string)
- func (c *ColumnBase) ID() string
- func (c *ColumnBase) Init(self ColumnI)
- func (c *ColumnBase) IsHidden() bool
- func (c *ColumnBase) IsSortable() bool
- func (c *ColumnBase) MarshalState(m maps.Setter)
- func (c *ColumnBase) ParentTable() TableI
- func (c *ColumnBase) PreRender()
- func (c *ColumnBase) RenderSortButton(labelHtml string) string
- func (c *ColumnBase) SetCellStyler(s html.Attributer)
- func (c *ColumnBase) SetCellTexter(s CellTexter) ColumnI
- func (c *ColumnBase) SetFooterTexter(s CellTexter) ColumnI
- func (c *ColumnBase) SetHeaderTexter(s CellTexter) ColumnI
- func (c *ColumnBase) SetHidden(h bool) ColumnI
- func (c *ColumnBase) SetID(id string) ColumnI
- func (c *ColumnBase) SetIsHtml(columnIsHtml bool) ColumnI
- func (c *ColumnBase) SetRenderAsHeader(r bool)
- func (c *ColumnBase) SetSortDirection(d SortDirection) ColumnI
- func (c *ColumnBase) SetSortable() ColumnI
- func (c *ColumnBase) SetSpan(span int) ColumnI
- func (c *ColumnBase) SetTitle(title string) ColumnI
- func (c *ColumnBase) SortDirection() SortDirection
- func (c *ColumnBase) Span() int
- func (c *ColumnBase) Title() string
- func (c *ColumnBase) UnmarshalState(m maps.Loader)
- func (c *ColumnBase) UpdateFormValues(ctx *page.Context)
- type ColumnI
- type DataPager
- func (d *DataPager) Action(ctx context.Context, params page.ActionParams)
- func (d *DataPager) CalcBunch() (pageStart, pageEnd int)
- func (d *DataPager) Deserialize(dec page.Decoder, p *page.Page) (err error)
- func (d *DataPager) Init(self page.ControlI, parent page.ControlI, id string, ...)
- func (d *DataPager) NextButtonsHtml() string
- func (d *DataPager) PageButtonsHtml(i int) string
- func (d *DataPager) PaginatedControl() PaginatedControlI
- func (d *DataPager) PreviousButtonsHtml() string
- func (d *DataPager) Serialize(e page.Encoder) (err error)
- func (d *DataPager) SetLabels(previous string, next string)
- func (d *DataPager) SetMaxPageButtons(b int)
- func (d *DataPager) SetObjectNames(singular string, plural string)
- func (d *DataPager) SliceOffsets() (start, end int)
- func (d *DataPager) SqlLimits() (maxRowCount, offset int)
- func (d *DataPager) ΩDrawInnerHtml(ctx context.Context, buf *bytes.Buffer) (err error)
- func (d *DataPager) ΩDrawingAttributes() *html.Attributes
- func (d *DataPager) ΩMarshalState(m maps.Setter)
- func (d *DataPager) ΩPreRender(ctx context.Context, buf *bytes.Buffer) (err error)
- func (d *DataPager) ΩUnmarshalState(m maps.Loader)
- func (d *DataPager) ΩisSerializer(i page.ControlI) bool
- type DataPagerI
- type DateTextbox
- func (d *DateTextbox) Date() datetime.DateTime
- func (d *DateTextbox) Init(self TextboxI, parent page.ControlI, id string)
- func (d *DateTextbox) SetDate(dt datetime.DateTime)
- func (d *DateTextbox) SetFormat(format string)
- func (d *DateTextbox) SetText(s string) page.ControlI
- func (d *DateTextbox) SetValue(val interface{}) *DateTextbox
- func (d *DateTextbox) Value() interface{}
- func (d *DateTextbox) ΩUpdateFormValues(ctx *page.Context)
- type DateTimeSpan
- func (s *DateTimeSpan) Init(self page.ControlI, parent page.ControlI, id string)
- func (s *DateTimeSpan) SetDateTime(d datetime.DateTime)
- func (s *DateTimeSpan) SetFormat(format string) *DateTimeSpan
- func (s *DateTimeSpan) SetValue(v interface{})
- func (s *DateTimeSpan) Value() datetime.DateTime
- func (s *DateTimeSpan) ΩDrawInnerHtml(ctx context.Context, buf *bytes.Buffer) error
- type DateValidator
- type Dialog
- func (d *Dialog) Action(ctx context.Context, a page.ActionParams)
- func (d *Dialog) AddButton(label string, id string, options *DialogButtonOptions)
- func (d *Dialog) AddCloseButton(label string, id string)
- func (d *Dialog) Close()
- func (d *Dialog) DrawTemplate(ctx context.Context, buf *bytes.Buffer) (err error)
- func (d *Dialog) Init(self DialogI, parent page.ControlI, id string)
- func (d *Dialog) Open()
- func (d *Dialog) RemoveAllButtons()
- func (d *Dialog) RemoveButton(id string)
- func (d *Dialog) SetButtonStyles(id string, a *html.Style)
- func (d *Dialog) SetButtonVisible(id string, visible bool)
- func (d *Dialog) SetDialogStyle(s DialogStyle)
- func (d *Dialog) SetHasCloseBox(h bool)
- func (d *Dialog) SetTitle(t string)
- func (d *Dialog) Title() string
- func (d *Dialog) ΩDrawingAttributes() *html.Attributes
- type DialogButtonOptions
- type DialogI
- type DialogStyle
- type EmailTextbox
- type Fieldset
- type FieldsetI
- type FloatTextbox
- func (i *FloatTextbox) Float32() float32
- func (i *FloatTextbox) Float64() float64
- func (i *FloatTextbox) Init(self TextboxI, parent page.ControlI, id string)
- func (i *FloatTextbox) SetFloat32(v float32) *FloatTextbox
- func (i *FloatTextbox) SetFloat64(v float64) *FloatTextbox
- func (i *FloatTextbox) SetMaxValue(maxValue float64, invalidMessage string)
- func (i *FloatTextbox) SetMinValue(minValue float64, invalidMessage string)
- func (i *FloatTextbox) Value() interface{}
- type FloatValidator
- type FormBase
- type GridLayoutBuilder
- func (g *GridLayoutBuilder) Build() string
- func (g *GridLayoutBuilder) ColumnCount(count int) *GridLayoutBuilder
- func (g *GridLayoutBuilder) Direction(placement LayoutDirection) *GridLayoutBuilder
- func (g *GridLayoutBuilder) Items(items []string) *GridLayoutBuilder
- func (g *GridLayoutBuilder) RowClass(t string) *GridLayoutBuilder
- func (g *GridLayoutBuilder) RowTag(t string) *GridLayoutBuilder
- type IDSetter
- type IDer
- type IdSlice
- type Image
- func (i *Image) Alt() string
- func (i *Image) Data() []byte
- func (i *Image) Height() int
- func (i *Image) Init(self ImageI, parent page.ControlI, id string)
- func (i *Image) SetAlt(alt string)
- func (i *Image) SetData(data []byte)
- func (i *Image) SetHeight(height int)
- func (i *Image) SetMimeType(typ string)
- func (i *Image) SetSrc(src string)
- func (i *Image) SetWidth(width int)
- func (i *Image) Src() string
- func (i *Image) Width() int
- func (i *Image) ΩDrawingAttributes() *html.Attributes
- type ImageCapture
- func (i *ImageCapture) Data() []byte
- func (i *ImageCapture) Init(self ImageCaptureI, parent page.ControlI, id string)
- func (i *ImageCapture) SetData(data []byte)
- func (i *ImageCapture) SetMaskShape(shape ImageCaptureShape)
- func (i *ImageCapture) SetMimeType(typ string)
- func (i *ImageCapture) SetPixelSize(width int, height int)
- func (i *ImageCapture) SetQuality(quality float32)
- func (i *ImageCapture) SetZoom(zoom int)
- func (i *ImageCapture) TurnOff()
- func (i *ImageCapture) ΩDrawingAttributes() *html.Attributes
- func (i *ImageCapture) ΩPutCustomScript(ctx context.Context, response *page.Response)
- func (i *ImageCapture) ΩUpdateFormValues(ctx *page.Context)
- type ImageCaptureI
- type ImageCaptureShape
- type ImageI
- type IntValidator
- type IntegerTextbox
- func (i *IntegerTextbox) Init(self TextboxI, parent page.ControlI, id string)
- func (i *IntegerTextbox) Int() int
- func (i *IntegerTextbox) Int64() int64
- func (i *IntegerTextbox) SetInt(v int) *IntegerTextbox
- func (i *IntegerTextbox) SetMaxValue(maxValue int, invalidMessage string)
- func (i *IntegerTextbox) SetMinValue(minValue int, invalidMessage string)
- func (i *IntegerTextbox) SetValue(v interface{}) *IntegerTextbox
- func (i *IntegerTextbox) Value() interface{}
- type ItemIDer
- type ItemList
- func (l *ItemList) AddItem(label string, value ...interface{}) ListItemI
- func (l *ItemList) AddItemAt(index int, label string, value ...interface{})
- func (l *ItemList) AddListItemAt(index int, item ListItemI)
- func (l *ItemList) AddListItems(items ...interface{})
- func (l *ItemList) Clear()
- func (l *ItemList) GetItem(id string) (foundItem ListItemI)
- func (l *ItemList) GetItemAt(index int) ListItemI
- func (l *ItemList) GetItemByValue(value interface{}) (id string, foundItem ListItemI)
- func (l *ItemList) Len() int
- func (l *ItemList) ListItems() []ListItemI
- func (l *ItemList) RemoveItemAt(index int)
- type ItemListI
- type ItemLister
- type Labeler
- type LayoutDirection
- type ListItem
- func (i *ListItem) Anchor() string
- func (i *ListItem) AnchorAttributes() *html.Attributes
- func (i *ListItem) Attributes() *html.Attributes
- func (i *ListItem) Disabled() bool
- func (i *ListItem) HasChildItems() bool
- func (i *ListItem) ID() string
- func (i *ListItem) IntValue() int
- func (i *ListItem) IsDivider() bool
- func (i *ListItem) IsEmptyValue() bool
- func (i *ListItem) Label() string
- func (i *ListItem) RenderLabel() (h string)
- func (i *ListItem) SetAnchor(a string)
- func (i *ListItem) SetDisabled(d bool)
- func (i *ListItem) SetID(id string)
- func (i *ListItem) SetIsDivider(d bool)
- func (i *ListItem) SetLabel(l string)
- func (i *ListItem) SetShouldEscapeLabel(e bool) *ListItem
- func (i *ListItem) SetValue(v interface{}) *ListItem
- func (i *ListItem) StringValue() string
- func (i *ListItem) Value() interface{}
- type ListItemI
- type ListValue
- type MaxFloatValidator
- type MaxIntValidator
- type MaxLengthValidator
- type MinFloatValidator
- type MinIntValidator
- type MinLengthValidator
- type MultiselectList
- func (l *MultiselectList) Init(self MultiselectListI, parent page.ControlI, id string)
- func (l *MultiselectList) IsIdSelected(id string) bool
- func (l *MultiselectList) SelectedIds() []string
- func (l *MultiselectList) SelectedItems() []ListItemI
- func (l *MultiselectList) SelectedLabels() []string
- func (l *MultiselectList) SelectedValues() []interface{}
- func (l *MultiselectList) SetSelectedIdNoRefresh(id string, value bool)
- func (l *MultiselectList) SetSelectedIds(ids []string)
- func (l *MultiselectList) SetSelectedIdsNoRefresh(ids []string)
- func (l *MultiselectList) SetSize(size int) MultiselectListI
- func (l *MultiselectList) SetValue(v interface{})
- func (l *MultiselectList) Size() int
- func (l *MultiselectList) Validate(ctx context.Context) bool
- func (l *MultiselectList) Value() interface{}
- func (l *MultiselectList) ΩDrawInnerHtml(ctx context.Context, buf *bytes.Buffer) (err error)
- func (l *MultiselectList) ΩDrawingAttributes() *html.Attributes
- func (l *MultiselectList) ΩMarshalState(m maps.Setter)
- func (l *MultiselectList) ΩUnmarshalState(m maps.Loader)
- func (l *MultiselectList) ΩUpdateFormValues(ctx *page.Context)
- type MultiselectListI
- type OrderedList
- func (l *OrderedList) Init(self page.ControlI, parent page.ControlI, id string)
- func (l *OrderedList) NumberType() string
- func (l *OrderedList) SetNumberType(t string) *OrderedList
- func (l *OrderedList) SetStart(start int) *OrderedList
- func (l *OrderedList) ΩDrawInnerHtml(ctx context.Context, buf *bytes.Buffer) (err error)
- type PaginatedControl
- func (c *PaginatedControl) AddDataPager(d DataPagerI)
- func (c *PaginatedControl) CalcPageCount() int
- func (c *PaginatedControl) PageNum() int
- func (c *PaginatedControl) PageSize() int
- func (c *PaginatedControl) SetPageNum(n int)
- func (c *PaginatedControl) SetPageSize(size int)
- func (c *PaginatedControl) SetTotalItems(count uint)
- func (c *PaginatedControl) TotalItems() int
- type PaginatedControlI
- type PaginatedTable
- type Panel
- type PanelI
- type PrimaryKeyer
- type Proxy
- func (p *Proxy) ActionAttributes(actionValue string) *html.Attributes
- func (p *Proxy) ButtonHtml(label string, actionValue string, attributes *html.Attributes, rawHtml bool) string
- func (p *Proxy) Draw(ctx context.Context, buf *bytes.Buffer) (err error)
- func (p *Proxy) Init(parent page.ControlI)
- func (p *Proxy) LinkHtml(ctx context.Context, label string, actionValue string, ...) string
- func (p *Proxy) OnSubmit(actions ...action.ActionI) page.EventI
- func (p *Proxy) TagHtml(label string, actionValue string, attributes *html.Attributes, tag string, ...) string
- func (p *Proxy) WrapEvent(eventName string, selector string, eventJs string) string
- type ProxyI
- type RadioButton
- type RadioButtonI
- type RadioList
- func (l *RadioList) ColumnCount() int
- func (l *RadioList) Direction() LayoutDirection
- func (l *RadioList) Init(self RadioListI, parent page.ControlI, id string)
- func (l *RadioList) SetColumnCount(columns int) *RadioList
- func (l *RadioList) SetDirection(direction LayoutDirection) *RadioList
- func (l *RadioList) SetIsScrolling(s bool) *RadioList
- func (l *RadioList) SetLabelDrawingMode(mode html.LabelDrawingMode) *RadioList
- func (l *RadioList) ΩDrawInnerHtml(ctx context.Context, buf *bytes.Buffer) (err error)
- func (l *RadioList) ΩDrawingAttributes() *html.Attributes
- func (l *RadioList) ΩRenderItem(item ListItemI) (h string)
- func (l *RadioList) ΩRenderItems(items []ListItemI) string
- func (l *RadioList) ΩUpdateFormValues(ctx *page.Context)
- type RadioListI
- type SelectList
- func (l *SelectList) Init(self page.ControlI, parent page.ControlI, id string)
- func (l *SelectList) IntValue() int
- func (l *SelectList) SelectedItem() ListItemI
- func (l *SelectList) SelectedLabel() string
- func (l *SelectList) SetData(data interface{})
- func (l *SelectList) SetSelectedID(id string)
- func (l *SelectList) SetValue(v interface{})
- func (l *SelectList) StringValue() string
- func (l *SelectList) Validate(ctx context.Context) bool
- func (l *SelectList) Value() interface{}
- func (l *SelectList) ΩDrawInnerHtml(ctx context.Context, buf *bytes.Buffer) (err error)
- func (l *SelectList) ΩDrawingAttributes() *html.Attributes
- func (l *SelectList) ΩMarshalState(m maps.Setter)
- func (l *SelectList) ΩUnmarshalState(m maps.Loader)
- func (l *SelectList) ΩUpdateFormValues(ctx *page.Context)
- type SelectListI
- type SelectTable
- func (t *SelectTable) GetRowAttributes(row int, data interface{}) (a *html.Attributes)
- func (t *SelectTable) Init(self page.ControlI, parent page.ControlI, id string)
- func (t *SelectTable) SelectedID() string
- func (t *SelectTable) SetSelectedID(id string)
- func (t *SelectTable) ΩDrawingAttributes() *html.Attributes
- func (t *SelectTable) ΩMarshalState(m maps.Setter)
- func (t *SelectTable) ΩPutCustomScript(ctx context.Context, response *page.Response)
- func (t *SelectTable) ΩUnmarshalState(m maps.Loader)
- func (t *SelectTable) ΩUpdateFormValues(ctx *page.Context)
- type SelectTableI
- type SortDirection
- type Span
- type SpanI
- type Table
- func (t *Table) AddColumn(column ColumnI) ColumnI
- func (t *Table) AddColumnAt(column ColumnI, loc int)
- func (t *Table) ClearColumns()
- func (t *Table) DrawCaption(ctx context.Context, buf *bytes.Buffer) (err error)
- func (t *Table) GetColumn(loc int) ColumnI
- func (t *Table) GetColumnByID(id string) ColumnI
- func (t *Table) GetColumnByTitle(title string) ColumnI
- func (t *Table) GetFooterRowAttributes(row int) *html.Attributes
- func (t *Table) GetHeaderRowAttributes(row int) *html.Attributes
- func (t *Table) GetRowAttributes(row int, data interface{}) *html.Attributes
- func (t *Table) HeaderCellDrawingInfo(ctx context.Context, col ColumnI, rowNum int, colNum int) (cellHtml string, cellAttributes *html.Attributes)
- func (t *Table) HideColumns()
- func (t *Table) Init(self page.ControlI, parent page.ControlI, id string)
- func (t *Table) PrivateAction(ctx context.Context, p page.ActionParams)
- func (t *Table) RemoveColumn(loc int)
- func (t *Table) RemoveColumnByID(id string)
- func (t *Table) RemoveColumnByTitle(title string)
- func (t *Table) RowStyler() TableRowAttributer
- func (t *Table) SetCaption(caption interface{}) TableI
- func (t *Table) SetFooterRowCount(count int) TableI
- func (t *Table) SetFooterRowStyler(a TableFooterRowAttributer)
- func (t *Table) SetHeaderRowCount(count int) TableI
- func (t *Table) SetHeaderRowStyler(a TableHeaderRowAttributer)
- func (t *Table) SetRowStyler(a TableRowAttributer)
- func (t *Table) SetSortHistoryLimit(n int)
- func (t *Table) SetSortable() TableI
- func (t *Table) ShowColumns()
- func (t *Table) SortColumns() (ret []ColumnI)
- func (t *Table) ΩDrawInnerHtml(ctx context.Context, buf *bytes.Buffer) (err error)
- func (t *Table) ΩDrawTag(ctx context.Context) string
- func (t *Table) ΩDrawingAttributes() *html.Attributes
- func (t *Table) ΩMarshalState(m maps.Setter)
- func (t *Table) ΩUnmarshalState(m maps.Loader)
- func (t *Table) ΩUpdateFormValues(ctx *page.Context)
- type TableFooterRowAttributer
- type TableHeaderRowAttributer
- type TableI
- type TableRowAttributer
- type Textbox
- func (t *Textbox) Deserialize(d page.Decoder, p *page.Page) (err error)
- func (t *Textbox) Init(self TextboxI, parent page.ControlI, id string)
- func (t *Textbox) MaxLength() int
- func (t *Textbox) MinLength() int
- func (t *Textbox) Placeholder() string
- func (t *Textbox) ResetValidators()
- func (t *Textbox) Serialize(e page.Encoder) (err error)
- func (t *Textbox) SetColumnCount(columns int)
- func (t *Textbox) SetMaxLength(len int) *MaxLengthValidator
- func (t *Textbox) SetMinLength(len int) *MinLengthValidator
- func (t *Textbox) SetPlaceholder(s string) TextboxI
- func (t *Textbox) SetReadOnly(r bool)
- func (t *Textbox) SetRowCount(rows int)
- func (t *Textbox) SetText(s string) page.ControlI
- func (t *Textbox) SetType(typ string) TextboxI
- func (t *Textbox) SetValue(v interface{}) page.ControlI
- func (t *Textbox) Text() string
- func (t *Textbox) Validate(ctx context.Context) bool
- func (t *Textbox) ValidateWith(v Validater)
- func (t *Textbox) Value() interface{}
- func (t *Textbox) ΩDrawInnerHtml(ctx context.Context, buf *bytes.Buffer) (err error)
- func (t *Textbox) ΩDrawingAttributes() *html.Attributes
- func (t *Textbox) ΩMarshalState(m maps.Setter)
- func (t *Textbox) ΩSanitize(s string) string
- func (t *Textbox) ΩUnmarshalState(m maps.Loader)
- func (t *Textbox) ΩUpdateFormValues(ctx *page.Context)
- func (t *Textbox) ΩisSerializer(i page.ControlI) bool
- type TextboxI
- type UnorderedList
- func (l *UnorderedList) GetItemsHtml(items []ListItemI) string
- func (l *UnorderedList) Init(self page.ControlI, parent page.ControlI, id string)
- func (l *UnorderedList) SetBulletStyle(s string)
- func (l *UnorderedList) SetData(data interface{})
- func (l *UnorderedList) SetItemTag(s string)
- func (l *UnorderedList) ΩDrawInnerHtml(ctx context.Context, buf *bytes.Buffer) (err error)
- func (l *UnorderedList) ΩDrawTag(ctx context.Context) string
- func (l *UnorderedList) ΩDrawingAttributes() *html.Attributes
- type UnorderedListI
- type Validater
Constants ¶
const ( ButtonClick = iota + 3000 DialogClose )
event codes
const ( OrderedListNumberTypeNumber = "1" // default OrderedListNumberTypeUpperLetter = "A" OrderedListNumberTypeLowerLetter = "a" OrderedListNumberTypeUpperRoman = "I" OrderedListNumberTypeLowerRoman = "i" )
const ( // UnoderedListStyleDisc is the default list style for main items and is a bullet UnorderedListStyleDisc = "disc" // default // UnorderedListStyleCircle is the default list style for 2nd level items and is an open circle UnorderedListStyleCircle = "circle" // UnorderedListStyleSquare sets a square as the bullet UnorderedListStyleSquare = "square" // UnorderedListStyleNone removes the bullet from the list UnorderedListStyleNone = "none" )
const ( ColumnAction = iota + 2000 SortClick )
const ( NotSortable = SortDirection(0) SortAscending = SortDirection(1) SortDescending = SortDirection(-1) NotSorted = SortDirection(-100) )
const ( TextboxTypeDefault = "text" TextboxTypePassword = "password" TextboxTypeSearch = "search" TextboxTypeNumber = "number" // Puts little arrows in box, will need to widen it. TextboxTypeEmail = "email" // see TextEmail. Prevents submission of RFC5322 email addresses (Gogh Fir <[email protected]>) TextboxTypeTel = "tel" // not well supported TextboxTypeUrl = "url" )
const DialogButtonEvent = "gr-dlgbtn"
const (
PageClick = iota + 1000
)
Variables ¶
var DefaultMaxPagintorButtons = 10
DefaultMaxPagintorButtons is the default maximum number of buttons to display on the pager. You can change this in an individual control, too.
var DefaultPaginatorPageSize = 10
DefaultPaginatorPageSize is the default number of items that a paginated control will show. You can change this in an individual control, too.
var SortButtonHtmlGetter func(SortDirection) string
SortButtonHtmlGetter is the injected function for getting the html for sort buttons in the column header. The default uses FontAwesome to draw the buttons, which means the css for FontAwesome must be loaded into the web page. You can change what html is loaded by setting this function.
Functions ¶
func SetAlertFunction ¶
func SetAlertFunction(f AlertFuncType)
SetAlertFunction will set the entire framework's alert function to this function. The alert function is called whenever the framework needs to display an alert. Currently, this is done only from the code generated forms. Css/js frameworks that want to work with goradd should call this from an init() function to enable goradd to use it to display its alerts.
Types ¶
type AlertFuncType ¶
type Button ¶
Button is a standard html form submit button. It corresponds to a <button> tag in html.
The default behavior of a submit button is to submit a form. If you have text boxes on your form, pressing enter will submit the FIRST button in the form, and so this essentially becomes your default button. If you have more than one button, and you want the default button to NOT be the first button on the screen, you can handle this in one of two ways: - Make sure your default button comes out first in the html, but then use css to change the visible order of the buttons. Be sure to also set the tab order if you do this to reflect the visible arrangement of the buttons. Or, - Create another button as the first button, and give it a display attribute of none so that it is not visible. Set its action to be the default action you want.
If you want the button to display an image, simple create an Image control as a child of the button.
func (*Button) Init ¶
Init is called by subclasses of Button to initialize the button control structure.
func (*Button) OnSubmit ¶
OnSubmit is a shortcut for adding a click event handler that is particular to buttons and button like objects. It debounces the click, so that all other events are lost until this event processes. It should generally be used for operations that will eventually redirect to a different page. If coupling this with an ajax response, you should probably also make the response priority PriorityFinal.
func (*Button) SetLabel ¶
SetLabel is an alias for SetText on buttons. Standard buttons do not normally have separate labels. Subclasses can redefine this if they use separate labels.
func (*Button) ΩDrawingAttributes ¶ added in v0.0.3
func (b *Button) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
type Canvas ¶
Canvas is a Goradd control that is an html canvas control. It currently does not have any primitives to draw on the canvas, and is here primarily to create a canvas that you would draw on using JavaScript.
func (*Canvas) ΩDrawingAttributes ¶ added in v0.0.3
func (c *Canvas) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes is called by the framework to get the temporary attributes that are specifically set by this control just before drawing.
type CellTexter ¶
type CellTexter interface {
CellText(ctx context.Context, col ColumnI, rowNum int, colNum int, data interface{}) string
}
CellTexter defines the interface for a structure that provides the content of a table cell.
type Checkbox ¶
type Checkbox struct {
CheckboxBase
}
Checkbox is a basic html checkbox input form control.
func NewCheckbox ¶
NewCheckbox creates a new checkbox control.
func (*Checkbox) ΩDrawingAttributes ¶ added in v0.0.3
func (c *Checkbox) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes is called by the framework to set the temporary attributes that the control needs. Checkboxes set the grctl, name, type and value attributes automatically. You do not normally need to call this function.
func (*Checkbox) ΩUpdateFormValues ¶ added in v0.0.3
ΩUpdateFormValues is an internal call that lets us reflect the value of the checkbox on the form. You do not normally need to call this function.
type CheckboxBase ¶
type CheckboxBase struct { page.Control // LabelMode describes where to place the label associating the text with the checkbox LabelMode html.LabelDrawingMode // contains filtered or unexported fields }
CheckboxBase is a base class for checkbox-like objects, including html checkboxes and radio buttons.
func (*CheckboxBase) Checked ¶
func (c *CheckboxBase) Checked() bool
Checked returns true if the checkbox is checked.
func (*CheckboxBase) Deserialize ¶
Deserialize is called by the framework during page state serialization.
func (*CheckboxBase) Init ¶
Init initializes a checkbox base class. It is called by checkbox implementations.
func (*CheckboxBase) InputLabelAttributes ¶
func (c *CheckboxBase) InputLabelAttributes() *html.Attributes
InputLabelAttributes returns a pointer to the input label attributes. Feel free to set the attributes directly on the returned object. The input label attributes are the attributes for the label tag that associates the Text with the checkbox. This is specific to checkbox style controls and is not the same as the label tag that appears when using a name wrapper. After setting attributes, be sure to call Refresh on the control if you do this during an Ajax response.
func (*CheckboxBase) Serialize ¶
func (c *CheckboxBase) Serialize(e page.Encoder) (err error)
Serialize is called by the framework during pagestate serialization.
func (*CheckboxBase) SetChecked ¶
func (c *CheckboxBase) SetChecked(v bool) CheckboxI
SetChecked sets the value of the checkbox. Returns itself for chaining.
func (*CheckboxBase) SetCheckedNoRefresh ¶
func (c *CheckboxBase) SetCheckedNoRefresh(v interface{})
SetCheckedNoRefresh is used internally to update values without causing a refresh loop.
func (*CheckboxBase) SetLabelDrawingMode ¶
func (c *CheckboxBase) SetLabelDrawingMode(m html.LabelDrawingMode)
SetLabelDrawingMode determines how the label is drawn for the checkbox.
func (*CheckboxBase) SetValue ¶
func (c *CheckboxBase) SetValue(v interface{}) CheckboxI
SetValue sets the checked status of checkbox. The given value can be:
For True "1", "true", "TRUE", "on", "ON", 1(int), true(bool)
For False "0", "false", "FALSE", "off, "OFF", ""(empty string), 0(int), false(bool)
Other values will cause a panic.
func (*CheckboxBase) TextIsLabel ¶
func (c *CheckboxBase) TextIsLabel() bool
TextIsLabel is called by the framework to determine that the Text of the control is used in a label tag. You do not normally need to call this unless you are creating the template for a custom control.
func (*CheckboxBase) UpdateCheckboxFormValues ¶ added in v0.0.4
func (c *CheckboxBase) UpdateCheckboxFormValues(ctx *page.Context)
UpdateCheckboxFormValues is used by subclasses of CheckboxBase to update their internal state if they are a checkbox type of control.
func (*CheckboxBase) UpdateRadioFormValues ¶ added in v0.0.4
func (c *CheckboxBase) UpdateRadioFormValues(ctx *page.Context, group string)
UpdateRadioFormValues is used by subclasses of CheckboxBase to update their internal state if they are a radioButton type of control.
func (*CheckboxBase) Value ¶
func (c *CheckboxBase) Value() interface{}
Value returns the boolean checked status of the checkbox.
func (*CheckboxBase) ΩDrawTag ¶ added in v0.0.3
func (c *CheckboxBase) ΩDrawTag(ctx context.Context) (ctrl string)
ΩDrawTag draws the checkbox tag. This can be quite tricky. Some CSS frameworks are very particular about how checkboxes get associated with labels. The Text value of the control will become the text directly associated with the checkbox, while the Label value is only shown when drawing a checkbox with a wrapper.
func (*CheckboxBase) ΩDrawingAttributes ¶ added in v0.0.3
func (c *CheckboxBase) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
func (*CheckboxBase) ΩGetDrawingLabelAttributes ¶ added in v0.0.3
func (c *CheckboxBase) ΩGetDrawingLabelAttributes() *html.Attributes
ΩGetDrawingLabelAttributes is called by the framework to temporarily set the attributes of the label associated with the checkbox.
func (*CheckboxBase) ΩMarshalState ¶ added in v0.0.3
func (c *CheckboxBase) ΩMarshalState(m maps.Setter)
ΩMarshalState is called by the framework to save the state of the checkbox between form views. Call SetState(true) to enable state saving.
func (*CheckboxBase) ΩUnmarshalState ¶ added in v0.0.3
func (c *CheckboxBase) ΩUnmarshalState(m maps.Loader)
ΩUnmarshalState restores the state of the checkbox if coming back to a form in the same session.
func (*CheckboxBase) ΩisSerializer ¶
func (c *CheckboxBase) ΩisSerializer(i page.ControlI) bool
ΩisSerializer is used by the automated control serializer to determine how far down the control chain the control has to go before just calling serialize and deserialize
type CheckboxI ¶
type CheckboxI interface { page.ControlI ΩGetDrawingLabelAttributes() *html.Attributes }
type CheckboxList ¶
type CheckboxList struct { MultiselectList // contains filtered or unexported fields }
CheckboxList is a multi-select control that presents its choices as a list of checkboxes. Styling is provided by divs and spans that you can provide css for in your style sheets. The goradd.css file has default styling to handle the basics. It wraps the whole thing in a div that can be set to scroll as well, so that the final structure can be styled like a multi-column table, or a single-column scrolling list much like a standard html select list.
func NewCheckboxList ¶
func NewCheckboxList(parent page.ControlI, id string) *CheckboxList
NewCheckboxList creates a new CheckboxList
func (*CheckboxList) ColumnCount ¶
func (l *CheckboxList) ColumnCount() int
ColumnCount returns the current column count.
func (*CheckboxList) Direction ¶
func (l *CheckboxList) Direction() LayoutDirection
Direction returns the direction of how items are spread across the columns.
func (*CheckboxList) Init ¶
func (l *CheckboxList) Init(self CheckboxListI, parent page.ControlI, id string)
Init is called by subclasses
func (*CheckboxList) SetColumnCount ¶
func (l *CheckboxList) SetColumnCount(columns int) *CheckboxList
SetColumnCount sets the number of columns to use to display the list. Items will be evenly distributed across the columns.
func (*CheckboxList) SetDirection ¶
func (l *CheckboxList) SetDirection(direction LayoutDirection) *CheckboxList
SetDirection specifies how items are distributed across the columns.
func (*CheckboxList) SetIsScrolling ¶
func (l *CheckboxList) SetIsScrolling(s bool) *CheckboxList
SetIsScrolling sets whether the list will scroll if it gets bigger than its bounding box. You will need to style the bounding box to give it limits, or else it will simply grow as big as the list.
func (*CheckboxList) SetLabelDrawingMode ¶
func (l *CheckboxList) SetLabelDrawingMode(mode html.LabelDrawingMode) *CheckboxList
SetLabelDrawingMode indicates how labels for each of the checkboxes are drawn.
func (*CheckboxList) ΩDrawInnerHtml ¶ added in v0.0.3
ΩDrawInnerHtml is called by the framework to draw the contents of the list.
func (*CheckboxList) ΩDrawingAttributes ¶ added in v0.0.3
func (l *CheckboxList) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
func (*CheckboxList) ΩRenderItem ¶ added in v0.0.3
func (l *CheckboxList) ΩRenderItem(item ListItemI) (h string)
ΩRenderItem is called by the framework to render a single item in the list.
func (*CheckboxList) ΩRenderItems ¶ added in v0.0.4
func (l *CheckboxList) ΩRenderItems(items []ListItemI) string
func (*CheckboxList) ΩUpdateFormValues ¶ added in v0.0.3
func (l *CheckboxList) ΩUpdateFormValues(ctx *page.Context)
ΩUpdateFormValues is called by the framework to tell the control to update its internal values based on the form values sent by the browser.
type CheckboxListI ¶
type CheckboxListI interface { MultiselectListI ΩRenderItems(items []ListItemI) string }
type ColumnBase ¶
type ColumnBase struct { base.Base *html.Attributes // These are attributes that will appear on the cell // contains filtered or unexported fields }
ColumnBase is the base implementation of all table columns
func (*ColumnBase) Action ¶
func (c *ColumnBase) Action(ctx context.Context, params page.ActionParams)
Do a table action that is directed at this table Column implementations can implement this method to receive private actions that they have added using AddActions
func (*ColumnBase) AddActions ¶
func (c *ColumnBase) AddActions(ctrl page.ControlI)
func (*ColumnBase) CellAttributes ¶
func (c *ColumnBase) CellAttributes(ctx context.Context, row int, col int, data interface{}) *html.Attributes
CellAttributes returns the attributes of the cell. Column implementations should call this base version first before customizing more. It will use the CellStyler if one was provided.
func (*ColumnBase) CellText ¶
CellText returns the text in the cell. It will use the CellTexter if one was provided.
func (*ColumnBase) CellTexter ¶
func (c *ColumnBase) CellTexter() CellTexter
CellTexter returns the cell texter.
func (*ColumnBase) ColTagAttributes ¶
func (c *ColumnBase) ColTagAttributes() *html.Attributes
ColTagAttributes specifies attributes that will appear in the table tag. Note that you have to turn on table tags in the table object as well for these to appear.
func (*ColumnBase) DrawCell ¶
func (c *ColumnBase) DrawCell(ctx context.Context, row int, col int, data interface{}, buf *bytes.Buffer)
DrawCell is the default cell drawing function.
func (*ColumnBase) DrawColumnTag ¶
func (c *ColumnBase) DrawColumnTag(ctx context.Context, buf *bytes.Buffer)
DrawColumnTag draws the column tag if one was requested.
func (*ColumnBase) DrawFooterCell ¶
func (c *ColumnBase) DrawFooterCell(ctx context.Context, row int, col int, count int, buf *bytes.Buffer)
DrawFooterCell will draw the footer cells html into the given buffer.
func (*ColumnBase) FooterAttributes ¶
func (c *ColumnBase) FooterAttributes(row int, col int) *html.Attributes
FooterAttributes returns the attributes to use for the footer cell.
func (*ColumnBase) FooterCellHtml ¶
FooterCellHtml returns the html to use in the given footer cell.
func (*ColumnBase) HeaderAttributes ¶
func (c *ColumnBase) HeaderAttributes(row int, col int) *html.Attributes
HeaderAttributes returns the attributes to use on the header cell.
func (*ColumnBase) HeaderCellHtml ¶
HeaderCellHtml returns the text of the indicated header cell. The default will call into the headerTexter if it is provided, or just return the Label value. This function can also be overridden by embedding the ColumnBase object into another object.
func (*ColumnBase) Init ¶
func (c *ColumnBase) Init(self ColumnI)
func (*ColumnBase) IsHidden ¶
func (c *ColumnBase) IsHidden() bool
IsHidden returns true if the column is hidden.
func (*ColumnBase) IsSortable ¶
func (c *ColumnBase) IsSortable() bool
IsSortable indicates whether the column is sortable, and has a sort indicator in the head.
func (*ColumnBase) MarshalState ¶ added in v0.0.4
func (c *ColumnBase) MarshalState(m maps.Setter)
MarshalState is an internal function to save the state of the control.
func (*ColumnBase) ParentTable ¶
func (c *ColumnBase) ParentTable() TableI
ParentTable returns the table that is the parent of the column
func (*ColumnBase) PreRender ¶ added in v0.0.4
func (c *ColumnBase) PreRender()
PreRender is called just before the table is redrawn.
func (*ColumnBase) RenderSortButton ¶
func (c *ColumnBase) RenderSortButton(labelHtml string) string
func (*ColumnBase) SetCellStyler ¶
func (c *ColumnBase) SetCellStyler(s html.Attributer)
SetCellStyler sets the CellStyler for the body cells.
func (*ColumnBase) SetCellTexter ¶
func (c *ColumnBase) SetCellTexter(s CellTexter) ColumnI
SetCellTexter sets the CellTexter for getting the content of each body cell.
func (*ColumnBase) SetFooterTexter ¶
func (c *ColumnBase) SetFooterTexter(s CellTexter) ColumnI
SetFooterTexter sets the CellTexter that gets the text for footer cells.
func (*ColumnBase) SetHeaderTexter ¶
func (c *ColumnBase) SetHeaderTexter(s CellTexter) ColumnI
SetHeaderTexter sets the CellTexter that gets the text for header cells.
func (*ColumnBase) SetHidden ¶
func (c *ColumnBase) SetHidden(h bool) ColumnI
SetHidden hides the column without removing it completely from the table.
func (*ColumnBase) SetID ¶
func (c *ColumnBase) SetID(id string) ColumnI
SetID sets the id of the column. If you are going to provide your own id, do this as the first thing after you create a table, or the new id might not propagate through the system correctly. Note that the id in html will have the table id prepended to it. This is required so that actions can be routed to a column.
func (*ColumnBase) SetIsHtml ¶
func (c *ColumnBase) SetIsHtml(columnIsHtml bool) ColumnI
SetIsHtml will cause the cell to treat the text it receives as html rather than raw text it should escape. Use this with extreme caution. Do not display unescaped text that might come from user input, as it could open you up to XSS attacks.
func (*ColumnBase) SetRenderAsHeader ¶
func (c *ColumnBase) SetRenderAsHeader(r bool)
SetRenderAsHeader will cause the entire column to be output with th instead of td cells.
func (*ColumnBase) SetSortDirection ¶
func (c *ColumnBase) SetSortDirection(d SortDirection) ColumnI
SetSortDirection is used internally to set the sort direction indicator.
func (*ColumnBase) SetSortable ¶ added in v0.0.7
func (c *ColumnBase) SetSortable() ColumnI
SetSortable indicates that the column should be drawn with sort indicators.
func (*ColumnBase) SetSpan ¶
func (c *ColumnBase) SetSpan(span int) ColumnI
SetSpan sets the span indicated in the column tag of the column. This is used to create colgroup tags.
func (*ColumnBase) SetTitle ¶
func (c *ColumnBase) SetTitle(title string) ColumnI
SetTitle sets the title of the column. It returns a column reference for chaining.
func (*ColumnBase) SortDirection ¶
func (c *ColumnBase) SortDirection() SortDirection
SortDirection returns the current sort direction.
func (*ColumnBase) Span ¶
func (c *ColumnBase) Span() int
Span returns the number of columns this column will span.
func (*ColumnBase) Title ¶
func (c *ColumnBase) Title() string
Title returns the title text that will appear in the header of the column
func (*ColumnBase) UnmarshalState ¶ added in v0.0.4
func (c *ColumnBase) UnmarshalState(m maps.Loader)
UnmarshalState is an internal function to restore the state of the control.
func (*ColumnBase) UpdateFormValues ¶
func (c *ColumnBase) UpdateFormValues(ctx *page.Context)
UpdateFormValues is called by the system whenever values are sent by client controls. This default version does nothing. Columns that need to record information (checkbox columns for example), should implement this.
type ColumnI ¶
type ColumnI interface { ID() string SetID(string) ColumnI ParentTable() TableI Title() string SetTitle(string) ColumnI Span() int SetSpan(int) ColumnI IsHidden() bool SetHidden(bool) ColumnI DrawColumnTag(ctx context.Context, buf *bytes.Buffer) DrawCell(ctx context.Context, row int, col int, data interface{}, buf *bytes.Buffer) CellText(ctx context.Context, row int, col int, data interface{}) string HeaderCellHtml(ctx context.Context, row int, col int) string HeaderAttributes(row int, col int) *html.Attributes ColTagAttributes() *html.Attributes UpdateFormValues(ctx *page.Context) AddActions(ctrl page.ControlI) Action(ctx context.Context, params page.ActionParams) SetHeaderTexter(s CellTexter) ColumnI SetCellTexter(s CellTexter) ColumnI SetCellStyler(s html.Attributer) IsSortable() bool SortDirection() SortDirection SetSortDirection(SortDirection) ColumnI SetSortable() ColumnI SetIsHtml(columnIsHtml bool) ColumnI PreRender() MarshalState(m maps.Setter) UnmarshalState(m maps.Loader) // contains filtered or unexported methods }
ColumnI defines the interface that all columns must support. Most of these functions are provided by the default behavior of the ColumnBase class.
type DataPager ¶
type DataPager struct { page.Control ObjectName string ObjectPluralName string LabelForNext string LabelForPrevious string Proxy *Proxy // contains filtered or unexported fields }
DataPager is a toolbar designed to aid scrolling a large set of data. It is implemented using Aria design best practices. It is designed to be paired with a Table or DataRepeater to aid in navigating through the data. It is similar to a Paginator, but a paginator is for navigating through a series of related web pages and not just for data on one form.
func NewDataPager ¶
func NewDataPager(parent page.ControlI, id string, paginatedControl PaginatedControlI) *DataPager
NewDataPager creates a new DataPager
func (*DataPager) Action ¶
func (d *DataPager) Action(ctx context.Context, params page.ActionParams)
Action is called by the framework to respond to actions.
func (*DataPager) CalcBunch ¶
CalcBunch is called by the framework to lay out the data pager based on the number of pages in the pager. It should try to represent an easy to navigate interface that can manage 2 or 2000 pages.
A "Bunch" is defined as the collection of numbers that lies in between the pair of Ellipsis ("...")
Layout ¶
For an IndexCount of 10 2 213 2 (two items to the left of the bunch, and then 2 indexes, selected index, 3 indexes, and then two items to the right of the bunch) e.g. 1 ... 5 6 *7* 8 9 10 ... 100
For IndexCount of 11 2 313 2
For IndexCount of 12 2 314 2
For IndexCount of 13 2 414 2
For IndexCount of 14 2 415 2
Start/end page numbers for the bunch
For IndexCount of 10 1 2 3 4 5 6 7 8 .. 100 1 .. 4 5 *6* 7 8 9 .. 100 1 .. 92 93 *94* 95 96 97 .. 100 1 .. 93 94 95 96 97 98 99 100
For IndexCount of 11 1 2 3 4 5 6 7 8 9 .. 100 1 .. 4 5 6 *7* 8 9 10 .. 100 1 .. 91 92 93 *94* 95 96 97 .. 100 1 .. 92 93 94 95 96 97 98 99 100
For IndexCount of 12 1 2 3 4 5 6 7 8 9 10 .. 100 1 .. 4 5 6 *7* 8 9 10 11 .. 100 1 .. 90 91 92 *93* 94 95 96 97 .. 100 1 .. 91 92 93 94 95 96 97 98 99 100
For IndexCount of 13 1 2 3 4 5 6 7 8 9 11 .. 100 1 .. 4 5 6 7 *8* 9 10 11 12 .. 100 1 .. 89 90 91 92 *93* 94 95 96 97 .. 100 1 .. 90 91 92 93 94 95 96 97 98 99 100
Note: there are likely better ways to do this. Some innovative ones are to have groups of 10s, and then 100s etc. Or, use the ellipsis as a dropdown menu for more selections
func (*DataPager) Deserialize ¶
func (*DataPager) Init ¶
func (d *DataPager) Init(self page.ControlI, parent page.ControlI, id string, paginatedControl PaginatedControlI)
Init is called by subclasses of a DataPager to initialize the data pager. You do not normally need to call this.
func (*DataPager) NextButtonsHtml ¶
NextButtonsHtml returns the html for the next buttons. Subclasses can override this to change how the next buttons are drawn.
func (*DataPager) PageButtonsHtml ¶
PageButtonsHtml returns the html for the page buttons. Subclasses can override this to change how the page buttons are drawn.
func (*DataPager) PaginatedControl ¶
func (d *DataPager) PaginatedControl() PaginatedControlI
func (*DataPager) PreviousButtonsHtml ¶
PreviousButtonsHtml returns the html to draw the previous buttons. Subclasses can override this to change how the Previous buttons are drawn.
func (*DataPager) SetMaxPageButtons ¶
SetMaxPageButtons sets the maximum number of buttons that will be displayed in the paginator.
func (*DataPager) SetObjectNames ¶
SetObjectNames sets the single and plural names of the objects that are represented in the data pager.
func (*DataPager) SliceOffsets ¶
SliceOffsets returns the start and end values to use to specify a portion of a slice corresponding to the data the pager refers to
func (*DataPager) SqlLimits ¶
SqlLimits returns the limits you would use in a sql database limit clause
func (*DataPager) ΩDrawInnerHtml ¶ added in v0.0.3
ΩDrawInnerHtml is called by the framework to draw the control's inner html.
func (*DataPager) ΩDrawingAttributes ¶ added in v0.0.3
func (d *DataPager) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes is called by the framework to add temporary attributes to the html.
func (*DataPager) ΩMarshalState ¶ added in v0.0.3
ΩMarshalState is an internal function to save the state of the control
func (*DataPager) ΩPreRender ¶ added in v0.0.3
ΩPreRender is called by the framework to load data into the paginated control just before drawing.
func (*DataPager) ΩUnmarshalState ¶ added in v0.0.3
ΩUnmarshalState is an internal function to restore the state of the control
type DataPagerI ¶
type DataPagerI interface { page.ControlI PreviousButtonsHtml() string NextButtonsHtml() string PageButtonsHtml(i int) string }
DataPagerI is the data pager interface that allows this object to call into subclasses.
type DateTextbox ¶
type DateTextbox struct { Textbox // contains filtered or unexported fields }
DateTextbox is a textbox that only permits dates and/or times to be entered into it.
func NewDateTextbox ¶
func NewDateTextbox(parent page.ControlI, id string) *DateTextbox
NewDateTextbox creates a new DateTextbox.
func (*DateTextbox) Date ¶
func (d *DateTextbox) Date() datetime.DateTime
Date returns the value as a DateTime value based on the format. If a bad value was entered into the textbox, it will return an empty datetime.
func (*DateTextbox) Init ¶
func (d *DateTextbox) Init(self TextboxI, parent page.ControlI, id string)
func (*DateTextbox) SetDate ¶
func (d *DateTextbox) SetDate(dt datetime.DateTime)
SetDate will set the textbox to the give datetime value
func (*DateTextbox) SetFormat ¶
func (d *DateTextbox) SetFormat(format string)
SetFormat sets the format of the text allowed. The format is any allowable format that datetime or time can convert.
func (*DateTextbox) SetText ¶
func (d *DateTextbox) SetText(s string) page.ControlI
SetText sets the DateTime to the given text. If you attempt set the text to something that is not convertible to a date, an empty string will be entered.
func (*DateTextbox) SetValue ¶
func (d *DateTextbox) SetValue(val interface{}) *DateTextbox
SetValue will set the DateTextbox to the given value if possible.
func (*DateTextbox) Value ¶
func (d *DateTextbox) Value() interface{}
Value returns the value as an interface, but the underlying value will be a datetime. If a bad value was entered into the textbox, it will return an empty datetime.
func (*DateTextbox) ΩUpdateFormValues ¶ added in v0.0.3
func (d *DateTextbox) ΩUpdateFormValues(ctx *page.Context)
type DateTimeSpan ¶
type DateTimeSpan struct { Span // contains filtered or unexported fields }
DateTimeSpan is a span that displays a datetime value as static text. This is a typical default control to use for a timestamp in the database.
func NewDateTimeSpan ¶
func NewDateTimeSpan(parent page.ControlI, id string) *DateTimeSpan
NewDateTimeSpan create a new DateTimeSpan.
func (*DateTimeSpan) Init ¶
Init is called by subclasses to initialize the parent. You do not normally need to call this.
func (*DateTimeSpan) SetDateTime ¶
func (s *DateTimeSpan) SetDateTime(d datetime.DateTime)
SetDateTime sets the value to a datetime.DateTime.
func (*DateTimeSpan) SetFormat ¶
func (s *DateTimeSpan) SetFormat(format string) *DateTimeSpan
SetFormat sets the format string. This should be a time.TimeFormat string described at https://golang.org/pkg/time/#Time.Format
func (*DateTimeSpan) SetValue ¶
func (s *DateTimeSpan) SetValue(v interface{})
SetValue sets the value display. You can set the value to a datetime.DateTime, a time.Time, or a string that can be parsed by the format string.
func (*DateTimeSpan) Value ¶
func (s *DateTimeSpan) Value() datetime.DateTime
Value returns the value as a datetime.DateTime object.
func (*DateTimeSpan) ΩDrawInnerHtml ¶ added in v0.0.3
ΩDrawInnerHtml is called by the framework to draw the inner html of the span.
type DateValidator ¶
type DateValidator struct { Message string // contains filtered or unexported fields }
type Dialog ¶
type Dialog struct { Panel // contains filtered or unexported fields }
Our own implementation of a dialog. This works cooperatively with javascript in goradd.js to create a minimal implementation of the dialog interface.
func (*Dialog) Action ¶
func (d *Dialog) Action(ctx context.Context, a page.ActionParams)
Action is called by the framework and will respond to the DialogClose action sent by any close buttons on the page to close the dialog. You do not normally need to call this.
func (*Dialog) AddButton ¶
func (d *Dialog) AddButton( label string, id string, options *DialogButtonOptions, )
AddButton adds the given button to the dialog. The first button added is the default button that gets submitted when an enter key is pressed in a textbox.
func (*Dialog) AddCloseButton ¶
AddCloseButton adds a button to the list of buttons with the given label, but this button will trigger the DialogCloseEvent instead of the DialogButtonEvent. The button will also close the dialog.
func (*Dialog) DrawTemplate ¶
func (*Dialog) RemoveAllButtons ¶
func (d *Dialog) RemoveAllButtons()
RemoveAllButtons removes all the buttons from the dialog
func (*Dialog) RemoveButton ¶
RemoveButton removes the given button from the dialog
func (*Dialog) SetButtonStyles ¶
SetButtonStyle sets css styles on a button that is already in the dialog
func (*Dialog) SetButtonVisible ¶
SetButtonVisible sets the visible state of the button. Hidden buttons are still rendered, but are styled so that they are not shown.
func (*Dialog) SetDialogStyle ¶ added in v0.0.3
func (d *Dialog) SetDialogStyle(s DialogStyle)
SetDialogStyle sets the style of the dialog.
func (*Dialog) SetHasCloseBox ¶ added in v0.0.3
SetHasCloseBox adds a close box so that the dialog can be closed in a way that is independent of buttons. Often this is an X button in the upper right corner of the dialog.
func (*Dialog) ΩDrawingAttributes ¶ added in v0.0.3
func (d *Dialog) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes is called by the framework to set temporary attributes just before drawing.
type DialogButtonOptions ¶
type DialogButtonOptions struct { // Validates indicates that this button will validate the dialog Validates bool // The ConfirmationMessage string will appear with a yes/no box making sure the user wants the action. // This is usually used when the action could be destructive, like a Delete button. ConfirmationMessage string // PushLeft pushes this button to the left side of the dialog. Buttons are typically aligned right. // This is helpful to separate particular buttons from the main grouping of buttons. PushLeft bool // IsClose will set the button up to automatically close the dialog. Detect closes with the DialogCloseEvent if needed. // The button will not send a DialogButton event. IsClose bool // Options are additional options specific to the dialog implementation you are using. Options map[string]interface{} }
DialogButtonOptions are optional additional items you can add to a dialog button.
type DialogI ¶
type DialogI interface { PanelI SetTitle(string) SetDialogStyle(state DialogStyle) Open() Close() }
DialogI defines the publicly consumable api that the goradd framework uses to interact with a dialog.
More and more CSS and javascript frameworks are coming out with their own forms of dialog, which is usually a combination of html, css and a javascript widget. goradd has many ways of potentially interacting with dialogs, but to be able to inject a dialog into the framework, we need a consistent interface for all to use.
This particular interface has been implemented in a simple default dialog and Bootstrap dialogs. As more needs arise, we can modify the interface to accommodate as many frameworks as possible.
Dialog implementations should descend from the Panel control. Dialogs should be able to be a member of a form or control object and appear with an Open call, but they should also be able to be instantiated on the fly. The framework has hooks for both, and if you are creating a dialog implementation, see the current Bootstrap implementation for more direction. Feel free to implement more than just the functions listed. These are the minimal set to allow goradd to use a dialog implementation. When possible, implementations should use the same function signatures found here to do the same work. For example, SetHasCloseBox is defined here, and in the Bootstrap Modal implementation with the same function signature, and other implementations should attempt to do the same, but it is not enforced by an interface.
func Alert ¶
Alert is used by the framework to create an alert type message dialog.
If you specify no buttons, a close box in the corner will be created that will just close the dialog. If you specify just a string in buttons, or just one string as a slice of strings, one button will be shown that will just close the message.
If you specify more than one button, the first button will be the default button (the one pressed if the user presses the return key). In this case, you will need to detect the button by adding a On(event.DialogButton(), action) to the dialog returned. You will also be responsible for calling "Close()" on the dialog after detecting a button in this case.
Call SetAlertFunction to register a different alert function for the framework to use.
type DialogStyle ¶ added in v0.0.3
type DialogStyle int
DialogStyle represents the style of the dialog, whether its a plain dialog (the default), or whether it should display additional indicators showing that its indicating an error, warning, information, or success. Not all css frameworks support all of these styles.
const ( DialogStyleDefault DialogStyle = iota DialogStyleError DialogStyleWarning DialogStyleInfo DialogStyleSuccess )
type EmailTextbox ¶
type EmailTextbox struct { Textbox // contains filtered or unexported fields }
EmailTextbox is a Text control that validates for email addresses. EmailTextbox can accept multiple addresses separated by commas, and can accept any address in RFC5322 format (Barry Gibbs <[email protected]>) making it useful for people copying addresses out of an email client and pasting into the field.
func NewEmailTextbox ¶
func NewEmailTextbox(parent page.ControlI, id string) *EmailTextbox
NewEmailTextbox creates a new textbox that validates its input as an email address. multi will allow the textbox to accept multiple email addresses separated by a comma.
func (*EmailTextbox) Addresses ¶
func (t *EmailTextbox) Addresses() []string
Addresses returns a slice of the individual addresses entered, stripped of any extra text entered.
func (*EmailTextbox) Init ¶
func (t *EmailTextbox) Init(self TextboxI, parent page.ControlI, id string)
func (*EmailTextbox) SetMaxCount ¶
func (t *EmailTextbox) SetMaxCount(max int)
func (*EmailTextbox) ΩUpdateFormValues ¶ added in v0.0.3
func (t *EmailTextbox) ΩUpdateFormValues(ctx *page.Context)
type Fieldset ¶
type Fieldset struct {
Panel
}
Fieldset is a Panel that is drawn with a fieldset tag. The panel's label is used as the legend tag. Fieldset's cannot have wrappers.
func NewFieldset ¶
NewFieldset creates a new Fieldset.
func (*Fieldset) ΩDrawingAttributes ¶ added in v0.0.3
func (c *Fieldset) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes is called by the framework.
type FloatTextbox ¶
type FloatTextbox struct {
Textbox
}
FloatTextbox is a text control that ensures a valid floating point number is entered in the field.
func NewFloatTextbox ¶
func NewFloatTextbox(parent page.ControlI, id string) *FloatTextbox
func (*FloatTextbox) Float32 ¶
func (i *FloatTextbox) Float32() float32
func (*FloatTextbox) Float64 ¶
func (i *FloatTextbox) Float64() float64
func (*FloatTextbox) Init ¶
func (i *FloatTextbox) Init(self TextboxI, parent page.ControlI, id string)
func (*FloatTextbox) SetFloat32 ¶
func (i *FloatTextbox) SetFloat32(v float32) *FloatTextbox
func (*FloatTextbox) SetFloat64 ¶
func (i *FloatTextbox) SetFloat64(v float64) *FloatTextbox
func (*FloatTextbox) SetMaxValue ¶
func (i *FloatTextbox) SetMaxValue(maxValue float64, invalidMessage string)
func (*FloatTextbox) SetMinValue ¶
func (i *FloatTextbox) SetMinValue(minValue float64, invalidMessage string)
func (*FloatTextbox) Value ¶
func (i *FloatTextbox) Value() interface{}
type FloatValidator ¶
type FloatValidator struct {
Message string
}
type FormBase ¶
The FormBase is the control that all Form objects should include, and is the master container for all other goradd controls.
func NewMockForm ¶ added in v0.0.3
func NewMockForm() *FormBase
NewMockForm creates a form that should be used as a parent of a control when unit testing the control.
type GridLayoutBuilder ¶ added in v0.0.3
type GridLayoutBuilder struct {
// contains filtered or unexported fields
}
GridLayoutBuilder is a helper that will allow a slice of items to be layed out in a table like pattern. It will compute the number of rows required, and then wrap the rows in row html, and the cells in cell html. You can have the items flow with the rows, or flow across the row axis. You can use this to build a table or a table-like structure.
func (*GridLayoutBuilder) Build ¶ added in v0.0.3
func (g *GridLayoutBuilder) Build() string
func (*GridLayoutBuilder) ColumnCount ¶ added in v0.0.3
func (g *GridLayoutBuilder) ColumnCount(count int) *GridLayoutBuilder
ColumnCount sets the number of columns.
func (*GridLayoutBuilder) Direction ¶ added in v0.0.3
func (g *GridLayoutBuilder) Direction(placement LayoutDirection) *GridLayoutBuilder
Direction indicates how items are placed, whether they should fill up rows first, or fill up columns.
func (*GridLayoutBuilder) Items ¶ added in v0.0.3
func (g *GridLayoutBuilder) Items(items []string) *GridLayoutBuilder
Items sets the html for each item to display.
func (*GridLayoutBuilder) RowClass ¶ added in v0.0.3
func (g *GridLayoutBuilder) RowClass(t string) *GridLayoutBuilder
func (*GridLayoutBuilder) RowTag ¶ added in v0.0.3
func (g *GridLayoutBuilder) RowTag(t string) *GridLayoutBuilder
type IDSetter ¶
type IDSetter interface {
SetID(id string)
}
IDSetter is an interface for an item that sets an id.
type IdSlice ¶
type IdSlice []string
IdSlice is a slice of string ids, and is used to sort a list of ids that the item list uses.
type Image ¶
Image is an img tag. You can display either a URL, or direct image information by setting the Src or the Data values.
func (*Image) SetAlt ¶
SetAlt will set the alt tag. The html standard requires the alt tag. Alt tags are used to display a descirption of an image when the browser cannot display an image, and is very important for assistive technologies.
func (*Image) SetMimeType ¶
Set the MIME type for the data, (jpeg, gif, png, etc.)
func (*Image) ΩDrawingAttributes ¶ added in v0.0.3
func (i *Image) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes is called by the framework.
type ImageCapture ¶
type ImageCapture struct { Panel Canvas *Canvas CaptureButton *Button SwitchCameraButton *Button ErrText *Panel // contains filtered or unexported fields }
ImageCapture is a panel that has both an image and button to help you capture images from the user's camera. It is a kind of composite control that exports the image so that you can further manipulate it after creation. It also has javascript to manage the actual image capture process. It does not currently allow the user to upload an image in place of capturing an image from the camera. It only captures images from devices and browsers that support image capture.
func NewImageCapture ¶
func NewImageCapture(parent page.ControlI, id string) *ImageCapture
NewImageCapture creates a new image capture panel.
func (*ImageCapture) Data ¶
func (i *ImageCapture) Data() []byte
func (*ImageCapture) Init ¶
func (i *ImageCapture) Init(self ImageCaptureI, parent page.ControlI, id string)
Init is called by subclasses.
func (*ImageCapture) SetData ¶
func (i *ImageCapture) SetData(data []byte)
SetData sets the binary picture data. The data must be in the mime type format.
func (*ImageCapture) SetMaskShape ¶
func (i *ImageCapture) SetMaskShape(shape ImageCaptureShape)
SetMaskShape sets the masking shape for the image
func (*ImageCapture) SetMimeType ¶
func (i *ImageCapture) SetMimeType(typ string)
func (*ImageCapture) SetPixelSize ¶
func (i *ImageCapture) SetPixelSize(width int, height int)
SetPixelSize sets the pixel size of the image that will be returned. Control the visible size of the canvas through setting css sizes.
func (*ImageCapture) SetQuality ¶
func (i *ImageCapture) SetQuality(quality float32)
SetQuality specifies a number between 0 and 1 used as the quality value for capturing jpegs or webp images.
func (*ImageCapture) SetZoom ¶
func (i *ImageCapture) SetZoom(zoom int)
SetZoom zooms the camera by the given percent, i.e. 50 is 50% closer and 100 would be a 2x zoom.
func (*ImageCapture) TurnOff ¶
func (i *ImageCapture) TurnOff()
TurnOff will turn off the camera and the image displayed in the control
func (*ImageCapture) ΩDrawingAttributes ¶ added in v0.0.3
func (i *ImageCapture) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes is called by the framework.
func (*ImageCapture) ΩPutCustomScript ¶ added in v0.0.3
func (i *ImageCapture) ΩPutCustomScript(ctx context.Context, response *page.Response)
ΩPutCustomScript is called by the framework.
func (*ImageCapture) ΩUpdateFormValues ¶ added in v0.0.3
func (i *ImageCapture) ΩUpdateFormValues(ctx *page.Context)
ΩUpdateFormValues is called by the framework.
type ImageCaptureI ¶
type ImageCaptureShape ¶
type ImageCaptureShape string
const ( ImageCaptureShapeRect ImageCaptureShape = "rect" ImageCaptureShapeCircle ImageCaptureShape = "circle" )
type IntValidator ¶
type IntValidator struct {
Message string
}
type IntegerTextbox ¶
type IntegerTextbox struct { Textbox // contains filtered or unexported fields }
func NewIntegerTextbox ¶
func NewIntegerTextbox(parent page.ControlI, id string) *IntegerTextbox
func (*IntegerTextbox) Init ¶
func (i *IntegerTextbox) Init(self TextboxI, parent page.ControlI, id string)
func (*IntegerTextbox) Int ¶
func (i *IntegerTextbox) Int() int
func (*IntegerTextbox) Int64 ¶
func (i *IntegerTextbox) Int64() int64
func (*IntegerTextbox) SetInt ¶
func (i *IntegerTextbox) SetInt(v int) *IntegerTextbox
func (*IntegerTextbox) SetMaxValue ¶
func (i *IntegerTextbox) SetMaxValue(maxValue int, invalidMessage string)
SetMaxValue creates a validator that makes sure the value of the text box is at most the given value. Specify your own error message, or leave the error message blank and a standard error message will be presented if the value is not valid.
func (*IntegerTextbox) SetMinValue ¶
func (i *IntegerTextbox) SetMinValue(minValue int, invalidMessage string)
SetMinValue creates a validator that makes sure the value of the text box is at least the given value. Specify your own error message, or leave the error message blank and a standard error message will be presented if the value is not valid.
func (*IntegerTextbox) SetValue ¶
func (i *IntegerTextbox) SetValue(v interface{}) *IntegerTextbox
func (*IntegerTextbox) Value ¶
func (i *IntegerTextbox) Value() interface{}
type ItemIDer ¶
type ItemIDer interface { ID() interface{} String() string }
ItemIDer is an interface to a listable object that matches orm objects
type ItemList ¶
type ItemList struct {
// contains filtered or unexported fields
}
ItemList manages a list of ListItemI list items. ItemList is designed to be embedded in another structure, and will turn that object into a manager of list items. ItemList will manage the id's of the items in its list, you do not have control of that, and it needs to manage those ids in order to efficiently manage the selection process.
func NewItemList ¶
NewItemList creates a new item list. "owner" is the object that has the list embedded in it, and must be an IDer.
func (*ItemList) AddItem ¶
AddItem adds the given item to the end of the list. The value is optional, but should only be one or zero values.
func (*ItemList) AddItemAt ¶
AddItemAt adds the item at the given index. If the index is negative, it counts from the end. If the index is -1 or bigger than the number of items, it adds it to the end. If the index is zero, or is negative and smaller than the negative value of the number of items, it adds to the beginning. This can be an expensive operation in a long hierarchical list, so use sparingly.
func (*ItemList) AddListItemAt ¶
AddItemAt adds the item at the given index. If the index is negative, it counts from the end. If the index is -1 or bigger than the number of items, it adds it to the end. If the index is zero, or is negative and smaller than the negative value of the number of items, it adds to the beginning. This can be an expensive operation in a long hierarchical list, so use sparingly.
func (*ItemList) AddListItems ¶
func (l *ItemList) AddListItems(items ...interface{})
AddListItems adds one or more objects to the end of the list. items should be a list of ListItemI, ItemLister, ItemIDer, Labeler or Stringer types. This function can accept one or more lists of items, or single items
func (*ItemList) GetItem ¶
GetItem recursively searches for and returns the item corresponding to the given id. Since we are managing the id numbers, we can efficiently find the item. Note that if you add items to the list, the ids may change.
func (*ItemList) GetItemByValue ¶
GetItemByValue recursively searches the list to find the item with the given value. It starts with the current list, and if not found, will search in sublists.
func (*ItemList) Len ¶
Len returns the length of the item list at the current level. In other words, it does not count items in sublists.
func (*ItemList) ListItems ¶
ListItems returns a slice of the ListItemI items, in the order they were added or arranged.
func (*ItemList) RemoveItemAt ¶ added in v0.0.3
RemoveItemAt removes an item at the given index.
type ItemListI ¶
type ItemListI interface { AddItem(label string, value ...interface{}) ListItemI AddItemAt(index int, label string, value ...interface{}) AddListItemAt(index int, item ListItemI) AddListItems(items ...interface{}) GetItemAt(index int) ListItemI ListItems() []ListItemI Clear() RemoveItemAt(index int) Len() int GetItem(id string) (foundItem ListItemI) GetItemByValue(value interface{}) (id string, foundItem ListItemI) // contains filtered or unexported methods }
ItemListI is the interface for all controls that display a list of ListItems.
type ItemLister ¶
type ItemLister interface { Value() interface{} Label() string }
type LayoutDirection ¶ added in v0.0.4
type LayoutDirection int
LayoutDirection controls whether items are layed out in rows or columns.
const ( // LayoutRow lays out items in rows LayoutRow LayoutDirection = iota // LayoutColumn lays out items in columns, computing the number of rows required to make the specified number of columns. LayoutColumn )
type ListItem ¶
type ListItem struct { ItemList // contains filtered or unexported fields }
A ListItem is an object that is a member of a list. HTML has a few different kinds of lists, and this can be a member of a select list (<select>), or an ordered or unordered list (<ul> or <ol>). It is up to the manager of the list to render the item, but this serves as a place to store options about the item. Not all options are pertinent to all lists.
A list item generally has a value, and a label. Often, lists will have ids too, that will appear in the html output, but the id values are managed by the list manager and generally should not be set by you. In situations where the user selects a list item, you would use the id to retrieve the ListItem selected.
func NewItemFromItemIDer ¶
NewItemFromItemIDer creates a new item from any object that has an ID and String method. Note that the ID() of the ItemIDer will become the value of the select item, and the String() will become the label
func NewItemFromItemLister ¶
func NewItemFromItemLister(i ItemLister) *ListItem
NewItemFromItemLister creates a new item from any object that has a Value and Label method.
func NewItemFromLabeler ¶
NewItemFromLabeler creates a new item from any object that has just a Label method.
func NewItemFromStringer ¶
NewItemFromStringer creates a new item from any object that has just a String method.
func NewListItem ¶
NewListItem creates a new item for a list. Specify an empty value for an item that represents no selection.
func (*ListItem) AnchorAttributes ¶
func (i *ListItem) AnchorAttributes() *html.Attributes
func (*ListItem) Attributes ¶
func (i *ListItem) Attributes() *html.Attributes
Attributes returns a pointer to the attributes of the item for customization. You can directly set the attributes on the returned object.
func (*ListItem) HasChildItems ¶
func (*ListItem) IsEmptyValue ¶ added in v0.0.3
IsEmptyValue returns true if the value is empty, meaning it does not satisfy a selection being made if the list has IsRequired turned on.
func (*ListItem) RenderLabel ¶
func (*ListItem) SetDisabled ¶
func (*ListItem) SetID ¶
SetID should not be called by your code typically. It is exported for implementations of item lists. The IDs of an item list are completely managed by the list, you cannot have custom ids.
func (*ListItem) SetIsDivider ¶
func (*ListItem) SetShouldEscapeLabel ¶
func (*ListItem) StringValue ¶
type ListItemI ¶
type ListItemI interface { ItemListI Value() interface{} ID() string SetID(string) Label() string SetLabel(string) SetDisabled(bool) Disabled() bool SetIsDivider(bool) IsDivider() bool IntValue() int StringValue() string HasChildItems() bool Attributes() *html.Attributes Anchor() string SetAnchor(string) AnchorAttributes() *html.Attributes RenderLabel() string IsEmptyValue() bool }
ListItemI is the interface for list items in one of the various list controls that embed the ItemList structure. It is generally used by implementations of list controls.
type ListValue ¶ added in v0.0.3
type ListValue struct { // L is the label L string // V is the value V interface{} }
ListValue is a helper for initializing a control based on ItemList. It satisfies the ItemLister interface. To use it, create a slice of ListValue's and pass the list to AddListItems or SetData.
type MaxFloatValidator ¶
type MaxIntValidator ¶
type MaxLengthValidator ¶
MaxLengthValidator is a Validater to test that the user did not enter too many characters.
type MinFloatValidator ¶
type MinIntValidator ¶
type MinLengthValidator ¶
MinLenghtValidator is a validator that checks that the user has entered a minimum length. It is set up automatically by calling SetMinValue.
type MultiselectList ¶
MultiselectList is a generic list box which allows multiple selections. It is here for completeness, but is not used very often since it doesn't present an intuitive interface and is very browser dependent on what is presented. A Checkboxlist is better.
func NewMultiselectList ¶
func NewMultiselectList(parent page.ControlI, id string) *MultiselectList
func (*MultiselectList) Init ¶
func (l *MultiselectList) Init(self MultiselectListI, parent page.ControlI, id string)
func (*MultiselectList) IsIdSelected ¶
func (l *MultiselectList) IsIdSelected(id string) bool
func (*MultiselectList) SelectedIds ¶
func (l *MultiselectList) SelectedIds() []string
SelectedIds returns a list of ids sorted by id number that correspond to the selection
func (*MultiselectList) SelectedItems ¶
func (l *MultiselectList) SelectedItems() []ListItemI
func (*MultiselectList) SelectedLabels ¶
func (l *MultiselectList) SelectedLabels() []string
func (*MultiselectList) SelectedValues ¶
func (l *MultiselectList) SelectedValues() []interface{}
func (*MultiselectList) SetSelectedIdNoRefresh ¶ added in v0.0.3
func (l *MultiselectList) SetSelectedIdNoRefresh(id string, value bool)
func (*MultiselectList) SetSelectedIds ¶
func (l *MultiselectList) SetSelectedIds(ids []string)
SetSelectedIds sets the current selection to the given ids. You must ensure that the items with the ids exist, it will not attempt to make sure the items exist.
func (*MultiselectList) SetSelectedIdsNoRefresh ¶
func (l *MultiselectList) SetSelectedIdsNoRefresh(ids []string)
func (*MultiselectList) SetSize ¶
func (l *MultiselectList) SetSize(size int) MultiselectListI
func (*MultiselectList) SetValue ¶
func (l *MultiselectList) SetValue(v interface{})
SetValue implements the Valuer interface for general purpose value getting and setting
func (*MultiselectList) Size ¶
func (l *MultiselectList) Size() int
func (*MultiselectList) Value ¶
func (l *MultiselectList) Value() interface{}
Value implements the Valuer interface for general purpose value getting and setting
func (*MultiselectList) ΩDrawInnerHtml ¶ added in v0.0.3
func (*MultiselectList) ΩDrawingAttributes ¶ added in v0.0.3
func (l *MultiselectList) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
func (*MultiselectList) ΩMarshalState ¶ added in v0.0.3
func (l *MultiselectList) ΩMarshalState(m maps.Setter)
ΩMarshalState is an internal function to save the state of the control
func (*MultiselectList) ΩUnmarshalState ¶ added in v0.0.3
func (l *MultiselectList) ΩUnmarshalState(m maps.Loader)
ΩUnmarshalState is an internal function to restore the state of the control
func (*MultiselectList) ΩUpdateFormValues ¶ added in v0.0.3
func (l *MultiselectList) ΩUpdateFormValues(ctx *page.Context)
ΩUpdateFormValues is an internal function that lets us reflect the value of the selection on the web override
type MultiselectListI ¶
type OrderedList ¶
type OrderedList struct {
UnorderedList
}
OrderedList is a dynamically generated html ordered list (ol). Such lists are often used as the basis for javascript and css widgets. If you use a data provider to set the data, you should call AddItems to the list in your GetData function.
func NewOrderedList ¶
func NewOrderedList(parent page.ControlI, id string) *OrderedList
NewOrderedList creates a new ordered list (ol tag).
func (*OrderedList) NumberType ¶
func (l *OrderedList) NumberType() string
NumberType returns the string used for the type attribute.
func (*OrderedList) SetNumberType ¶
func (l *OrderedList) SetNumberType(t string) *OrderedList
SetNumberType sets the top level number style for the list. Choose from the OrderedListNumberType* constants. To set a number type for a sublevel, set the "type" attribute on the list item that is the parent of the sub list.
func (*OrderedList) SetStart ¶
func (l *OrderedList) SetStart(start int) *OrderedList
SetStart sets the starting number for the numbers in the top level list. To set the start of a sub-list, set the "start" attribute on the list item that is the parent of the sub-list.
func (*OrderedList) ΩDrawInnerHtml ¶ added in v0.0.3
type PaginatedControl ¶
type PaginatedControl struct {
// contains filtered or unexported fields
}
PaginatedControl is a mixin that makes a Control controllable by a data pager
func (*PaginatedControl) AddDataPager ¶
func (c *PaginatedControl) AddDataPager(d DataPagerI)
AddDataPager adds a data pager to the PaginatedControl. A PaginatedControl can have multiple data pagers.
func (*PaginatedControl) CalcPageCount ¶
func (c *PaginatedControl) CalcPageCount() int
CalcPageCount will return the number of pages based on the page size and total items.
func (*PaginatedControl) PageNum ¶
func (c *PaginatedControl) PageNum() int
PageNum returns the current page number.
func (*PaginatedControl) PageSize ¶
func (c *PaginatedControl) PageSize() int
PageSize returns the maximum number of items that will be allowed in a page.
func (*PaginatedControl) SetPageNum ¶
func (c *PaginatedControl) SetPageNum(n int)
SetPageNum sets the current page number. It does not redraw anything, nor does it determine if the page is actually visible.
func (*PaginatedControl) SetPageSize ¶
func (c *PaginatedControl) SetPageSize(size int)
SetPageSize sets the maximum number of items that will be displayed at one time. If more than this number of items is being displayed, the pager will allow paging to other items.
func (*PaginatedControl) SetTotalItems ¶
func (c *PaginatedControl) SetTotalItems(count uint)
SetTotalItems sets the total number of items that the paginator keeps track of. This will be divided by the PageSize to determine the number of pages presented. You must call this each time the data size might change.
func (*PaginatedControl) TotalItems ¶
func (c *PaginatedControl) TotalItems() int
TotalItems returns the number of items that the paginator is aware of in the list it is managing.
type PaginatedControlI ¶
type PaginatedControlI interface { data.DataManagerI SetTotalItems(uint) TotalItems() int SetPageSize(size int) PageSize() int PageNum() int SetPageNum(n int) AddDataPager(DataPagerI) CalcPageCount() int // contains filtered or unexported methods }
PaginatedControlI is the interface that paginated controls must implement
type PaginatedTable ¶
type PaginatedTable struct { Table PaginatedControl }
func NewPaginatedTable ¶
func NewPaginatedTable(parent page.ControlI, id string) *PaginatedTable
type Panel ¶
Panel is a Goradd control that is a basic "div" wrapper. Use it to style and listen to events on a div. It can also be used as the basis for more advanced javascript controls.
func (*Panel) ΩDrawingAttributes ¶ added in v0.0.3
func (c *Panel) ΩDrawingAttributes() *html.Attributes
type PrimaryKeyer ¶
type PrimaryKeyer interface {
PrimaryKey() string
}
PrimaryKeyer is an interface that is often implemented by model objects.
type Proxy ¶
Proxy is a control that attaches events to controls. It is useful for attaching similar events to a series of controls, like all the links in a table, or all the buttons in button bar. You can also use it to draw a series of links or buttons. The proxy differentiates between the different objects that are sending it events by the ActionValue that you given the proxy when it draws.
To use a Proxy, create it in the control that wraps the controls the proxy will manage. Attach an event to the proxy control, and in the action handler, look for the ControlValue in the Action Value to know which of the controls sent the event. Draw the proxy with one of the following:
LinkHtml() - Output the proxy as a link ButtonHtml() - Output the proxy as a button TagHtml() - Output the proxy in any tag ActionAttributes() - Returns attributes you can use in any custom control to attach a proxy
The ProxyColumn of the Table object will use a proxy to draw items in a table column.
func NewProxy ¶
NewProxy creates a new proxy. The parent should be the wrapping control of the objects that the proxy will manage.
func (*Proxy) ActionAttributes ¶
func (p *Proxy) ActionAttributes(actionValue string) *html.Attributes
ActionAttributes returns attributes that can be included in any tag to attach a proxy to the tag.
func (*Proxy) ButtonHtml ¶
func (p *Proxy) ButtonHtml(label string, actionValue string, attributes *html.Attributes, rawHtml bool, ) string
ButtonHtml outputs the proxy as a button tag. actionValue becomes the event's ControlValue parameter
func (*Proxy) Draw ¶
Draw is used by the form engine to draw the control. As a proxy, there is no html to draw, but this is where the scripts attached to the proxy get sent to the response. This should get drawn by the auto-drawing routine, since proxies are not rendered in templates.
func (*Proxy) LinkHtml ¶
func (p *Proxy) LinkHtml(ctx context.Context, label string, actionValue string, attributes *html.Attributes, ) string
LinkHtml renders the proxy as a link. To conform to the html standard and accessibility guidelines, links should only be used to navigate away from the page, so the action of your proxy should lead to that kind of behavior. Otherwise, use ButtonHtml.
func (*Proxy) OnSubmit ¶
OnSubmit is a shortcut for adding a click event handler that is particular to buttons. It debounces the click, to prevent potential accidental multiple form submissions. All events fired after this event fires will be lost. It is intended to be used when the action will result in navigating to a new page.
type ProxyI ¶
type ProxyI interface { page.ControlI LinkHtml(label string, actionValue string, attributes *html.Attributes, ) string TagHtml(label string, actionValue string, attributes *html.Attributes, tag string, rawHtml bool, ) string ButtonHtml(label string, eventActionValue string, attributes *html.Attributes, rawHtml bool, ) string OnSubmit(actions ...action.ActionI) page.EventI }
type RadioButton ¶
type RadioButton struct { CheckboxBase // contains filtered or unexported fields }
RadioButton is a standard html radio button. You can optionally specify a group name for the radiobutton to belong to and the browser will make sure only one item in the group is selected.
func NewRadioButton ¶
func NewRadioButton(parent page.ControlI, id string) *RadioButton
NewRadioButton creates a new radio button
func (*RadioButton) Group ¶
func (c *RadioButton) Group() string
Group returns the name of the group that the control belongs to.
func (*RadioButton) SetChecked ¶
func (c *RadioButton) SetChecked(v bool) RadioButtonI
SetChecked will set the checked status of this radio button to the given value.
func (*RadioButton) SetGroup ¶
func (c *RadioButton) SetGroup(g string) RadioButtonI
SetGroup sets the name of the group that the control will belong to. Set all the radio buttons that represent a selection from a group to this same group name.
func (*RadioButton) ΩDrawingAttributes ¶ added in v0.0.3
func (c *RadioButton) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes is called by the framework to create temporary attributes for the input tag.
func (*RadioButton) ΩUpdateFormValues ¶ added in v0.0.3
func (c *RadioButton) ΩUpdateFormValues(ctx *page.Context)
ΩUpdateFormValues is called by the framework to update the value of the control based on values sent by the browser.
type RadioButtonI ¶
type RadioButtonI interface { CheckboxI }
type RadioList ¶
type RadioList struct { SelectList // contains filtered or unexported fields }
RadioList is a multi-select control that presents its choices as a list of checkboxes. Styling is provided by divs and spans that you can provide css for in your style sheets. The goradd.css file has default styling to handle the basics. It wraps the whole thing in a div that can be set to scroll as well, so that the final structure can be styled like a multi-table table, or a single-table scrolling list much like a standard html select list.
func NewRadioList ¶
NewRadioList creates a new RadioList control.
func (*RadioList) ColumnCount ¶ added in v0.0.3
ColumnCount returns the current column count.
func (*RadioList) Direction ¶ added in v0.0.4
func (l *RadioList) Direction() LayoutDirection
Direction returns the direction of how items are spread across the columns.
func (*RadioList) Init ¶
func (l *RadioList) Init(self RadioListI, parent page.ControlI, id string)
Init is called by subclasses.
func (*RadioList) SetColumnCount ¶ added in v0.0.4
SetColumnCount sets the number of columns to use to display the list. Items will be evenly distributed across the columns.
func (*RadioList) SetDirection ¶ added in v0.0.4
func (l *RadioList) SetDirection(direction LayoutDirection) *RadioList
SetDirection specifies how items are distributed across the columns.
func (*RadioList) SetIsScrolling ¶ added in v0.0.4
SetIsScrolling sets whether the list will scroll if it gets bigger than its bounding box. You will need to style the bounding box to give it limits, or else it will simply grow as big as the list.
func (*RadioList) SetLabelDrawingMode ¶ added in v0.0.4
func (l *RadioList) SetLabelDrawingMode(mode html.LabelDrawingMode) *RadioList
SetLabelDrawingMode indicates how labels for each of the checkboxes are drawn.
func (*RadioList) ΩDrawInnerHtml ¶ added in v0.0.3
ΩDrawInnerHtml is called by the framework to draw the contents of the list.
func (*RadioList) ΩDrawingAttributes ¶ added in v0.0.3
func (l *RadioList) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
func (*RadioList) ΩRenderItem ¶ added in v0.0.3
ΩRenderItem is called by the framework to render a single item in the list.
func (*RadioList) ΩRenderItems ¶ added in v0.0.3
func (*RadioList) ΩUpdateFormValues ¶ added in v0.0.3
ΩUpdateFormValues is called by the framework to tell the control to update its internal values based on the form values sent by the browser.
type RadioListI ¶
type RadioListI interface { SelectListI ΩRenderItems(items []ListItemI) string }
type SelectList ¶
type SelectList struct { page.Control ItemList data.DataManager // contains filtered or unexported fields }
SelectList is typically a dropdown list with a single selection. Items are selected by id number, and the SelectList completely controls the ids in the list. Create the list by calling AddItem or AddItems to add ListItemI objects. Or, use the embedded DataManager to load items. Set the size attribute if you want to display it as a scrolling list rather than a dropdown list.
func NewSelectList ¶
func NewSelectList(parent page.ControlI, id string) *SelectList
NewSelectList creates a new select list
func (*SelectList) IntValue ¶
func (l *SelectList) IntValue() int
IntValue returns the select value as an integer.
func (*SelectList) SelectedItem ¶
func (l *SelectList) SelectedItem() ListItemI
SelectedItem will return the currently selected item. If no item has been selected, it will return the first item in the list, since that is what will be showing in the selection list, and will update its internal pointer to make the first item the current selection.
func (*SelectList) SelectedLabel ¶
func (l *SelectList) SelectedLabel() string
SelectedLabel returns the label of the selected item
func (*SelectList) SetData ¶
func (l *SelectList) SetData(data interface{})
SetData overrides the default data setter to add objects to the item list. The result is kept in memory currently. ItemLister, ItemIDer, Labeler or Stringer types. This function can accept one or more lists of items, or single items.
func (*SelectList) SetSelectedID ¶
func (l *SelectList) SetSelectedID(id string)
SetSelectedId sets the current selection to the given id. You must ensure that the item with the id exists, it will not attempt to make sure the item exists.
func (*SelectList) SetValue ¶
func (l *SelectList) SetValue(v interface{})
SetValue implements the Valuer interface for general purpose value getting and setting
func (*SelectList) StringValue ¶
func (l *SelectList) StringValue() string
StringValue returns the selected value as a string
func (*SelectList) Validate ¶
func (l *SelectList) Validate(ctx context.Context) bool
Validate is called by the framework to validate the contents of the control. For a SelectList, this is typically just checking to see if something was selected if a selection is required.
func (*SelectList) Value ¶
func (l *SelectList) Value() interface{}
Value implements the Valuer interface for general purpose value getting and setting
func (*SelectList) ΩDrawInnerHtml ¶ added in v0.0.3
ΩDrawInnerHtml is called by the framework during drawing of the control to draw the inner html of the control
func (*SelectList) ΩDrawingAttributes ¶ added in v0.0.3
func (l *SelectList) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
func (*SelectList) ΩMarshalState ¶ added in v0.0.3
func (l *SelectList) ΩMarshalState(m maps.Setter)
ΩMarshalState is an internal function to save the state of the control
func (*SelectList) ΩUnmarshalState ¶ added in v0.0.3
func (l *SelectList) ΩUnmarshalState(m maps.Loader)
ΩUnmarshalState is an internal function to restore the state of the control
func (*SelectList) ΩUpdateFormValues ¶ added in v0.0.3
func (l *SelectList) ΩUpdateFormValues(ctx *page.Context)
ΩUpdateFormValues is an internal function that lets us reflect the value of the selection that is currently on the browser
type SelectListI ¶ added in v0.0.4
type SelectTable ¶
type SelectTable struct { Table // contains filtered or unexported fields }
SelectTable is a table that is row selectable. To detect a row selection, trigger on event.RowSelected
func NewSelectTable ¶
func NewSelectTable(parent page.ControlI, id string) *SelectTable
func (*SelectTable) GetRowAttributes ¶
func (t *SelectTable) GetRowAttributes(row int, data interface{}) (a *html.Attributes)
func (*SelectTable) SelectedID ¶
func (t *SelectTable) SelectedID() string
func (*SelectTable) SetSelectedID ¶
func (t *SelectTable) SetSelectedID(id string)
func (*SelectTable) ΩDrawingAttributes ¶ added in v0.0.3
func (t *SelectTable) ΩDrawingAttributes() *html.Attributes
func (*SelectTable) ΩMarshalState ¶ added in v0.0.3
func (t *SelectTable) ΩMarshalState(m maps.Setter)
func (*SelectTable) ΩPutCustomScript ¶ added in v0.0.3
func (t *SelectTable) ΩPutCustomScript(ctx context.Context, response *page.Response)
func (*SelectTable) ΩUnmarshalState ¶ added in v0.0.3
func (t *SelectTable) ΩUnmarshalState(m maps.Loader)
func (*SelectTable) ΩUpdateFormValues ¶ added in v0.0.3
func (t *SelectTable) ΩUpdateFormValues(ctx *page.Context)
type SelectTableI ¶
type SelectTableI interface { TableI }
type SortDirection ¶
type SortDirection int
type Span ¶
type Span struct {
Panel
}
Span is a Goradd control that is a basic "span" wrapper. Use it to style and listen to events on a span. It can also be used as the basis for more advanced javascript controls.
func (*Span) ΩDrawingAttributes ¶ added in v0.0.3
func (c *Span) ΩDrawingAttributes() *html.Attributes
type Table ¶
type Table struct { page.Control data.DataManager // contains filtered or unexported fields }
Table is a goradd control that outputs a dynamic HTML table object, with table, tr, th and td tags, as well as optional col, thead, and tfoot tags.
To use a Table, call NewTable and then add column objects to it. The columns use a CellTexter to draw the contents of a cell in the table. There are a number of predefined columns to draw text coming from slices of maps, slices, database objects, as well as custom functions you define. See the examples directory for examples of using a Table object. See also the PaginatedTable for a table that works with a Pager object to page through a large data set.
Call SetSortable() to make a table sortable, in which case the user can click in the header of a column to sort by that column. The Table maintains a history of what columns have been sorted by what row, so that you can implement multi-level sorting if you so desire. This is particularly helpful when some columns have duplicate data, that then get further identified by another column.
You can provide data to the table when it is first created by calling SetData, or you can provide the data just before drawing by calling SetDataProvider at initialization of the table, and then providing the table data in response to the BindData function. The advantage of this approach is that if you are showing a lot of data, the data is only loaded in memory during drawing, and not kept in the pagestate after drawing.
func (*Table) AddColumnAt ¶
AddColumnAt adds the given column at the column offset given. 0 is the first column location. Pass a negative number or a number bigger than the current number of columns to put it at the end.
func (*Table) ClearColumns ¶
func (t *Table) ClearColumns()
ClearColumns removes all of the columns.
func (*Table) DrawCaption ¶
DrawCaption is called internally to draw the caption. Subclasses can override this to draw a custom caption.
func (*Table) GetColumnByID ¶
GetColumnByID returns the column with the given id.
func (*Table) GetColumnByTitle ¶
GetColumnByTitle returns the column with the given title.
func (*Table) GetFooterRowAttributes ¶
func (t *Table) GetFooterRowAttributes(row int) *html.Attributes
GetFooterRowAttributes is called internally to get the attributes for the tr tags in footer rows.
func (*Table) GetHeaderRowAttributes ¶
func (t *Table) GetHeaderRowAttributes(row int) *html.Attributes
GetHeaderRowAttributes is called internally to get the attributes for the tr tags in header rows.
func (*Table) GetRowAttributes ¶
func (t *Table) GetRowAttributes(row int, data interface{}) *html.Attributes
GetRowAttributes is used internally to return the attributes for the tr tag of a data row.
func (*Table) HeaderCellDrawingInfo ¶
func (t *Table) HeaderCellDrawingInfo(ctx context.Context, col ColumnI, rowNum int, colNum int) (cellHtml string, cellAttributes *html.Attributes)
HeaderCellDrawingInfo is called internally to provide the info for each header cell drawn. Subclasses can override this.
func (*Table) HideColumns ¶
func (t *Table) HideColumns()
HideColumns hides all of the columns, keeping them in the column list, but causing them not to draw.
func (*Table) Init ¶
Init is an internal function that enables the object-oriented pattern of calling virtual functions used by the goradd controls. You would only call this if you were implementing a "subclass" of the Table. Call it immediately after creating your Table structure, passing the newly created table as "self".
func (*Table) PrivateAction ¶
func (t *Table) PrivateAction(ctx context.Context, p page.ActionParams)
PrivateAction is called by the framework to allow controls to process actions internal to themselves.
func (*Table) RemoveColumn ¶
RemoveColumn removes the column at the given location. If you attempt to remove a column that does not exist, it will panic.
func (*Table) RemoveColumnByID ¶
RemoveColumnByID removes the column with the given id. If the column does not exist, nothing will change.
func (*Table) RemoveColumnByTitle ¶
RemoveColumnByTitle removes the given column with the given title. If the column does not exist, nothing will change.
func (*Table) RowStyler ¶
func (t *Table) RowStyler() TableRowAttributer
func (*Table) SetCaption ¶
SetCaption sets the caption of the table. The default Table permits a caption to be either a string, or a goradd control.
func (*Table) SetFooterRowCount ¶
SetFooterRowCount sets the number of footer rows shown. Each column will be asked to draw this number of footer rows.
func (*Table) SetFooterRowStyler ¶
func (t *Table) SetFooterRowStyler(a TableFooterRowAttributer)
SetFooterRowStyler sets a styler that returns attributes to be used on a particular footer row.
func (*Table) SetHeaderRowCount ¶
SetHeaderRowCount sets the number of header rows shown. Each column will be asked to draw this number of header rows.
func (*Table) SetHeaderRowStyler ¶
func (t *Table) SetHeaderRowStyler(a TableHeaderRowAttributer)
SetHeaderRowStyler sets a styler that returns attributes to be used on a particular header row.
func (*Table) SetRowStyler ¶
func (t *Table) SetRowStyler(a TableRowAttributer)
SetRowStyler sets a styler that returns attributes to be used on a particular row.
func (*Table) SetSortHistoryLimit ¶
SetSortHistoryLimit sets the number of columns that the table will remember for the sort history. It defaults to 1, meaning it will remember only the current column. Setting it more than 1 will let the system report back on secondary sort columns that the user chose. For example, if the user clicks to sort a first name column, and then a last name column, it will let you know to sort by last name, and then first name.
func (*Table) SetSortable ¶ added in v0.0.7
SetSortable makes a table sortable. It will attach sortable events and show the header if its not shown.
func (*Table) ShowColumns ¶
func (t *Table) ShowColumns()
ShowColumns sets all of the columns to be shown.
func (*Table) SortColumns ¶
SortColumns returns a slice of columns in sort order
func (*Table) ΩDrawInnerHtml ¶ added in v0.0.3
ΩDrawInnerHtml is an override to draw the meat of the table.
func (*Table) ΩDrawTag ¶ added in v0.0.3
ΩDrawTag is called by the framework to draw the table. The Table overrides this to call into the DataProvider to load the table's data into memory just before drawing. The data will be unloaded after drawing.
func (*Table) ΩDrawingAttributes ¶ added in v0.0.3
func (t *Table) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes is an override to add attributes to the table, including not showing the table at all if there is no data to show. This will hide header and footer cells and potentially the outline of the table when there is no data in the table.
func (*Table) ΩMarshalState ¶ added in v0.0.4
ΩMarshalState is an internal function to save the state of the control
func (*Table) ΩUnmarshalState ¶ added in v0.0.4
ΩUnmarshalState is an internal function to restore the state of the control
func (*Table) ΩUpdateFormValues ¶ added in v0.0.3
ΩUpdateFormValues is called by the system whenever values are sent by client controls. We forward that to the columns.
type TableFooterRowAttributer ¶ added in v0.0.7
type TableFooterRowAttributer interface { int) *html.Attributes }TableFooterRowAttributes(row
type TableHeaderRowAttributer ¶ added in v0.0.7
type TableHeaderRowAttributer interface { // TableHeaderRowAttributes returns attributes to use for the particular header row indicated TableHeaderRowAttributes(row int) *html.Attributes }
type TableI ¶
type TableI interface { page.ControlI SetCaption(interface{}) TableI DrawCaption(context.Context, *bytes.Buffer) error GetHeaderRowAttributes(row int) *html.Attributes GetRowAttributes(row int, data interface{}) *html.Attributes HeaderCellDrawingInfo(ctx context.Context, col ColumnI, rowNum int, colNum int) (cellHtml string, cellAttributes *html.Attributes) }
TableI is the table interface that lets you create a "subclass" of the Table object. The functions defined here are hooks that you can implement in your subclass.
type TableRowAttributer ¶ added in v0.0.7
type TableRowAttributer interface { // TableRowAttributes returns attributes that should be used on the particular row indicated. // Data is the data for that row. TableRowAttributes(row int, data interface{}) *html.Attributes }
TableRowAttributer is used to style particular table rows.
type Textbox ¶
Textbox is a goradd control that outputs an "input" html tag with a "type" attribute of "text", or one of the text-like types, like "password", "search", etc.
func NewTextbox ¶
NewTextbox creates a new goradd textbox html widget.
func (*Textbox) Deserialize ¶
Deserialize is used by the pagestate serializer.
func (*Textbox) Placeholder ¶
Placeholder returns the value of the placeholder.
func (*Textbox) ResetValidators ¶
func (t *Textbox) ResetValidators()
ResetValidators removes all validators
func (*Textbox) Serialize ¶
Serialize is used by the framework to serialize the textbox into the pagestate.
func (*Textbox) SetColumnCount ¶
SetColumnCount sets the visible width of the text control. Each table is an approximate with of a character, and is browser dependent, so its not a very good way of setting the width. The css width property is more accurate. Also, this is only the visible width, not the maximum number of characters.
func (*Textbox) SetMaxLength ¶
func (t *Textbox) SetMaxLength(len int) *MaxLengthValidator
SetMaxLength sets the maximum length allowed in the textbox. The text will be limited by the browser, but the server side will also make sure that the text is not too big.
func (*Textbox) SetMinLength ¶
func (t *Textbox) SetMinLength(len int) *MinLengthValidator
SetMinLength will set the minimum length permitted. If the user does not enter enough text, an error message will be displayed upon submission of the form.
func (*Textbox) SetPlaceholder ¶
SetPlaceholder will set the html placeholder attribute, which puts text in the textbox when the textbox is empty as a hint to the user of what to enter.
func (*Textbox) SetReadOnly ¶
SetReadOnly will disable editing by setting a browser attribute.
func (*Textbox) SetRowCount ¶
SetRowCount sets the number of rowCount the Textbox will have. A value of 0 produces an input tag, and a value of 1 or greater produces a textarea tag.
func (*Textbox) SetType ¶
SetType sets the type of textbox this is. Pass it a TEXTBOX_TYPE... constant normally, though you can pass any string and it will become the input type
func (*Textbox) SetValue ¶
SetValue sets the text in the textbox. This satisfies the Valuer interface.
func (*Textbox) Validate ¶
Validate will first check for the IsRequired attribute, and if set, will make sure a value is in the text field. It will then check the validators in the order assigned. The first invalid value found will return false.
func (*Textbox) ValidateWith ¶
ValidateWith adds a Validater to the validator list.
func (*Textbox) Value ¶
func (t *Textbox) Value() interface{}
Value returns the user entered text in the textbox.
func (*Textbox) ΩDrawInnerHtml ¶ added in v0.0.3
ΩDrawInnerHtml is an internal function that renders the inner html of a tag. In this case, it is rendering the inner text of a textarea
func (*Textbox) ΩDrawingAttributes ¶ added in v0.0.3
func (t *Textbox) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes is called by the framework to retrieve the tag's private attributes at draw time.
func (*Textbox) ΩMarshalState ¶ added in v0.0.3
ΩMarshalState is an internal function to save the state of the control
func (*Textbox) ΩSanitize ¶ added in v0.0.3
Sanitize is called by the framework when taking in user input and strips it of potential malicious XSS scripts. The default uses a global sanitizer created at bootup. Override Sanitize in a subclass if you want a per-textbox sanitizer. This is a very difficult thing to get right, and depends a bit on your application on just how much you want to remove.
func (*Textbox) ΩUnmarshalState ¶ added in v0.0.3
ΩUnmarshalState is an internal function to restore the state of the control
func (*Textbox) ΩUpdateFormValues ¶ added in v0.0.3
ΩUpdateFormValues is an internal function that lets us reflect the value of the textbox on the web override
type UnorderedList ¶
type UnorderedList struct { page.Control ItemList data.DataManager // contains filtered or unexported fields }
UnorderedList is a dynamically generated html unordered list (ul). Such lists are often used as the basis for javascript and css widgets. If you use a data provider to set the data, you should call AddItems to the list in your GetData function.
func NewUnorderedList ¶
func NewUnorderedList(parent page.ControlI, id string) *UnorderedList
NewUnorderedList creates a new ul type list.
func (*UnorderedList) GetItemsHtml ¶
func (l *UnorderedList) GetItemsHtml(items []ListItemI) string
GetItemsHtml is used by the framework to get the items for the html. It is exported so that it can be overridden by other implementations of an UnorderedList.
func (*UnorderedList) SetBulletStyle ¶
func (l *UnorderedList) SetBulletStyle(s string)
SetBulletType sets the list-style-type attribute of the list. Choose from the UnorderedListStyle* constants.
func (*UnorderedList) SetData ¶ added in v0.0.4
func (l *UnorderedList) SetData(data interface{})
SetData replaces the current list with the given data. The result is kept in memory currently. ItemLister, ItemIDer, Labeler or Stringer types. This function can accept one or more lists of items, or single items. They will all get added to the top level of the list. To add sub items, get a list item and add items to it.
func (*UnorderedList) SetItemTag ¶ added in v0.0.4
func (l *UnorderedList) SetItemTag(s string)
SetItemTag sets the tag that will be used for items in the list. By default this is "li".
func (*UnorderedList) ΩDrawInnerHtml ¶ added in v0.0.3
func (*UnorderedList) ΩDrawTag ¶ added in v0.0.3
func (l *UnorderedList) ΩDrawTag(ctx context.Context) string
func (*UnorderedList) ΩDrawingAttributes ¶ added in v0.0.3
func (l *UnorderedList) ΩDrawingAttributes() *html.Attributes
ΩDrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
type UnorderedListI ¶
type Validater ¶
type Validater interface { // Validate evaluates the input, and returns an empty string if the input is valid, and an error string to display // to the user if the input does not pass the validator. Validate(page.ControlI, string) string }
A Validater can be added to a textbox to validate its input on the server side. A textbox can have more than one validater. A number of built-in validators are provided.
Source Files
¶
- button.go
- canvas.go
- checkbox.go
- checkbox_base.go
- data_pager.go
- datetime_span.go
- dialog.go
- dialog.tpl.go
- doc.go
- fieldset.go
- form_base.go
- grid_layout.go
- image.go
- image_capture.go
- item_list.go
- list_checkbox.go
- list_item.go
- list_multiselect.go
- list_ordered.go
- list_radio.go
- list_select.go
- list_unordered.go
- panel.go
- proxy.go
- radioButton.go
- span.go
- table.go
- table_column_base.go
- table_paginated.go
- table_select.go
- textbox.go
- textbox_date.go
- textbox_email.go
- textbox_float.go
- textbox_integer.go