[longomatch/redesign2: 63/140] Add method to build a TreeStore for subcategories
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch/redesign2: 63/140] Add method to build a TreeStore for subcategories
- Date: Tue, 24 May 2011 22:01:24 +0000 (UTC)
commit 756e2f567b4bc881772e2974c69d6d8cb2b1744b
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Sun Jan 30 13:49:44 2011 +0100
Add method to build a TreeStore for subcategories
LongoMatch/Store/Project.cs | 42 ++++++++++++++++++++++++++++--------------
1 files changed, 28 insertions(+), 14 deletions(-)
---
diff --git a/LongoMatch/Store/Project.cs b/LongoMatch/Store/Project.cs
index 765df63..7f5633b 100644
--- a/LongoMatch/Store/Project.cs
+++ b/LongoMatch/Store/Project.cs
@@ -259,25 +259,39 @@ namespace LongoMatch.Store
#endregion
#region Private Methods
+ private void FillList<T>(List<T> options, String tagName, TreeStore store) {
+ foreach (var tagValue in options){
+ /* Add a root in the tree with the option name */
+ var iter = store.AppendValues(tagName);
+ var queryByTag =
+ (from play in playsList
+ where play.HasTag(tagName, tagValue) == true
+ select play);
+ /* Then add as children of the Player in the tree */
+ foreach (Play play in queryByTag)
+ store.AppendValues(iter, play);
+ }
+ }
- private TreeStore GetTeamModel(TeamTemplate team){
+ private TreeStore GetSubCategoryModel(TagSubCategory subcat){
TreeStore dataFileListStore = new TreeStore(typeof(object));
- /* For all the players in the team */
- foreach (var player in team){
- /* Add a root in the tree with the player */
- var iter = dataFileListStore.AppendValues(player);
- /* Query the plays where this player is in the list of players*/
- var queryByPlayers =
- from play in playsList
- where play.HasPlayer(player) == true
- select play;
- /* Then add as children of the Player in the tree */
- foreach (var play in queryByPlayers)
- dataFileListStore.AppendValues(iter, play);
+ FillList (subcat.Options, subcat.Name, dataFileListStore);
+ return dataFileListStore;
+ }
+
+ private TreeStore GetSubCategoryModel(PlayerSubCategory subcat){
+ TreeStore dataFileListStore = new TreeStore(typeof(object));
+ TeamTemplate template;
+
+ foreach (Team team in subcat.Options){
+ if (team == Team.NONE)
+ continue;
+ template = team == Team.LOCAL?LocalTeamTemplate:VisitorTeamTemplate;
+ FillList(template, subcat.Name, dataFileListStore);
}
return dataFileListStore;
}
- #endregion
+#endregion
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]