T
- the type of the list elementspublic abstract class GUIItemList<T extends GUIItemItem> extends GUIList<T>
GUIList
instance that displays GUIItemItem
instances.javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
private AbstractLabel |
currentItem
The label to update with information about the selected item.
|
private GUIElementChangedListener |
itemChangedListener
The
GUIElementChangedListener attached to all GUIItemItem
instances in the list. |
private ItemView |
itemView
The
ItemView to monitor. |
private LocationsListener |
locationsListener
The
LocationsListener to be notified about changes. |
private static long |
serialVersionUID
The serial version UID.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Modifier | Constructor and Description |
---|---|
protected |
GUIItemList(TooltipManager tooltipManager,
GUIElementListener elementListener,
java.lang.String name,
int cellWidth,
int cellHeight,
ItemView itemView,
AbstractLabel currentItem,
GUIItemItem templateItem)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
activeChanged()
Will be called whenever the active state has changed.
|
private void |
button1Clicked(int modifiers)
Called if the user has clicked the left mouse button.
|
private void |
button2Clicked(int modifiers)
Called if the user has clicked the middle mouse button.
|
private void |
button3Clicked(int modifiers)
Called if the user has clicked the right mouse button.
|
void |
dispose()
Releases all allocated resources.
|
GUIItemItem |
getSelectedItem()
Returns the selected
GUIItemItem instance. |
void |
mouseClicked(java.awt.event.MouseEvent e)
Will be called when the user has clicked (pressed+released) this element.
|
protected abstract T |
newItem(int index)
Creates a new
GUIElement instance. |
private void |
rebuildList(java.lang.Integer[] changedSlots)
Rebuilds the list cells.
|
protected void |
selectionChanged(int selectedIndex)
Called whenever the selected list entry has changed.
|
private void |
setChanged(int index)
Marks one slot as modified.
|
private void |
setChanged(java.lang.Integer[] changedSlots,
int limit)
Marks some slots as modified.
|
protected void |
updateTooltip(int index,
int x,
int y,
int w,
int h)
Updates the tooltip text.
|
addElement, canMoveSelection, canScroll, execute, getElement, getMinimumSize, getPreferredSize, getSelectedObject, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, moveSelection, resetScroll, resizeElements, scroll, selectionChanged, setBounds, setChanged, setLayoutOrientation, setSelectedIndex
isActive, markInactivePending, setActive, setInactiveIfPending
getName, hasTooltipText, isDefault, isIgnore, mouseReleased, setChangedListener, setDefault, setIgnore, setTooltipText, setTooltipText, toString
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
@Nullable private final AbstractLabel currentItem
@NotNull private final GUIElementChangedListener itemChangedListener
GUIElementChangedListener
attached to all GUIItemItem
instances in the list.@NotNull private final LocationsListener locationsListener
LocationsListener
to be notified about changes.private static final long serialVersionUID
protected GUIItemList(@NotNull TooltipManager tooltipManager, @NotNull GUIElementListener elementListener, @NotNull java.lang.String name, int cellWidth, int cellHeight, @NotNull ItemView itemView, @Nullable AbstractLabel currentItem, @NotNull GUIItemItem templateItem)
tooltipManager
- the tooltip manager to updateelementListener
- the element listener to notifyname
- the name of this elementcellWidth
- the width of cellscellHeight
- the height of cellsitemView
- the item view to monitorcurrentItem
- the label to update with information about the
selected item.templateItem
- the template item for painting the listprotected void activeChanged()
activeChanged
in class ActivatableGUIElement
private void button1Clicked(int modifiers)
modifiers
- the active modifiersprivate void button2Clicked(int modifiers)
modifiers
- the active modifiersprivate void button3Clicked(int modifiers)
modifiers
- the active modifierspublic void dispose()
dispose
in interface GUIElement
dispose
in class GUIList<T extends GUIItemItem>
@Nullable public GUIItemItem getSelectedItem()
GUIItemItem
instance.null
if none is selectedpublic void mouseClicked(@NotNull java.awt.event.MouseEvent e)
GUIElement.mouseReleased(MouseEvent)
.mouseClicked
in interface GUIElement
mouseClicked
in class GUIList<T extends GUIItemItem>
e
- the mouse event relative to this element@NotNull protected abstract T newItem(int index)
GUIElement
instance.index
- the item inventory's indexprivate void rebuildList(@Nullable java.lang.Integer[] changedSlots)
changedSlots
- the changed slots; null
=all slotsprotected void selectionChanged(int selectedIndex)
selectionChanged
in class GUIList<T extends GUIItemItem>
selectedIndex
- the selected list entryprivate void setChanged(int index)
index
- the slot indexprivate void setChanged(@Nullable java.lang.Integer[] changedSlots, int limit)
changedSlots
- the slots to mark as modified; null
=alllimit
- the limit; only slots less than this index are affectedprotected void updateTooltip(int index, int x, int y, int w, int h)
updateTooltip
in class GUIList<T extends GUIItemItem>
index
- the index to usex
- the x coordinate of the celly
- the y coordinate of the cellw
- the width of the cellh
- the height of the cell