Columns
- Refactored column objects to contain a ::validate method, for the validation of incoming data. - Context.columns is now a vector of one of each column object, indexed by attribute name, for validation purposes.
This commit is contained in:
@@ -39,6 +39,7 @@ extern Context context;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnDepends::ColumnDepends ()
|
||||
{
|
||||
_name = "depends";
|
||||
_type = "string";
|
||||
_style = "default";
|
||||
_label = STRING_COLUMN_LABEL_DEP;
|
||||
@@ -49,6 +50,12 @@ ColumnDepends::~ColumnDepends ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool ColumnDepends::validate (std::string& value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Overriden so that style <----> label are linked.
|
||||
// Note that you can not determine which gets called first.
|
||||
@@ -93,7 +100,7 @@ void ColumnDepends::measure (Task& task, int& minimum, int& maximum)
|
||||
}
|
||||
}
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "depends", _style);
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -103,7 +110,7 @@ void ColumnDepends::render (
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
if (task.has ("depends"))
|
||||
if (task.has (_name))
|
||||
{
|
||||
if (_style == "indicator")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user