Class DefaultKanbanModel
java.lang.Object
com.codename1.kanban.AbstractKanbanModel
com.codename1.kanban.DefaultKanbanModel
- All Implemented Interfaces:
KanbanModel
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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddCard(String columnId, KanbanCard card) Adds a card at the end of a column, in the lane the card names.addColumn(KanbanColumn column) Adds a column after the others.addLane(KanbanLane lane) Adds a swimlane after the others.booleancanMoveCard(KanbanCard card, KanbanColumn column, KanbanLane lane) WhethermoveCardwould take the card into a column.voidclear()Removes every column, lane and card.The card with an id, or null.intgetCardCount(KanbanColumn column) The number of cards in a column, in all its lanes.getCards(KanbanColumn column, KanbanLane lane) The cards of one cell, in order: those of a column that are in a lane.The columns, in order.getLanes()The swimlanes, in order; empty for a board without lanes.booleaninsertCard(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.booleanTrue when a card that would take a column past its limit is refused.booleanmoveCard(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.booleanmoveColumn(KanbanColumn column, int index) Moves a column to an index among the columns, counted without it.An id no card of the model has, for a card the user adds.booleanremoveCard(KanbanCard card) Removes a card.booleanremoveColumn(KanbanColumn column) Removes a column and the cards in it.booleanremoveLane(KanbanLane lane) Removes a lane.booleanrenameCard(KanbanCard card, String title) Gives a card another title.booleansetCollapsed(KanbanColumn column, boolean collapsed) Folds or unfolds a column.voidsetEnforceWipLimits(boolean enforceWipLimits) MakesmoveCardandinsertCardrefuse a card that would take a column past its limit.booleansetLaneCollapsed(KanbanLane lane, boolean collapsed) Folds or unfolds a lane.Methods inherited from class AbstractKanbanModel
addChangeListener, fireChanged, getColumn, getLane, removeChangeListener
-
Constructor Details
-
DefaultKanbanModel
public DefaultKanbanModel()
-
-
Method Details
-
getColumns
Description copied from interface:KanbanModelThe columns, in order. Do not modify the list. -
getLanes
Description copied from interface:KanbanModelThe 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) MakesmoveCardandinsertCardrefuse 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
Adds a column after the others.
Throws
IllegalArgumentException: when a column has that id already
-
removeColumn
Removes a column and the cards in it. -
addLane
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
Removes a lane. Its cards stay, and show in the first lane left. -
addCard
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
An id no card of the model has, for a card the user adds. -
getCards
Description copied from interface:KanbanModelThe cards of one cell, in order: those of a column that are in a lane.laneis null on a board without lanes, and then the answer is every card of the column. Do not modify the list. -
getCardCount
Description copied from interface:KanbanModelThe number of cards in a column, in all its lanes.- Specified by:
getCardCountin interfaceKanbanModel- Overrides:
getCardCountin classAbstractKanbanModel
-
getCard
Description copied from interface:KanbanModelThe card with an id, or null.- Specified by:
getCardin interfaceKanbanModel- Overrides:
getCardin classAbstractKanbanModel
-
canMoveCard
Description copied from interface:KanbanModelWhethermoveCardwould 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.- Specified by:
canMoveCardin interfaceKanbanModel- Overrides:
canMoveCardin classAbstractKanbanModel
-
insertCard
Description copied from interface:KanbanModelAdds a card to a cell at an index among the cell's cards; an index past the end adds it last.- Specified by:
insertCardin interfaceKanbanModel- Overrides:
insertCardin classAbstractKanbanModel
-
removeCard
Description copied from interface:KanbanModelRemoves a card.- Specified by:
removeCardin interfaceKanbanModel- Overrides:
removeCardin classAbstractKanbanModel
-
renameCard
Description copied from interface:KanbanModelGives a card another title.- Specified by:
renameCardin interfaceKanbanModel- Overrides:
renameCardin classAbstractKanbanModel
-
moveCard
Description copied from interface:KanbanModelMoves 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.- Specified by:
moveCardin interfaceKanbanModel- Overrides:
moveCardin classAbstractKanbanModel
-
moveColumn
Description copied from interface:KanbanModelMoves a column to an index among the columns, counted without it.- Specified by:
moveColumnin interfaceKanbanModel- Overrides:
moveColumnin classAbstractKanbanModel
-
setCollapsed
Description copied from interface:KanbanModelFolds or unfolds a column.- Specified by:
setCollapsedin interfaceKanbanModel- Overrides:
setCollapsedin classAbstractKanbanModel
-
setLaneCollapsed
Description copied from interface:KanbanModelFolds or unfolds a lane.- Specified by:
setLaneCollapsedin interfaceKanbanModel- Overrides:
setLaneCollapsedin classAbstractKanbanModel
-