01: /*
02: * $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/editormodules/LocationEditorModule.java,v 1.1 2005/04/20 22:20:30 paulby Exp $
03: *
04: * Sun Public License Notice
05: *
06: * The contents of this file are subject to the Sun Public License Version
07: * 1.0 (the "License"). You may not use this file except in compliance with
08: * the License. A copy of the License is available at http://www.sun.com/
09: *
10: * The Original Code is the Java 3D(tm) Scene Graph Editor.
11: * The Initial Developer of the Original Code is Paul Byrne.
12: * Portions created by Paul Byrne are Copyright (C) 2002.
13: * All Rights Reserved.
14: *
15: * Contributor(s): Paul Byrne.
16: *
17: **/
18: package org.jdesktop.j3dedit.editormodules;
19:
20: import org.jdesktop.j3dedit.J3dEdit;
21: import org.jdesktop.j3dedit.locationeditor.LocationEditor;
22:
23: /**
24: *
25: * @author paulby
26: * @version
27: */
28: public class LocationEditorModule extends AbstractEditorModule {
29:
30: private J3dFlyEditorModule j3dFlyModule;
31: private J3dEdit j3dEdit;
32: private LocationEditor locationEditor = null;
33:
34: /** Creates new AnimationEditorModule */
35: public LocationEditorModule(J3dEdit j3dEdit,
36: J3dFlyEditorModule j3dFlyModule) {
37: this .j3dFlyModule = j3dFlyModule;
38: this .j3dEdit = j3dEdit;
39: }
40:
41: /**
42: * Return the name of the module.
43: *
44: * The name will be used in the mode button for selecting this
45: * module
46: */
47: public String getModuleName() {
48: return "Location Editor";
49: }
50:
51: /**
52: * Activate/Deactive this module.
53: *
54: * When a module is activated this method will create, display and
55: * arrange all the windows.
56: *
57: * When deactived the windows are hidden and possibly destroyed
58: */
59: public void setActive(boolean active) {
60: System.out.println("Location Editor active:" + active);
61:
62: if (active)
63: activate();
64: else
65: locationEditor.setActive(false);
66: }
67:
68: private void activate() {
69: java.awt.Dimension screenSize = java.awt.Toolkit
70: .getDefaultToolkit().getScreenSize();
71:
72: int viewWidth = 420;
73: int viewHeight = 380;
74:
75: int minY = j3dEdit.getSize().height; // Top of available area
76: int midY = screenSize.height / 2 + minY / 2; // Mid point Y of available area
77:
78: //System.out.println("Min Y "+minY );
79:
80: j3dFlyModule.setBounds(screenSize.width - viewWidth, minY,
81: viewWidth, viewHeight);
82:
83: if (locationEditor == null)
84: locationEditor = new LocationEditor(j3dEdit, j3dFlyModule
85: .getContext().getLocale());
86:
87: locationEditor.setActive(true);
88: }
89: }
|