JavaView® v2.12

jv.project
Interface PvViewerIf

All Superinterfaces:
java.util.EventListener, java.awt.event.KeyListener, PsViewerIf
All Known Implementing Classes:
PvViewer

public interface PvViewerIf
extends PsViewerIf

Interface for a viewer which manages the 3d-display, control window, and list of projects. Central class in JavaView and usually created at the beginning of an applet or application.

Add one, or more, projects PjProject via method calls addProject((String, String, String [])), addProject(String, String, String, String []), or addProject(PjProject). Once a project has been registered this way, it may be selected by selectProject(String) to become the active project, i.e. its geometry is rendered in the display getDisplay(), and its panels may be made visible via the method showPanel(int).

The 3d-display is be obtained from PsViewerIf by getDisplay(String) and includable in a container, e.g. inside the applet or standalone frame.

The control window may be slightly configured by showPanel(int).

HACK: Currently, this class references the interface PvDisplayIf. This cross package reference should be removed to avoid dependence of jv.object on jv.project.

Version:
08.04.00, 1.30 revised (kp) Methods related with frames of displays removed.
02.04.00, 1.20 revised (kp) Added two methods to obtain applet and frame.
13.10.99, 1.11 revised (sk) byu export added.
19.06.99, 1.10 revised (kp) Menu identifiers added.
12.06.99, 1.00 created (kp) Created the interface from the implementation jv.viewer.PvViewer.
Author:
Konrad Polthier
See Also:
PvViewer, PsViewerIf

Fields inherited from interface jv.object.PsViewerIf
ABOUT, ABOUT_APPLET, ADD_GEOMETRY, ADD_PROJECT, ANIMATION, CAMERA, CONFIG, CONSOLE, CONTROL, DISPLAY, EXPORT_BYU, EXPORT_EPS, EXPORT_FE, EXPORT_GIF, EXPORT_GIF_ANIM, EXPORT_JVD, EXPORT_JVX, EXPORT_JVX_SMALL, EXPORT_MGS, EXPORT_MPL, EXPORT_OBJ, EXPORT_OFF, EXPORT_PPM, EXPORT_PPM_ANIM, EXPORT_PS, EXPORT_VRML, EXPORT_XML, HELP, IMPORT_DISK, IMPORT_VGP, INFO, MATERIAL, MENU_FILE, MENU_FILE_ADD, MENU_FILE_ADD_GEOMETRY, MENU_FILE_ADD_PROJECT, MENU_FILE_CLOSE, MENU_FILE_EXIT, MENU_FILE_EXPORT, MENU_FILE_EXPORT_BYU, MENU_FILE_EXPORT_FE, MENU_FILE_EXPORT_GIF, MENU_FILE_EXPORT_JVD, MENU_FILE_EXPORT_JVX, MENU_FILE_EXPORT_JVX_SMALL, MENU_FILE_EXPORT_MGS, MENU_FILE_EXPORT_MPL, MENU_FILE_EXPORT_OBJ, MENU_FILE_EXPORT_OFF, MENU_FILE_EXPORT_PPM, MENU_FILE_EXPORT_VRML, MENU_FILE_IMPORT, MENU_FILE_IMPORT_DISK, MENU_FILE_IMPORT_VGP, MENU_FILE_NEW, MENU_FILE_NEW_DISPLAY, MENU_FILE_NEW_GEOMETRY, MENU_FILE_NEW_PROJECT, MENU_FILE_PRINT, MENU_FILE_PRINT_EPS, MENU_FILE_PRINT_PS, MENU_FILE_SUBMIT, MENU_HELP, MENU_HELP_ABOUT, MENU_HELP_APPLET, MENU_HELP_FONTS, MENU_HELP_RSRC, MENU_HELP_SYSTEM, MENU_HELP_VIEWER, MENU_INSPECTOR, MENU_INSPECTOR_CAMERA, MENU_INSPECTOR_DISPLAY, MENU_INSPECTOR_OBJECT, MENU_INSPECTOR_OBJECT_CONFIG, MENU_INSPECTOR_OBJECT_INFO, MENU_INSPECTOR_OBJECT_MATERIAL, MENU_INSPECTOR_OBJECT_TEXTURE, MENU_INSPECTOR_PROJECT, MENU_METHOD, MENU_WINDOW, MENU_WINDOW_ANIMATION, MENU_WINDOW_CONSOLE, MENU_WINDOW_NETWORK, NEW_GEOMETRY, NEW_PROJECT, OBJECT, PROJECT, RSRC, TEXTURE
 
