[jsword-svn] bibledesktop/java/main/org/crosswire/bibledesktop/book/install s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sun Feb 27 19:21:28 MST 2005


Update of /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/install
In directory www.crosswire.org:/tmp/cvs-serv26301/java/main/org/crosswire/bibledesktop/book/install

Modified Files:
	SitePane.java 
Added Files:
	TextPaneBookMetaDataDisplay.java 
Log Message:
Fixed the display of the conf (BD-16, 17 & 18)

Index: SitePane.java
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/install/SitePane.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SitePane.java	17 Feb 2005 12:28:15 -0000	1.2
--- SitePane.java	28 Feb 2005 02:21:26 -0000	1.3
***************
*** 11,15 ****
  import javax.swing.JScrollPane;
  import javax.swing.JSplitPane;
- import javax.swing.JTable;
  import javax.swing.JTree;
  import javax.swing.event.TreeSelectionEvent;
--- 11,14 ----
***************
*** 24,29 ****
  import org.crosswire.common.swing.ActionFactory;
  import org.crosswire.common.swing.FixedSplitPane;
- import org.crosswire.common.swing.MapTable;
- import org.crosswire.common.swing.MapTableModel;
  import org.crosswire.common.util.NetUtil;
  import org.crosswire.common.util.Reporter;
--- 23,26 ----
***************
*** 184,191 ****
      private Component createSelectedPanel()
      {
!         emptyTableModel = new MapTableModel(null);
!         tblSelected = new MapTable(emptyTableModel);
          JLabel lblSelected = actions.createJLabel(SELECTED_BOOK_LABEL);
!         lblSelected.setLabelFor(tblSelected);
  
          JScrollPane scrSelected = new JScrollPane();
--- 181,188 ----
      private Component createSelectedPanel()
      {
!         
          JLabel lblSelected = actions.createJLabel(SELECTED_BOOK_LABEL);
!         display = new TextPaneBookMetaDataDisplay();
!         lblSelected.setLabelFor(display.getComponent());
  
          JScrollPane scrSelected = new JScrollPane();
***************
*** 194,198 ****
          panel.add(lblSelected, BorderLayout.PAGE_START);
          panel.add(scrSelected, BorderLayout.CENTER);
!         scrSelected.getViewport().add(tblSelected);
          return panel;
      }
--- 191,195 ----
          panel.add(lblSelected, BorderLayout.PAGE_START);
          panel.add(scrSelected, BorderLayout.CENTER);
!         scrSelected.getViewport().add(display.getComponent());
          return panel;
      }
***************
*** 364,379 ****
  
          boolean bookSelected = false;
!         MapTableModel mtm = emptyTableModel;
          if (path != null)
          {
              Object last = path.getLastPathComponent();
!             BookMetaData bmd = getBookMetaData(last);
              if (bmd != null)
              {
-                 mtm = new BookMetaDataTableModel(bmd);
                  bookSelected = true;
              }
          }
!         tblSelected.setModel(mtm);
  
          //actions.getAction(DELETE).setEnabled(bookSelected);
--- 361,375 ----
  
          boolean bookSelected = false;
!         BookMetaData bmd = null;
          if (path != null)
          {
              Object last = path.getLastPathComponent();
!             bmd = getBookMetaData(last);
              if (bmd != null)
              {
                  bookSelected = true;
              }
          }
!         display.setBookMetaData(bmd);
  
          //actions.getAction(DELETE).setEnabled(bookSelected);
***************
*** 432,437 ****
       */
      private JTree treAvailable = null;
!     private JTable tblSelected = null;
!     private MapTableModel emptyTableModel = null;
      private JLabel lblDesc = null;
  
--- 428,432 ----
       */
      private JTree treAvailable = null;
!     private TextPaneBookMetaDataDisplay display;
      private JLabel lblDesc = null;
  

--- NEW FILE: TextPaneBookMetaDataDisplay.java ---
package org.crosswire.bibledesktop.book.install;

import java.awt.Component;

import javax.swing.JTextPane;
import javax.swing.text.html.HTMLEditorKit;

import org.crosswire.common.swing.AntiAliasedTextPane;
import org.crosswire.common.util.Logger;
import org.crosswire.common.util.Reporter;
import org.crosswire.common.xml.Converter;
import org.crosswire.common.xml.JDOMSAXEventProvider;
import org.crosswire.common.xml.SAXEventProvider;
import org.crosswire.common.xml.TransformingSAXEventProvider;
import org.crosswire.common.xml.XMLUtil;
import org.crosswire.jsword.book.BookMetaData;
import org.crosswire.jsword.util.ConverterFactory;

/**
 * A JDK JTextPane implementation of an OSIS displayer.
 *
 * <p><table border='1' cellPadding='3' cellSpacing='0'>
 * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
 *
 * Distribution Licence:<br />
 * 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.<br />
 * 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.<br />
 * The License is available on the internet
 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, or by writing to:
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 * MA 02111-1307, USA<br />
 * The copyright to this program is held by it's authors.
 * </font></td></tr></table>
 * @see gnu.gpl.Licence
 * @author Joe Walker [joe at eireneh dot com]
 * @author DM Smith [dmsmith555 at yahoo dot com]
 * @version $Id: TextPaneBookMetaDataDisplay.java,v 1.1 2005/02/28 02:21:26 dmsmith Exp $
 */
public class TextPaneBookMetaDataDisplay
{
    /**
     * Simple ctor
     */
    public TextPaneBookMetaDataDisplay()
    {
        converter = ConverterFactory.getConverter();
        txtView = new AntiAliasedTextPane();
        txtView.setEditable(false);
        txtView.setEditorKit(new HTMLEditorKit());
    }

    /* (non-Javadoc)
     * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book, org.crosswire.jsword.passage.Key)
     */
    public void setBookMetaData(BookMetaData bmd)
    {
        if (bmd == null)
        {
            txtView.setText(""); //$NON-NLS-1$
            return;
        }

        try
        {
            
            SAXEventProvider osissep = new JDOMSAXEventProvider(bmd.toOSIS());
            TransformingSAXEventProvider htmlsep = (TransformingSAXEventProvider) converter.convert(osissep);
            String text = XMLUtil.writeToString(htmlsep);

            txtView.setText(text);
            txtView.select(0, 0);
        }
        catch (Exception ex)
        {
            Reporter.informUser(this, ex);
        }
    }

    /**
     * Accessor for the Swing component
     */
    public Component getComponent()
    {
        return txtView;
    }

    /**
     * The log stream
     */
    protected static final Logger log = Logger.getLogger(TextPaneBookMetaDataDisplay.class);

    /**
     * To convert OSIS to HTML
     */
    private Converter converter;

    /**
     * The display component
     */
    private JTextPane txtView;

}



More information about the jsword-svn mailing list