package net.trevize.gui.xmltreetable;

import java.awt.BorderLayout;
import java.io.File;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.tree.TreeModel;

import org.netbeans.swing.outline.DefaultOutlineModel;
import org.netbeans.swing.outline.Outline;
import org.netbeans.swing.outline.OutlineModel;

public class Test extends JFrame {

	private Outline outline;

	public Test() {

		setDefaultCloseOperation(EXIT_ON_CLOSE);

		getContentPane().setLayout(new BorderLayout());

		TreeModel treeMdl = new XmlTreeModel("./p1010843.xml");

		OutlineModel mdl = DefaultOutlineModel.createOutlineModel(treeMdl,
				new XmlRowModel(), true);

		outline = new Outline();

		outline.setRootVisible(true);

		outline.setTableHeader(null);

		outline.setModel(mdl);

		JScrollPane sp = new JScrollPane();
		sp.setViewportView(outline);

		sp
				.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

		getContentPane().add(sp, BorderLayout.CENTER);

		setBounds(20, 20, 700, 400);

		setVisible(true);

	}

	public static void main(String[] args) {
		// setting the system look and feel
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (UnsupportedLookAndFeelException e) {
			e.printStackTrace();
		}
		new Test();
	}

}

