Skip to content
This repository has been archived by the owner on Jul 16, 2019. It is now read-only.

Columns

ktoso edited this page May 7, 2011 · 2 revisions

Columns

Columns are one of the more fun parts of Kanbanery, the other part is Tasks of course. Let's see what you can do with them:

Query for columns

You can query by position

Column first = getColumn.onPosition(1);
Column second = getColumn.onPosition(2);

or using special queries:

Column firstColumn = janbanery.columns().first();
Column secondColumn = janbanery.columns().after(firstColumn);

Column lastColumn = janbanery.columns().last();
Column beforeLastColumn = janbanery.columns().before(lastColumn);

Create a Column

Here the query methods come into play, as you have to know where exactly you want to create the new column, for example:

janbanery.columns()
         .create(newColumnData)
         .afterFirst();

janbanery.columns()
         .create(newColumnData)
         .beforeLast();

you could to the same by the more powerful before/after calls:

janbanery.columns()
         .create(newColumnData)
         .before(lastColumn);

janbanery.columns()
         .create(newColumnData)
         .after(firstColumn);

janbanery.columns()
         .create(newColumnData)
         .after(janbanery.columns().onPosition(2).get()); // well you COULD call it like this

// but this is way better:
janbanery.columns()
         .create(newColumnData)
         .onPosition(2);

Moving a Column (with all it's Tasks)

Is just as easy as creating it:

janbanery.columns()
         .move(column)
         .after(someColumn);

janbanery.columns()
         .move(column)
         .before(lastColumn);

janbanery.columns()
         .move(column)
         .toPosition(3);

Delete a Column

Remember that, you must move or delete all Tasks from a Column in order to be able to delete it.

So a simple delete would look like this:

Column column = janbanery.columns()
                         .byName("Testing").get(0);

janbanery.columns().delete(column);

And a full example with moving tasks first out of this Column would look like bellow. It is the best method to delete a column and not run into exceptions.

janbanery.tasks()
         .moveAllFrom(column) // a special "batch" version of the move flow
         .toFirstColumn(); // it has the same API as TaskMoveFlow

janbanery.columns().delete(column);

Update a Column

janbanery.columns()
         .update(column)
         .name("New Name")
         .capacity(newColumnCapacity)
         .get();

Each of the above update calls, goes to the server. So you may want to call it like this if you update two properties at the same time:

Column withValues = new Column("New Name", 3);
janbanery.columns.update(column, withValues);

which will only trigger one call to the server.

Clone this wiki locally