How to implement dual list concept

How to implement dual list concept

Old forum URL: forums.lhotka.net/forums/t/7938.aspx


alef posted on Tuesday, November 03, 2009

I've the following interesting GUI. (see attachment contest.gif).
The purpose is that for a contest in the categories listbox you get all the available categories which exists (Juniors, Seniors, Masters,..).
The user selects a category in this categories listbox and with the dual listbox he assigns disciplines to the chosen category. He repeats this process for each category.

I was thinking about the following tables:
tblCategory (Id,Category)
tblDiscipline (Id,Discipline)

tblContest(Id,Date,Title)
tblContestDisciplines(Id,CategoryId,DisciplineId)

For the dual list control I've found the following control.
http://www.reflectionit.nl/Articles/DragDrop.aspx


Can somebody put me in the right direction which objects and which stereotypes I've to use?
Is it possible to create the entities in the business layer so that a GUI developer just have to use the objects without doing a lot of code?



alef replied on Wednesday, November 04, 2009

I was thinking of the following objects

1) CategoryList (NameValueListBase)
2) DisciplineList (NameValueListBase)
3) Contest (EditableRoot) with the following properties
  - Id
  - Title
  - Date
  - Categories (which points to ContestCategories)

4) ContestCategories (EditableChildList)
 
5) ContestCategory (EditableChild)
  - CategoryId
  - Category
  - AvailableDisciplines (which points to AvailableDisciplines)
  - SelectedDisciplines (which points to SelectedDisciplines)

6) AvailableDisciplines (EditableChildList)
 
7) AvailableDiscipline (EditableChild)
  - Id
  - ContestId
  - CategoryId
  - DisciplineId
  - Discipline

8) SelectedDisciplines (EditableChildList)
 
9) SelectedDiscipline (EditableChild)
  - Id
  - ContestId
  - CategoryId
  - DisciplineId
  - Discipline

But with this proposal I've some remarks.
   I can bind the left listbox to Contest.Categories[0].AvailableDisciplines and the right listbox to Contest.Categories[0].SelectedDisciplines. But when doing this the problem arises that in the left listbox we have AvailableDiscipline listitems and in the right listbox we have SelectedDiscipline listitems. So now when we are moving items from left to right and the other way around we are mixing two types of objects (AvailableDiscipline,SelectedDiscipline). This will give an error, we can't add an object of type AvailableDiscipline to the collection SelectedDisciplines.

Does somebody has any idea to implement this dual listbox concept?


alef replied on Thursday, November 05, 2009

I'm struggling some days how to design this use case.
Any suggestion or a dump of some code of a similar use case would even be better?

Copyright (c) Marimer LLC