/**
 * GUI Commands
 * Copyright 2004 Andrew Pietsch
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * $Id: ScriptDemoPanel.java,v 1.8 2006/02/26 00:59:08 pietschy Exp $
 */

package org.pietschy.command.demo.script;

import au.com.skypie.ui.HTMLPane;
import org.pietschy.command.CommandGroup;
import org.pietschy.command.demo.AbstractDemoPanel;

import javax.swing.*;
import java.io.IOException;

public class
ScriptDemoPanel
extends AbstractDemoPanel
{
   static final String _ID_ = "$Id: ScriptDemoPanel.java,v 1.8 2006/02/26 00:59:08 pietschy Exp $";

   private CommandGroup[] menus = new CommandGroup[0];
//   private JConsole console;

   public ScriptDemoPanel()
   {
      super("Script Examples", "script-page.selector", "script-commands.xml");
   }


   public void
   loadBlurb(HTMLPane html)
   {
      try
      {
         html.setPage(getClass().getResource("script.html"));
         html.setDragEnabled(true);
      }
      catch (IOException e)
      {
         throw new RuntimeException("Couldn't load script file", e);
      }
   }

   public JComponent
   createExamplePanel()
   {
////      menu = CommandManager.instance().getGroup("example.script.menu");
//      console = new JConsole();
//      console.setFont(new Font("Monospaced", Font.PLAIN, 11));
//      Interpreter interpreter = new Interpreter(console);
//      new Thread(interpreter).start();
//      try
//      {
//         interpreter.eval("import org.pietschy.command.*");
//         interpreter.eval("import org.pietschy.command.demo.*");
//         interpreter.set("cm", CommandManager.defaultInstance());
//         interpreter.set("mainMenu", CommandManager.defaultInstance().getGroup("menu.main"));
//         interpreter.set("fileMenu", CommandManager.defaultInstance().getGroup("menu.file"));
//         interpreter.set("viewMenu", CommandManager.defaultInstance().getGroup("menu.view"));
////         interpreter.set("toolbar", CommandManager.instance().getGroup("main.toolbar"));
//      }
//      catch (EvalError evalError)
//      {
//         throw new RuntimeException("Couldn't initialize interpreter", evalError);
//      }
//
//      return console;
      return null;
   }

   public CommandGroup[]
   getMenuGroups()
   {
      return menus;
   }

}
