[jsword-svn]
bibledesktop/java/main/org/crosswire/bibledesktop/book/install 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/install
In directory www.crosswire.org:/tmp/cvs-serv18577/java/main/org/crosswire/bibledesktop/book/install
Modified Files:
SwordSiteEditor.java SitePane.java Msg.java Msg.properties
Added Files:
BookTreeCellRenderer.java
Log Message:
Fixed a release bug.
Finished the BookCategory implementation.
--- NEW FILE: BookTreeCellRenderer.java ---
/**
* Distribution Licence:
* JSword 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
*
* The copyright to this program is held by it's authors.
*/
package org.crosswire.bibledesktop.book.install;
import java.awt.Component;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
import org.crosswire.bibledesktop.book.BookIcon;
import org.crosswire.jsword.book.Book;
/**
* Provides appropriate icons for books.
*
* @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 BookTreeCellRenderer extends DefaultTreeCellRenderer
{
/* (non-Javadoc)
* @see javax.swing.tree.DefaultTreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean)
*/
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean focus)
{
String tooltip = null;
if (leaf && value instanceof BookNode)
{
Book book = (Book) ((BookNode) value).getUserObject();
setLeafIcon(BookIcon.getIcon(book));
if (book.isQuestionable())
{
tooltip = Msg.BOOK_QUESTIONABLE.toString();
}
if (!book.isSupported())
{
if (book.isEnciphered())
{
tooltip = Msg.BOOK_LOCKED.toString();
}
else
{
tooltip = Msg.BOOK_UNSUPPORTED.toString();
}
}
}
setToolTipText(tooltip);
return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
/**
* Serialization ID
*/
private static final long serialVersionUID = -942626483282049048L;
}
Index: SwordSiteEditor.java
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/install/SwordSiteEditor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SwordSiteEditor.java 10 Sep 2005 09:07:07 -0000 1.1
--- SwordSiteEditor.java 9 Jan 2006 00:52:02 -0000 1.2
***************
*** 36,42 ****
* A representation of a Sword SiteEditor.
*
! * @see gnu.gpl.License
* @author DM Smith [ dmsmith555 at yahoo dot com]
- * @version $Id$
*/
public class SwordSiteEditor extends JPanel implements SiteEditor
--- 36,42 ----
* A representation of a Sword SiteEditor.
*
! * @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 SwordSiteEditor extends JPanel implements SiteEditor
Index: Msg.properties
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/install/Msg.properties,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Msg.properties 10 Sep 2005 09:07:07 -0000 1.4
--- Msg.properties 9 Jan 2006 00:52:02 -0000 1.5
***************
*** 51,52 ****
--- 51,56 ----
SwordSiteEditor.ProxyHost=Proxy Host:
SwordSiteEditor.ProxyPort=Proxy Port:
+
+ BookTreeCellRenderer.BookLocked=Locked
+ BookTreeCellRenderer.BookUnsupported=Unsupported
+ BookTreeCellRenderer.BookQuestionable=Cult / Unorthodox / Questionable
Index: SitePane.java
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/install/SitePane.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** SitePane.java 2 Jan 2006 03:40:02 -0000 1.16
--- SitePane.java 9 Jan 2006 00:52:02 -0000 1.17
***************
*** 33,36 ****
--- 33,37 ----
import javax.swing.JSplitPane;
import javax.swing.JTree;
+ import javax.swing.ToolTipManager;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
***************
*** 210,213 ****
--- 211,218 ----
{
treAvailable = new JTree();
+ // Turn on tooltips so that they will show
+ ToolTipManager.sharedInstance().registerComponent(treAvailable);
+ treAvailable.setCellRenderer(new BookTreeCellRenderer());
+
setTreeModel(books);
// Add lines if viewed in Java Look & Feel
***************
*** 451,459 ****
display.setBook(book);
IndexManager imanager = IndexManagerFactory.getIndexManager();
actions.getAction(DELETE).setEnabled(bookSelected && book.getDriver().isDeletable(book));
actions.getAction(UNINDEX).setEnabled(bookSelected && imanager.isIndexed(book));
! actions.getAction(INSTALL).setEnabled(bookSelected);
! actions.getAction(INSTALL_SEARCH).setEnabled(bookSelected && book.getBookCategory() == BookCategory.BIBLE);
}
--- 456,465 ----
display.setBook(book);
+ boolean canInstall = bookSelected && book.isSupported() && !book.isEnciphered();
IndexManager imanager = IndexManagerFactory.getIndexManager();
actions.getAction(DELETE).setEnabled(bookSelected && book.getDriver().isDeletable(book));
actions.getAction(UNINDEX).setEnabled(bookSelected && imanager.isIndexed(book));
! actions.getAction(INSTALL).setEnabled(canInstall);
! actions.getAction(INSTALL_SEARCH).setEnabled(canInstall && book.getBookCategory() == BookCategory.BIBLE);
}
Index: Msg.java
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/install/Msg.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Msg.java 10 Sep 2005 09:07:07 -0000 1.8
--- Msg.java 9 Jan 2006 00:52:02 -0000 1.9
***************
*** 71,74 ****
--- 71,78 ----
static final Msg PROXY_PORT = new Msg("SwordSiteEditor.ProxyPort"); //$NON-NLS-1$
+ static final Msg BOOK_LOCKED = new Msg("BookTreeCellRenderer.BookLocked"); //$NON-NLS-1$
+ static final Msg BOOK_UNSUPPORTED = new Msg("BookTreeCellRenderer.BookUnsupported"); //$NON-NLS-1$
+ static final Msg BOOK_QUESTIONABLE = new Msg("BookTreeCellRenderer.BookQuestionable"); //$NON-NLS-1$
+
/**
* Passthrough ctor
More information about the jsword-svn
mailing list