vgp.tutor.model
Class PjModel
java.lang.Object
jv.object.PsObject
jv.project.PjProject
vgp.tutor.model.PjModel
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.lang.Cloneable, java.util.EventListener, PsTimeListenerIf, PsUpdateIf, PvPickListenerIf, java.io.Serializable
- public class PjModel
- extends PjProject
- implements java.awt.event.ActionListener
Tutorial on usage of importing models from file.
Three methods to load a geometry from file are presented:
- The first loading takes place inside the start method of the project
where a geometry from a given file is loaded, without any user
interaction. Of course, the code may be inserted into any other
method than the start() method. This is a batch version.
- The second loading may be invoked by opening the control panel of
JavaView and import a model from the menu
File -> Import -> ...
This adds the loaded geometry to this project, and this project overwrites
the methods addGeometry() and selectGeometry() to show how the project
might react on newly loaded geometries. Here just a message is printed.
- The third loading may be invoked by including a separate panel of the
project PjImportModel into the info panel of this project. In this case
the import project should exist as instance, and this project should be
its ActionListener to be able to receive events invoked by the import project
when its info panel has received user interaction.
- See Also:
PvViewer,
Serialized Form
| Fields inherited from class jv.object.PsObject |
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 |
|
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent event)
|
boolean |
addGeometry(PgGeometryIf geom)
Overwrite method of superclass to be able to react when new geometry
is loaded from file by menu import.
|
void |
init()
Initialize and reset project, stops the running animation if any.
|
void |
removeGeometry(PgGeometryIf geom)
Overwrite method of superclass to be able to react when new geometry
is loaded from file by menu import.
|
void |
selectGeometry(PgGeometryIf geom)
Overwrite method of superclass to be able to react when new geometry
is loaded from file by menu import.
|
void |
start()
Start method is invoke when project is selected in the viewer. |
| Methods inherited from class jv.project.PjProject |
addDisplay, addGeometry, dispose, dragDisplay, dragInitial, dragVertex, fitDisplays, getAnimation, getDisplay, getDisplays, getGeometry, getGeometry, getNumGeometries, getParameter, getViewer, hasAnimation, hasDisplay, isEnabledAutoFit, markVertices, pickDisplay, pickInitial, pickVertex, removeDisplay, removeGeometries, selectDisplay, setAnimation, setBackColor, setBorderType, setDisplay, setEnabledAutoFit, setGeometry, setParameter, setTime, setViewer, stop, unmarkVertices |
| 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, update, updatePanels |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
PjModel
public PjModel()
init
public void init()
- Description copied from class:
PjProject
- Initialize and reset project, stops the running animation if any.
Does not reset any registered display nor geometry. They must
be reset individually in each subclass.
- Overrides:
init in class PjProject
start
public void start()
- Start method is invoke when project is selected in the viewer. Here
the loading of geometry from file is demonstrated as a batch version
using another instance of PjImportModel.
- Overrides:
start in class PjProject
- See Also:
PvViewerIf.start(),
PjProject.isEnabledAutoFit()
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
- Specified by:
actionPerformed in interface java.awt.event.ActionListener
addGeometry
public boolean addGeometry(PgGeometryIf geom)
- Overwrite method of superclass to be able to react when new geometry
is loaded from file by menu import.
This method is invoked when the import menu is pressed.
- Overrides:
addGeometry in class PjProject
- Parameters:
geom - geometry to be added to this project and the current display.
- Returns:
false if geometry was null or already registered in project.
selectGeometry
public void selectGeometry(PgGeometryIf geom)
- Overwrite method of superclass to be able to react when new geometry
is loaded from file by menu import.
This method is invoked when the imported geometry is accepted.
- Specified by:
selectGeometry in interface PvPickListenerIf- Overrides:
selectGeometry in class PjProject
removeGeometry
public void removeGeometry(PgGeometryIf geom)
- Overwrite method of superclass to be able to react when new geometry
is loaded from file by menu import.
This method is invoked when the imported geometry is cancelled.
- Overrides:
removeGeometry in class PjProject
The software JavaView© is copyright protected. All Rights Reserved.