private boolean seeWordCount;
private boolean listMode;
- private JList<BookInfo> list;
+ @SuppressWarnings("rawtypes") // JList<BookInfo> is not java 1.6
+ private JList list;
private ListModel<BookInfo> data;
private DelayWorker bookCoverUpdater;
private String filter = "";
}
}
- private JList<BookInfo> initList() {
+ @SuppressWarnings("rawtypes") // JList<BookInfo> is not java 1.6
+ private JList initList() {
final JList<BookInfo> list = new JList<BookInfo>();
data = new ListModel<BookInfo>(list, new BookPopup(
Instance.getInstance().getLibrary(), initInformer()));
book.getInfo());
}
+ @Override
protected void done() {
try {
book.setCoverImage(get());
* @param <T>
* the type of elements and items (the same type)
*/
-public class ListModel<T> extends DefaultListModel<T> {
+@SuppressWarnings("rawtypes") // ListModel<T> and JList<T> are not java 1.6
+public class ListModel<T> extends DefaultListModel {
private static final long serialVersionUID = 1L;
/**
private int hoveredIndex;
private List<T> items = new ArrayList<T>();
- private JList<T> list;
+ private JList list;
/**
* Create a new {@link ListModel}.
* @param list
* the {@link JList} we will handle the data of (cannot be NULL)
*/
- public ListModel(JList<T> list) {
+ public ListModel(JList list) {
this(list, null);
}
* @param popup
* the popup to use and keep track of (can be NULL)
*/
- public ListModel(final JList<T> list, final JPopupMenu popup) {
+ @SuppressWarnings("unchecked") // ListModel<T> and JList<T> are not java 1.6
+ public ListModel(final JList list, final JPopupMenu popup) {
this.list = list;
list.setModel(this);
* the filter will be copied as an element (can be NULL, in that
* case all items will be copied as elements)
*/
+ @SuppressWarnings("unchecked") // ListModel<T> and JList<T> are not java 1.6
public void filter(Predicate<T> filter) {
clear();
for (T item : items) {
}
}
+ @SuppressWarnings("unchecked") // ListModel<T> and JList<T> are not java 1.6
+ @Override
+ public T get(int index) {
+ return (T) super.get(index);
+ }
+
/**
* Generate a {@link ListCellRenderer} that supports {@link Hoverable}
* elements.
*
* @return a suitable, {@link Hoverable} compatible renderer
*/
- static public <T extends Component> ListCellRenderer<T> generateRenderer(
+ static public <T extends Component> ListCellRenderer generateRenderer(
final ListModel<T> model) {
- return new ListCellRenderer<T>() {
+ return new ListCellRenderer() {
@Override
- public Component getListCellRendererComponent(
- JList<? extends T> list, T item, int index,
- boolean isSelected, boolean cellHasFocus) {
+ public Component getListCellRendererComponent(JList list,
+ Object item, int index, boolean isSelected,
+ boolean cellHasFocus) {
if (item instanceof Hoverable) {
Hoverable hoverable = (Hoverable) item;
hoverable.setSelected(isSelected);
hoverable.setHovered(model.isHovered(index));
}
- return item;
+ return (Component) item;
}
};
}