<commit_before>/*
 *                  BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 * 
 * Created on Jul 28, 2006
 *
 */
package org.biojava.spice.manypanel.renderer;

import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.util.logging.Logger;

import javax.swing.BorderFactory;
import javax.swing.JEditorPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;

import org.biojava.dasobert.eventmodel.SequenceEvent;
import org.biojava.dasobert.eventmodel.SequenceListener;
import org.biojava.spice.feature.Feature;
import org.biojava.spice.feature.Segment;
import org.biojava.spice.gui.AbstractPopupFrame;
import org.biojava.spice.manypanel.eventmodel.SpiceFeatureEvent;
import org.biojava.spice.manypanel.eventmodel.SpiceFeatureListener;
import org.biojava.spice.utils.BrowserOpener;



/** provides the actual implementation of the AbstractPopupFrame
 * This class takes care of the actual behaviour of when the popup appears, as well
 * as provides the content
 * 
 * @author <NAME>
 * @since 1:31:08 PM
 * @version %I% %G%
 */
public class SegmentPopupFrame
extends AbstractPopupFrame    
implements SpiceFeatureListener, 
SequenceListener
{
    public static Logger logger =  Logger.getLogger("org.biojava.spice");
    
    Container content ;
    JPanel panel;
  
    public static final int FRAME_WIDTH        = 300;
    public static final int FRAME_PREF_HEIGHT  = 250;
    //private static final int FRAME_MAX_HEIGHT   = 300;
    
    private static String font  =  "<b><font color=\"#0000FF\">";
    private static String efont = "</font></b>";
    private static String endl  = "<br>";
    private static String ahref = "<a href=\"";
    private static String ehref = "</a>";
    
    public SegmentPopupFrame() {
        super();
        content = null;
        panel = new JPanel();
    }
    
    
    private StringBuffer startStringBuffer(){
        StringBuffer text = new StringBuffer(
        "<html><body><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">");
        return text;
    }
    
    private void endStringBuffer(StringBuffer text){
        text.append("</font></body></html>");
    }
    
    private void appendFeatureDesc(StringBuffer text, Feature f){
        if ( f == null)
            return;
        text.append(font + "feature: " + efont + f.getName()   + endl);
        text.append(font + "type: "   + efont +  f.getType()   + endl);
        text.append(font + "method: "  + efont + f.getMethod() + endl);
        
        if ( f.getNote() != null)
            text.append(font + "note: "  + efont + f.getNote() + endl);
        
        if ( f.getName() != null)
            text.append(font + "name: " + efont + f.getName() + endl);
        if ( f.getScore() != null)
            text.append(font + "score: " + efont + f.getScore()+ endl);
        
        if ( f.getLink() != null)
            text.append(font + "link: " + efont + ahref + f.getLink() + "\">" + f.getLink()  + ehref + endl);
        text.append(font + "source: " + efont + ahref  + f.getSource() + "\">"+ f.getSource()+ ehref + endl);
                
    }
    
    
    private JPanel getFramePanel(JEditorPane editorP){
        
        JPanel panel = new JPanel();
        panel.setBackground(Color.white);
        panel.setBorder(BorderFactory.createEmptyBorder());
        
        panel.setPreferredSize(new Dimension(FRAME_WIDTH,FRAME_PREF_HEIGHT));

        editorP.setPreferredSize(new Dimension(FRAME_WIDTH,FRAME_PREF_HEIGHT));
        
        JScrollPane scroll = new JScrollPane(editorP);
        scroll.setBorder(BorderFactory.createEmptyBorder());
        
        
        panel.add(scroll);
        <commit_msg>fixed a problem with improper-setting of size for big content panels<commit_after>/*
 *                  BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 * 
 * Created on Jul 28, 2006
 *
 */
package org.biojava.spice.manypanel.renderer;

import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.util.logging.Logger;

import javax.swing.BorderFactory;
import javax.swing.JEditorPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;

import org.biojava.dasobert.eventmodel.SequenceEvent;
import org.biojava.dasobert.eventmodel.SequenceListener;
import org.biojava.spice.feature.Feature;
import org.biojava.spice.feature.Segment;
import org.biojava.spice.gui.AbstractPopupFrame;
import org.biojava.spice.manypanel.eventmodel.SpiceFeatureEvent;
import org.biojava.spice.manypanel.eventmodel.SpiceFeatureListener;
import org.biojava.spice.utils.BrowserOpener;



/** provides the actual implementation of the AbstractPopupFrame
 * This class takes care of the actual behaviour of when the popup appears, as well
 * as provides the content
 * 
 * @author <NAME>
 * @since 1:31:08 PM
 * @version %I% %G%
 */
public class SegmentPopupFrame
extends AbstractPopupFrame    
implements SpiceFeatureListener, 
SequenceListener
{
    public static Logger logger =  Logger.getLogger("org.biojava.spice");
    
    Container content ;
    JPanel panel;
  
    public static final int FRAME_WIDTH        = 300;
    public static final int FRAME_PREF_HEIGHT  = 250;
    //private static final int FRAME_MAX_HEIGHT   = 300;
    
    private static String font  =  "<b><font color=\"#0000FF\">";
    private static String efont = "</font></b>";
    private static String endl  = "<br>";
    private static String ahref = "<a href=\"";
    private static String ehref = "</a>";
    
    public SegmentPopupFrame() {
        super();
        content = null;
        panel = new JPanel();
    }
    
    
    private StringBuffer startStringBuffer(){
        StringBuffer text = new StringBuffer(
        "<html><body><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">");
        return text;
    }
    
    private void endStringBuffer(StringBuffer text){
        text.append("</font></body></html>");
    }
    
    private void appendFeatureDesc(StringBuffer text, Feature f){
        if ( f == null)
            return;
        text.append(font + "feature: " + efont + f.getName()   + endl);
        text.append(font + "type: "   + efont +  f.getType()   + endl);
        text.append(font + "method: "  + efont + f.getMethod() + endl);
        
        if ( f.getNote() != null)
            text.append(font + "note: "  + efont + f.getNote() + endl);
        
        if ( f.getName() != null)
            text.append(font + "name: " + efont + f.getName() + endl);
        if ( f.getScore() != null)
            text.append(font + "score: " + efont + f.getScore()+ endl);
        
        if ( f.getLink() != null)
            text.append(font + "link: " + efont + ahref + f.getLink() + "\">" + f.getLink()  + ehref + endl);
        text.append(font + "source: " + efont + ahref  + f.getSource() + "\">"+ f.getSource()+ ehref + endl);
                
    }
    
    
    private JPanel getFramePanel(JEditorPane editorP){
        
        JPanel panel = new JPanel();
        panel.setBackground(Color.white);
        panel.setBorder(BorderFactory.createEmptyBorder());
        
        panel.setPreferredSize(new Dimension(FRAME_WIDTH,FRAME_PREF_HEIGHT));

        
        JScrollPane scroll = new JScrollPane(editorP);
        scroll.setBorder(BorderFactory.createEmptyBorder());
        scroll.setPreferredSize(new Dimension(FRAME_WIDTH,FRAME_PREF_HEIGHT));
        
        
        panel.add(scroll);
        
{'fraction_non_alphanumeric': 0.1172215843857635, 'fraction_numerical': 0.0057405281285878304, 'mean_word_length': 2.751507321274763, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3435356', 'n_tokens_mistral': 2651, 'n_tokens_neox': 2597, 'n_words': 684}