YOUSEFUL / DELPHI / COMPONENTS

TAtlasKanbanColumn

Internal storage of one Kanban column; read columns through TAtlasKanbanModel instead.

Class Unit Atlas.Kanban · Inherits TObject · Product Atlas UI

Description

The model keeps one TAtlasKanbanColumn per column. Its fields are private and the model never hands an instance out, so application code has no use for the class: create columns with TAtlasKanbanModel.AddColumn and read them with ColumnCount, ColumnID, ColumnTitle, ColumnLimit and CardCount, which take the column's position. The class is public only because the model's declaration refers to it.

Members

MemberKindWhat it does
CreateconstructorUsed by the model.
DestroydestructorFrees the column's card list.

Constructors

Create constructor

constructor Create(const ID, Title: string; Limit: Integer);

Used by the model. Performs no validation; a column created directly cannot be added to a model.

Destructors

Destroy destructor

destructor Destroy; override;

Frees the column's card list. The model frees its columns itself.

Examples

Find a column by id and how much room it has

The model addresses columns by position; these helpers turn an id into a position and report the free slots under the work-in-progress limit.

pascal
uses System.SysUtils, Atlas.Kanban;

// The position of the column with the given id, or -1.
function ColumnIndex(Model: TAtlasKanbanModel; const ColumnID: string): Integer;
var
  C: Integer;
begin
  Result := -1;
  for C := 0 to Model.ColumnCount - 1 do
    if Model.ColumnID(C) = ColumnID then
      Exit(C);
end;

// How many more cards the column accepts; MaxInt when it has no limit.
function FreeSlots(Model: TAtlasKanbanModel; const ColumnID: string): Integer;
var
  C: Integer;
begin
  C := ColumnIndex(Model, ColumnID);
  if C < 0 then
    raise EAtlasKanban.Create('Unknown column ' + ColumnID);
  if Model.ColumnLimit(C) = 0 then
    Result := MaxInt
  else
    Result := Model.ColumnLimit(C) - Model.CardCount(C);
end;

TAtlasKanbanModel

Also in Atlas UI

TAtlasKanbanModel · TAtlasKanban · TAtlasSyntaxMemo · TAtlasWebUpdater