Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class DefaultKanbanModel

  1. Object
  2. AbstractKanbanModel
  3. DefaultKanbanModel

ImplementsKanbanModel

A board kept in memory that accepts every edit.

DefaultKanbanModel model = new DefaultKanbanModel();
model.addColumn(new KanbanColumn("todo", "To do"));
model.addColumn(new KanbanColumn("doing", "Doing").setWipLimit(3));
model.addColumn(new KanbanColumn("done", "Done"));
model.addCard("todo", new KanbanCard("c1", "Write the release notes"));

Override a mutator to refuse an edit, or to send it to a server and accept it.

Constructors

public DefaultKanbanModel()

Methods

public List<KanbanColumn> getColumns()The columns, in order.
public List<KanbanLane> getLanes()The swimlanes, in order; empty for a board without lanes.
public boolean isEnforceWipLimits()True when a card that would take a column past its limit is refused.
public void setEnforceWipLimits(boolean enforceWipLimits)Makes moveCard and insertCard refuse a card that would take a column past its limit.
public KanbanColumn addColumn(KanbanColumn column)Adds a column after the others.
public boolean removeColumn(KanbanColumn column)Removes a column and the cards in it.
public KanbanLane addLane(KanbanLane lane)Adds a swimlane after the others.
public boolean removeLane(KanbanLane lane)Removes a lane.
public KanbanCard addCard(String columnId, KanbanCard card)Adds a card at the end of a column, in the lane the card names.
public void clear()Removes every column, lane and card.
public String newCardId()An id no card of the model has, for a card the user adds.
public List<KanbanCard> getCards(KanbanColumn column, KanbanLane lane)The cards of one cell, in order: those of a column that are in a lane.
public int getCardCount(KanbanColumn column)The number of cards in a column, in all its lanes.
public KanbanCard getCard(String id)The card with an id, or null.
public boolean canMoveCard(KanbanCard card, KanbanColumn column, KanbanLane lane)Whether moveCard would take the card into a column.
public boolean insertCard(KanbanCard card, KanbanColumn column, KanbanLane lane, int index)Adds a card to a cell at an index among the cell’s cards; an index past the end adds it last.
public boolean removeCard(KanbanCard card)Removes a card.
public boolean renameCard(KanbanCard card, String title)Gives a card another title.
public boolean moveCard(KanbanCard card, KanbanColumn column, KanbanLane lane, int index)Moves a card to an index among the cards of a cell, which may be the cell it is in.
public boolean moveColumn(KanbanColumn column, int index)Moves a column to an index among the columns, counted without it.
public boolean setCollapsed(KanbanColumn column, boolean collapsed)Folds or unfolds a column.
public boolean setLaneCollapsed(KanbanLane lane, boolean collapsed)Folds or unfolds a lane.

Inherited methods

Constructor details

DefaultKanbanModel

public DefaultKanbanModel()

Method details

getColumns

public List<KanbanColumn> getColumns()
The columns, in order. Do not modify the list.

getLanes

public List<KanbanLane> getLanes()
The swimlanes, in order; empty for a board without lanes. Do not modify the list.

isEnforceWipLimits

public boolean isEnforceWipLimits()
True when a card that would take a column past its limit is refused.

setEnforceWipLimits

public void setEnforceWipLimits(boolean enforceWipLimits)
Makes moveCard and insertCard refuse a card that would take a column past its limit. Off by default, when a column over its limit is only drawn as such.

addColumn

public KanbanColumn addColumn(KanbanColumn column)
Adds a column after the others.

Throws

IllegalArgumentException
when a column has that id already

removeColumn

public boolean removeColumn(KanbanColumn column)
Removes a column and the cards in it.

addLane

public KanbanLane addLane(KanbanLane lane)
Adds a swimlane after the others. A board has lanes once it has one; a card in no lane, or in one that is gone, shows in the first.

removeLane

public boolean removeLane(KanbanLane lane)
Removes a lane. Its cards stay, and show in the first lane left.

addCard

public KanbanCard addCard(String columnId, KanbanCard card)
Adds a card at the end of a column, in the lane the card names. Unlike insertCard, this is the application filling the model, and no limit refuses it.

Throws

IllegalArgumentException
when there is no such column, or a card has that id already

clear

public void clear()
Removes every column, lane and card.

newCardId

public String newCardId()
An id no card of the model has, for a card the user adds.

getCards

public List<KanbanCard> getCards(KanbanColumn column, KanbanLane lane)
The cards of one cell, in order: those of a column that are in a lane. lane is null on a board without lanes, and then the answer is every card of the column. Do not modify the list.

getCardCount

public int getCardCount(KanbanColumn column)
The number of cards in a column, in all its lanes.

getCard

public KanbanCard getCard(String id)
The card with an id, or null.

canMoveCard

public boolean canMoveCard(KanbanCard card, KanbanColumn column, KanbanLane lane)
Whether moveCard would take the card into a column. A board asks while a card is dragged over a column, to show a refusal before the card is let go.

insertCard

public boolean insertCard(KanbanCard card, KanbanColumn column, KanbanLane lane, int index)
Adds a card to a cell at an index among the cell’s cards; an index past the end adds it last.

removeCard

public boolean removeCard(KanbanCard card)
Removes a card.

renameCard

public boolean renameCard(KanbanCard card, String title)
Gives a card another title.

moveCard

public boolean moveCard(KanbanCard card, KanbanColumn column, KanbanLane lane, int index)
Moves a card to an index among the cards of a cell, which may be the cell it is in. The index counts the cell without the card. A null lane is the whole column: the index counts every lane’s cards, and the card keeps the lane it names.

moveColumn

public boolean moveColumn(KanbanColumn column, int index)
Moves a column to an index among the columns, counted without it.

setCollapsed

public boolean setCollapsed(KanbanColumn column, boolean collapsed)
Folds or unfolds a column.

setLaneCollapsed

public boolean setLaneCollapsed(KanbanLane lane, boolean collapsed)
Folds or unfolds a lane.