Gridarta Editor
MapListCellRenderer.java
Go to the documentation of this file.
1
/*
2
* Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3
* Copyright (C) 2000-2015 The Gridarta Developers.
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License along
16
* with this program; if not, write to the Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
*/
19
20
package
net.sf.gridarta.gui.dialog.gomap;
21
22
import
java.awt.Component;
23
import
javax.swing.DefaultListCellRenderer;
24
import
javax.swing.JList;
25
import
net
.
sf
.
gridarta
.
model
.
index
.
MapsIndex
;
26
import
net
.
sf
.
gridarta
.
model
.
mapmodel
.
MapFile
;
27
import
org.jetbrains.annotations.NotNull;
28
34
public
class
MapListCellRenderer
extends
DefaultListCellRenderer {
35
39
private
static
final
long
serialVersionUID
= 1L;
40
44
@NotNull
45
private
final
MapsIndex
mapsIndex
;
46
51
public
MapListCellRenderer
(@NotNull
final
MapsIndex
mapsIndex
) {
52
this.mapsIndex =
mapsIndex
;
53
}
54
55
@NotNull
56
@Override
57
public
Component
getListCellRendererComponent
(@NotNull
final
JList<?> list, @NotNull
final
Object value,
final
int
index,
final
boolean
isSelected,
final
boolean
cellHasFocus) {
58
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
59
final
MapFile
file = (
MapFile
) value;
60
final
String name =
mapsIndex
.
getName
(file);
61
setText((name ==
null
?
"?"
: name) +
" ("
+ file.
getMapPath
() +
")"
);
62
setToolTipText(value.toString());
63
return
this
;
64
}
65
66
}
net.sf.gridarta
net.sf.gridarta.gui.dialog.gomap.MapListCellRenderer.MapListCellRenderer
MapListCellRenderer(@NotNull final MapsIndex mapsIndex)
Definition:
MapListCellRenderer.java:51
net.sf.gridarta.gui.dialog.gomap.MapListCellRenderer.getListCellRendererComponent
Component getListCellRendererComponent(@NotNull final JList<?> list, @NotNull final Object value, final int index, final boolean isSelected, final boolean cellHasFocus)
Definition:
MapListCellRenderer.java:57
net.sf
net.sf.gridarta.model.mapmodel
Definition:
AboveFloorInsertionMode.java:20
net.sf.gridarta.model.mapmodel.MapFile.getMapPath
AbsoluteMapPath getMapPath()
Definition:
MapFile.java:93
net
net.sf.gridarta.model.index.AbstractIndex.getName
String getName(@NotNull final V value)
Definition:
AbstractIndex.java:233
net.sf.gridarta.model.mapmodel.MapFile
Definition:
MapFile.java:31
net.sf.gridarta.model.index
Definition:
AbstractIndex.java:20
net.sf.gridarta.model
net.sf.gridarta.model.index.MapsIndex
Definition:
MapsIndex.java:28
net.sf.gridarta.gui.dialog.gomap.MapListCellRenderer
Definition:
MapListCellRenderer.java:34
net.sf.gridarta.gui.dialog.gomap.MapListCellRenderer.mapsIndex
final MapsIndex mapsIndex
Definition:
MapListCellRenderer.java:45
net.sf.gridarta.gui.dialog.gomap.MapListCellRenderer.serialVersionUID
static final long serialVersionUID
Definition:
MapListCellRenderer.java:39
src
gridarta
src
main
java
net
sf
gridarta
gui
dialog
gomap
MapListCellRenderer.java
Generated by
1.8.17