Crossfire JXClient, Trunk
Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T > Class Template Referenceabstract
Inheritance diagram for com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >:
Inheritance graph
Collaboration diagram for com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >:
Collaboration graph

Public Member Functions

void dispose ()
 
Dimension getMinimumSize ()
 
Dimension getPreferredSize ()
 
TooltipText getTooltip ()
 
void setBounds (final int x, final int y, final int width, final int height)
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement
int getDialogBorderBottom ()
 
int getDialogBorderLeft ()
 
int getDialogBorderRight ()
 
int getDialogBorderTop ()
 
String getName ()
 
void inhibitListeners ()
 
boolean isDefault ()
 
boolean isIgnore ()
 
void mouseClicked (@NotNull final MouseEvent e)
 
void mouseDragged (@NotNull final MouseEvent e)
 
void mouseEntered (@NotNull final MouseEvent e)
 
void mouseExited (@NotNull final MouseEvent e)
 
void mouseMoved (@NotNull final MouseEvent e)
 
void mousePressed (@NotNull final MouseEvent e)
 
void mouseReleased (@NotNull final MouseEvent e)
 
void mouseWheelMoved (final int wheelRotation)
 
void setChanged ()
 
void setChangedListener (@Nullable final GUIElementChangedListener changedListener)
 
void setDefault (final boolean isDefault)
 
void setIgnore ()
 
String toString ()
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.gui.gui.GUIElement
void notifyOpen ()
 

Protected Member Functions

abstract String getDescription (@Nullable T item)
 
abstract Component getListCellRendererComponent (@NotNull final JList<? extends T > list, @Nullable final T value, final int index, final boolean selected, final boolean cellHasFocus)
 
 GUIComboBox (@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @Nullable final GUILabelLog label, @NotNull final GuiFactory guiFactory)
 
void setSelectedItem (@NotNull final T item)
 
void updateModel (@Nullable final List< T > elements)
 
void updateSelectedItem ()
 
abstract void updateSelectedItem (@Nullable final T item)
 
- Protected Member Functions inherited from com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement
 AbstractGUIElement (@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, final boolean opaque, @NotNull final GuiFactory guiFactory)
 
TooltipText newTooltipText (@Nullable final String tooltipText)
 
void tooltipChanged ()
 

Private Attributes

final ActionListener actionListener = e -> updateSelectedItem()
 
final JComboBox< T > comboBox = new JComboBox<>(model)
 
boolean inhibitActionListener
 
final GUILabelLog label
 
final DefaultComboBoxModel< T > model = new DefaultComboBoxModel<>()
 

Static Private Attributes

static final Pattern PATTERN_BOLD_BEGIN = Pattern.compile("\\[b]")
 
static final Pattern PATTERN_BOLD_END = Pattern.compile("\\[/b]")
 
static final long serialVersionUID = 1
 

Detailed Description

A GUIElement that displays a combo box.

Parameters
<T>the type of the entries of this list
Author
Andreas Kirschbaum

Definition at line 50 of file GUIComboBox.java.

Constructor & Destructor Documentation

◆ GUIComboBox()

com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.GUIComboBox ( @NotNull final TooltipManager  tooltipManager,
@NotNull final GUIElementListener  elementListener,
@NotNull final String  name,
@Nullable final GUILabelLog  label,
@NotNull final GuiFactory  guiFactory 
)
protected

Creates a new instance.

Parameters
tooltipManagerthe tooltip manager to update
elementListenerthe element listener to notify
namethe name of this element
labelthe label to update or
null
guiFactorythe global GUI factory instance

Definition at line 106 of file GUIComboBox.java.

Member Function Documentation

◆ dispose()

Releases all allocated resources.

Reimplemented from com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.

Definition at line 117 of file GUIComboBox.java.

◆ getDescription()

abstract String com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.getDescription ( @Nullable T  item)
abstractprotected

Returns the description for an item.

Parameters
itemthe item
Returns
the description

Referenced by com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< Integer >.getTooltip(), and com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< Integer >.updateSelectedItem().

Here is the caller graph for this function:

◆ getListCellRendererComponent()

abstract Component com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.getListCellRendererComponent ( @NotNull final JList<? extends T >  list,
@Nullable final T  value,
final int  index,
final boolean  selected,
final boolean  cellHasFocus 
)
abstractprotected

Returns a Component that displays the

value

.

Parameters
listthe list that contains the value
valuethe value that is displayed or
null
indexthe list index
selectedwhether the value is selected
cellHasFocuswhether the value has the focus
Returns
the component to render the value

◆ getMinimumSize()

Definition at line 129 of file GUIComboBox.java.

◆ getPreferredSize()

Dimension com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.getPreferredSize ( )

Definition at line 123 of file GUIComboBox.java.

◆ getTooltip()

Returns the current tooltip text.

Returns
the tooltip text or
null
to not show a tooltip

Reimplemented from com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.

Definition at line 235 of file GUIComboBox.java.

◆ setBounds()

void com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.setBounds ( final int  x,
final int  y,
final int  width,
final int  height 
)

Definition at line 135 of file GUIComboBox.java.

◆ setSelectedItem()

void com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.setSelectedItem ( @NotNull final T  item)
protected

Updates the selected item.

Parameters
itemthe new selected item

Definition at line 221 of file GUIComboBox.java.

◆ updateModel()

void com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.updateModel ( @Nullable final List< T >  elements)
protected

Updates entries shown in the combo box.

Parameters
elementsthe new entries to show

Definition at line 144 of file GUIComboBox.java.

Referenced by com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< Integer >.updateModel().

Here is the caller graph for this function:

◆ updateSelectedItem() [1/2]

void com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.updateSelectedItem ( )
protected

Called whenever the selected item has changed.

Definition at line 195 of file GUIComboBox.java.

Referenced by com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< Integer >.updateModel(), and com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< Integer >.updateSelectedItem().

Here is the caller graph for this function:

◆ updateSelectedItem() [2/2]

abstract void com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.updateSelectedItem ( @Nullable final T  item)
abstractprotected

Will be called whenever the selected item has changed.

Parameters
itemthe selected item

Member Data Documentation

◆ actionListener

final ActionListener com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.actionListener = e -> updateSelectedItem()
private

◆ comboBox

final JComboBox<T> com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.comboBox = new JComboBox<>(model)
private

◆ inhibitActionListener

boolean com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.inhibitActionListener
private

◆ label

◆ model

final DefaultComboBoxModel<T> com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.model = new DefaultComboBoxModel<>()
private

◆ PATTERN_BOLD_BEGIN

final Pattern com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.PATTERN_BOLD_BEGIN = Pattern.compile("\\[b]")
staticprivate

A Pattern that matches "[b]".

Definition at line 61 of file GUIComboBox.java.

Referenced by com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< Integer >.getTooltip().

◆ PATTERN_BOLD_END

final Pattern com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.PATTERN_BOLD_END = Pattern.compile("\\[/b]")
staticprivate

A Pattern that matches "[/b]".

Definition at line 67 of file GUIComboBox.java.

Referenced by com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< Integer >.getTooltip().

◆ serialVersionUID

final long com.realtime.crossfire.jxclient.gui.combobox.GUIComboBox< T >.serialVersionUID = 1
staticprivate

The serial version UID.

Definition at line 55 of file GUIComboBox.java.


The documentation for this class was generated from the following file: