Skip to content

Commit 116a90d

Browse files
committed
ViewerUtil improvements
1 parent 6794f72 commit 116a90d

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

src/org/infinity/check/StructChecker.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ public int getOffset() {
564564
return offset;
565565
}
566566

567+
@SuppressWarnings("unused")
567568
public String getMessage() {
568569
return errorMsg;
569570
}

src/org/infinity/gui/ViewerUtil.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public static JLabel makeBamPanel(ResourceRef iconRef, int frameNr) {
209209
return new JLabel("No " + iconRef.getName().toLowerCase(Locale.ENGLISH), SwingConstants.CENTER);
210210
}
211211

212-
public static JComponent makeBamPanel(ResourceRef iconRef, int animNr, int frameNr) {
212+
public static JLabel makeBamPanel(ResourceRef iconRef, int animNr, int frameNr) {
213213
ResourceEntry iconEntry = ResourceFactory.getResourceEntry(iconRef.getResourceName());
214214
if (iconEntry != null) {
215215
try {
@@ -233,7 +233,7 @@ public static JComponent makeBamPanel(ResourceRef iconRef, int animNr, int frame
233233
return new JLabel("No " + iconRef.getName().toLowerCase(Locale.ENGLISH), SwingConstants.CENTER);
234234
}
235235

236-
public static JComponent makeCheckLabel(StructEntry entry, String yes) {
236+
public static JLabel makeCheckLabel(StructEntry entry, String yes) {
237237
JLabel check = new JLabel(entry.getName());
238238
if (entry.toString().equalsIgnoreCase(yes)) {
239239
check.setIcon(Icons.ICON_CHECK_16.getIcon());
@@ -296,7 +296,7 @@ public static JLabel makeImagePanel(ResourceRef imageRef, boolean searchExtraDir
296296
*
297297
* @return Editor for show list of the specified attributes
298298
*/
299-
public static JPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass) {
299+
public static StructListPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass) {
300300
return new StructListPanel(title, struct, listClass, null, null, null);
301301
}
302302

@@ -310,7 +310,7 @@ public static JPanel makeListPanel(String title, AbstractStruct struct, Class<?
310310
*
311311
* @return Editor for show list of the specified attributes
312312
*/
313-
public static JPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
313+
public static StructListPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
314314
String attrName) {
315315
return new StructListPanel(title, struct, listClass, getAttributeEntry(attrName), null, null);
316316
}
@@ -326,7 +326,7 @@ public static JPanel makeListPanel(String title, AbstractStruct struct, Class<?
326326
*
327327
* @return Editor for show list of the specified attributes
328328
*/
329-
public static JPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
329+
public static StructListPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
330330
String attrName, ListCellRenderer<Object> renderer) {
331331
return new StructListPanel(title, struct, listClass, getAttributeEntry(attrName), renderer, null);
332332
}
@@ -343,7 +343,7 @@ public static JPanel makeListPanel(String title, AbstractStruct struct, Class<?
343343
*
344344
* @return Editor for show list of the specified attributes
345345
*/
346-
public static JPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
346+
public static StructListPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
347347
String attrName, ListCellRenderer<Object> renderer, ListSelectionListener listener) {
348348
return new StructListPanel(title, struct, listClass, getAttributeEntry(attrName), renderer, listener);
349349
}
@@ -358,7 +358,7 @@ public static JPanel makeListPanel(String title, AbstractStruct struct, Class<?
358358
*
359359
* @return Editor for show list of the specified attributes
360360
*/
361-
public static JPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
361+
public static StructListPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
362362
AttributeEntry attrEntry) {
363363
return new StructListPanel(title, struct, listClass, attrEntry, null, null);
364364
}
@@ -374,7 +374,7 @@ public static JPanel makeListPanel(String title, AbstractStruct struct, Class<?
374374
*
375375
* @return Editor for show list of the specified attributes
376376
*/
377-
public static JPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
377+
public static StructListPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
378378
AttributeEntry attrEntry, ListCellRenderer<Object> renderer) {
379379
return new StructListPanel(title, struct, listClass, attrEntry, renderer, null);
380380
}
@@ -391,7 +391,7 @@ public static JPanel makeListPanel(String title, AbstractStruct struct, Class<?
391391
*
392392
* @return Editor for show list of the specified attributes
393393
*/
394-
public static JPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
394+
public static StructListPanel makeListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
395395
AttributeEntry attrEntry, ListCellRenderer<Object> renderer, ListSelectionListener listener) {
396396
return new StructListPanel(title, struct, listClass, attrEntry, renderer, listener);
397397
}
@@ -551,8 +551,8 @@ public static interface AttributeEntry extends Function<StructEntry, StructEntry
551551
public static final class StructListPanel extends JPanel implements TableModelListener, ActionListener {
552552
private final AbstractStruct struct;
553553
private final Class<? extends StructEntry> listClass;
554-
private final JList<Object> list;
555-
private final SimpleListModel<Object> listModel = new SimpleListModel<>();
554+
private final JList<StructEntry> list;
555+
private final SimpleListModel<StructEntry> listModel = new SimpleListModel<>();
556556
private final JButton bOpen = new JButton("View/Edit", Icons.ICON_ZOOM_16.getIcon());
557557

558558
private StructListPanel(String title, AbstractStruct struct, Class<? extends StructEntry> listClass,
@@ -617,7 +617,7 @@ public void mouseClicked(MouseEvent e) {
617617
}
618618

619619
/** Provides access to the list component of the panel. */
620-
public JList<Object> getList() {
620+
public JList<StructEntry> getList() {
621621
return list;
622622
}
623623

src/org/infinity/resource/wmp/ViewerMap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ private enum Direction {
168168
mapScaleX = (float) mapOrig.getWidth() / (float) mapTargetWidth;
169169
mapScaleY = (float) mapOrig.getHeight() / (float) mapTargetHeight;
170170

171-
listPanel = (StructListPanel) ViewerUtil.makeListPanel("Areas", wmpMap, AreaEntry.class,
172-
AreaEntry.WMP_AREA_CURRENT, new WmpAreaListRenderer(mapIcons), listeners);
171+
listPanel = ViewerUtil.makeListPanel("Areas", wmpMap, AreaEntry.class, AreaEntry.WMP_AREA_CURRENT,
172+
new WmpAreaListRenderer(mapIcons), listeners);
173173
listPanel.getList().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
174174
JScrollPane mapScroll = new JScrollPane(rcMap);
175175
mapScroll.getVerticalScrollBar().setUnitIncrement(16);

0 commit comments

Comments
 (0)