Crossfire JXClient, Trunk  R20561
GUIFloorList.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 
34 import java.awt.Image;
35 import org.jetbrains.annotations.NotNull;
36 import org.jetbrains.annotations.Nullable;
37 
42 public class GUIFloorList extends GUIItemList<GUIItemFloor> {
43 
47  private static final long serialVersionUID = 1L;
48 
52  @NotNull
54 
58  @NotNull
60 
64  @NotNull
65  private final String name;
66 
70  private final int cellWidth;
71 
75  private final int cellHeight;
76 
80  @NotNull
81  private final ItemView itemView;
82 
86  @NotNull
87  private final CommandQueue commandQueue;
88 
92  @NotNull
93  private final ItemPainter itemPainter;
94 
98  @NotNull
100 
104  @NotNull
105  private final FacesManager facesManager;
106 
110  @NotNull
111  private final ItemSet itemSet;
112 
116  @NotNull
117  private final Image nextGroupFace;
118 
122  @NotNull
123  private final Image prevGroupFace;
124 
143  public GUIFloorList(@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 CommandQueue commandQueue, @NotNull final ItemPainter itemPainter, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final FacesManager facesManager, @NotNull final ItemSet itemSet, @NotNull final Image nextGroupFace, @NotNull final Image prevGroupFace) {
144  super(tooltipManager, elementListener, name, cellWidth, cellHeight, itemView, currentItem, new GUIItemFloor(tooltipManager, elementListener, commandQueue, name+"_template", itemPainter, -1, crossfireServerConnection, itemView, itemSet, facesManager, nextGroupFace, prevGroupFace, cellHeight));
145  this.tooltipManager = tooltipManager;
146  this.elementListener = elementListener;
147  this.name = name;
148  this.cellWidth = cellWidth;
149  this.cellHeight = cellHeight;
150  this.itemView = itemView;
151  this.commandQueue = commandQueue;
152  this.itemPainter = itemPainter;
153  this.crossfireServerConnection = crossfireServerConnection;
154  this.facesManager = facesManager;
155  this.itemSet = itemSet;
156  this.nextGroupFace = nextGroupFace;
157  this.prevGroupFace = prevGroupFace;
158  }
159 
164  public int getNumLookObjects() {
165  return Math.max(getWidth()/cellWidth, 1)*Math.max(getHeight()/cellHeight, 1);
166  }
167 
171  @Override
172  @NotNull
173  protected GUIItemFloor newItem(final int index) {
174  return new GUIItemFloor(tooltipManager, elementListener, commandQueue, name+index, itemPainter, index, crossfireServerConnection, itemView, itemSet, facesManager, nextGroupFace, prevGroupFace, 0);
175  }
176 
177 }
Abstract base class for all label classes.
A GUIElement representing an in-game object in the ground view.
final Image prevGroupFace
The Image for "prev group of items".
Manages image information ("faces") needed to display the map view, items, and spell icons...
final FacesManager facesManager
The FacesManager to use.
final ItemPainter itemPainter
The ItemPainter to use.
A GUIList instance that displays GUIItemItem instances.
final TooltipManager tooltipManager
The tooltip manager to update.
static final long serialVersionUID
The serial version UID.
final GUIElementListener elementListener
The GUIElementListener to notify.
GUIFloorList(@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 CommandQueue commandQueue, @NotNull final ItemPainter itemPainter, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final FacesManager facesManager, @NotNull final ItemSet itemSet, @NotNull final Image nextGroupFace, @NotNull final Image prevGroupFace)
Creates a new instance.
final Image nextGroupFace
The Image for "next group of items".
final ItemView itemView
The ItemView to use.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
Model class maintaining the CfItems known to the player.
Definition: ItemSet.java:43
Maintains the pending (ncom) commands sent to the server.
int getNumLookObjects()
Returns the preferred number of objects to display.
final CrossfireServerConnection crossfireServerConnection
The CrossfireServerConnection to use.
final CommandQueue commandQueue
The CommandQueue for sending commands.
final AbstractLabel currentItem
The label to update with information about the selected item.
Maintains a mapping of face numbers to face data.