/* $Id: DirectLinkPanel.java 125 2011-03-09 09:49:51Z ohura $ */
/*
 * 作成日: 2006/06/11
 *
 */
package smart_gs.reasoning_web.swingui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.util.List;

import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.LineBorder;
import reasoning_web.logical.inter_face.RWElement;
import smart_gs.reasoning_web.logical.GS_RWElement;
import smart_gs.reasoning_web.logical.GS_RWRepository;

/**
 * @author kazuaki kobayashi
 *
 * 
*/
@SuppressWarnings("serial")
public class DirectLinkPanel extends JPanel{
	
	private JScrollPane scrollPane;
	private JList list;
	public DirectLinkPanel(){
		this.setLayout(new BorderLayout());
		this.scrollPane = new JScrollPane();
		this.list = new JList();
		this.list.setBorder(new LineBorder(Color.BLACK));
		this.add(this.scrollPane,BorderLayout.CENTER);
		this.scrollPane.setViewportView(list);
	}
	public DirectLinkPanel(GS_RWElement element){
		this();
		List<RWElement> elements = GS_RWRepository.getInstance().getDirectElements(element);	
		if(elements == null){
			return;
		}
		this.list.setListData(elements.toArray());
		this.validate();
	}
}
