JavaView© v3.95.000

jv.loader
Class PjImportModel

java.lang.Object
  extended byjv.object.PsObject
      extended byjv.project.PjProject
          extended byjv.loader.PjImportModel
All Implemented Interfaces:
java.lang.Cloneable, PsTimeListenerIf, PsUpdateIf, PvPickListenerIf, java.io.Serializable
Direct Known Subclasses:
PjVectorField

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, PjModel, Serialized Form

Field Summary
static int CONFIRM_CANCEL
          Confirmation id determines return status of an import model dialog.
static int CONFIRM_CLICKED
          Confirmation id determines return status of an import model dialog.
static int CONFIRM_OK
          Confirmation id determines return status of an import model dialog.
static java.lang.String DIR_LIST
          Name of file containing list of model files in each directory.
static int FULL_INFO_PANEL
          Identifies the full import inspector panel with selection from categories.
static boolean JVD_INFO
          Enable display of JVD author and abstract information in list panel.
static int MEDIUM_INFO_PANEL
          Identifies the medium sized import inspector panel with selection from a list of geometry files.
static 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.
 
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
 
Constructor Summary
PjImportModel()
          Constructor with default full info panel.
 
Method Summary
 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 in the textfield of the small info panel.
 java.lang.String getAuthor()
          Get author information of geometry to be displayed on info panel.
 java.lang.String getBaseDir()
          Get full path to base directory of model collection.
 java.lang.String getCategory()
          Get currently selected category.
 int getConfirm()
          Allow world to check whether user has choosen OK or Cancel, when existing the import dialog.
 PvDisplayOption[] getDisplayOption()
          Get display options which some parsers fill out.
 java.lang.String getFileName()
          Get filename including full path of a geometry file.
 java.lang.String getInfo()
          Get information of geometry to be displayed on info panel.
 PsPanel getInfoPanel()
          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.String getNotice()
          Get notice displayed on info panel.
 int getNumRows()
          Get number of rows of model list on info panel.
 java.lang.String getSelectedFileName()
          Get selected file name.
 java.lang.String getTitle()
          Get title displayed on info panel.
 void init()
          Initialize and reset project, stops the running animation if any.
 boolean isAnimated()
          Flag whether currently loaded data is interpreted an animation.
 boolean isEnabledLoadCamera()
          Check if automatic loading of camera settings is enabled.
 boolean isEnabledRemoveGeometry()
          Check if removal of geometries during reload is enabled.
 boolean isModal()
          Indicates whether the import dialog is modal.
 boolean isVisibleReplaceChoice()
          Determine if two choices in info panel are shown which allow adding or replacing existing geometry.
 boolean load(java.lang.String fullFileName)
          Load geometry model from file or URL and add it as selected geometry to this project.
 void removeActionListener(java.awt.event.ActionListener listener)
          Remove a previously added action listener.
 void setAnimated(boolean flag)
          Set flag whether currently loaded data should be interpreted an animation.
 void setAuthor(java.lang.String author)
          Set author information of geometry to be displayed on info panel.
 void setBase(java.lang.String baseDir)
          Set full path to base directory of model collection.
 void setCategory(java.lang.String category)
          Set currently selected category.
 void setEnabledLoadCamera(boolean bLoadCamera)
          Enable automatic loading of camera settings.
 void setEnabledRemoveGeometry(boolean bRemoveGeometry)
          Enable removal of previous geometries in display.
 void setFileName(java.lang.String fullFileName)
          Set filename including full path of a geometry file.
 void setInfo(java.lang.String info)
          Set information of geometry to be displayed on info panel.
 void setModal(boolean modal)
          Specifies whether the import dialog is modal.
 void setModelNames(java.lang.String[] name)
          Set names of model files to be displayed in list menu.
 void setNotice(java.lang.String notice)
          Set notice displayed on info panel.
 void setNumRows(int numRows)
          Set number of rows of model list on info panel.
 void setParentProject(PjProject project)
          Register parent project to which the model will be loaded.
 void setSelectedFileName(java.lang.String fileName)
          Set selected file name.
 void setTitle(java.lang.String title)
          Set title displayed on info panel.
 void setTypeOfInfoPanel(int infoType)
          Set type of info panel.
 void setVisibleReplaceChoice(boolean bReplaceChoice)
          Show two choices in info panel which allow adding or replacing existing geometry.
 void start()
          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, getViewer, hasAnimation, hasDisplay, isEnabledAutoFit, markVertices, pickDisplay, pickInitial, pickVertex, removeDisplay, removeGeometries, removeGeometry, selectDisplay, selectGeometry, 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, 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
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, getName, setParent, update
 

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 cancelling 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.

