Crossfire JXClient, Trunk  R20561
GUIKnowledgeTypeList.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff.
19  * Copyright (C) 2006-2011 Andreas Kirschbaum.
20  */
21 
22 package com.realtime.crossfire.jxclient.gui.list;
23 
32 import org.jetbrains.annotations.NotNull;
33 import org.jetbrains.annotations.Nullable;
34 
38 public class GUIKnowledgeTypeList extends GUIItemList<GUIItemKnowledgeType> {
39 
43  private static final long serialVersionUID = 1L;
44 
48  @NotNull
50 
54  @NotNull
56 
60  @NotNull
61  private final String name;
62 
66  @NotNull
67  private final ItemView itemView;
68 
69  @NotNull
71 
75  @NotNull
76  private final ItemPainter itemPainter;
77 
81  @NotNull
82  private final FacesManager facesManager;
83 
98  public GUIKnowledgeTypeList(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, final int cellWidth, final int cellHeight, @NotNull final ItemView itemView, @Nullable final AbstractLabel currentItem, @NotNull final KnowledgeManager knowledgeManager, @NotNull final ItemPainter itemPainter, @NotNull final FacesManager facesManager) {
99  super(tooltipManager, elementListener, name, cellWidth, cellHeight, itemView, currentItem, new GUIItemKnowledgeType(tooltipManager, elementListener, name+"_template", itemPainter, -1, facesManager, knowledgeManager, itemView, cellHeight));
100  this.tooltipManager = tooltipManager;
101  this.elementListener = elementListener;
102  this.name = name;
103  this.itemView = itemView;
104  this.knowledgeManager = knowledgeManager;
105  this.itemPainter = itemPainter;
106  this.facesManager = facesManager;
107  }
108 
112  @Override
113  protected void selectionChanged(final int selectedIndex) {
114  if (knowledgeManager == null) {
115  return;
116  }
117  knowledgeManager.filterType(selectedIndex);
118  super.selectionChanged(selectedIndex);
119  }
120 
124  @NotNull
125  @Override
126  protected GUIItemKnowledgeType newItem(final int index) {
127  return new GUIItemKnowledgeType(tooltipManager, elementListener, name+index, itemPainter, index, facesManager, knowledgeManager, itemView, 0);
128  }
129 
130 }
Abstract base class for all label classes.
Manages image information ("faces") needed to display the map view, items, and spell icons...
final TooltipManager tooltipManager
The TooltipManager to update.
A GUIList instance that displays GUIItemItem instances.
final ItemPainter itemPainter
The ItemPainter for painting the icon.
final FacesManager facesManager
The FacesManager to use.
final String name
The base name for created elements.
GUIKnowledgeTypeList(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, final int cellWidth, final int cellHeight, @NotNull final ItemView itemView, @Nullable final AbstractLabel currentItem, @NotNull final KnowledgeManager knowledgeManager, @NotNull final ItemPainter itemPainter, @NotNull final FacesManager facesManager)
Creates a new instance.
final GUIElementListener elementListener
The GUIElementListener to notify.
final AbstractLabel currentItem
The label to update with information about the selected item.
Maintains a mapping of face numbers to face data.