public abstract class PjWorkshop extends PsObject implements PjWorkshopIf
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
MODE_BUG, MODE_STANDARD, MODE_VALIDATE
Constructor and Description |
---|
PjWorkshop(java.lang.String aName)
Constructor with unique name.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancel operation of this workshop by resetting the assigned geometry,
and finally close this workshop.
|
void |
close()
Close workshop and remove itself as listener from various classes.
|
PvDisplayIf |
getDisplay()
Get the active display when this workshop was launched.
|
java.util.Vector |
getDisplays()
Get the list of displays.
|
PgGeometry |
getGeometry()
Get the assigned geometry on which this workshop operates.
|
int |
getMode()
Gets the mode in which this workshop runs.
|
PgGeometry |
getSavedGeometry()
Get clone of originally assigned geometry.
|
PvViewerIf |
getViewer()
Get the viewer manager when this workshop was launched.
|
void |
init()
Initialize and reset project, stops the running animation if any.
|
boolean |
isModal()
Check if workshop runs modal, that means only this workshop should be open.
|
boolean |
isStandalone()
Check if current workshop is running standalone (default),
that is, the workshop is not embedded inside another parent workshop.
|
void |
ok()
Accept current version of the geometry as new version.
|
PjWorkshop_Dialog |
openDialog(PgGeometry geom,
PvDisplayIf display)
Set the geometry and display of this workshop and create and show a dialog window.
|
void |
removeGeometry()
Remove the assigned geometry and its backup clone.
|
void |
reset()
Reset this workshop to its initial state from which computations
can start.
|
void |
setDisplay(PvDisplayIf display)
Set the active display when this workshop was launched.
|
void |
setDisplays(java.util.Vector dispList)
Assign the list of displays.
|
void |
setGeometry(PgGeometry geom)
Assign a geometry on which this workshop operates,
and create a backup clone of the geometry.
|
void |
setModal(boolean modal)
Set flag if workshop runs modal, that means only this workshop should be open.
|
void |
setMode(int mode)
Sets the mode in which this workshop runs.
|
void |
setStandalone(boolean flag)
Set flag if current workshop is running standalone (default),
that is, the workshop is not embedded inside another parent workshop.
|
void |
setViewer(PvViewerIf viewer)
Set the viewer manager when this workshop was launched.
|
boolean |
update(java.lang.Object event)
Updates the geometry if this workshop has changed,
i.e. if the event is
this or null . |
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFather, getName, setParent
public PjWorkshop(java.lang.String aName)
public void init()
public PjWorkshop_Dialog openDialog(PgGeometry geom, PvDisplayIf display)
PwMyWorkshop ws = new PwMyWorkshop();
ws.setDisplay(display);
ws.setGeometry(geom);
PjWorkshop_Dialog dialog = new PjWorkshop_Dialog(false);
dialog.setParent(ws);
dialog.update(this);
dialog.setVisible(true);
with one simple line:
(new PwMyWorkshop()).openDialog(geom, display);
geom
- The geometry that will be set for this the workshop.display
- The display that will be set for this workshop.public boolean update(java.lang.Object event)
this
or null
.
Also propagates update() to superclass with the original argument event.
Some subclasses may register themselves as update listener of the geometry of this workshop. In order to prevent an update loop, this method safely uses isUpdateSender() when updating the geometry.
update
in interface PsUpdateIf
update
in class PsObject
event
- sender of this update.PsObject.setParent(PsUpdateIf)
,
PsObject.getFather()
,
PsObject.addUpdateListener(PsUpdateIf)
public PgGeometry getSavedGeometry()
public PgGeometry getGeometry()
getGeometry
in interface PjWorkshopIf
public void setGeometry(PgGeometry geom)
Subclasses frequently overwrite this method but are advised to call this method.
setGeometry
in interface PjWorkshopIf
geom
- the workshop modifies this geometry.public void removeGeometry()
public PvViewerIf getViewer()
getViewer
in interface PjWorkshopIf
public void setViewer(PvViewerIf viewer)
setViewer
in interface PjWorkshopIf
public PvDisplayIf getDisplay()
getDisplay
in interface PjWorkshopIf
public void setDisplay(PvDisplayIf display)
setDisplay
in interface PjWorkshopIf
public java.util.Vector getDisplays()
getDisplays
in interface PjWorkshopIf
public void setDisplays(java.util.Vector dispList)
setDisplays
in interface PjWorkshopIf
public boolean isStandalone()
If workshop is standalone then update of geometry is triggered by geom#update() and setUpdateSender() technique. If workshop is not standalone but embedded inside a parent workshop, then this#update must be caught by parent workshop, and only the parent workshop is allowed to call geom#update.
setStandalone(boolean)
public void setStandalone(boolean flag)
If workshop is standalone then update of geometry is triggered by geom#update() and setUpdateSender() technique. If workshop is not standalone but embedded inside a parent workshop, then this#update must be caught by parent workshop, and only the parent workshop is allowed to call geom#update.
isStandalone()
public int getMode()
Most workshops do no use this method.
PjWorkshopIf.MODE_STANDARD
public void setMode(int mode)
setMode
in interface PjWorkshopIf
mode
- either MODE_STANDARD for standard mode, or MODE_BUG for debugging operations.PjWorkshopIf.MODE_STANDARD
public boolean isModal()
isModal
in interface PjWorkshopIf
setModal(boolean)
public void setModal(boolean modal)
setModal
in interface PjWorkshopIf
isModal()
public void reset()
A subclass may also want to reset a geometry to some initial state useful for this workshop, although, not always is the initial state of the geometry equivalent to the original state of the geometry, for example, if material properties of the geometry must be set specifically for this workshop. Therefore, this superclass does not restore the original duplicate of the geometry.
The reset method often is different from the init() method of a workshop since often the workshop needs information about the registered geometry to get into a working initial state.
public void ok()
Implementation in this class calls close()
.
public void close()
Subclasses may remove workshop from geometry as update listener, or remove any temporary geometries from display, if necessary.
Implementation in this class simply calls removeGeometry()
.
public void cancel()
If necessary, the duplicate of the original geometry is restored into the geometry. The update method of the geometry is called.
"