CARMA C++
carma::ui::rtd::Cell Class Reference

An abstract realtime (dynamic) text Cell. More...

#include <carma/ui/rtd/common/RtDisplay.h>

Inheritance diagram for carma::ui::rtd::Cell:
carma::ui::rtd::RtObject carma::ui::rtd::CellCatString carma::ui::rtd::CellChar carma::ui::rtd::CellCharString carma::ui::rtd::CellDble carma::ui::rtd::CellEmpty carma::ui::rtd::CellFloat carma::ui::rtd::CellInt carma::ui::rtd::CellShort carma::ui::rtd::CellString carma::ui::rtd::CellUChar carma::ui::rtd::CellUT carma::ui::rtd::MonitorCell

Public Member Functions

int addAlternative (const ::std::string &text, CellColor color)
 Add an alternate text string. More...
 
bool alternativeIsActive () const
 
 Cell (int indent, int chars, int width)
 Constructor. More...
 
 Cell (const char *fmt, int altLen=0)
 Constructor. More...
 
 Cell (const Format &fmt, int altLen=0)
 Constructor. More...
 
void clearActiveAlternative ()
 
char getAudio ()
 Get audio state code. More...
 
std::string getCellName () const
 
std::string getDynamicDescription () const
 
int getIndent () const
 Get the indentation for the text. More...
 
int getLen () const
 Get the length of the text string. More...
 
::std::string getPlotLabel () const
 Get the plot label. More...
 
std::string getText ()
 Get the dynamic text. More...
 
bool isGrayedOut ()
 
bool isPlottable () const
 Can contents be plotted (can it be converted to a number)? More...
 
bool isReplaceText () const
 Is this the dynamically formatted text or is it a replacement string set by nohw, overflow or an altString? More...
 
bool isValid ()
 Check validity of cell. More...
 
void serialize (bool initialize, int fontSize,::rtdproto::RtObject *rtobj)
 Describe (serialize) the static description of the cell. More...
 
void setActiveAlternative (int index)
 Select which alternate string to use. More...
 
void setAudio (char c)
 Set audio state code. More...
 
void setBorderBottomEnabled (bool state)
 
void setBorderLeftEnabled (bool state)
 
void setBorderRightEnabled (bool state)
 
void setBorderTopEnabled (bool state)
 Enable/disbable an edge of the cell border. More...
 
void setCellName (const std::string &s)
 
void setColor (CellColor color)
 Sets the single character background color code. More...
 
void setDynamicDescription (const std::string &s)
 
void setEmpty (bool state)
 
void setGrayedOut (bool state)
 
void setNa (bool tf)
 Set the "not applicable" flag to true/false. More...
 
void setNoAudio ()
 Turn off audio capability for the cell. More...
 
void setNohw (bool tf)
 Set the "no hardware" flag to true/false. More...
 
void setNohwColor (CellColor color)
 Sets the single character background color to use when there is no hardware. More...
 
void setPlotLabel (const ::std::string &s)
 Sets the label for a plot. More...
 
void setPlotLabel (int a, bool dev, const ::std::string &s)
 Creates a label string for a plot based on antenna & rx. More...
 
void setPlottable (bool yesOrNo)
 Sets whether the cell data may be plotted. More...
 
void setValidity (bool validity)
 Set the validity of cell. More...
 
- Public Member Functions inherited from carma::ui::rtd::RtObject
void appendToolTipText (const std::string &text)
 Append more text to the existing tool tip text. More...
 
Layout getLayout () const
 Get the layout for this object. More...
 
std::string getToolTipText ()
 
void setFontSize (int fontSize)
 Set the absolute font size for this object. More...
 
void setLayout (Layout layout)
 Set the layout for this object. More...
 
void setToolTipText (const std::string &text)
 Set the tool tip text for this RtObject. More...
 
virtual void update ()=0
 Creates a new string that is the dynamic ascii contents of this object. More...
 
virtual ~RtObject ()
 Destructor. More...
 

Protected Member Functions

::std::string centerStringFmt (const ::std::string &s) const
 Helper to trim and center the formatted string. More...
 
virtual void updateColor ()
 Automatically called as part of the update cycle to set background color. More...
 
void updateInt (int data)
 Create an output string for an integer. More...
 
- Protected Member Functions inherited from carma::ui::rtd::RtObject
int getFontSize (int parentFontSize) const
 Get the absolute font size for this object. More...
 
int getFontSize () const
 Get the absolute font size for this object. More...
 
 RtObject ()
 Constructor. More...
 

Protected Attributes

char audio
 Audio cell control ('E'/'Y'/'N') - enabled,y,n. More...
 
::std::ostringstream fmtOss_
 Formatted text stream. More...
 
const Format format_
 Format for cell data. More...
 
int indent
 Left indent of chars. More...
 
const char * legit
 Deprecated... More...
 
int len
 Total number of chars. More...
 
::std::string text
 Formatted text. More...
 

Detailed Description

An abstract realtime (dynamic) text Cell.

This is the base class for all of the variants of the realtime cell. Subclasses will use different datatypes and the formatting functions (update) to turn it into text. Some of the key constructs are:

  • There can be several fixed strings that replace dynamic text. Standard ones are "NoHw" for missing hardware, "?" when the legit flag is bad, and "****" when the formatted string exceeds the pre-determined length. There are also "alternate" strings that can be added to the cell and used by setting a flag.
  • The background cell color is a single character code that is sent to the Java client. The codes are simple: the default is White ('w'). The other common codes are Red, Yellow, Green, Cyan, Magenta, & Blue. Alternate strings also carry a background color with them.

Definition at line 300 of file RtDisplay.h.

Constructor & Destructor Documentation

carma::ui::rtd::Cell::Cell ( int  indent,
int  chars,
int  width 
)

