Class PvViewer
- java.lang.Object
-
- jv.object.PsObject
-
- jv.viewer.PvViewer
-
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.WindowListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, PsUpdateIf, PsViewerIf, PsDropListenerIf, PvViewerIf
public final class PvViewer extends PsObject implements PvViewerIf, java.awt.event.ActionListener, java.awt.event.WindowListener, PsDropListenerIf
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
PjProjectvia method callsaddProject. Once a project has been registered this way, it may be selected byselectProject(PjProject)to become the active project, i.e. its geometry is rendered in the displaygetDisplay()and its panels are accessible via the control window which can be shown viashowPanel(int).The default 3d-display is be obtained from PvViewer by
getDisplay()for inclusion in a container, e.g. inside an applet or standalone frame.The control window may be slightly configured by
showPanel(int). It is created whenever a panel is requested, i.e. initially there are no inspector panels allocated.- See Also:
PsViewerIf,PjProject,addProject(PjProject),selectProject(PjProject), Serialized Form- Author:
- Konrad Polthier
- Version:
- 07.10.17, 7.05 revised (kp) More projects from image source added.
05.05.17, 7.00 revised (kp) Initial version of drag and drop handling added.
15.12.16, 6.00 revised (kp) Many more projects added to New Project choices.
28.09.10, 5.80 revised (fk) Removed interfaces that are inherited from superclass.
07.01.07, 5.70 revised (kp) Configuration of main frame moved to init() behind reading of license and resource information.
15.11.06, 5.60 revised (kp) Bug removed, that invisible control panel prevented shutting down of JavaView. New method getNumVisibleFrames() added.
01.10.06, 5.50 revised (kp) KeyEvents ctrl-x, ctrl-c, ctrl-v no longer used since conflict with MS-Windows.
11.06.06, 5.30 revised (kp) Existing frames appear as menu items in the menu Window.
30.04.06, 5.20 revised (kp) New export entry U3D added.
07.10.04, 5.10 revised (kp) Method getGeometry() made public.
15.02.04, 5.00 revised (kp) Consistent usage of PsJavaView implemented.
08.12.02, 4.50 revised (kp) Selected display may be marked with red border.
10.11.02, 4.40 revised (kp) All frames now have a menu bar, also PsActionSupport added to handle workshop dialogs.
07.11.02, 4.30 revised (ep) Removed old references to jvx.geom.PwParmCurve and jvx.geom.PwParmSurface fromgetGeometry(String), and corrected PwParmCurve to PgParmCurve.
25.10.02, 4.20 revised (kp) Remove usage of StdLink, use PjWorkshopIf for loading classes.
18.07.02, 4.10 revised (kp) Store filename of recently opened geometry for later use.
05.06.02, 4.00 revised (kp) Menu bar handling moved from PvControl.
19.06.99, 2.50 revised (kp) PvControl not longer created during startup but when panel requested.
12.06.99, 2.21 revised (kp) Subset of methods extracted toPsViewerIf.
20.05.99, 2.20 revised (kp) m_animationPanel and m_console no longer handled here.
26.01.99, 2.10 revised (kp) m_currentGeometry no longer handled, moved to project.
16.11.98, 2.00 revised (kp) Major revision.
00.00.97, 1.00 created (kp)
-
-
Field Summary
-
Fields inherited from class jv.object.PsObject
HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
-
Fields inherited from interface jv.object.PsViewerIf
ABOUT, ABOUT_APPLET, ADD_GEOMETRY, ADD_PROJECT, ANIMATION, AXIS, AXIS_X, AXIS_Y, AXIS_Z, BOUNDARY, CAMERA, CONFIG, CONSOLE, CONTROL, DISPLAY, EXPORT_BUG, EXPORT_BYU, EXPORT_DXF, EXPORT_EPS, EXPORT_FE, EXPORT_GIF, EXPORT_GIF_ANIM, EXPORT_HTML, EXPORT_JPG, EXPORT_JPG_ANIM, EXPORT_JVD, EXPORT_JVX, EXPORT_JVX_SMALL, EXPORT_JVZ, EXPORT_MA, EXPORT_MGS, EXPORT_MPL, EXPORT_MULTIPLE, EXPORT_OBJ, EXPORT_OFF, EXPORT_PDF, EXPORT_PLY, EXPORT_PNG, EXPORT_POV, EXPORT_PPM, EXPORT_PPM_ANIM, EXPORT_PS, EXPORT_STL, EXPORT_U3D, EXPORT_VAL, EXPORT_VALIDATE, EXPORT_VRML, EXPORT_WRL, EXPORT_XML, EXPORT_XYZ, HELP, IMPORT_DISK, IMPORT_JVD, IMPORT_VGP, INFO, LABEL, LICENSE, LIGHT, MATERIAL, MENU_DISPLAY_ADD_ELEMENT, MENU_DISPLAY_ADD_VERTEX, MENU_DISPLAY_DELETE_GEOMETRY, MENU_DISPLAY_DISPLAY_PICK, MENU_DISPLAY_DRAWING, MENU_DISPLAY_INITIAL_PICK, MENU_DISPLAY_MARK_ELEMENT, MENU_DISPLAY_MARK_VERTEX, MENU_DISPLAY_ORBIT, MENU_DISPLAY_PICK_VERTEX, MENU_DISPLAY_SCALE, MENU_DISPLAY_SCALE_RECT, MENU_DISPLAY_TRANSLATE, MENU_DISPLAY_TRANSLATE_Z, MENU_DISPLAY_UNMARK_ELEMENT, MENU_DISPLAY_UNMARK_VERTEX, MENU_DISPLAY_VERTICAL, MENU_FILE, MENU_FILE_CLOSE, MENU_FILE_EXIT, MENU_FILE_EXPORT, MENU_FILE_EXPORT_BYU, MENU_FILE_EXPORT_FE, MENU_FILE_EXPORT_GIF, MENU_FILE_EXPORT_JPG, MENU_FILE_EXPORT_JVD, MENU_FILE_EXPORT_JVX, MENU_FILE_EXPORT_JVX_SMALL, MENU_FILE_EXPORT_MA, MENU_FILE_EXPORT_MGS, MENU_FILE_EXPORT_MPL, MENU_FILE_EXPORT_OBJ, MENU_FILE_EXPORT_OFF, MENU_FILE_EXPORT_PDF, MENU_FILE_EXPORT_PLY, MENU_FILE_EXPORT_POV, MENU_FILE_EXPORT_PPM, MENU_FILE_EXPORT_STL, MENU_FILE_EXPORT_U3D, MENU_FILE_EXPORT_VRML, MENU_FILE_EXPORT_WRL, MENU_FILE_EXPORT_XYZ, MENU_FILE_IMPORT, MENU_FILE_IMPORT_DISK, MENU_FILE_IMPORT_JVD, MENU_FILE_IMPORT_SER, 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_LICENSE, MENU_HELP_RESOURCE, MENU_HELP_SYSTEM, MENU_HELP_VIEWER, MENU_INSPECTOR, MENU_INSPECTOR_AXIS, MENU_INSPECTOR_AXIS_X, MENU_INSPECTOR_AXIS_Y, MENU_INSPECTOR_AXIS_Z, MENU_INSPECTOR_CAMERA, MENU_INSPECTOR_DISPLAY, MENU_INSPECTOR_GEOMETRY, MENU_INSPECTOR_GEOMETRY_BOUNDARY, MENU_INSPECTOR_GEOMETRY_CONFIG, MENU_INSPECTOR_GEOMETRY_INFO, MENU_INSPECTOR_GEOMETRY_LABEL, MENU_INSPECTOR_GEOMETRY_MATERIAL, MENU_INSPECTOR_GEOMETRY_TEXTURE, MENU_INSPECTOR_GEOMETRY_VECTOR, MENU_INSPECTOR_LIGHT, 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_SEPARATOR, MENU_WINDOW, MENU_WINDOW_ANIMATION, MENU_WINDOW_CONSOLE, MENU_WINDOW_NETWORK, NEW_GEOMETRY, NEW_PROJECT, OBJECT, PRINT, PROJECT, RESOURCE, RSRC, TEXTURE, VECTOR
-
-
Constructor Summary
Constructors Constructor and Description PvViewer()Constructor for JavaView's display and project manager if JavaView runs inside another program.PvViewer(java.applet.Applet applet, java.awt.Frame frame)Constructor for JavaView's display and project manager JavaView runs in an applet or as standalone application.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description voidactionPerformed(java.awt.event.ActionEvent event)Internal method to catch action events from internal dialogs.booleanaddDisplay(java.lang.String name, PvDisplayIf disp)Register a new display under a name.booleanaddGeometry(java.lang.String category, java.lang.String name, java.lang.String className)Registers the name and class of a geometry class in the viewer in given category.booleanaddProject(PjProject prj)Registers name and instance of a project in the viewer.booleanaddProject(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.booleanaddProject(java.lang.String category, java.lang.String name, java.lang.String className, java.lang.String[] parmList)Registers the name and class of a project in the viewer in given category.voidaddProjects()Parses and adds all projects mentioned in the applet's parmInfo or Html page.voiddestroy()Called from an applet.destroy() method to perform clean-up when applet is destroyed.booleanexport(int aDialog, java.lang.String fileName)Export geometries of active display or display setting without opening a dialog.booleanexport(int aDialog, java.lang.String fileName, int width, int height)Export image file of currently active display with specified image size.voidfilesDropped(java.io.File[] files)Listener method when files are dropped into a registered drop listener, e.g. a display.java.applet.AppletgetApplet()Get current applet.PjProjectgetCurrentProject()Get currently selected project.PsDialoggetDialog(int dialog)Get dialog window.PvDisplayIfgetDisplay()Get currently selected 3d-display, for example, for inclusion in an applet.PvDisplayIf[]getDisplays()Get array of registered displays.java.awt.FramegetFrame()Get current frame if running as application.PgGeometryIfgetGeometry()Get current geometry whose inspector panels are displayed inside the control panel.PgGeometryIfgetGeometry(java.lang.String name)Get geometry with given name.intgetNumFrames()Get number of registered frame.java.awt.PanelgetPanel(int aPanel)Make panels available outside our environment, i.e. outside control panel and outside our direct influence.java.lang.StringgetParameter(java.lang.String parmLabel)Get value of applet parameter.PjProjectgetProject(java.lang.String name)Get project instance with given name.java.util.HashtablegetProjectClasses()Get hashtable with name and class of projects registered in PvViewer.java.util.HashtablegetProjectInstances()Get hashtable with name and instance of projects allocated in PvViewer.java.lang.StringgetRecentGeometryFile()Deprecated.since JavaView 3.09.003, use PsJavaView#getFullFileName(int)PvDisplayIfgetSelectedDisplay()Get currently selected display.booleanhasDisplay(PvDisplayIf disp)Determine whether a display is registered in the viewer.booleanhasProject(java.lang.String name)Check existence of a project instance with given name.booleanhideDialog(int dialog)Hides visible dialogs.voidinit()Creates an empty hashtable for all added projects, creates a display, and a nearly empty control window.booleanisEmbedded()Check if JavaView is embedded into another system.booleanisEnabledPanel(int aPanel)Check if menu entry of panel is enable or disable.voidkeyPressed(java.awt.event.KeyEvent event)Receives function key and strg-key events to show and hide panels.voidkeyReleased(java.awt.event.KeyEvent event)Event currently not handled.voidkeyTyped(java.awt.event.KeyEvent event)Event currently not handled.java.lang.StringnewDisplay()Create a new AWT display inside a new frame with menu bar.PvDisplayIfnewDisplay(java.lang.String name)Deprecated.Use methodnewDisplay(String, boolean).PvDisplayIfnewDisplay(java.lang.String name, boolean bFrame)Create a new empty AWT display which is optionally placed inside a new frame.PvDisplayIfnewDisplay(java.lang.String name, boolean bFrame, boolean bSelect)Create a new empty AWT display which is optionally placed inside a new frame.PvControlMenunewMenuBar(java.awt.Frame frame)Create a new menubar and call setEnabled(boolean) depending on the current scene.PsToolbarnewToolbar(java.awt.Frame frame)Create a new toolbar for frame.voidprintParameter()Print all parameters and values to console.booleanremoveDisplay(PvDisplayIf disp)Remove a registered display from list of registered displays.booleanremoveProject(PjProject proj)Removes a registered project, project may be added again later.booleanremoveProject(java.lang.String aName)Deprecated.since JavaView 2.92.000, use removeProject(PjProject)booleanselectDisplay(PvDisplayIf disp)Select a registered display to become the active display.booleanselectProject(PjProject prj)Selects a project to become the active project.booleanselectProject(java.lang.String aName)Deprecated.since JavaView 2.87, use selectProject(PjProject).voidsetEmbedded(boolean flag)Check if JavaView is embedded into another system.booleansetEnabledPanel(int aPanel, boolean cond)Enable or disable menu entry of panel.voidsetGeometry(PgGeometryIf geom)Set current geometry whose inspector panels are displayed inside the control panel.voidsetRecentGeometryFile(java.lang.String model)Deprecated.since JavaView 3.09.003, use PsJavaView#setFullFileName(int, String)voidshowAllFrames()Bring all frames to front (unless a frame is minimized).booleanshowDialog(int aDialog)Show dialogs as separate frames.booleanshowPanel(int aPanel)Make a panel visible if the control window has been created already.voidstart()Depending on applet parameter show control panel and call start method of current project.voidstop()Dispose open dialogs and invoke stop method of projects.booleanupdate(java.lang.Object object)Just a dummy routine to catch update() calls of stand-alone projects.voidupdateFonts(int size)voidwindowActivated(java.awt.event.WindowEvent event)Select display if window is instance of class Frame containing a display.voidwindowClosed(java.awt.event.WindowEvent event)No method body, just declared to fulfill interface WindowListener.voidwindowClosing(java.awt.event.WindowEvent event)Exit the application, or, if run as applet, close window.voidwindowDeactivated(java.awt.event.WindowEvent event)No method body, just declared to fulfill interface WindowListener.voidwindowDeiconified(java.awt.event.WindowEvent event)No method body, just declared to fulfill interface WindowListener.voidwindowIconified(java.awt.event.WindowEvent event)No method body, just declared to fulfill interface WindowListener.voidwindowOpened(java.awt.event.WindowEvent event)No method body, just declared to fulfill interface WindowListener.-
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels
-
-
-
-
Constructor Detail
-
PvViewer
public PvViewer()
Constructor for JavaView's display and project manager if JavaView runs inside another program. UsePvViewer(Applet, Frame)when writing JavaView based applets or applications.- See Also:
PvViewer(Applet, Frame)
-
PvViewer
public PvViewer(java.applet.Applet applet, java.awt.Frame frame)Constructor for JavaView's display and project manager JavaView runs in an applet or as standalone application. If JavaView runs as applet then the applet is queried for system properties to be stored inPsConfigat a central place.This constructor should be used if JavaView runs inside an applet or as standalone application.
Applications and applet should invoke the
start()method which shows the control panel if requested and invokes the start method of the current project. On exit, applications should call thestop()method to stop any running animations.The constructor checks license if running as application.
- Parameters:
applet- Parent appletframe- Parent frame- See Also:
PsConfig.init(Applet, PsViewerIf, Frame)- Version:
- 29.01.04, 3.20 revised (kp) If running as application then parse and assign codebase.
07.09.02, 3.10 revised (kp) Parse language right at the beginning.
-
-
Method Detail
-
init
public void init()
Creates an empty hashtable for all added projects, creates a display, and a nearly empty control window. Registers display in control window.
-
getApplet
public java.applet.Applet getApplet()
Get current applet. If running as application method returns applet inside frame.- Specified by:
getAppletin interfacePvViewerIf
-
getFrame
public java.awt.Frame getFrame()
Get current frame if running as application.- Specified by:
getFramein interfacePvViewerIf
-
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(String) tries to read all parameters specified in m_applet.m_info from Html page.Reads parameters from the applet's HTML page, and from command line of applications. Format on Html page:
<PARAM NAME="label" VALUE="some value">.
Format on command line:javaview label=some_value.
If the parameter is not found then an empty String "" is return. This behavior was introduced to avoid null pointer checks in application programs.
- Specified by:
getParameterin interfacePvViewerIf- Returns:
- value of string if string found, else an empty String "".
- See Also:
Applet.getParameterInfo(),Applet.getParameter(String),PsMainFrame.PsMainFrame(Component, String, String []),PsMainFrame.PsMainFrame(Component, String []),PsMainFrame.PsMainFrame(String, String [])- Version:
- 15.02.02, 1.20 revised (kp) Remove bracketing "" which may occur when using commandline arguments.
04.06.00, 1.10 revised (kp) Return value changed to "" instead null in case of failure.
-
printParameter
public void printParameter()
Print all parameters and values to console.- See Also:
Applet.getParameter(String)
-
addGeometry
public boolean addGeometry(java.lang.String category, java.lang.String name, java.lang.String className)Registers the name and class of a geometry class in the viewer in given category. Later the geometry must be selected by name to be instantiated and to become the active geometry in the viewer.- Parameters:
category- Unique name of category used to group geometriesname- Unique name of geometry, used for identification and selectionclassName- Class name of geometry, used for creation- See Also:
getGeometry(String)
-
getGeometry
public PgGeometryIf getGeometry(java.lang.String name)
Get geometry with given name. If geometry is not found in geometry list but there exists a class registered under the same name, then try to create a geometry instance from this geometry class.- See Also:
addGeometry(String, String, String)
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
Internal method to catch action events from internal dialogs.- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener- Since:
- JavaView 2.45
- Version:
- 09.11.02, 1.00 created (kp)
-
addProjects
public void addProjects()
Parses and adds all projects mentioned in the applet's parmInfo or Html page. Their names are added to the list of projects accessible via menuFILE-->LOAD.- See Also:
addProject(PjProject)
-
addProject
public boolean addProject(java.lang.String category, java.lang.String name, java.lang.String className, java.lang.String[] parmList)Registers the name and class of a project in the viewer in given 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.- Specified by:
addProjectin interfacePsViewerIf- Parameters:
category- Unique name of category used to group projectsname- Unique name of project, used for identification and selectionclassName- Class name of project, used for creationparmList- List of parameters, may benull.- See Also:
addProject(String, String, String []),addProject(PjProject),selectProject(PjProject)
-
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.- Specified by:
addProjectin interfacePvViewerIf- Parameters:
name- Unique name of project, used for identification and selectionclassName- Class name of project, used for creationparmList- List of parameters, may benull.- See Also:
addProject(String, String, String, String []),addProject(PjProject),selectProject(PjProject)
-
addProject
public boolean addProject(PjProject prj)
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.- Returns:
- false if argument is missing, has no name, or is already registered.
- See Also:
addProject(String, String, String []),selectProject(PjProject)
-
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.- Specified by:
hasProjectin interfacePvViewerIf- See Also:
getProject(String)
-
getCurrentProject
public PjProject getCurrentProject()
Get currently selected project.- See Also:
getProject(String)
-
getProject
public PjProject getProject(java.lang.String name)
Get project instance 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.
-
getProjectClasses
public java.util.Hashtable getProjectClasses()
Get hashtable with name and class of projects registered in PvViewer. The key is the project's unique long name, and the value is the project's class.- See Also:
getProjectInstances()
-
getProjectInstances
public java.util.Hashtable getProjectInstances()
Get hashtable with name and instance of projects allocated in PvViewer. The key is the project's unique long name, and the value is an instance of the project. If the project has not yet been selected, then the instance does not exist.- See Also:
getProjectClasses()
-
removeProject
public boolean removeProject(java.lang.String aName)
Deprecated. since JavaView 2.92.000, use removeProject(PjProject)Removes a registered project, project must be added again for further use.Project must be explicitly disposed using
PjProject#disposeafter calling the present method. Explicit disposal allows the individual project to clean-up its allocated resources.- Specified by:
removeProjectin interfacePvViewerIf- See Also:
PvViewerIf.hasProject(String),PvViewerIf.selectProject(String)- Version:
- 19.11.02, 1.10 revised (kp) No longer dispose project, must be done elsewhere.
-
removeProject
public boolean removeProject(PjProject proj)
Removes a registered project, project may be added again later.Project must be explicitly disposed using
PjProject#disposeafter calling the present method. Explicit disposal allows the individual project to clean-up its allocated resources.- Version:
- 14.08.03, 2.00 created (kp) Created from body of removeProject(String).
19.11.02, 1.10 revised (kp) No longer dispose project, must be done elsewhere.
-
selectProject
public boolean selectProject(PjProject prj)
Selects a project to become the active project. Selection may be done via a direct call or interactively by choosing from the menuFILE-->LOAD. Each project must be added to the viewer before it becomes selectable. If project was added by name then project is instantiated.Current display of PvViewer is added and selected in project. The method
start()of the project is invoked to start, e.g. animations. The project is made the current project in the control panel, if control frame exists already.- Parameters:
prj- will become the new active project.- Returns:
- true if project was successfully selected
- See Also:
addProject(PjProject)- Version:
- 24.07.03, 2.00 revised (kp) From original version selectProject(String).
28.12.01, 1.10 revised (kp) First set project in control then start project.
-
selectProject
public boolean selectProject(java.lang.String aName)
Deprecated. since JavaView 2.87, use selectProject(PjProject).Selects a project to become the active project. Selection may be done via a direct call or interactively by choosing from the menuFILE-->LOAD. Each project must be added to the viewer before it becomes selectable. If project was added by name then project is instantiated.Current display of PvViewer is added and selected in project. The method
start()of the project is invoked to start, e.g. animations. The project is made the current project in the control panel, if control frame exists already.- Specified by:
selectProjectin interfacePvViewerIf- See Also:
addProject(PjProject)- Version:
- 24.07.03, 2.00 revised (kp) From original version selectProject(String).
28.12.01, 1.10 revised (kp) First set project in control then start project.
-
getGeometry
public PgGeometryIf getGeometry()
Get current geometry whose inspector panels are displayed inside the control panel.- Since:
- JavaView v.3.04.001
- Version:
- 16.01.04, 1.00 created (kp)
-
setGeometry
public void setGeometry(PgGeometryIf geom)
Set current geometry whose inspector panels are displayed inside the control panel.- Specified by:
setGeometryin interfacePvViewerIf
-
update
public boolean update(java.lang.Object object)
Just a dummy routine to catch update() calls of stand-alone projects. Instead of letting a project ask itself whether it has a parent other than this PvViewer we just let it update its parent even if we do not react if the parent is this PvViewer.- Specified by:
updatein interfacePsUpdateIf- Overrides:
updatein classPsObject- Parameters:
object- carries a lot of information- Returns:
- true if event has been handled, otherwise false
- See Also:
PjProject
-
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 inPsViewerIf.- Specified by:
showDialogin interfacePvViewerIf- Parameters:
aDialog- Dialog to be shown, see jv.object.PsViewerIf.- Returns:
- Dialog true if success, false if dialog class not found.
- See Also:
PsViewerIf,hideDialog(int)- Version:
- 19.10.17, 1.61 revised (kp) Append file extension if known but not available in fileName selected in dialog.
13.03.01, 1.60 revised (kp) Import and export of display options implemented.
20.01.01, 1.40 revised (kp) With permanent panels, set visibility only if new state is different.
02.12.00, 1.30 revised (kp) On New Project first remove projects, then displays.
12.07.00, 1.20 revised (kp) Adding of new geometries handled.
25.10.99, 1.10 revised (kp) During export use m_currentGeometry instead of project's current geom.
00.00.98, 1.00 created (kp)
-
export
public boolean export(int aDialog, java.lang.String fileName, int width, int height)Export image file of currently active display with specified image size. Possible arguments for dialogs are PsViewerIf.EXPORT_PPM, PsViewerIf.EXPORT_PS etc, see static variables EXPORT_[type] inPsViewerIf.- Specified by:
exportin interfacePsViewerIf- Parameters:
aDialog- Id of a dialog determining the file formatfileName- Full file namewidth- width of imageheight- height of image, or -1 to keep aspect ratio.- Returns:
- boolean true if success, false if string data could not be generated.
- Version:
- 21.05.05, 2.00 revised (kp) Now handles all image exports.
03.04.00, 1.00 created (kp)
-
getRecentGeometryFile
public java.lang.String getRecentGeometryFile()
Deprecated. since JavaView 3.09.003, use PsJavaView#getFullFileName(int)Get the name including full path of the recently used geometry file. This information will be used as the default offer in some dialogs, for example, when exporting a geometry.- Specified by:
getRecentGeometryFilein interfacePvViewerIf- Since:
- JavaView 2.43
-
setRecentGeometryFile
public void setRecentGeometryFile(java.lang.String model)
Deprecated. since JavaView 3.09.003, use PsJavaView#setFullFileName(int, String)Set the name including full path of the recently used geometry file. This information will be used as the default offer in some dialogs, for example, when exporting a geometry.- Specified by:
setRecentGeometryFilein interfacePvViewerIf- Since:
- JavaView 2.30
-
getDialog
public PsDialog getDialog(int dialog)
Get dialog window. Possible arguments for dialogs are currentlyjv.object.PsViewerIf#ANIMATION,jv.object.PsViewerIf#CONSOLE. See static variables inPsViewerIf.- Specified by:
getDialogin interfacePvViewerIf- Parameters:
dialog- Identifier of a dialog, see jv.object.PsViewerIf- Returns:
- requested dialog, or null if not available.
- See Also:
PsViewerIf,hideDialog(int),showDialog(int)- Version:
- 30.07.00, 1.10 revised (kp) Return value changed to PsDialog, no longer return PvControl.
-
hideDialog
public boolean hideDialog(int dialog)
Hides visible dialogs. Possible arguments for dialogs are currentlyjv.object.PsViewerIf#ANIMATION,jv.object.PsViewerIf#CONSOLE,jv.object.PsViewerIf#CONTROL,jv.object.PsViewerIf#HELP. See static variables inPsViewerIf.- Specified by:
hideDialogin interfacePvViewerIf- Parameters:
dialog- Identifier of a dialog- Returns:
- true if success, false if dialog not found
- See Also:
PsViewerIf,showDialog(int)
-
newDisplay
public java.lang.String newDisplay()
Create a new AWT display inside a new frame with menu bar. 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.Projection mode is used as in current display.
Note: Method is currently only used by PvDisplay, and method is included in the interface jv.project.PvViewerIf to separate PvDisplay from PvViewer.
- Specified by:
newDisplayin interfacePvViewerIf- Returns:
- Automatically chosen name of new display
- See Also:
newDisplay(String, boolean),addDisplay(String, PvDisplayIf)- Version:
- 05.06.02, 1.50 revised (kp) Menu bar added to frame.
-
newDisplay
public PvDisplayIf newDisplay(java.lang.String name)
Deprecated. Use methodnewDisplay(String, boolean).Create a new empty AWT display inside a new frame. The frame is shown at a default position and with default size. The display becomes the selected display in this viewer.This method rescales and positions displays on the screen depending on the current number of displays.
- Specified by:
newDisplayin interfacePvViewerIf- Parameters:
name- Name of new display. If name is null, then default name is chosen.- Returns:
- Newly created display
- See Also:
PvViewerIf.newDisplay(String, boolean)
-
newDisplay
public PvDisplayIf newDisplay(java.lang.String name, boolean bFrame, boolean bSelect)
Create a new empty AWT display which is optionally placed inside a new frame. Optionally, this display becomes the selected display in this viewer.If a frame is allocated then the frame is not displayed and must be made visible in the application. The idea behind "not showing the frame" is as follows: if the frame is shown immediately then PvViewer must use a default window size and position. If the user would like to adjust this size, then he can do so only after the frame is already visible. Therefore, I do not show the frame in order to avoid instantaneous resizing.
The display is added to the center of the frame. The frame may be obtained from the display via
PvDisplayIf#getFrame().- Specified by:
newDisplayin interfacePvViewerIf- Parameters:
name- Name of new display. If name is null, then default name is chosen.bFrame- Iftruethen allocate a frame and add display to center.bSelect- Iftruethen select this display as current display.- Returns:
- Newly created display
- See Also:
newDisplay(String, boolean),addDisplay(String, PvDisplayIf),PvDisplayIf.getFrame()- Version:
- 21.11.2018, 1.10 revised (kp) No longer assign a frame when bFrame==false.
-
newDisplay
public PvDisplayIf newDisplay(java.lang.String name, boolean bFrame)
Create a new empty AWT display which is optionally placed inside a new frame. The display becomes the selected display in this viewer.Method simply invokes: return newDisplay(name, bFrame, true);
- Specified by:
newDisplayin interfacePvViewerIf- Parameters:
name- Name of new display. If name is null, then default name is chosen.bFrame- Iftruethen allocate a frame and add display to center.- Returns:
- Newly created display
- See Also:
newDisplay(String, boolean, boolean),addDisplay(String, PvDisplayIf),PvDisplayIf.getFrame()
-
getDisplay
public PvDisplayIf getDisplay()
Get currently selected 3d-display, for example, for inclusion in an applet. If no display exists, then an instance of PvDisplay is allocated and returned. This method is a convenient shortcut to create an instance of PvDisplay and register and select it in the viewer.- Specified by:
getDisplayin interfacePvViewerIf- Returns:
- PvDisplayIf the currently selected 3d-display
- See Also:
getDisplays(),newDisplay(String, boolean, boolean),addDisplay(String, PvDisplayIf)- Version:
- 14.07.00, 1.10 revised (kp) No longer select DisplayAWT on return.
-
getDisplays
public PvDisplayIf[] getDisplays()
Get array of registered displays.- Specified by:
getDisplaysin interfacePvViewerIf- Returns:
- array of registered displays
- See Also:
getDisplay()
-
hasDisplay
public boolean hasDisplay(PvDisplayIf disp)
Determine whether a display is registered in the viewer.- Specified by:
hasDisplayin interfacePvViewerIf- Parameters:
disp- display to be checked- Returns:
falseif display is not registered.- See Also:
addDisplay(String, PvDisplayIf)- Version:
- 16.03.01, 1.50 revised (kp) Returned value change to boolean from String.
-
addDisplay
public boolean addDisplay(java.lang.String name, PvDisplayIf disp)Register a new display under a name. Name must be unique among displays. Name will become the name of the display which can be obtained with display#getName().This viewer is registered as parent and key listener of the display.
- Specified by:
addDisplayin interfacePvViewerIf- Parameters:
name- name of displaydisp- display to be added- Returns:
falseif same name already exists.- See Also:
hasDisplay(PvDisplayIf),selectDisplay(PvDisplayIf)
-
filesDropped
public void filesDropped(java.io.File[] files)
Listener method when files are dropped into a registered drop listener, e.g. a display.- Specified by:
filesDroppedin interfacePsDropListenerIf- Parameters:
files- An array of files that were dropped on a component.- Since:
- JavaView 4.80.015
- Version:
- 26.04.17, 1.00 created (kp)
-
removeDisplay
public boolean removeDisplay(PvDisplayIf disp)
Remove a registered display from list of registered displays.This viewer is removed as key listener of the display.
- Specified by:
removeDisplayin interfacePvViewerIf- Parameters:
disp- display to be removed- Returns:
falseif display is not registered.- See Also:
addDisplay(String, PvDisplayIf),hasDisplay(PvDisplayIf)- Version:
- 14.06.00, 1.10 revised (ep) Not only hide frame but also remove it from internal list.
-
selectDisplay
public boolean selectDisplay(PvDisplayIf disp)
Select a registered display to become the active display.The first selected display becomes the main display to which 'New Projects' are loaded.
- Specified by:
selectDisplayin interfacePvViewerIf- Parameters:
disp- display to selected- Returns:
falseif display is not registered.- See Also:
addDisplay(String, PvDisplayIf),hasDisplay(PvDisplayIf)
-
getSelectedDisplay
public PvDisplayIf getSelectedDisplay()
Get currently selected display.
-
getNumFrames
public int getNumFrames()
Get number of registered frame. Number is used for automatic numbering when creating new frames from menu.- Returns:
- number of registered frames
-
showAllFrames
public void showAllFrames()
Bring all frames to front (unless a frame is minimized).- Since:
- JavaView 3.97.033
- Version:
- 26.11.06, 1.00 created (kp)
-
windowOpened
public void windowOpened(java.awt.event.WindowEvent event)
No method body, just declared to fulfill interface WindowListener.- Specified by:
windowOpenedin interfacejava.awt.event.WindowListener
-
windowClosed
public void windowClosed(java.awt.event.WindowEvent event)
No method body, just declared to fulfill interface WindowListener.- Specified by:
windowClosedin interfacejava.awt.event.WindowListener
-
windowDeiconified
public void windowDeiconified(java.awt.event.WindowEvent event)
No method body, just declared to fulfill interface WindowListener.- Specified by:
windowDeiconifiedin interfacejava.awt.event.WindowListener
-
windowIconified
public void windowIconified(java.awt.event.WindowEvent event)
No method body, just declared to fulfill interface WindowListener.- Specified by:
windowIconifiedin interfacejava.awt.event.WindowListener
-
windowDeactivated
public void windowDeactivated(java.awt.event.WindowEvent event)
No method body, just declared to fulfill interface WindowListener.- Specified by:
windowDeactivatedin interfacejava.awt.event.WindowListener
-
windowActivated
public void windowActivated(java.awt.event.WindowEvent event)
Select display if window is instance of class Frame containing a display.- Specified by:
windowActivatedin interfacejava.awt.event.WindowListener
-
windowClosing
public void windowClosing(java.awt.event.WindowEvent event)
Exit the application, or, if run as applet, close window.- Specified by:
windowClosingin interfacejava.awt.event.WindowListener
-
showPanel
public boolean showPanel(int aPanel)
Make a panel visible if the control window has been created already. The panel appears 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 the control window has not been created yet then the requested panel id is stored and shown when the control window becomes visible.
If panel has already been requested by a call to
getPanel(int)then a call to showPanel is void and returns false.- Specified by:
showPanelin interfacePvViewerIf- Parameters:
aPanel- Id of panel to be shown, see PsViewerIf for possible values- Returns:
- Panel
trueif success,falseif panel not found or used outside via methodgetPanel(int). - See Also:
getPanel(int)
-
setEnabledPanel
public boolean setEnabledPanel(int aPanel, boolean cond)Enable or disable menu entry of panel.- Specified by:
setEnabledPanelin interfacePvViewerIf- Parameters:
aPanel- Id of panel to be enabled, see PsViewerIf for possible valuescond-trueenables this panel's menu entry; if false, disables it.- Returns:
trueif panel exists, otherwisefalse.- See Also:
isEnabledPanel(int),showPanel(int)- Version:
- 25.07.03, 1.10 revised (kp) Renamed to setEnabledPanel() from enablePanel().
-
isEnabledPanel
public boolean isEnabledPanel(int aPanel)
Check if menu entry of panel is enable or disable.- Parameters:
aPanel- Id of panel to be enabled, see PsViewerIf for possible values- Returns:
trueif menu entry of panel is enabled.- See Also:
setEnabledPanel(int, boolean)
-
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 separate 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 methodshowPanel(int). Menu entries will be disabled but still visible.- Specified by:
getPanelin interfacePvViewerIf- Parameters:
aPanel- Id of requested panel, see PsViewerIf for possible values- Returns:
- Requested panel if it exists, otherwise null.
- See Also:
showPanel(int)- Version:
- 10.10.03, 1.60 revised (kp) Return type changed back to Panel from PsPanel to prevent need for recompilation of old JARs.
13.08.03, 1.50 revised (kp) Return type changed to PsPanel from Panel.
-
isEmbedded
public boolean isEmbedded()
Check if JavaView is embedded into another system. Setting the embeddedness flag allows other software to switch off the System.exit() call when JavaView is exited, and to take over control then without being exited itself. The default return value isfalse.- Returns:
trueif the user has set embeddedness- See Also:
setEmbedded(boolean)
-
setEmbedded
public void setEmbedded(boolean flag)
Check if JavaView is embedded into another system. Setting the embeddedness flag allows other software to switch off the System.exit() call when JavaView is exited, and to take over control then without being exited itself.- See Also:
isEmbedded()
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent event)
Event currently not handled.- Specified by:
keyTypedin interfacejava.awt.event.KeyListener
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent event)
Event currently not handled.- Specified by:
keyReleasedin interfacejava.awt.event.KeyListener
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent event)
Receives function key and strg-key events to show and hide panels. The original F1 key is received by the display and has forward it. The F2 key is received by the control window when pressed right after the F1 key since input focus passes over to control window once it opens. If display receives focus again then F2 arrives here.Disable the following request since this would bring the display to front and hide the just opened panel behind the display. Simultaneously we disable the requestFocus() in PvDisplay when the mouse focus moves over the display.
- Specified by:
keyPressedin interfacejava.awt.event.KeyListener- Version:
- 25.10.16, 1.60 revised (kp) Key F2 now toggles showing of control panel.
18.05.13, 1.30 revised (kp) When showing of project panel in control window is enforced, then show control and validate frame.
15.06.02, 1.20 revised (kp) Bring panel to front and avoid hiding behind display.
28.09.99, 1.10 created (kp) Added validation of frames.
-
destroy
public void destroy()
Called from an applet.destroy() method to perform clean-up when applet is destroyed. Here we just close and dispose all control windows.Method is synchronized with start(), stop() and destroy() to avoid synchronization problems when applets are opened and closed very fast.
- Specified by:
destroyin interfacePvViewerIf
-
start
public void start()
Depending on applet parameter show control panel and call start method of current project. Method should be called sometimes after the viewer has been created and projects have been registered in order to invoke the start method of the current project. Usually, this method is invoked when the start method of an applet is called.Method is synchronized with start(), stop() and destroy() to avoid synchronization problems when applets are opened and closed very fast.
- Specified by:
startin interfacePvViewerIf- See Also:
PjProject.start()- Version:
- 03.10.01, 1.30 (kp) Start project before parsing display applet parameters.
22.03.01, 1.20 (kp) Repaint of display added if display parameter encountered.
02.10.99, 1.10 (kp) Showing of control moved in front of project.start().
-
stop
public void stop()
Dispose open dialogs and invoke stop method of projects. E.g. close control window if shown, and stop running animations.Method is synchronized with start(), stop() and destroy() to avoid synchronization problems when applets are opened and closed very fast.
- Specified by:
stopin interfacePvViewerIf- See Also:
PjProject.stop()- Version:
- 11.11.01, 1.10 revised (kp) Do not set current project to null.
-
export
public boolean export(int aDialog, java.lang.String fileName)Export geometries of active display or display setting without opening a dialog. If a file format allows a single geometry only then the currently active geometry is exported, otherwise all visible geometries are exported. Possible arguments for file formats are PsViewerIf.EXPORT_JVX etc, see static variables EXPORT_[type] inPsViewerIf.- Specified by:
exportin interfacePsViewerIf- Parameters:
aDialog- ID of dialog determining the file formatfileName- full file name- Returns:
- boolean true if success, false if string data could not be generated.
- Version:
- 21.04.05, 2.00 revised (kp) All image export moved to separate export() method.
13.03.01, 1.20 revised (kp) Import and export of display options implemented.
24.04.00, 1.10 revised (kp) Export only visible geometries.
07.02.00, 1.00 created (kp)
-
newToolbar
public PsToolbar newToolbar(java.awt.Frame frame)
Create a new toolbar for frame.
-
newMenuBar
public PvControlMenu newMenuBar(java.awt.Frame frame)
Create a new menubar and call setEnabled(boolean) depending on the current scene. The menubar is added to the list of menubars handled by PvViewer. The returned menubar must be added to the argument frame by the calling program.HACK: should handle the closing of the frame using a listener interface. Currently the menu will not have a CLOSE entry if argument frame==null.
- Parameters:
frame- parent frame of the menubar which will be closed on CLOSE.- Returns:
- menubar which must be included in a frame somewhere else.
-
updateFonts
public void updateFonts(int size)
-
-
"