[jsword-svn]
bibledesktop/java/main/org/crosswire/bibledesktop/book s
jswordcvs at crosswire.org
jswordcvs at crosswire.org
Sun Jan 8 17:52:04 MST 2006
Update of /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book
In directory www.crosswire.org:/tmp/cvs-serv18577/java/main/org/crosswire/bibledesktop/book
Modified Files:
BookListCellRenderer.java
Added Files:
BookIcon.java
Log Message:
Fixed a release bug.
Finished the BookCategory implementation.
--- NEW FILE: BookIcon.java ---
/**
* Distribution License:
* BibleDesktop is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 2 as published by
* the Free Software Foundation. This program is distributed in the hope
* that it will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* The License is available on the internet at:
* http://www.gnu.org/copyleft/gpl.html
* or by writing to:
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307, USA
*
* Copyright: 2005
* The copyright to this program is held by it's authors.
*
* ID: $Id: BookIcon.java,v 1.1 2006/01/09 00:52:02 dmsmith Exp $
*/
package org.crosswire.bibledesktop.book;
import javax.swing.Icon;
import javax.swing.SwingConstants;
import org.crosswire.common.swing.CompositeIcon;
import org.crosswire.common.swing.GuiUtil;
import org.crosswire.jsword.book.BookCategory;
import org.crosswire.jsword.book.BookMetaData;
/**
* Generates the appropriate icon for a book.
*
* @see gnu.gpl.License for license details.
* The copyright to this program is held by it's authors.
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
public class BookIcon
{
/**
* Static class
*/
private BookIcon()
{
}
public static Icon getIcon(BookMetaData book)
{
Icon icon = ICON_OTHER;
BookCategory type = book.getBookCategory();
if (type.equals(BookCategory.BIBLE))
{
icon = ICON_BIBLE;
}
else if (type.equals(BookCategory.COMMENTARY))
{
icon = ICON_COMNT;
}
else if (type.equals(BookCategory.DICTIONARY))
{
icon = ICON_DICT;
}
else if (type.equals(BookCategory.GLOSSARY))
{
icon = ICON_GLOSS;
}
else if (type.equals(BookCategory.DAILY_DEVOTIONS))
{
icon = ICON_READ;
}
else
{
icon = ICON_OTHER;
}
if (book.isQuestionable())
{
icon = new CompositeIcon(icon, ICON_QUESTIONABLE, SwingConstants.CENTER);
}
if (!book.isSupported())
{
// Enciphered is a specialized reason that it's not supported
if (book.isEnciphered())
{
icon = new CompositeIcon(icon, ICON_LOCKED, SwingConstants.CENTER);
}
else
{
icon = new CompositeIcon(icon, ICON_UNSUPPORTED, SwingConstants.CENTER);
}
}
return icon;
}
/**
* The small version icon
*/
private static final Icon ICON_BIBLE = GuiUtil.getIcon("images/book-b16.png"); //$NON-NLS-1$
/**
* The small version icon
*/
private static final Icon ICON_COMNT = GuiUtil.getIcon("images/book-c16.png"); //$NON-NLS-1$
/**
* The small version icon
*/
private static final Icon ICON_DICT = GuiUtil.getIcon("images/book-d16.png"); //$NON-NLS-1$
/**
* The small version icon
*/
private static final Icon ICON_READ = GuiUtil.getIcon("images/book-r16.png"); //$NON-NLS-1$
/**
* The small version icon
*/
private static final Icon ICON_GLOSS = GuiUtil.getIcon("images/book-g16.png"); //$NON-NLS-1$
/**
* The small version icon
*/
private static final Icon ICON_OTHER = GuiUtil.getIcon("images/book-o16.png"); //$NON-NLS-1$
/**
* The small version icon
*/
private static final Icon ICON_QUESTIONABLE = GuiUtil.getIcon("images/overlay-q16.png"); //$NON-NLS-1$
/**
* An overlay icon
*/
private static final Icon ICON_LOCKED = GuiUtil.getIcon("images/overlay-lock16.png"); //$NON-NLS-1$
/**
* An overlay icon
*/
private static final Icon ICON_UNSUPPORTED = GuiUtil.getIcon("images/overlay-x16.png"); //$NON-NLS-1$
}
Index: BookListCellRenderer.java
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/BookListCellRenderer.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** BookListCellRenderer.java 3 Jan 2006 13:25:46 -0000 1.15
--- BookListCellRenderer.java 9 Jan 2006 00:52:02 -0000 1.16
***************
*** 25,29 ****
import javax.swing.BorderFactory;
- import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
--- 25,28 ----
***************
*** 32,38 ****
import javax.swing.border.Border;
- import org.crosswire.common.swing.GuiUtil;
- import org.crosswire.jsword.book.Book;
- import org.crosswire.jsword.book.BookCategory;
import org.crosswire.jsword.book.BookMetaData;
--- 31,34 ----
***************
*** 103,107 ****
if (value instanceof BookMetaData)
{
! Book book = (Book) value;
String displayName = book.toString();
--- 99,103 ----
if (value instanceof BookMetaData)
{
! BookMetaData book = (BookMetaData) value;
String displayName = book.toString();
***************
*** 109,134 ****
setToolTipText(displayName);
! BookCategory type = book.getBookCategory();
! if (type.equals(BookCategory.BIBLE))
! {
! setIcon(ICON_BIBLE);
! }
! else if (type.equals(BookCategory.COMMENTARY))
! {
! setIcon(ICON_COMNT);
! }
! else if (type.equals(BookCategory.DICTIONARY))
! {
! setIcon(ICON_DICT);
! }
! else if (type.equals(BookCategory.GLOSSARY))
! {
! setIcon(ICON_GLOSS);
! }
! else if (type.equals(BookCategory.DAILY_DEVOTIONS))
! {
! setIcon(ICON_READ);
! }
!
setEnabled(list.isEnabled());
setFont(list.getFont());
--- 105,109 ----
setToolTipText(displayName);
! setIcon(BookIcon.getIcon(book));
setEnabled(list.isEnabled());
setFont(list.getFont());
***************
*** 140,168 ****
/**
- * The small version icon
- */
- private static final ImageIcon ICON_BIBLE = GuiUtil.getIcon("images/book-b16.png"); //$NON-NLS-1$
-
- /**
- * The small version icon
- */
- private static final ImageIcon ICON_COMNT = GuiUtil.getIcon("images/book-c16.png"); //$NON-NLS-1$
-
- /**
- * The small version icon
- */
- private static final ImageIcon ICON_DICT = GuiUtil.getIcon("images/book-d16.png"); //$NON-NLS-1$
-
- /**
- * The small version icon
- */
- private static final ImageIcon ICON_READ = GuiUtil.getIcon("images/book-r16.png"); //$NON-NLS-1$
-
- /**
- * The small version icon
- */
- private static final ImageIcon ICON_GLOSS = GuiUtil.getIcon("images/book-g16.png"); //$NON-NLS-1$
-
- /**
* border if we do not have focus
*/
--- 115,118 ----
More information about the jsword-svn
mailing list