Class DefaultKanbanCardRenderer

java.lang.Object
com.codename1.ui.kanban.DefaultKanbanCardRenderer
All Implemented Interfaces:
KanbanCardRenderer

public class DefaultKanbanCardRenderer extends Object implements KanbanCardRenderer

The renderer a board starts with: a card with its title, up to two lines of description, its tags as small labels and its badge, and a strip of colour down its leading edge when its style key has one.

Colours and fonts come from the UIIDs KanbanCard, KanbanCardSelected and KanbanCardTag.

  • Constructor Details

    • DefaultKanbanCardRenderer

      public DefaultKanbanCardRenderer()
  • Method Details

    • setAccent

      public void setAccent(String styleKey, int rgb)
      Gives the cards with a style key a colour, drawn down their leading edge.
    • setTagColor

      public void setTagColor(String tag, int rgb)
      Gives a tag a background colour of its own.
    • getTitleLines

      public int getTitleLines()
      The most lines a title takes before it is cut short; 2 by default.
    • setTitleLines

      public void setTitleLines(int titleLines)
      Sets the most lines a title takes.
    • getDescriptionLines

      public int getDescriptionLines()
      The most lines a description takes; 2 by default, 0 to hide it.
    • setDescriptionLines

      public void setDescriptionLines(int descriptionLines)
      Sets the most lines a description takes.
    • getCardHeight

      public int getCardHeight(KanbanBoard board, KanbanCard card, int width)
      Description copied from interface: KanbanCardRenderer
      The height of a card that is width pixels wide, without the component a KanbanCardFactory adds under it.
      Specified by:
      getCardHeight in interface KanbanCardRenderer
    • paintCard

      public void paintCard(Graphics g, KanbanBoard board, KanbanCard card, int x, int y, int w, int h, boolean selected, float lift)
      Description copied from interface: KanbanCardRenderer

      Paints a card into a rectangle.

      Parameters
      • g: the graphics, with the colour and alpha the renderer may change
      • board: the component
      • card: the card
      • x, y, w, h: the card on screen; the bottom board.getCardComponentHeight(card) pixels belong to its component
      • selected: true for the selected card
      • lift: how far the card is off the board, from 0 to 1, while it is dragged
      Specified by:
      paintCard in interface KanbanCardRenderer