ps-top: github.com/sjmudd/ps-top/display Index | Files

package display

import "github.com/sjmudd/ps-top/display"

Package display provides information on headers to the views as shown to the user

Package display represents the information we display to the user.

Index

Package Files

base.go display.go generic.go screen.go stdout.go

type BaseDisplay Uses

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

BaseDisplay holds the structure that is common for all types, somewhere to put what's needed in the header. Make the internal members visible without functions for now.

func (*BaseDisplay) HeadingLine Uses

func (d *BaseDisplay) HeadingLine(haveRelativeStats, wantRelativeStats bool, initial, last time.Time) string

HeadingLine returns the heading line as a string

func (BaseDisplay) MyName Uses

func (d BaseDisplay) MyName() string

MyName returns the application name (binary name)

func (*BaseDisplay) SetContext Uses

func (d *BaseDisplay) SetContext(ctx *context.Context)

SetContext sets the context from the given pointer

func (BaseDisplay) Uptime Uses

func (d BaseDisplay) Uptime() int

return ctx.Uptime() but protect against nil pointers

type Display Uses

type Display interface {
    // set values which are used later
    SetContext(ctx *context.Context)

    // stuff used by some of the objects
    ClearScreen()
    Close()
    EventChan() chan event.Event
    Resize(width, height int)

    // show various things
    Display(p GenericData)
    DisplayHelp()
}

Display is a generic interface to what a display can do

type GenericData Uses

type GenericData interface {
    Description() string           // description of the information being displayed
    Headings() string              // headings for the data
    InitialCollectTime() time.Time // initial time data was collected
    LastCollectTime() time.Time    // last time data was collected
    Len() int                      // the number row rows of data
    RowContent() []string          // a slice of rows of content
    TotalRowContent() string       // a string containing the details of a single row
    EmptyRowContent() string       // a string containing the details of an empty row
    HaveRelativeStats() bool       // does this data type have relative statistics
    WantRelativeStats() bool       // do we want to show relative statistics
}

GenericData is a generic interface to data collected from P_S (multiple rows)

type GenericRow Uses

type GenericRow interface {
    EmptyRowContent() string
    Print() string
}

GenericRow is a generic interface to a row of data collected from P_S

type GenericRows Uses

type GenericRows []GenericRow

GenericRows is just a slic of GenericRow

type ScreenDisplay Uses

type ScreenDisplay struct {
    BaseDisplay // embedded
    // contains filtered or unexported fields
}

ScreenDisplay contains screen specific display information

func NewScreenDisplay Uses

func NewScreenDisplay(limit int, onlyTotals bool) *ScreenDisplay

return a setup StdoutDisplay Neither limit or onlyTotals are used in ScreenDisplay

func (*ScreenDisplay) ClearScreen Uses

func (s *ScreenDisplay) ClearScreen()

ClearScreen clears the (internal) screen and flushes out the result to the real screen

func (*ScreenDisplay) Close Uses

func (s *ScreenDisplay) Close()

Close is called prior to closing the screen

func (*ScreenDisplay) Display Uses

func (s *ScreenDisplay) Display(t GenericData)

Display displays the wanted view to the screen

func (*ScreenDisplay) DisplayHelp Uses

func (s *ScreenDisplay) DisplayHelp()

DisplayHelp displays a help page on the screen

func (*ScreenDisplay) EventChan Uses

func (s *ScreenDisplay) EventChan() chan event.Event

EventChan creates a channel of display events and run a poller to send these events to the channel. Return the channel which the application can use

func (*ScreenDisplay) Resize Uses

func (s *ScreenDisplay) Resize(width, height int)

Resize records the new size of the screen and resizes it

type StdoutDisplay Uses

type StdoutDisplay struct {
    BaseDisplay // embedded
    // contains filtered or unexported fields
}

StdoutDisplay holds specific information needed for sending data to stdout.

func NewStdoutDisplay Uses

func NewStdoutDisplay(limit int, onlyTotals bool) *StdoutDisplay

return a setup StdoutDisplay

func (*StdoutDisplay) ClearScreen Uses

func (s *StdoutDisplay) ClearScreen()

ClearScreen does nothing for StdoutDisplay

func (*StdoutDisplay) Close Uses

func (s *StdoutDisplay) Close()

Close does nothing on a StdoutDisplay

func (*StdoutDisplay) Display Uses

func (s *StdoutDisplay) Display(p GenericData)

Display displays the data for the required view

func (*StdoutDisplay) DisplayHelp Uses

func (s *StdoutDisplay) DisplayHelp()

DisplayHelp does nothing on a StdoutDisplay

func (*StdoutDisplay) EventChan Uses

func (s *StdoutDisplay) EventChan() chan event.Event

EventChan creates a channel for event.Events and return the channel. currently does nothing...

func (*StdoutDisplay) Resize Uses

func (s *StdoutDisplay) Resize(width, height int)

Resize does nothing on a StdoutDisplay

Package display imports 8 packages (graph) and is imported by 3 packages. Updated 2017-11-01. Refresh now. Tools for package owners.