jv.loader
Class PjImportModel
- java.lang.Object
-
- jv.object.PsObject
-
- jv.project.PjProject
-
- jv.loader.PjImportModel
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, PsTimeListenerIf, PsUpdateIf, PvPickListenerIf
public class PjImportModel extends PjProject
Load geometry models from file or via http connections into JavaView. Different panels support the loading from collections of files.A tutorial applet on different ways to import models in JavaView is found in vgp.tutor.model.PjModel.
- See Also:
PjImportModel_InfoBox,PjImportModel_IP,PjImportModel_IPmed, Serialized Form- Author:
- Konrad Polthier
- Version:
- 24.02.05, 3.10 revised (kp) Default value of confirm button is cancel.
05.06.04, 3.00 revised (kp) Several new methods during implementation of PjImportModel_IPmed added.
24.01.02, 2.20 revised (ep) New method fireAction added. No longer createsPsActionSupportin constructor.
22.10.01, 2.10 revised (ep) Support for action listeners added.
17.04.00, 2.00 revised (kp) Handle array of geometries.
15.01.00, 1.20 revised (kp) Slight changes in the confirmation handling.
01.08.99, 1.10 revised (kp) Naming of models and model directories changed. Directories are now lowercase, first char of models is uppercase.
01.08.99, 1.00 created (kp)
-
-
Field Summary
Fields Modifier and Type Field and Description static intCONFIRM_CANCELConfirmation id determines return status of an import model dialog.static intCONFIRM_CLICKEDConfirmation id determines return status of an import model dialog.static intCONFIRM_OKConfirmation id determines return status of an import model dialog.static java.lang.StringDIR_LISTName of file containing list of model files in each directory.static intFULL_INFO_PANELIdentifies the full import inspector panel with selection from categories.static booleanJVD_INFOEnable display of JVD author and abstract information in list panel.static intMEDIUM_INFO_PANELIdentifies the medium sized import inspector panel with selection from a list of geometry files.static intSMALL_INFO_PANELIdentifies a tiny import inspector panel with textfield for typing a URL and with a button for opening a file browser.-
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
-
-
Constructor Summary
Constructors Constructor and Description PjImportModel()Constructor with default full info panel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddActionListener(java.awt.event.ActionListener listener)Action events are sent when a user clicks on Ok or Cancel button, doubleclicks on a model in the model dialog or presses <return> in the textfield of the small info panel.voidfireAction(int actionId, java.lang.String actionCommand)Fires an action event with source=this, id=actionId and command=actionCommand.voidfireAction(int actionId, java.lang.String actionCommand, int actionModifiers)Fires an action event with source=this, id=actionId, command=actionCommand and modifiers=actionModifiers.java.lang.StringgetAuthor()Get author information of geometry to be displayed on info panel.java.lang.StringgetBaseDir()Get full path to base directory of model collection.java.lang.StringgetCategory()Get currently selected category.intgetConfirm()Allow world to check whether user has chosen OK or Cancel, when existing the import dialog.PvDisplayOption[]getDisplayOption()Get display options which some parsers fill out.java.lang.StringgetFileName()Get filename including full path of a geometry file.java.lang.StringgetInfo()Get information of geometry to be displayed on info panel.PsPanelgetInfoPanel()Overwrite method of PsObject to allow choice of different info panels.java.lang.String[]getModelNames()Get names of model files to be displayed in list menu.java.lang.StringgetNotice()Get notice displayed on info panel.intgetNumRows()Get number of rows of model list on info panel.java.lang.StringgetSelectedFileName()Get selected file name.java.lang.StringgetTitle()Get title displayed on info panel.voidinit()Initialize and reset project, stops the running animation if any.booleanisAnimated()Flag whether currently loaded data is interpreted an animation.booleanisEnabledLoadCamera()Check if automatic loading of camera settings is enabled.booleanisEnabledRemoveGeometry()Check if removal of geometries during reload is enabled.booleanisModal()Indicates whether the import dialog is modal.booleanisVisibleReplaceChoice()Determine if two choices in info panel are shown which allow adding or replacing existing geometry.booleanload(java.lang.String fullFileName)Load geometry model from file or URL and add it as selected geometry to this project.voidremoveActionListener(java.awt.event.ActionListener listener)Remove a previously added action listener.voidsetAnimated(boolean flag)Set flag whether currently loaded data should be interpreted an animation.voidsetAuthor(java.lang.String author)Set author information of geometry to be displayed on info panel.voidsetBase(java.lang.String baseDir)Set full path to base directory of model collection.voidsetCategory(java.lang.String category)Set currently selected category.voidsetDisplay(PvDisplayIf disp)Register display in this project, add all geometries of project to the display, and register this project as pick listener in the display.voidsetEnabledLoadCamera(boolean bLoadCamera)Enable automatic loading of camera settings.voidsetEnabledRemoveGeometry(boolean bRemoveGeometry)Enable removal of previous geometries in display.voidsetFileName(java.lang.String fullFileName)Set filename including full path of a geometry file.voidsetInfo(java.lang.String info)Set information of geometry to be displayed on info panel.voidsetModal(boolean modal)Specifies whether the import dialog is modal.voidsetModelNames(java.lang.String[] name)Set names of model files to be displayed in list menu.voidsetNotice(java.lang.String notice)Set notice displayed on info panel.voidsetNumRows(int numRows)Set number of rows of model list on info panel.voidsetParentProject(PjProject project)Register parent project to which the model will be loaded.voidsetSelectedFileName(java.lang.String fileName)Set selected file name.voidsetTitle(java.lang.String title)Set title displayed on info panel.voidsetTypeOfInfoPanel(int infoType)Set type of info panel.voidsetVisibleReplaceChoice(boolean bReplaceChoice)Show two choices in info panel which allow adding or replacing existing geometry.voidstart()Load geometry file if file name has been specified.-
Methods inherited from class jv.project.PjProject
addDisplay, addGeometry, addGeometry, dispose, dragDisplay, dragInitial, dragVertex, fitDisplays, getAnimation, getDisplay, getDisplays, getGeometry, getGeometry, getNumGeometries, getParameter, getParameterInfo, getViewer, hasAnimation, hasDisplay, isEnabledAutoFit, markVertices, pickDisplay, pickInitial, pickVertex, removeDisplay, removeGeometries, removeGeometry, selectDisplay, selectGeometry, setAnimation, setBackColor, setBorderType, setEnabledAutoFit, setGeometry, setParameterInfo, setTime, setViewer, stop, unmarkVertices
-
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, 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
-
Methods inherited from interface jv.anim.PsTimeListenerIf
getName
-
Methods inherited from interface jv.project.PvPickListenerIf
getName
-
-
-
-
Field Detail
-
JVD_INFO
public static final boolean JVD_INFO
Enable display of JVD author and abstract information in list panel.- See Also:
- Constant Field Values
-
FULL_INFO_PANEL
public static final int FULL_INFO_PANEL
Identifies the full import inspector panel with selection from categories. Each category may contain a list if geometry files.- See Also:
- Constant Field Values
-
SMALL_INFO_PANEL
public static final int SMALL_INFO_PANEL
Identifies a tiny import inspector panel with textfield for typing a URL and with a button for opening a file browser.- See Also:
- Constant Field Values
-
MEDIUM_INFO_PANEL
public static final int MEDIUM_INFO_PANEL
Identifies the medium sized import inspector panel with selection from a list of geometry files. No categories exist in this panel.- See Also:
- Constant Field Values
-
CONFIRM_OK
public static final int CONFIRM_OK
Confirmation id determines return status of an import model dialog. User returned by accepting the current selection.- See Also:
getConfirm(), Constant Field Values
-
CONFIRM_CANCEL
public static final int CONFIRM_CANCEL
Confirmation id determines return status of an import model dialog. User returned by canceling the current selection.- See Also:
getConfirm(), Constant Field Values
-
CONFIRM_CLICKED
public static final int CONFIRM_CLICKED
Confirmation id determines return status of an import model dialog. User made a new current selection.- See Also:
getConfirm(), Constant Field Values
-
DIR_LIST
public static java.lang.String DIR_LIST
Name of file containing list of model files in each directory.
-
-
Method Detail
-
init
public void init()
Description copied from class:PjProjectInitialize 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.
-
start
public void start()
Load geometry file if file name has been specified. Otherwise do nothing.- Overrides:
startin classPjProject- See Also:
PvViewerIf.start(),PjProject.isEnabledAutoFit()
-
setDisplay
public void setDisplay(PvDisplayIf disp)
Register display in this project, add all geometries of project to the display, and register this project as pick listener in the display. The selected geometry of project will become the selected geometry in the display.Note, the automatic registrations can be avoided using alternatively the method
addDisplay(PvDisplayIf)be called.- Overrides:
setDisplayin classPjProject- See Also:
PjProject.addDisplay(PvDisplayIf)
-
getNumRows
public int getNumRows()
Get number of rows of model list on info panel.- Since:
- JavaView 3.60.001
- Version:
- 21.10.04, 1.00 created (kp)
-
setNumRows
public void setNumRows(int numRows)
Set number of rows of model list on info panel. Number must be assigned before project inspector is created. Default number is 6.- Since:
- JavaView 3.60.001
- Version:
- 21.10.04, 1.00 created (kp)
-
getTitle
public java.lang.String getTitle()
Get title displayed on info panel.
-
setTitle
public void setTitle(java.lang.String title)
Set title displayed on info panel.
-
getNotice
public java.lang.String getNotice()
Get notice displayed on info panel.- Since:
- JavaView 3.25.000
- Version:
- 05.06.04, 1.00 created (kp)
-
setNotice
public void setNotice(java.lang.String notice)
Set notice displayed on info panel.- Since:
- JavaView 3.25.000
- Version:
- 05.06.04, 1.00 created (kp)
-
getInfo
public java.lang.String getInfo()
Get information of geometry to be displayed on info panel.- Since:
- JavaView 3.25.000
- Version:
- 05.06.04, 1.00 created (kp)
-
setInfo
public void setInfo(java.lang.String info)
Set information of geometry to be displayed on info panel.- Since:
- JavaView 3.25.000
- Version:
- 05.06.04, 1.00 created (kp)
-
getAuthor
public java.lang.String getAuthor()
Get author information of geometry to be displayed on info panel.- Since:
- JavaView 3.25.000
- Version:
- 05.06.04, 1.00 created (kp)
-
setAuthor
public void setAuthor(java.lang.String author)
Set author information of geometry to be displayed on info panel.- Since:
- JavaView 3.25.000
- Version:
- 05.06.04, 1.00 created (kp)
-
isVisibleReplaceChoice
public boolean isVisibleReplaceChoice()
Determine if two choices in info panel are shown which allow adding or replacing existing geometry.- Since:
- JavaView 3.53.002
- Version:
- 17.08.04, 1.00 created (kp)
-
setVisibleReplaceChoice
public void setVisibleReplaceChoice(boolean bReplaceChoice)
Show two choices in info panel which allow adding or replacing existing geometry.- Since:
- JavaView 3.53.002
- Version:
- 17.08.04, 1.00 created (kp)
-
isEnabledRemoveGeometry
public boolean isEnabledRemoveGeometry()
Check if removal of geometries during reload is enabled.- Since:
- JavaView 3.25.000
- Version:
- 05.06.04, 1.00 created (kp)
-
setEnabledRemoveGeometry
public void setEnabledRemoveGeometry(boolean bRemoveGeometry)
Enable removal of previous geometries in display.- Since:
- JavaView 3.25.000
- Version:
- 05.06.04, 1.00 created (kp)
-
isEnabledLoadCamera
public boolean isEnabledLoadCamera()
Check if automatic loading of camera settings is enabled.- Since:
- JavaView 3.24.003
- Version:
- 01.06.04, 1.00 created (kp)
-
setEnabledLoadCamera
public void setEnabledLoadCamera(boolean bLoadCamera)
Enable automatic loading of camera settings.- Since:
- JavaView 3.24.003
- Version:
- 01.06.04, 1.00 created (kp)
-
getSelectedFileName
public java.lang.String getSelectedFileName()
Get selected file name. Currently only used as hint for medium info panel.- Since:
- JavaView 3.24.003
- Version:
- 01.06.04, 1.00 created (kp)
-
setSelectedFileName
public void setSelectedFileName(java.lang.String fileName)
Set selected file name. Currently only used as hint for medium info panel.- Since:
- JavaView 3.24.003
- Version:
- 01.06.04, 1.00 created (kp)
-
getModelNames
public java.lang.String[] getModelNames()
Get names of model files to be displayed in list menu.- Since:
- JavaView 3.24.003
- Version:
- 01.06.04, 1.00 created (kp)
-
setModelNames
public void setModelNames(java.lang.String[] name)
Set names of model files to be displayed in list menu.- Since:
- JavaView 3.24.003
- Version:
- 01.06.04, 1.00 created (kp)
-
isAnimated
public boolean isAnimated()
Flag whether currently loaded data is interpreted an animation.- Since:
- JavaView 2.49.002
- Version:
- 10.01.03, 1.00 created (kp)
-
setAnimated
public void setAnimated(boolean flag)
Set flag whether currently loaded data should be interpreted an animation.- Since:
- JavaView 2.49.002
- Version:
- 10.01.03, 1.00 created (kp)
-
isModal
public boolean isModal()
Indicates whether the import dialog is modal. A modal dialog grabs all input from the user.- Since:
- JavaView 3.01.001
- Version:
- 25.11.03, 1.00 created (kp)
-
setModal
public void setModal(boolean modal)
Specifies whether the import dialog is modal. A modal dialog grabs all the input to the parent frame from the user.- Since:
- JavaView 3.01.001
- Version:
- 25.11.03, 1.00 created (kp)
-
getBaseDir
public java.lang.String getBaseDir()
Get full path to base directory of model collection.
-
setBase
public void setBase(java.lang.String baseDir)
Set full path to base directory of model collection.
-
getCategory
public java.lang.String getCategory()
Get currently selected category.
-
setCategory
public void setCategory(java.lang.String category)
Set currently selected category.
-
getFileName
public java.lang.String getFileName()
Get filename including full path of a geometry file.
-
setFileName
public void setFileName(java.lang.String fullFileName)
Set filename including full path of a geometry file.
-
setTypeOfInfoPanel
public void setTypeOfInfoPanel(int infoType)
Set type of info panel. Method must be called before info panel has been created.- Parameters:
infoType- type of info panel, e.g. PjImportModel.FULL_INFO_PANEL
-
getInfoPanel
public PsPanel getInfoPanel()
Overwrite method of PsObject to allow choice of different info panels.- Overrides:
getInfoPanelin classPsObject- Returns:
- existing or new inspector panel
- See Also:
PsObject.addInspector(String, PsPanel),PsObject.getInspector(String),PsObject.hasInspector(String),PsObject.newInspector(String),PsObject.newInspector(String, String),PsObject.removeInspector(String)- Version:
- 04.03.00, 1.10 revised (kp) Slight modifications to avoid access of m_infoPanel.
-
getConfirm
public int getConfirm()
Allow world to check whether user has chosen OK or Cancel, when existing the import dialog. For example, used by other projects to restore a backup geometry if user cancels dialog.- Returns:
- Confirmation id such as
PjImportModel#CONFIRM_OK
-
setParentProject
public void setParentProject(PjProject project)
Register parent project to which the model will be loaded. When parent project is registered then a model container will be immediately added to parent project. If user selects a model from file then container model is filled or replaced if model in file has different type.If user cancels the loading process then the container model is removed from parent project. If user accepts the loaded model then it is selected in the parent project.
- Author:
- Konrad Polthier
- Version:
- 15.01.00, 1.10 revised (kp) Chosen model is now selected.
01.08.99, 1.00 created (kp)
-
load
public boolean load(java.lang.String fullFileName)
Load geometry model from file or URL and add it as selected geometry to this project.Use
getGeometry()to get a reference to the loaded model. UsegetConfirm()to check whether user has accepted or canceled an interactive loading process.- Parameters:
fullFileName- fully specified file name including code base, or URL.- Returns:
trueif model has been successfully loaded.- Author:
- Konrad Polthier
- Version:
- 26.11.06, 1.20 revised (kp) Bug in ADD mode corrected where too many intermediate geometries were kept.
15.01.00, 1.10 revised (kp) Accepted model is now selected.
01.08.99, 1.00 created (kp)
-
getDisplayOption
public PvDisplayOption[] getDisplayOption()
Get display options which some parsers fill out.
-
addActionListener
public void addActionListener(java.awt.event.ActionListener listener)
Action events are sent when a user clicks on Ok or Cancel button, doubleclicks on a model in the model dialog or presses <return> in the textfield of the small info panel. The event is sent after the model is loaded. You can check the type of the action viagetConfirm().
-
removeActionListener
public void removeActionListener(java.awt.event.ActionListener listener)
Remove a previously added action listener.
-
fireAction
public void fireAction(int actionId, java.lang.String actionCommand)Fires an action event with source=this, id=actionId and command=actionCommand.- Version:
- 18.05.13, 1.10 revised (kp) Method made public to support other derived import projects.
-
fireAction
public void fireAction(int actionId, java.lang.String actionCommand, int actionModifiers)Fires an action event with source=this, id=actionId, command=actionCommand and modifiers=actionModifiers.- Version:
- 18.05.13, 1.10 revised (kp) Method made public to support other derived import projects.
-
-
"