Method Summary
 boolean addDisplay(java.lang.String name, PvDisplayIf display)
          Register a new display.
 boolean addProject(PjProject aProject)
          Registers name and instance of a project in the viewer.
 boolean addProject(java.lang.String name, java.lang.String className, java.lang.String[] parmList)
          Registers the name and class of a project in the viewer in default category.
 void destroy()
          Called from an applet.destroy() method to perform clean-up when applet gets destroyed.
 boolean enablePanel(int aPanel, boolean cond)
          Enable or disable menu entry of panel.
 java.applet.Applet getApplet()
          Get current applet.
 PsDialog getDialog(int aDialog)
          Get dialog window.
 PvDisplayIf getDisplay()
          Make default display available outside, e.g. for inclusion in applet window.
 PvDisplayIf[] getDisplays()
          Get array of registered displays.
 java.awt.Frame getFrame()
          Get current frame if running as application.
 java.awt.Panel getPanel(int aPanel)
          Make panels available outside our environment, i.e. outside control panel and outside our direct influence.
 java.lang.String getParameter(java.lang.String parmLabel)
          Get value of applet parameter.
 PjProject getProject(java.lang.String name)
          Get project with given name.
 boolean hasDisplay(PvDisplayIf disp)
          Check for a registered display by display instance.
 boolean hasProject(java.lang.String name)
          Check existence of a project instance with given name.
 boolean hideDialog(int aDialog)
          Hide visible dialog.
 java.lang.String newDisplay()
          Create a new AWT display inside a new frame.
 PvDisplayIf newDisplay(java.lang.String name)
          Deprecated. Use method newDisplay(String, boolean)
 PvDisplayIf newDisplay(java.lang.String name, boolean bFrame)
          Create a new empty AWT display which is optionally placed inside a new frame.
 boolean removeDisplay(PvDisplayIf disp)
          Remove a registered display from list of registered displays.
 boolean removeProject(java.lang.String aName)
          Removes a project from control panel and display but keeps it in the list of added project.
 boolean selectDisplay(PvDisplayIf disp)
          Select a registered display to become the active display.
 boolean selectProject(java.lang.String aName)
          Selects a project to become the active project.
 void setGeometry(PgGeometryIf geom)
          Set current geometry whose inspector panels are display inside the control panel.
 boolean showDialog(int aDialog)
          Show dialogs as separate frames.
 boolean showPanel(int aPanel)
          Make panels visible.
 void start()
          Start viewer, call start method of current project, and show control panel if requested.
 void stop()
          Stop viewer, call stop() method of current project, and close control panel if shown.
 
Methods inherited from interface jv.object.PsViewerIf
addProject, export, export
 
Methods inherited from interface java.awt.event.KeyListener
keyPressed, keyReleased, keyTyped
 

Method Detail

getApplet

public java.applet.Applet getApplet()
Get current applet. If running as application method returns applet inside frame.

getFrame

public java.awt.Frame getFrame()
Get current frame if running as application.

getParameter

public java.lang.String getParameter(java.lang.String parmLabel)
Get value of applet parameter. Calling this method avoids multiple getParameter(String) calls.
The first call to getParameter() tries to read all parameters specified in m_applet.m_info from Html page. Reads parameters from the applet's HTML page. Format on Html page:
Returns:
value of string if string found, else null
See Also:
Applet.getParameterInfo(), Applet.getParameter(String)

addProject

