// 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

/*
 * ClickLinker.java
 *
 * Created on August 7, 2006, 4:38 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package medusa.applet ;

import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JApplet;

/**
 *
 * @author hooper
 */
public class ClickLinker{
    JApplet applet;
   
    String linkStart;
    String linkEnd;
    
    /** Creates a new instance of ClickLinker */
    public ClickLinker(String linkStart, String linkEnd,
            JApplet applet) {
        this.applet=applet;
        System.out.println(linkStart);
        this.linkStart=linkStart;
        this.linkEnd=linkEnd;
    }
    
    public boolean isActive(){
        return (linkStart!=null);
    }
    
    public void linkOut(String node){
        if (linkStart==null){
            return;
        }
        try{
    
         URL url = new URL(linkStart+node+linkEnd);
         System.out.println("Linking to "+linkStart+node+linkEnd);
         applet.getAppletContext().showDocument(url,"_blank");
      }
      catch(MalformedURLException er){ }
    }
}

 

Ads help maintain this website.