 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.gui.list;
35 import java.awt.event.MouseEvent;
36 import javax.swing.JList;
37 import javax.swing.SwingUtilities;
38 import org.jetbrains.annotations.NotNull;
39 import org.jetbrains.annotations.Nullable;
113 private void rebuildList(@NotNull
final Integer @Nullable [] changedSlots) {
114 synchronized (getTreeLock()) {
117 if (oldSize < newSize) {
118 for (
int i = oldSize; i < newSize; i++) {
137 private void setChanged(@NotNull
final Integer @Nullable [] changedSlots,
final int limit) {
138 if (changedSlots ==
null) {
139 for (
int i = 0; i < limit; i++) {
143 for (
int i : changedSlots) {
169 if (tooltipText3.isEmpty()) {
184 super.mouseClicked(e);
190 switch (e.getButton()) {
191 case MouseEvent.BUTTON1:
196 case MouseEvent.BUTTON2:
200 case MouseEvent.BUTTON3:
212 if (guiItem ==
null) {
225 if (guiItem ==
null) {
238 if (guiItem ==
null) {
260 protected abstract T
newItem(
final int index);
final ItemView itemView
The ItemView to monitor.
void removeLocationsListener(@NotNull LocationsListener locationsListener)
Removes a LocationsListener to be notified when any displayed item has changed.
A ListCellRenderer that renders GUIMetaElement instances.
final LocationsListener locationsListener
The LocationsListener to be notified about changes.
A GUIElement that displays a list of entries.
abstract T newItem(final int index)
Creates a new GUIElement instance.
Abstract base class for all label classes.
void mouseClicked(@NotNull final MouseEvent e)
GUIItemItem getSelectedItem()
Returns the selected GUIItemItem instance.
void selectionChanged(final int selectedIndex)
Interface for listeners interested in changed item locations.
String getTooltipText3()
Returns the third line of the tooltip text.
final AbstractLabel currentItem
The label to update with information about the selected item.
void button2Clicked(final int modifiers)
Called if the user has clicked the middle mouse button.
String getTooltipText2()
Returns the second line of the tooltip text.
A GUIElement instance representing an in-game item.
Interface defining an abstract GUI element.
The representation of a Crossfire Item, client-side.
int resizeElements(final int newSize)
Changes the number of list elements.
final int cellHeight
The height of a list cell in pixels.
CfItem getItem(int index)
Returns the CfItem in a given slot.
abstract void button1Clicked(final int modifiers)
Called when the left mouse button was pressed.
void selectionChanged()
Called whenever the selected list entry has changed.
void addElement( @NotNull final T element)
Adds an GUIElement to the list.
static final long serialVersionUID
The serial version UID.
void setText(@NotNull final String text)
Sets the label text.
A GUIList instance that displays GUIItemItem instances.
abstract void button2Clicked(final int modifiers)
Called when the middle mouse button was pressed.
void button3Clicked(final int modifiers)
Called if the user has clicked the right mouse button.
abstract void button3Clicked(final int modifiers)
Called when the right mouse button was pressed.
Interface for listeners interested in the changed flag of GUIElement instances.
void button1Clicked(final int modifiers)
Called if the user has clicked the left mouse button.
T getElement(final int index)
Returns the GUIElement for a given index.
void setChanged(final int index)
Marks one slot as modified.
Factory for creating Gui instances.
final GUIElementChangedListener itemChangedListener
The GUIElementChangedListener attached to all GUIItemItem instances in the list.
void setChanged(@NotNull final Integer @Nullable[] changedSlots, final int limit)
Marks some slots as modified.
void setLayoutOrientation(final int layoutOrientation, final int visibleRowCount)
Sets the layout orientation.
Object getSelectedObject()
Returns the selected list object.
final GuiFactory guiFactory
The global GuiFactory instance.
GUIItemList(@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 GUIItemItem templateItem, @NotNull final GuiFactory guiFactory)
Creates a new instance.
int getSize()
Returns the number of items.
Listener for GUIElement related events.
String getTooltipText1()
Returns the first line of the tooltip text.
void rebuildList(@NotNull final Integer @Nullable[] changedSlots)
Rebuilds the list cells.