public boolean addProject(java.lang.String name,
                          java.lang.String className,
                          java.lang.String[] parmList)
Registers the name and class of a project in the viewer in default category. Later the project must be selected by name to be instantiated and to become the active project in the environment. This method allows to pass a list of parameter strings to the project which may be parsed by the project, e.g. used to receive initial values from an Html page.
Parameters:
name - Unique name of project, used for identification and selection
className - Class name of project, used for creation
parmList - List of parameters, may be null.
See Also:
PsViewerIf.addProject(String, String, String, String []), addProject(PjProject), selectProject(String)

addProject

public boolean addProject(PjProject aProject)
Registers name and instance of a project in the viewer. Later the project must be selected by name to become the active project in the environment. This method has no slot to pass a parameter list to the project since it is assumed the project instance has been set up by the user somewhere else.

Method disabled since class from different package required.
See Also:
PsViewerIf.addProject(String, String, String, String []), addProject(String, String, String []), selectProject(String)

hasProject

public boolean hasProject(java.lang.String name)
Check existence of a project instance with given name. If project is not found in project list, return false. Note, this method queries for instances of projects and not for project class names.
See Also:
addProject(PjProject), getProject(String), hasProject(String), removeProject(String), selectProject(String)

getProject

public PjProject getProject(java.lang.String name)
Get project with given name. If project is not found in project list but there exists a class registered under the same name, then try to create a project instance from this project class.
See Also:
addProject(PjProject), hasProject(String), removeProject(String), selectProject(String)

removeProject

public boolean removeProject(java.lang.String aName)
Removes a project from control panel and display but keeps it in the list of added project. To further use the project it must be selected again.
See Also:
addProject(PjProject), getProject(String), hasProject(String), selectProject(String)

selectProject

public boolean selectProject(java.lang.String aName)
Selects a project to become the active project. Selection may be done via a direct call or interactively by choosing from the menu FILE->LOAD. Each project must be added to the viewer before it becomes selectable.
See Also:
addProject(PjProject), getProject(String), hasProject(String), removeProject(String)

getDisplay

public PvDisplayIf getDisplay()
Make default display available outside, e.g. for inclusion in applet window. Just include the display inside the applet in a container.

Returns:
PvDisplayIf the default 3d-display
See Also:
#getDisplay(String)

getDisplays

public PvDisplayIf[] getDisplays()
Get array of registered displays.
Returns:
array of registered displays

newDisplay

public java.lang.String newDisplay()
Create a new AWT display inside a new frame. Method is invoked from menus, name of display is automatically chosen. All geometries of currently selected display are added to new display. Display becomes the selected display in viewer. Note: Method is currently only used by PvDisplay, and method is included in this interface to separate PvDisplay from PvViewer.
Returns:
Automatically chosen name of new display
See Also:
newDisplay(String)

newDisplay

public PvDisplayIf newDisplay(java.lang.String name)
Deprecated. Use method newDisplay(String, boolean)

Add new AWT display in a new frame.
Parameters:
Name - of new display. If name is null, then default name is chosen.
Returns:
New display
See Also:
newDisplay()

newDisplay

public PvDisplayIf newDisplay(java.lang.String name,
                              boolean bFrame)
Create a new empty AWT display which is optionally placed inside a new frame. Display becomes the selected display in viewer.

If a frame is allocated then the frame is not displayed and must be made visible in the application. The display is added to the center of the frame. The frame may be obtained from the display via PvDisplayIf#getFrame().

Parameters:
name - Name of new display. If name is null, then default name is chosen.
bFrame - If true then allocate a frame and add display to center.
Returns:
New display
See Also:
newDisplay(String), PvDisplayIf.getFrame()

hasDisplay

public boolean hasDisplay(PvDisplayIf disp)
Check for a registered display by display instance.

Returns:
false if display is not registered.
See Also:
#getDisplay(PvDisplayIf)

addDisplay

public boolean addDisplay(java.lang.String name,
                          PvDisplayIf display)
Register a new display.

