Request

Response

    UI

    Autodesk.Viewing.UI.PropertyPanel

    Extends DockingPanel

    new PropertyPanel(parentContainer,id,title,options)

    Property panel.

    A panel for displaying a set of properties that are optionally categorized.

    Parameters

    parentContainer*
    HTMLElement
    The container for this panel.
    id*
    string
    The id for this panel.
    title*
    string
    The initial title for this panel.
    options
    object
    An optional dictionary of options. Currently unused.
    * Required

    Methods

    addEventListener(target,eventId,callback)

    Adds an event listener to a given target that has an addEventListener(event, callback) API. These event listeners are tracked by the DockingPanel and are automatically removed on uninitialize.

    Parameters

    target*
    object
    The target that will fire the event.
    eventId*
    string
    The event to be listened to.
    callback*
    function
    The callback to execute when the event is fired.
    * Required

    addProperty(name,value,category,options)

    Adds a property to this panel. The property is defined by its name, value, and category. The add will fail if a property with the same name, value, and category already exists.

    Parameters

    Expand all
    name*
    string
    The name of the property to add.
    value*
    string
    The value of the property to add.
    category*
    string
    The category of the property to add.
    options
    Object
    An optional dictionary of options.
    localizeCategory
    boolean
    When true, localization is attempted for the given category
    localizeProperty
    boolean
    When true, localization is attempted for the given property
    * Required

    Returns

    TypeDescription
    boolean
    • true if the property was added, false otherwise.

    addVisibilityListener(callback)

    Adds a callback to call when this DockingPanel changes visibility.

    Parameters

    callback*
    function
    A function that takes in a single boolean parameter indicating the current visibility state.
    * Required

    areDefaultPropertiesShown()

    Override this to return true if the default properties are being displayed.

    createCloseButton()

    Creates a close button to add to this DockingPanel. When clicked, this DockingPanel is hidden. Call this method during initialize() if a standard close button is desired, and then add it to an existing container.

    Returns

    TypeDescription
    HTMLElement The created close button.

    createScrollContainer(options)

    Creates a scroll container element to add to this DockingPanel. Call this method during initialize() if a scroll container is needed. The function will create the scroll container and make it available via the “scrollContainer” property of the DockingPanel.

    Parameters

    Expand all
    options
    object
    An optional dictionary of options.
    left
    boolean
    When true, the scrollbar appears on the left.
    heightAdjustment
    number
    The scroll container height is 100% of the panel minus the height adjustment. Provide a value to account for other elements in the panel like a title bar.
    marginTop
    number
    The marginTop setting for the scroll container’s CSS style, in pixels.

    createTitleBar(title)

    Inherits createTitleBar

    Creates a title bar element to add to this DockingPanel. Call this method during initialize() if a standard title bar is desired, and then add it to an existing container.

    Parameters

    title*
    string
    The text to use in the title bar.
    * Required

    Returns

    TypeDescription
    HTMLElement The created title bar.

    displayCategory(category,parent,options)

    Creates and adds the HTML elements to display the given category.

    Parameters

    Expand all
    category*
    Object
    A category object.
    parent*
    HTMLElement
    The parent to attach the new HTML elements.
    options
    Object
    An optional dictionary of options.
    localize
    boolean
    When true, localization is attempted for the given category name.
    * Required

    Returns

    TypeDescription
    Array elementList - the list of HTML elements to include when highlighting. Warning: ensure no event listeners are attached to these elements as they will be lost during highlighting.

    displayProperty(property,parent,options)

    Creates and adds the HTML elements to display the given property.

    Parameters

    Expand all
    property*
    Object
    A property object.
    parent*
    HTMLElement
    The parent to attach the new HTML elements.
    options
    Object
    An optional dictionary of options.
    localize
    boolean
    When true, localization is attempted for the given property name.
    * Required

    Returns

    TypeDescription
    Array elementList - the list of HTML elements to include when highlighting. Warning: ensure no event listeners are attached to these elements as they will be lost during highlighting.

    getCategoryClass(category)

    Override this to specify the CSS classes of a category. This way, in CSS, the designer can specify custom styling for specific category types.

    Parameters

    category*
    Object
    * Required

    Returns

    TypeDescription
    string
    • CSS classes for the category.

    getContainerBoundingRect()

    Returns the parent’s container bounding rectangle.

    Returns

    TypeDescription
    ClientRect Bounding rectangle of the parent.

    getContentSize()

    Returns the width and height to be used when resizing the panel to the content.

    Returns

    TypeDescription
    Object

    getPropertyClass(property)

    Override this to specify the CSS classes of a property. This way, in CSS, the designer can specify custom styling for specific property types.

    Parameters

    property*
    Object
    * Required

    Returns

    TypeDescription
    string
    • CSS classes for the property.

    hasProperties()

    Returns whether this property panel currently has properties.

    Returns

    TypeDescription
    boolean
    • true if there are properties to display, false otherwise.

    highlight(text,options)

    Highlights the given text if found in the property name or value.

    Parameters

    text*
    string
    The text to highlight.
    options
    Object
    An optional dictionary of options. Currently unused.
    * Required

    initialize()

    Inherits initialize

    Creates the sub-elements of this DockingPanel. Override this in derived classes. The default implementation is to create a title bar with the title or id provided in the constructor. The title bar also acts as the move handler for the DockingPanel. Finally, a close button is added to the top right corner.

    initializeCloseHandler(closer)

    Initializes the given HTMLDomElement as the close handle for this DockingPanel. When this element is clicked, this DockingPanel is hidden.

    Parameters

    closer*
    HTMLElement
    The DOM element that will act as the close handle.
    * Required

    initializeMoveHandlers(mover)

    Initializes the given HTMLDomElement as the move handle for this DockingPanel. When this element is clicked and dragged, this DockingPanel is moved.

    Parameters

    mover*
    HTMLElement
    The DOM element that will act as the move handle.
    * Required

    isCategoryCollapsed(category)

    Returns whether the given category is currently collapsed.

    Parameters

    category*
    Object
    A category object.
    * Required

    Returns

    TypeDescription
    boolean
    • true if the category is collapsed, false otherwise.

    isVisible()

    Inherits isVisible

    Gets the new visibility state of this DockingPanel.

    Returns

    TypeDescription
    boolean Whether or not the panel is visible.

    onCategoryClick(category,event)

    Override this method to do something when the user clicks on a category. The default implementation is to toggle the collapse state of the category.

    Parameters

    category*
    Object
    event*
    Event
    * Required

    onCategoryDoubleClick(category,event)

    Override this method to do something when the user double clicks on a category.

    Parameters

    category*
    Object
    event*
    Event
    * Required

    onCategoryIconClick(category,event)

    Override this method to do something when the user clicks on a category’s icon. The default implementation is to toggle the collapse state of the category.

    Parameters

    category*
    Object
    event*
    Event
    * Required

    onCategoryRightClick(category,event)

    Override this method to do something when the user right clicks on a category.

    Parameters

    category*
    Object
    event*
    Event
    * Required

    onEndMove(event,endX,endY)

    Inherits onEndMove

    Override this event to be notified when this panel ends a move operation.

    Parameters

    event*
    MouseEvent
    The mouseup event.
    endX*
    number
    The ending x position of the panel in pixels.
    endY*
    number
    The ending y position of the panel in pixels.
    * Required

    onMove(event,currentX,currentY)

    Inherits onMove

    Override this to be notified when this panel is moved. Note, do not forget to call this base class method in the overriding method.

    Parameters

    event*
    MouseEvent
    The mousemove event.
    currentX*
    number
    The current x position of the panel in pixels.
    currentY*
    number
    The current y position of the panel in pixels.
    * Required

    onPropertyClick(property,event)

    Override this method to do something when the user clicks on a property.

    Parameters

    property*
    Object
    event*
    Event
    * Required

    onPropertyDoubleClick(property,event)

    Override this method to do something when the user double clicks on a property.

    Parameters

    property*
    Object
    event*
    Event
    * Required

    onPropertyIconClick(property,event)

    Override this method to do something when the user clicks on a property’s icon.

    Parameters

    property*
    Object
    event*
    Event
    * Required

    onPropertyRightClick(property,event)

    Override this method to do something when the user right clicks on a property.

    Parameters

    property*
    Object
    event*
    Event
    * Required

    onStartMove(event,startX,startY)

    Inherits onStartMove

    Override this event to be notified when this panel begins a move operation.

    Parameters

    event*
    MouseEvent
    The mousedown event.
    startX*
    number
    The starting x position of the panel in pixels.
    startY*
    number
    The starting y position of the panel in pixels.
    * Required

    onTitleClick(event)

    Inherits onTitleClick

    Override this method to be notified when the user clicks on the title.

    Parameters

    event*
    Event
    * Required

    onTitleDoubleClick(event)

    Override this method to be notified when the user double-clicks on the title.

    Parameters

    event*
    Event
    * Required

    removeAllProperties()

    Removes all properties from the panel.

    removeEventListener(target,eventId,callback)

    Removes an existing event listener added using DockingPanel.addEventListener.

    Parameters

    target*
    object
    The target with the event listener.
    eventId*
    string
    The id of the event being listened to.
    callback*
    function
    The callback executed when the event is fired.
    * Required

    Returns

    TypeDescription
    boolean True if the listener was removed successfully; false otherwise.

    removeProperty(name,value,category,options)

    Removes a property from this panel. The property is defined by its name, value, and category.

    Parameters

    name*
    string
    The name of the property to remove.
    value*
    string
    The value of the property to remove.
    category*
    string
    The category of the property to remove.
    options
    Object
    An optional dictionary of options. Currently unused.
    * Required

    Returns

    TypeDescription
    boolean
    • true if the property was removed, false otherwise.

    resizeToContent(options)

    Inherits resizeToContent

    Resizes the panel to the current content. Currently this only works on height.

    Parameters

    Expand all
    options
    object
    An optional dictionary of options.
    maxHeight
    number
    The maximum height to resize this panel.

    setCategoryCollapsed(category,collapsed)

    Sets the collapse state of the given category.

    Parameters

    category*
    Object
    A category object.
    collapsed*
    boolean
    The new collapse state.
    * Required

    setProperties(properties,options)

    Adds the given properties to the display panel.

    Parameters

    properties*
    Array
    An array of properties, each property represented as {displayName: name, displayValue: value}.
    options
    Object
    An optional dictionary of options. Currently unused.
    * Required

    setTitle(text,options)

    Inherits setTitle

    Sets the title for this panel.

    Parameters

    Expand all
    text*
    string
    The title for this panel.
    options
    Object
    An optional dictionary of options.
    localizeTitle
    boolean
    When true, localization is attempted for the given text.
    * Required

    setVisible(show)

    Inherits setVisible

    Sets the new visibility state of this DockingPanel.

    Parameters

    show*
    boolean
    The desired visibility state.
    * Required

    showDefaultProperties()

    Override this to display the default properties. The current default is to display no properties.

    showNoProperties()

    Displays only the “No properties” item.

    uninitialize()

    Inherits uninitialize

    Performs any clean up necessary. This can include disconnecting UI elements, unregistering event callbacks, etc.

    visibilityChanged()

    Notification that visibility has been changed by external sources.