Class VisualizationHelper

java.lang.Object
com.ptc.wvs.common.ui.VisualizationHelper
All Implemented Interfaces:
VisualizationHelperIfc

public class VisualizationHelper extends Object implements VisualizationHelperIfc
The VisualizationHelper class provides abstract access to class methods in the com.ptc.wvs package from external packages such as wt and provides visualization helper methods.

Supported API: true

Extendable: false
  • Field Details

    • THUMBNAILS_PROP_PAGE_PREF_KEY

      public static final String THUMBNAILS_PROP_PAGE_PREF_KEY
      Thumbnail preference key to use in getIndexOfVisLink

      Supported API: true
      See Also:
    • DEFAULT_THUMBNAILS_PROP_PAGE_PREF_VALUE

      public static final String DEFAULT_THUMBNAILS_PROP_PAGE_PREF_VALUE
      Thumbnail preference default value to use in getIndexOfVisLink

      Supported API: true
      See Also:
  • Constructor Details

    • VisualizationHelper

      public VisualizationHelper()
      No-arg constructor for this VisualizationHelper class.

      Supported API: true
  • Method Details

    • isWVSEnabled

      public boolean isWVSEnabled()
      Returns true if visualization services are enabled

      Supported API: true
      Specified by:
      isWVSEnabled in interface VisualizationHelperIfc
    • isVisualNavigationInstalled

      public boolean isVisualNavigationInstalled()
      Returns true if visual nagigation is installed

      Supported API: true
      Specified by:
      isVisualNavigationInstalled in interface VisualizationHelperIfc
    • isDisplayPartViewEnabled

      public boolean isDisplayPartViewEnabled()
      Returns true if the WVS property partstructureview is true. NOTE: Also insures that visualization services and required software is installed and configured.

      Supported API: true
      Specified by:
      isDisplayPartViewEnabled in interface VisualizationHelperIfc
    • getThumbnailSize

      public int[] getThumbnailSize()
      Returns the thumbnail width and height

      Supported API: true
      Specified by:
      getThumbnailSize in interface VisualizationHelperIfc
    • getCreateDialogWindow

      public String getCreateDialogWindow()
      Returns the JavaScript to create a Dialog Window. This should be called once per page, and included in the HEAD of the page

      Supported API: true
      Specified by:
      getCreateDialogWindow in interface VisualizationHelperIfc
    • getDefaultVisualizationData

      public String[] getDefaultVisualizationData(String representableObjectReference, Boolean forListing, Locale locale)
      Returns a set of HTML fragments to display thumbnails and other visualization action links

      Supported API: true
      Specified by:
      getDefaultVisualizationData in interface VisualizationHelperIfc
      Parameters:
      representableObjectReference - The object reference of the representable
      forListing - Specifies if the resulting HTML is to be used in a listing
      locale - Specifies the locale to use for tooltip display
      Returns:
      String[] HTML fragments, which can be extracted using the "...Index" methods in this class
    • productViewLinkIndex

      public int productViewLinkIndex()
      Returns the index of the Launch ProductView link in the data array returned by getDefaultVisualizationData

      Supported API: true
      Specified by:
      productViewLinkIndex in interface VisualizationHelperIfc
    • thumbnailLinkIndex

      public int thumbnailLinkIndex()
      Returns the index of the thumbnail, Publish Me, or Launch ProductView link in the data array returned by getDefaultVisualizationData. The graphic returned depends on the state of the Representable object.

      Supported API: true
      Specified by:
      thumbnailLinkIndex in interface VisualizationHelperIfc
    • clipboardLinkIndex

      public int clipboardLinkIndex()
      Returns the index of the Add to Clipboard link in the data array returned by getDefaultVisualizationData

      Supported API: true
      Specified by:
      clipboardLinkIndex in interface VisualizationHelperIfc
    • printLinkIndex

      public int printLinkIndex()
      Returns the index of the Print link in the data array returned by getDefaultVisualizationData

      Supported API: true
      Specified by:
      printLinkIndex in interface VisualizationHelperIfc
    • viewRepsLinkIndex

      public int viewRepsLinkIndex()
      Returns the index of the view representations link in the data array returned by getDefaultVisualizationData

      Supported API: true
      Specified by:
      viewRepsLinkIndex in interface VisualizationHelperIfc
    • getIndexOfVisLink

      public int getIndexOfVisLink(String prefKey, String prefDefault)
      Returns the index in the data array returned by getDefaultVisualizationData of the HTML fragment to use for launching PV. This depends on the thumbnail preference setting for the client. The index returned will be that of the element containing the Launch PV icon (productViewLinkIndex) or the element containing the thumbnail (thumbnailLinkIndex).
      Specified by:
      getIndexOfVisLink in interface VisualizationHelperIfc
      Parameters:
      prefKey - The key for the user preference to display thumbnails use THUMBNAILS_PROP_PAGE_PREF_KEY for the property page preference key
      prefDefault - The default value for the key, use DEFAULT_THUMBNAILS_PROP_PAGE_PREF_VALUE for the default property page value

      Supported API: true
    • findDescribedParts

      public WTCollection findDescribedParts(EPMDocument _targetEPMDoc, int _linkNavigation, boolean _executeHook)
      Find Described Parts for the given EPMDocument.
      Specified by:
      findDescribedParts in interface VisualizationHelperIfc
      Parameters:
      _targetEPMDoc - The EPMDocument object to find all of the Described Parts for.
      _linkNavigation - Indicate which links should be used when doing the navigation from the given EPMDocument to the Described Parts. The following are supported values which can be concatenated together to indicate more than one link type (Bit Mask): VisualizationHelperIfc.LINK_NAVIGATION_NON_OWNER VisualizationHelperIfc.LINK_NAVIGATION_NON_PRIMARY_OWNER VisualizationHelperIfc.LINK_NAVIGATION_DESCRIBE VisualizationHelperIfc.LINK_NAVIGATION_ALL
      boolean - _executeHook Whether or not to execute a configured "Find Described Parts" hook. See wvs.properties.xconf for configuration information.

      Supported API: true
    • copyToDescribedParts

      public boolean copyToDescribedParts(Representation _sourceRepresentation, boolean _includeMarkUps, boolean _defaultRepresentation, boolean _requireOwnerLink, boolean _latestIteration, int _linkNavigation)
      Copies the source Representation to the described parts.
      Specified by:
      copyToDescribedParts in interface VisualizationHelperIfc
      Parameters:
      _sourceRepresentation - Representation to copy from.
      _includeMarkUps - Copy all associated MarkUps associated to the representation.
      _defaultRepresentation - Should the source representation be the "default" in order to proceed with copying to all described parts.
      _requireOwnerLink - Should the target EPMDocument have a Owner link to a WTPart in order to proceed with copying to all described parts.
      _latestIteration - Should the target EPMDocument be the latest iteration in order to proceed with copying to all described parts.
      _linkNavigation - Indicate which links should be used when doing the navigation from the given EPMDocument to the Described Parts. The following are supported values which can be concatenated together to indicate more than one link type (Bit Mask): VisualizationHelperIfc.LINK_NAVIGATION_NON_OWNER VisualizationHelperIfc.LINK_NAVIGATION_NON_PRIMARY_OWNER VisualizationHelperIfc.LINK_NAVIGATION_DESCRIBE VisualizationHelperIfc.LINK_NAVIGATION_ALL
      Returns:
      boolean If the copy was successful

      Supported API: true
    • copyToDescribedParts

      public boolean copyToDescribedParts(Representation _sourceRepresentation, EPMDocument _targetEPMDocument, boolean _includeMarkUps, boolean _defaultRepresentation, boolean _requireOwnerLink, boolean _latestIteration, int _linkNavigation)
      Copy a representation to all described parts.
      Specified by:
      copyToDescribedParts in interface VisualizationHelperIfc
      Parameters:
      _sourceRepresentation - Representation to copy from.
      _targetEPMDocument - The EPMDocument used to find associated described parts to copy the source representation to.
      _includeMarkUps - Copy all associated MarkUps associated to the representation.
      _defaultRepresentation - Should the source representation be the "default" in order to proceed with copying to all described parts.
      _requireOwnerLink - Should the target EPMDocument have a Owner link to a WTPart in order to proceed with copying to all described parts.
      _latestIteration - Should the target EPMDocument be the latest iteration in order to proceed with copying to all described parts.
      _linkNavigation - Indicate which links should be used when doing the navigation from the given EPMDocument to the Described Parts. The following are supported values which can be concatenated together to indicate more than one link type (Bit Mask): VisualizationHelperIfc.LINK_NAVIGATION_NON_OWNER VisualizationHelperIfc.LINK_NAVIGATION_NON_PRIMARY_OWNER VisualizationHelperIfc.LINK_NAVIGATION_DESCRIBE VisualizationHelperIfc.LINK_NAVIGATION_ALL
      Returns:
      boolean If the copy was successful

      Supported API: true
    • findRepresentable

      public Representable findRepresentable(Persistable d)
      Find the representable to be used for a given object. If the object is an EPMDocument this will return an actively associated WTPart, otherwise if the object is Representable it will return the same object as was passed.
      Specified by:
      findRepresentable in interface VisualizationHelperIfc
      Parameters:
      Persistable - d - object to find Representable for
      Returns:
      Representable

      Supported API: true
    • getRepresentations

      public QueryResult getRepresentations(Persistable d)
      Get the representations for an object. If an EPMDocument is given this will locate the representations on an actively associated WTPart
      Parameters:
      Persistable - d - object to locate representations for
      Returns:
      QueryResult of Representations

      Supported API: true
    • getRepresentation

      public Representation getRepresentation(Persistable d)
      Get the default representation for an object. If an EPMDocument is given this will locate a representation on an actively associated WTPart
      Specified by:
      getRepresentation in interface VisualizationHelperIfc
      Parameters:
      Persistable - d - object to locate representation for
      Returns:
      Representation

      Supported API: true
    • getRepresentation

      public Representation getRepresentation(Persistable d, String repName)
      Get the named representation for an object. If an EPMDocument is given this will locate a representation on an actively associated WTPart
      Specified by:
      getRepresentation in interface VisualizationHelperIfc
      Parameters:
      Persistable - d - object to locate representation for
      String - repName - the Represnetation name
      Returns:
      Representation

      Supported API: true
    • setAccess

      public static boolean setAccess(Representation representation, VisualizationHelper.RepresentationPermission permission, WTPrincipal principal)
      Set AdHoc permissions on Representations. This method will return true of successful. If it returns false, look for stack trace in the method serverlog.

      Pre-requisites: For this API to work, the Principal calling this API should have "Change Permissions" access on the Representations in the given domain. Also the principal calling this method can only give permissions (not take away) that he/she has.

      Supported API: true
      Parameters:
      representation - The representation you want to set adhoc permissions on
      permission - This can be either VisualizationHelper.Representation.READ or VisualizationHelper.Representation.MODIFY or VisualizationHelper.Representation.DELETE
      principal - The WTPrincipal who gets the access permissions
      Returns:
      boolean