Returns:
false if same name already exists.
See Also:
#getDisplay(String), selectDisplay(PvDisplayIf)

removeDisplay

public boolean removeDisplay(PvDisplayIf disp)
Remove a registered display from list of registered displays.
Returns:
false if display is not registered.
See Also:
addDisplay(String, PvDisplayIf), #getDisplay(PvDisplayIf)

selectDisplay

public boolean selectDisplay(PvDisplayIf disp)
Select a registered display to become the active display.
Returns:
false if display is not registered.
See Also:
addDisplay(String, PvDisplayIf), #getDisplay(PvDisplayIf)

showDialog

public boolean showDialog(int aDialog)
Show dialogs as separate frames. Possible arguments jv.object.PsViewerIf.ABOUT etc.
Possible arguments for dialogs are PsViewerIf.ABOUT, PsViewerIf.EXPORT_PS etc, see static variables in PsViewerIf.
Parameters:
int - Name of dialog to be shown
Returns:
Dialog true if success, false if dialog class not found.
See Also:
getDialog(int), hideDialog(int)

getDialog

public PsDialog getDialog(int aDialog)
Get dialog window. Possible arguments jv.object.PsViewerIf.ABOUT,...
Possible arguments for dialogs are currently jv.object.PsViewerIf#ANIMATION, jv.object.PsViewerIf#CONSOLE. See static variables in PsViewerIf.
Parameters:
int - Name of dialog
Returns:
Dialog
See Also:
hideDialog(int), showDialog(int)

hideDialog

public boolean hideDialog(int aDialog)
Hide visible dialog. For possible arguments see jv.object.PsViewerIf#ABOUT,... Hides visible dialogs. Possible arguments for dialogs are currently jv.object.PsViewerIf#ANIMATION, jv.object.PsViewerIf#CONSOLE, jv.object.PsViewerIf#CONTROL, jv.object.PsViewerIf#HELP. See static variables in PsViewerIf.
Parameters:
String - Name of dialog to be hidden
Returns:
boolean true if success, false if dialog not found
See Also:
getDialog(int), showDialog(int)

showPanel

public boolean showPanel(int aPanel)
Make panels visible. They appear either inside the control window or as separate frames, e.g. the control window appears as frame, and project, display, camera, and object panels as panels inside control frame. If panel has already been requested by a call to @see getPanel then a call to showPanel is void and returns false.
Parameters:
int - Id of panel to be shown
Returns:
Panel true if success, false if panel not found or used outside via method @see getPanel().
See Also:
getPanel(int)

enablePanel

public boolean enablePanel(int aPanel,
                           boolean cond)
Enable or disable menu entry of panel.
Parameters:
int - Id of panel to enable
boolean - If true, enables this panel's menu entry; if false, disables it.
Returns:
boolean true if panel exists, otherwise false.
See Also:
showPanel(int)

getPanel

public java.awt.Panel getPanel(int aPanel)
Make panels available outside our environment, i.e. outside control panel and outside our direct influence. E.g. an applet may include a panel or it may create a seperate frame for the panel.

If a panel is requested via this method, then it will no longer be selectable via its menu entry in the control window neither by a call to method showPanel. Menu entries will be disabled but still visible.

Parameters:
int - Id of requested panel
Returns:
Panel Requested panel if it exists, otherwise null.
See Also:
showPanel(int)

setGeometry

public void setGeometry(PgGeometryIf geom)
Set current geometry whose inspector panels are display inside the control panel. Note: Method is currently only used by PvDisplay, and method is included in this interface to separate PvDisplay from PvViewer.

destroy

public void destroy()
Called from an applet.destroy() method to perform clean-up when applet gets destroyed. Here we just close and dispose all control windows.

start

public void start()
Start viewer, call start method of current project, and show control panel if requested.
See Also:
PjProject.start()

stop

public void stop()
Stop viewer, call stop() method of current project, and close control panel if shown.
See Also:
PjProject.stop()

JavaView® v2.12

The software JavaView® is copyright protected. All Rights Reserved.