// Medusa is a graph viewer which allows interactive editing of networks
// (edges and nodes) and also connects to databases.
//
// Copyright (C) 2006 Sean Hooper
//
// This program is free software; you can redistribute it and/or modify 
// it under the terms of the GNU General Public License as published by 
// the Free Software Foundation; either version 2 of the License, or (at 
// your option) any later version.
//
// 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.
//
// You should have received a copy of the GNU General Public License along 
// with this program; if not, write to the 
// Free Software Foundation, Inc., 
// 59 Temple Place, Suite 330, 
// Boston, MA 02111-1307 USA

package medusa;

import javax.swing.JFrame;

/*
 * ShowEdgeMultiPanel.java
 *
 * Created on April 6, 2006, 11:57 AM
 */

/**
 *
 * @author  hooper
 */
public class ShowEdgeMultiPanel extends javax.swing.JPanel 
{
    
    private MedusaSettings ss;
    //private ShowEdgePanel[] seps;
    private JFrame parent; //ref to parent
    
    private final int baseSize=20;

    /** Creates new form ShowEdgeMultiPanel */
    public ShowEdgeMultiPanel() {
        this.ss=new MedusaSettings();
        initComponents();
        initEdgePanels();
    }
    
    public ShowEdgeMultiPanel(JFrame parent,MedusaSettings ss) {
        this.ss=ss;
	this.parent=parent;
        initComponents();
        initEdgePanels();
    }

    /*public ShowEdgeMultiPanel(MedusaSettings ss, Item) {
        this.ss=ss;
        this.superListener=superListener;
        initComponents();
        initEdgePanels();
	}*/

//    private ShowEdgePanel sp = new ShowEdgePanel(
//            new Color(244,20,120),"My interaction",baseSize,baseSize,1, this);
//    
    public void updateSettings(MedusaSettings ss){
       removeAll();
        this.ss=ss;
        initEdgePanels();
    }
    
    private void initEdgePanels(){
        Integer temp;
	//seps=new ShowEdgePanel[ss.getSize()];
        ShowEdgePanel sp;
        for (int i=1; i<=ss.getSize();i++){
	    temp=new Integer(i);
            sp=new ShowEdgePanel(ss.getColor(temp),
                    ss.getName(temp,0), baseSize, baseSize,i, this);
	    //seps[i-1].addItemListener(this);
            add(sp);
            
        }
	//pack();
        revalidate();
    }

   

    /*private ItemListener weng = new ItemListener(){
        public void itemStateChanged(ItemEvent ae) {
            System.out.println("weng!");
            Object src=ae.getSource();
          
            System.out.println(src);
        }
    };*/
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {//GEN-BEGIN:initComponents

        setLayout(new java.awt.GridLayout(0, 1));

        setBackground(new java.awt.Color(238, 238, 238));
	
    }//GEN-END:initComponents
    
    protected  void handleEdgeEvent(int number, boolean selected){
	//System.out.println("Just got "+number+ " from "+e.getSource());
	medusa.MedusaSimplerFrame.handleEdgeEvent(number, selected);
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
        
 
}

 

Ads help maintain this website.