Constructor.

Parameters
widththe total width of the cell
indentleft indent to start of dynamic text
lenlength of dynamic text
carma::ui::rtd::Cell::Cell ( const char *  fmt,
int  altLen = 0 
)
explicit

Constructor.

Parameters
fmtstandard text cell format string
altLenmaximum length of an alternate string. This is not important if you don't have alt strings. If you do, make sure it is as long as the longest alt string.
See Also
Format
carma::ui::rtd::Cell::Cell ( const Format fmt,
int  altLen = 0 
)
explicit

Constructor.

Parameters
fmtstandard text cell format
altLenmaximum length of an alternate string. This is not important if you don't have alt strings. If you do, make sure it is as long as the longest alt string.
See Also
Format

Member Function Documentation

int carma::ui::rtd::Cell::addAlternative ( const ::std::string &  text,
CellColor  color 
)

Add an alternate text string.

Alternate text strings are assigned an index based on the order in which they are created (starting at 0 for the first).

Parameters
textthe alternate text string
colorCodethe color character
Returns
0 on success
::std::string carma::ui::rtd::Cell::centerStringFmt ( const ::std::string &  s) const
protected

Helper to trim and center the formatted string.

char carma::ui::rtd::Cell::getAudio ( )

Get audio state code.

Returns
audio code
See Also
setAudio
int carma::ui::rtd::Cell::getIndent ( ) const

Get the indentation for the text.

int carma::ui::rtd::Cell::getLen ( ) const

Get the length of the text string.

::std::string carma::ui::rtd::Cell::getPlotLabel ( ) const

Get the plot label.

std::string carma::ui::rtd::Cell::getText ( )

Get the dynamic text.

Should be stored by update() and put in result.

bool carma::ui::rtd::Cell::isPlottable ( ) const

Can contents be plotted (can it be converted to a number)?

bool carma::ui::rtd::Cell::isReplaceText ( ) const

Is this the dynamically formatted text or is it a replacement string set by nohw, overflow or an altString?

bool carma::ui::rtd::Cell::isValid ( )

Check validity of cell.

void carma::ui::rtd::Cell::serialize ( bool  initialize,
int  fontSize,
::rtdproto::RtObject *  rtobj 
)
virtual

Describe (serialize) the static description of the cell.

Parameters
initializeset all non-changing (static) fields
fontSizethe fontsize to use
rtobjthe ::rtdproto::RtObject to populate

Implements carma::ui::rtd::RtObject.

void carma::ui::rtd::Cell::setActiveAlternative ( int  index)

Select which alternate string to use.

A negative index means don't use any alternate.

Parameters
indexindex of alternate
void carma::ui::rtd::Cell::setAudio ( char  c)

Set audio state code.

  • 'N' No audio capability
  • 'Y' Has audio capability, initially disabled
  • 'E' Has audio capability, initially enabled
See Also
getAudio
void carma::ui::rtd::Cell::setBorderTopEnabled ( bool  state)

Enable/disbable an edge of the cell border.

If a border edge is disabled it is not drawn. Each edge of the border can be individually enabled, but may be overwritten in a table as the borders are only a single pixel and are shared. To be sure, disable both of the neighbor cells for a shared border.

Definition at line 387 of file RtDisplay.h.

void carma::ui::rtd::Cell::setColor ( CellColor  color)

Sets the single character background color code.

The color of that characters are written in is chosen to be white or black to complement this background color.

void carma::ui::rtd::Cell::setNa ( bool  tf)

Set the "not applicable" flag to true/false.

void carma::ui::rtd::Cell::setNoAudio ( )

Turn off audio capability for the cell.

void carma::ui::rtd::Cell::setNohw ( bool  tf)

Set the "no hardware" flag to true/false.

void carma::ui::rtd::Cell::setNohwColor ( CellColor  color)

Sets the single character background color to use when there is no hardware.

void carma::ui::rtd::Cell::setPlotLabel ( const ::std::string &  s)

Sets the label for a plot.

void carma::ui::rtd::Cell::setPlotLabel ( int  a,
bool  dev,
const ::std::string &  s 
)

Creates a label string for a plot based on antenna & rx.

The final label is Ant::a/Rx#r/string

void carma::ui::rtd::Cell::setPlottable ( bool  yesOrNo)

Sets whether the cell data may be plotted.

Parameters
yesOrNoyes or no
void carma::ui::rtd::Cell::setValidity ( bool  validity)

Set the validity of cell.

Parameters
validity
virtual void carma::ui::rtd::Cell::updateColor ( )
protectedvirtual
void carma::ui::rtd::Cell::updateInt ( int  data)
protected

Create an output string for an integer.

This routine is used by several derived classes so it is put here rather than make another class.

Member Data Documentation

char carma::ui::rtd::Cell::audio
protected

Audio cell control ('E'/'Y'/'N') - enabled,y,n.

Definition at line 520 of file RtDisplay.h.

::std::ostringstream carma::ui::rtd::Cell::fmtOss_
protected

Formatted text stream.

Definition at line 514 of file RtDisplay.h.

const Format carma::ui::rtd::Cell::format_
protected

Format for cell data.

Definition at line 509 of file RtDisplay.h.

int carma::ui::rtd::Cell::indent
protected

Left indent of chars.

Definition at line 507 of file RtDisplay.h.

const char* carma::ui::rtd::Cell::legit
protected

Deprecated...

Definition at line 517 of file RtDisplay.h.

int carma::ui::rtd::Cell::len
protected

Total number of chars.

Definition at line 505 of file RtDisplay.h.

::std::string carma::ui::rtd::Cell::text
protected

Formatted text.

Definition at line 511 of file RtDisplay.h.


The documentation for this class was generated from the following file: