/* ========================
* JSynoptic : a free Synoptic editor
* ========================
*
* Project Info: http://jsynoptic.sourceforge.net/index.html
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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.
*
* (C) Copyright 2001-2005, by :
* Corporate:
* Astrium SAS
* Individual:
* Ronan Ogor
*
* $Id: Xith3DView3DShape.java,v 1.3 2006/11/23 16:43:24 ogor Exp $
*
* Changes
* -------
* 14 juin 2005 : Creation date (RO);
*
*/
package jsynoptic.plugins.syn3d.xith3d;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import syn3d.base.ActiveNode;
import syn3d.nodes.SceneNode;
import syn3d.ui.SceneGraphModel;
import syn3d.ui.SceneGraphTree;
import jsynoptic.base.Plugin;
import jsynoptic.plugins.syn3d.View3DShape;
import jsynoptic.ui.JSynoptic;
/**
* @author ogor
*
*/
public class Xith3DView3DShape extends View3DShape{
public Xith3DView3DShape(Plugin plugin, int ox, int oy, int w, int h) {
super(plugin, ox, oy, w, h);
}
public boolean doAction(double x, double y, Object o, String action) {
if (super.doAction(x,y,o,action)) return true;
if (action.equals("Link to Scene")) {
SceneGraphTree tree = new SceneGraphTree((SceneGraphModel)((Xith3DPlugin3D)plugin).getSceneTree().getModel());
tree.setVisibleRowCount(7);
int result = JOptionPane.showConfirmDialog(JSynoptic.gui.getOwner(), new JScrollPane(tree),
"Select a scene", JOptionPane.OK_CANCEL_OPTION,
JOptionPane.PLAIN_MESSAGE);
if (result == JOptionPane.OK_OPTION) {
ActiveNode sel = tree.getSelectedNode();
if (sel instanceof SceneNode) {
node = new SynopticViewNodeXith3d(sel);
if (node==null) return false;
node.attach(this);
}
}
return true;
}
return false;
}
}