Documentation of 'jv.object.PsObject' Java class
PsObject ("JavaView Reference Manual")
"JavaView? v5.03.003"
jv.object

Class PsObject

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsUpdateIf
    Direct Known Subclasses:
    MyClass, PdColor, PgBndConstraint, PgDomainDescr, PgFem, PgFrame, PgGeometry, PgMacroPatch, PgTexture, PgU3dSrc, PgVertexStar, PgWeierstrassDescr, PiImageSource, PjProject, PjWorkshop, PnBandEigenSolver, PnEnergyMinimizer, PnExplodePolytope, PnFunction, PnGeodesicRK, PnJacobi, PnOde, PnSparseMatrix, PsAnimation, PsAuthorInfo, PsGeometryInfo, PsJavaView, PsJvzConfig, PsKey, PsLicense, PsPdfConfig, PuBoolean, PuColorBar, PuComplexFunction, PuDouble, PuEnum, PuFunction, PuHistogram, PuInteger, PuIntervalDescr, PuPriorityQueue, PuProgressBar, PvCamera, PvImageDisplay, PvScene, PvViewer, PwCurvature, PwRivaraBisection


    public class PsObject
    extends java.lang.Object
    implements PsUpdateIf, java.lang.Cloneable, java.io.Serializable
    Super class in JavaView which implements the update interface and has an info panel. Every class which implements the update interface PsUpdateIf may have PsObject as super class unless it is a panel, dialog etc. which are derived from PsPanel and PsDialog.

    Subclasses must call the init() method in each constructor, and each init() method must call super.init() at first. The following layout may be used:

            public class myClass extends mySuperClass
                    public myClass() {
                            ...     // create all instance variables
                            if (getClass() == myClass.class)
                                    init();
                    }
                    public void init() {
                            super.init();
                            ...     // initialization of instance variables, allows to use init() as reset()
                    }
     
    This ensures that the init() method of superclasses is called. Otherwise even the init() methods of the superclasses will not be called. The init() method should be written such that it can be used to reset the current instance. Therefore, all creation of instance variables should be placed in the constructor, as far as possible.

    Each instance of PsObject may have an associated info panel as interactive inspector. Most information in the panel is interactively modifiable. The class name of an info panel may follow a special naming convention: "name of main class"+"_IP". This convention allows the method getInfoPanel() of PsObject to find this class automatically if it is in the same java package as the main class. For example, jv.geom.PgPointSet.java and jv.geom.PgPointSet_IP.java are a pair of base class and info panel.

    If a class does not have an own inspector class then the inspector of its superclass is used. Each object may have several other inspectors with different filename extensions which are accessible via the menu of the control window.

    Each instance of PsObject has a unique default name of the form 'object_NUMBER' where NUMBER is a unique integer number counting the number of created instances. The name should be changed using method setName(String) since it is used e.g. as header of the inspector panel, and in debug output as a unique reference to the object.

    The tag variable may be used locally in methods or projects. They have no global influence, and a user cannot rely on the value once a method is left.

    Since JavaView 1.74, we get the Class object that describes any Java type using the new class literal syntax. A class literal is simply the name of a type (a class name or a primitive type name) followed by a period and the class keyword. For example:

     Class o = PsObject.class;
     Class i = int.class;
     Class v = java.util.Vector.class;
     
    Prior to JavaView 1.74 we used the Java 1.0 style, where we got the Class object from the name of a data type using the forName() class method of Class.
    See Also:
    Serialized Form
    Author:
    Konrad Polthier
    Version:
    31.07.04, 1.95 revised (kp) New methods get/setSymbol(String) added.
    29.07.03, 1.91 revised (kp) Assign standard string "" as name in constructor.
    25.07.02, 1.90 revised (kp) Parent is now serialized.
    24.01.02, 1.80 revised (ep) Bug in addInspector removed.
    22.06.00, 1.70 revised (kp) Additional flag FIXED added which allows to freeze an object.
    20.03.00, 1.60 revised (kp) Constructor used .class literal to decide calling init().
    19.08.99, 1.50 revised (kp) Inspector panels in hashtable, update listeners added.
    23.01.99, 1.20 revised (kp) Initialization of parent with setParent instead of update.
    16.11.98, 1.10 revised (kp) method newInstance(,,) added
    00.00.97, 1.00 created (kp)
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int HAS_BOUNDARY_PANEL
      Tag object as having a texture panel.
      static int HAS_CONFIG_PANEL
      Tag object as having a control panel.
      static int HAS_INFO_PANEL
      Tag object as having an inspector panel.
      static int HAS_LABEL_PANEL
      Tag object as having a font panel.
      static int HAS_MATERIAL_PANEL
      Tag object as having a material panel.
      static int HAS_TEXTURE_PANEL
      Tag object as having a texture panel.
      static int HAS_VECTOR_PANEL
      Tag object as having a vector field panel.
      static java.lang.String INSPECTOR_INFO
      Deprecated. 
      use PsPanel.INFO instead
      static java.lang.String INSPECTOR_INFO_EXT
      Deprecated. 
      use PsPanel.INFO_EXT instead
      static int IS_DELETED
      Tag object as been deleted, applications should not continue to access its data.
      static int IS_FIXED
      Tag object as been fixed, applications should not modify its data.
      static int IS_FOCUSSED
      Tag object as being within the focus of a device, and further action might pick or select this object.
      static int IS_PICKED
      Tag object as being temporarily picked in a device and interactively modified.
      static int IS_SELECTED
      Tag object as been selected, applications may use this tag.
      static int IS_USED
      Tag object as been used, applications may use this tag.
      static int NUM_TAGS
      Number of available tags to describe state of object.
    • Constructor Summary

      Constructors 
      Constructor and Description
      PsObject()
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method and Description
      boolean addInspector(java.lang.String name, PsPanel panel)
      Register a new inspector, and set current object as parent of panel.
      boolean addUpdateListener(PsUpdateIf listener)
      Register a new update listener.
      PsPanel assureInspector(java.lang.String name, java.lang.String ext)
      Get a certain panel - if it does not exist then try to allocate it.
      void clearTag(int aBit)
      Clear tag of object.
      java.lang.Object clone()
      Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners.
      static PsObject[] clone(PsObject[] src)
      Duplicate array and all entries by recursively cloning all instance variables except inspector panels and lists of registered listeners.
      static PsObject[][] clone(PsObject[][] src)
      Duplicate array and all entries by recursively cloning all instance variables except inspector panels and lists of registered listeners.
      void copy(PsObject object)
      Copy the content of data instance variables from argument object to this object.
      PsUpdateIf getFather()
      Get unique parent of an object.
      PsPanel getInfoPanel()
      Get info panel, or if panel does not exist then try to allocate it.
      PsPanel getInspector(java.lang.String name)
      Get a registered inspector panel.
      java.lang.String getName()
      Get name identifying the object.
      static int getNumObjects()
      Get number of allocated instances of PsObject and its subclasses.
      java.lang.String getSymbol()
      Get symbol, i.e. shortcut name, which identifies this object in equations.
      boolean hasInspector(java.lang.String name)
      Check for a registered inspector panel by name.
      boolean hasTag(int aBit)
      Check whether tag of object is set.
      boolean hasUpdateListener(PsUpdateIf listener)
      Check whether an instance is a registered listener.
      void init()
      If instance has missing name then assign default name 'Object_NUMBER' where number is the total number of already created instances.
      static boolean instanceOf(java.lang.Object obj, java.lang.Class cl)
      Method checks if an object extends a given class or one of its superclasses.
      boolean instanceOf(java.lang.String className)
      Deprecated. 
      use "if (getClass() == PsObject.class)" instead
      PsPanel newInspector(java.lang.String ext)
      Create and register a new inspector panel of this class, and set current object as parent of inspector panel.
      PsPanel newInspector(java.lang.String name, java.lang.String ext)
      Create and register a new inspector panel of this class, and set current object as parent of inspector panel.
      boolean removeInspector(PsPanel panel)
      Remove a registered inspector panel from list of registered inspectors.
      boolean removeInspector(java.lang.String name)
      Remove a registered inspector panel from list of registered inspectors.
      boolean removeUpdateListener(PsUpdateIf listener)
      Remove a registered listener from list of registered listeners.
      void setName(java.lang.String name)
      Set name identifying the object.
      void setParent(PsUpdateIf aParent)
      Set parent to receive update methods.
      void setSymbol(java.lang.String symbol)
      Set symbol, i.e. shortcut name, which identifies this object in equations.
      void setTag(int aBit)
      Set tag of object.
      java.lang.String toString()
      Create a multi-line string representation with detailed information about all instance variables.
      boolean update(java.lang.Object event)
      Update all inspector panels, send update to all registered update listeners and finally update parent.
      boolean updatePanels(java.lang.Object event)
      Partial update method to synchronize all registered inspector panels.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • NUM_TAGS

        public static final int NUM_TAGS
        Number of available tags to describe state of object. Applications usually add additional tags for own purposes.
        See Also:
        setTag(int), Constant Field Values
      • IS_DELETED

        public static final int IS_DELETED
        Tag object as been deleted, applications should not continue to access its data.
        See Also:
        setTag(int), Constant Field Values
      • IS_FIXED

        public static final int IS_FIXED
        Tag object as been fixed, applications should not modify its data.
        Since:
        JavaView 1.95
        See Also:
        setTag(int), Constant Field Values
      • IS_PICKED

        public static final int IS_PICKED
        Tag object as being temporarily picked in a device and interactively modified.
        Since:
        JavaView 2.99.012
        See Also:
        setTag(int), Constant Field Values
      • IS_FOCUSSED

        public static final int IS_FOCUSSED
        Tag object as being within the focus of a device, and further action might pick or select this object.
        Since:
        JavaView 2.99.012
        See Also:
        setTag(int), Constant Field Values
      • HAS_INFO_PANEL

        public static final int HAS_INFO_PANEL
        Tag object as having an inspector panel. Usually tag is set in the constructor.
        Since:
        JavaView 1.95
        See Also:
        setTag(int), Constant Field Values
      • HAS_MATERIAL_PANEL

        public static final int HAS_MATERIAL_PANEL
        Tag object as having a material panel. Usually tag is set in the constructor.
        Since:
        JavaView 1.95
        See Also:
        setTag(int), Constant Field Values
      • HAS_BOUNDARY_PANEL

        public static final int HAS_BOUNDARY_PANEL
        Tag object as having a texture panel. Usually tag is set in the constructor.
        Since:
        JavaView 2.03
        See Also:
        setTag(int), Constant Field Values
      • HAS_TEXTURE_PANEL

        public static final int HAS_TEXTURE_PANEL
        Tag object as having a texture panel. Usually tag is set in the constructor.
        Since:
        JavaView 2.03
        See Also:
        setTag(int), Constant Field Values
      • HAS_VECTOR_PANEL

        public static final int HAS_VECTOR_PANEL
        Tag object as having a vector field panel. Usually tag is set in the constructor.
        Since:
        JavaView 2.28
        See Also:
        setTag(int), Constant Field Values
      • HAS_LABEL_PANEL

        public static final int HAS_LABEL_PANEL
        Tag object as having a font panel. Usually tag is set in the constructor.
        Since:
        JavaView 3.52.001
        See Also:
        setTag(int), Constant Field Values
      • HAS_CONFIG_PANEL

        public static final int HAS_CONFIG_PANEL
        Tag object as having a control panel. Usually tag is set in the constructor.
        Since:
        JavaView 1.95
        See Also:
        setTag(int), Constant Field Values
      • INSPECTOR_INFO_EXT

        public static final java.lang.String INSPECTOR_INFO_EXT
        Deprecated. use PsPanel.INFO_EXT instead
        Identifier of class extension characterizing info panels.
        See Also:
        Constant Field Values
      • INSPECTOR_INFO

        public static final java.lang.String INSPECTOR_INFO
        Deprecated. use PsPanel.INFO instead
        Name of default info panel under which panel is registered in panel list.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PsObject

        public PsObject()
        Constructor. Increase total number of created instances.
    • Method Detail

      • init

        public void init()
        If instance has missing name then assign default name 'Object_NUMBER' where number is the total number of already created instances.
        Version:
        26.10.04, 1.10 revised (kp) Use plain name prefix 'Object' since resource might not be loaded yet.
      • toString

        public java.lang.String toString()
        Create a multi-line string representation with detailed information about all instance variables. E.g. use PsDebug.message(object.toString()) to print information to console. This method is usually extended by subclasses with further information.
        Overrides:
        toString in class java.lang.Object
      • clone

        public static PsObject[][] clone(PsObject[][] src)
        Duplicate array and all entries by recursively cloning all instance variables except inspector panels and lists of registered listeners. The parent relationship is maintained only within this class but not to external classes. In general, all links of the clone to external objects are set to null.
        See Also:
        copy(PsObject)
        Version:
        05.07.00, 1.00 created (kp)
      • clone

        public static PsObject[] clone(PsObject[] src)
        Duplicate array and all entries by recursively cloning all instance variables except inspector panels and lists of registered listeners. The parent relationship is maintained only within this class but not to external classes. In general, all links of the clone to external objects are set to null.
        See Also:
        copy(PsObject)
        Version:
        05.07.00, 1.00 created (kp)
      • clone

        public java.lang.Object clone()
        Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners. The parent relationship is maintained only within this class but not to an external parent. In general, all links of the clone to external objects are set to null.
        Overrides:
        clone in class java.lang.Object
        See Also:
        copy(PsObject)
        Version:
        21.10.00, 1.10 revised (kp) Clone tags too which was explicitly not done before.
        05.07.00, 1.00 created (kp)
      • getNumObjects

        public static int getNumObjects()
        Get number of allocated instances of PsObject and its subclasses.
      • copy

        public void copy(PsObject object)
        Copy the content of data instance variables from argument object to this object. Instance variables are copied recursively.

        Instance variables like parent and listeners are not copied.

        See Also:
        clone()
      • update

        public boolean update(java.lang.Object event)
        Update all inspector panels, send update to all registered update listeners and finally update parent. Each of those updates has this object as event independent of the argument of this method.

        Central update method of this object. Must be overwritten if this class receives unknown events, say, from new children. Any subclass must class invoke super.update(event) on all events it does handle itself.

        Specified by:
        update in interface PsUpdateIf
        Parameters:
        event - carries a lot of information
        Returns:
        true if event has been handled, otherwise false
        See Also:
        setParent(PsUpdateIf), getFather(), addUpdateListener(PsUpdateIf)
        Version:
        21.01.01, 1.15 revised (kp) Update of inspector panels moved into separate method.
        29.06.00, 1.10 revised (kp) Ensure that events from panels lead to update of other panels.
      • updatePanels

        public boolean updatePanels(java.lang.Object event)
        Partial update method to synchronize all registered inspector panels. This method is a convenience for certain classes like PuDouble which automatically and instantaneously synchronize their panels whenever, say, their value has changed. This is in contrast to heavier classes b which only synchronize their panels on a call b.update(panel of b) or b.update(b).

        Method does nothing if event is neither the object nor any of the inspector panels registered with this object. Method issues a warning if event is not among the registered inspector panels.

        If event is the object, then all inspector panels are updated or set out of date. If event is a registered inspector panel, then only the other panels are updated, assuming the event panel has triggered this update process.

        If inspector panel is visible then panel.update(this) is called to refresh the content of the panel. If panel is not visible then panel is set out of date and will be updated when it becomes visible.

        Usually, application classes do not call this method but use update(Object).

        Parameters:
        event - Either this object or a registered panel.
        Returns:
        false, if no event or event is unknown.
        See Also:
        update(Object), addInspector(String, PsPanel)
        Version:
        21.01.01, 1.00 created (kp) Extracted from update(Object).
      • addUpdateListener

        public boolean addUpdateListener(PsUpdateIf listener)
        Register a new update listener. Update listener must be different from this base class and parent of this base since those are always updated.
        Parameters:
        listener - Listener to register
        Returns:
        false if listener already registered.
        See Also:
        hasUpdateListener(PsUpdateIf), removeUpdateListener(PsUpdateIf)
      • getName

        public java.lang.String getName()
        Get name identifying the object.
        Specified by:
        getName in interface PsUpdateIf
      • setName

        public void setName(java.lang.String name)
        Set name identifying the object. Should be chosen unique. The given name may not be Null or the empty string.
        Version:
        17.07.03, 1.10 revised (kp) Reject missing and empty names.
      • getSymbol

        public java.lang.String getSymbol()
        Get symbol, i.e. shortcut name, which identifies this object in equations.
        Since:
        JavaView 3.50.002
        Version:
        31.07.04, 1.00 created (kp)
      • setSymbol

        public void setSymbol(java.lang.String symbol)
        Set symbol, i.e. shortcut name, which identifies this object in equations. The given name may be null but not the empty string.
        Since:
        JavaView 3.50.002
        Version:
        31.07.04, 1.00 created (kp)
      • clearTag

        public void clearTag(int aBit)
        Clear tag of object. For possible tags see PsObject.
      • hasTag

        public boolean hasTag(int aBit)
        Check whether tag of object is set. For possible tags see PsObject.
      • setTag

        public void setTag(int aBit)
        Set tag of object. For possible tags see PsObject.
      • instanceOf

        public final boolean instanceOf(java.lang.String className)
        Deprecated. use "if (getClass() == PsObject.class)" instead
        Method checks if this object is exactly instance of a class given by its class name. Package names of class may be optionally given. Even if string denotes a super class method returns false. This method is different from Java operator instanceof which is true even if current instance is subclass of class 'className'.
        Parameters:
        className - name of class without package identifiers
        Returns:
        true if current object is exact instance of class
        See Also:
        instanceOf(Object, Class)
      • instanceOf

        public static boolean instanceOf(java.lang.Object obj,
                                         java.lang.Class cl)
        Method checks if an object extends a given class or one of its superclasses. An instanceof that works on Class objects at runtime, instead of type descriptors at compile time.
        Parameters:
        obj - object to test
        cl - class or interface
        Returns:
        true, if object is instance of class or its superclasses
        See Also:
        instanceOf(String)
      • newInspector

        public PsPanel newInspector(java.lang.String name,
                                    java.lang.String ext)
        Create and register a new inspector panel of this class, and set current object as parent of inspector panel.

        The parameter name specifies the string under which the inspector is registered in the list of inspectors of this class. Any name of an inspector panels is possible except the string PsPanel.INFO, PsPanel.MATERIAL which are reserved for JavaView internal panels.

        The extension string allows this method to reconstruct the file name of the inspector panel from the name of this class. For example, if the name of this class is 'jvx.geom.Torus' then the name of the inspector panel must be 'jvx.geom.Torus_myExt' if the parameter extension is '_myExt', e.g. PsPanel#INFO_EXT.

        This method calls addInspector(String, PsPanel).

        Parameters:
        name - any name except one of the reserved inspector names
        ext - suffix to name of base class
        Returns:
        new panel
        See Also:
        addInspector(String, PsPanel), getInspector(String), hasInspector(String), newInspector(String), removeInspector(PsPanel), removeInspector(String)
        Version:
        28.12.01, 1.00 created (kp)
      • assureInspector

        public PsPanel assureInspector(java.lang.String name,
                                       java.lang.String ext)
        Get a certain panel - if it does not exist then try to allocate it. This method is a shortcut to avoid checking, creating, and adding the panel to the inspector list.

        Class name of info panel must consist of the name of the class to be inspected and '_IP' as suffix. In this case the panel is automatically found.

         For example:
            assureInspector(PsPanel.INFO, PsPanel.INFO_EXT)
         

        Method is a shortcut to avoid checking, creating, and adding the panel to the inspector list.

        Parameters:
        name - name of panel
        ext - suffix to name of base class
        Returns:
        existing or new inspector panel
        See Also:
        addInspector(String, PsPanel), getInspector(String), hasInspector(String), newInspector(String), newInspector(String, String), removeInspector(PsPanel), removeInspector(String)
        Version:
        03.06.01, 1.00 revised (kp)
        03.06.01, 1.00 created (kp)
      • getInfoPanel

        public PsPanel getInfoPanel()
        Get info panel, or if panel does not exist then try to allocate it. Standard panel for inspecting standard internal data such as vertex arrays etc. of geometry.

        Class name of info panel must consist of the name of the class to be inspected and '_IP' as suffix. In this case the panel is automatically found.

        Method is a shortcut to avoid checking, creating, and adding the panel to the inspector list. But note, obtaining an inspector with this method provides always the same panel instance, that is, this panel should only be used within a single other container, for example. If more panels are needed the create panels with different names using assureInspector(String, String).

        Returns:
        existing or new inspector panel
        See Also:
        addInspector(String, PsPanel), getInspector(String), hasInspector(String), newInspector(String), newInspector(String, String), removeInspector(String)
        Version:
        03.06.01, 2.00 revised (kp) Method simply calls assureInspector().
        07.06.00, 1.10 revised (kp) Recreate panel if language has changed.
"JavaView? v5.03.003"

"

The software JavaView? is copyright protected. All Rights Reserved.
"

You see the box below because you did not login.