Constructor Detail

PjImportModel

public PjImportModel()
Constructor with default full info panel.

Method Detail

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()
Load geometry file if file name has been specified. Otherwise do nothing.

Overrides:
start in class PjProject
See Also:
PvViewerIf.start(), PjProject.isEnabledAutoFit()

getNumRows

public int getNumRows()
Get number of rows of model list on info panel.

Since:
JavaView 3.60.001

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

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

setNotice

public void setNotice(java.lang.String notice)
Set notice displayed on info panel.

Since:
JavaView 3.25.000

getInfo

public java.lang.String getInfo()
Get information of geometry to be displayed on info panel.

Since:
JavaView 3.25.000

setInfo

public void setInfo(java.lang.String info)
Set information of geometry to be displayed on info panel.

Since:
JavaView 3.25.000

getAuthor

public java.lang.String getAuthor()
Get author information of geometry to be displayed on info panel.

Since:
JavaView 3.25.000

setAuthor

public void setAuthor(java.lang.String author)
Set author information of geometry to be displayed on info panel.

Since:
JavaView 3.25.000

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

setVisibleReplaceChoice

public void setVisibleReplaceChoice(boolean bReplaceChoice)
Show two choices in info panel which allow adding or replacing existing geometry.

Since:
JavaView 3.53.002

isEnabledRemoveGeometry

public boolean isEnabledRemoveGeometry()
Check if removal of geometries during reload is enabled.

Since:
JavaView 3.25.000

setEnabledRemoveGeometry

public void setEnabledRemoveGeometry(boolean bRemoveGeometry)
Enable removal of previous geometries in display.

Since:
JavaView 3.25.000

isEnabledLoadCamera

public boolean isEnabledLoadCamera()
Check if automatic loading of camera settings is enabled.

Since:
JavaView 3.24.003

setEnabledLoadCamera

public void setEnabledLoadCamera(boolean bLoadCamera)
Enable automatic loading of camera settings.

Since:
JavaView 3.24.003

getSelectedFileName

public java.lang.String getSelectedFileName()
Get selected file name. Currently only used as hint for medium info panel.

Since:
JavaView 3.24.003

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

getModelNames

public java.lang.String[] getModelNames()
Get names of model files to be displayed in list menu.

Since:
JavaView 3.24.003

setModelNames

public void setModelNames(java.lang.String[] name)
Set names of model files to be displayed in list menu.

Since:
JavaView 3.24.003

isAnimated

public boolean isAnimated()
Flag whether currently loaded data is interpreted an animation.

Since:
JavaView 2.49.002

setAnimated

public void setAnimated(boolean flag)
Set flag whether currently loaded data should be interpreted an animation.

Since:
JavaView 2.49.002

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

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

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:
getInfoPanel in class PsObject
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)

getConfirm

public int getConfirm()
Allow world to check whether user has choosen 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.


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. Use getConfirm() to check whether user has accepted or cancelled an interactive loading process.

Parameters:
fullFileName - fully specified file name including code base, or URL.
Returns:
true if model has been successfully loaded.

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 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 via getConfirm().


removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Remove a previously added action listener.


JavaView© v3.95.000

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