001 /* 002 * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. 003 * Copyright (C) 2000-2011 The Gridarta Developers. 004 * 005 * This program is free software; you can redistribute it and/or modify 006 * it under the terms of the GNU General Public License as published by 007 * the Free Software Foundation; either version 2 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU General Public License for more details. 014 * 015 * You should have received a copy of the GNU General Public License along 016 * with this program; if not, write to the Free Software Foundation, Inc., 017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 018 */ 019 020 package net.sf.gridarta.gui.panel.archetypechooser; 021 022 import java.util.Comparator; 023 import javax.swing.DefaultListCellRenderer; 024 import net.sf.gridarta.model.archetype.Archetype; 025 import net.sf.gridarta.model.gameobject.GameObject; 026 import net.sf.gridarta.model.maparchobject.MapArchObject; 027 028 /** 029 * Abstract base class for classes implementing display modes of the archetype 030 * chooser. It defines both a {@link DefaultListCellRenderer} and a {@link 031 * Comparator} for sorting the list entries. 032 * @author Andreas Kirschbaum 033 * @noinspection AbstractClassExtendsConcreteClass 034 */ 035 public abstract class DisplayMode<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DefaultListCellRenderer implements Comparator<Archetype<G, A, R>> { 036 037 /** 038 * The serial version UID. 039 */ 040 private static final long serialVersionUID = 1L; 041 042 /** 043 * Creates a new instance. 044 */ 045 protected DisplayMode() { 046 } 047 048 /** 049 * Returns the layout orientation. See {@link javax.swing.JList#getLayoutOrientation}. 050 * @return the layout orientation 051 */ 052 public abstract int getLayoutOrientation(); 053 054 }