## jsPlumbUIComponent

Abstract superclass for Endpoint, Connection, Connector and Overlay.

This class provides support for a few basic capabilities that are common to many objects in jsPlumb:

- Events
- Types
- CSS Classes
- Parameters
- Paint Styles

You don't interact directly with an instance of this class; it is abstract.

#### new jsPlumbUIComponent()

  Source:
    - uicomponent.js, line 1

### Extends

- jsPlumbUtil.EventGenerator

### Methods

#### addClass(class)

  Adds a class or some classes to the visual elements for the given component.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `class` | String | The class(es) to add. The values are appended as given, meaning you can supply a space separated string of several classes if you wish.

  Source:
    - uicomponent.js, line 11

#### addType(typeId, params, doNotRepaint)

  Adds a type to the component. Note this is distinct from jsPlumbUIComponent#setType, which overrides all current types - this function just adds a type to the existing list.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `typeId` | String |  |  | Id of the type to add.
  `params` | Object | <optional> |  | Optional params to use when applying the type.
  `doNotRepaint` | Boolean | <optional> | false | Tells jsPlumb not to repaint after adding the type.

  Source:
    - uicomponent.js, line 23

#### bind(event, listener)

  Binds a listener to an event.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | String | Name of the event to bind to.
  `listener` | Function | Function to execute.

  Inherited From:
    - jsPlumbUtil.EventGenerator#bind
  Source:
    - util-api.js, line 21

#### cleanupListeners()

  Removes all listeners.

  Inherited From:
    - jsPlumbUtil.EventGenerator#cleanupListeners
  Source:
    - util-api.js, line 28

#### getParameter(name) → {Object}

  Gets a parameter from the component

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `name` | String | Name of the parameter to get

  Source:
    - uicomponent.js, line 3

  ##### Returns:

  The given parameter's value, null if not found.

  Type
    Object

#### getParameters() → {Object}

  Gets all parameters from the component. Note that you are given the actual parameters object, not a copy, so you can alter their values directly, and if you hold the reference to the parameters object you could cause a memory leak.

  Source:
    - uicomponent.js, line 7

  ##### Returns:

  All of the component's parameters.

  Type
    Object

#### getType() → {String[]}

  Gets the current type - or types - for this component.

  Source:
    - uicomponent.js, line 17

  ##### Returns:

  The current list of types, empty if none registered.

  Type
    String[]

#### hasType(typeId) → {Boolean}

  Returns whether or not the component currently has the given type.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `typeId` | String | Id of the type to check for

  Source:
    - uicomponent.js, line 21

  ##### Returns:

  True if the component has the type, false if not.

  Type
    Boolean

#### isHover() → {Boolean}

  Returns whether or not the object is currently in hover state

  Source:
    - uicomponent.js, line 29

  ##### Returns:

  True if in hover state, false if not.

  Type
    Boolean

#### isSuspendEvents() → {Boolean}

  Inherited From:
    - jsPlumbUtil.EventGenerator#isSuspendEvents
  Source:
    - util-api.js, line 27

  ##### Returns:

  True if events are suspended, false otherwise.

  Type
    Boolean

#### reapplyTypes(params)

  Reapplies the current list of types with the given (optional) parameters. See the jsPlumb documentation for a full discussion of types.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `params` | Object | <optional> | Optional params to use when reapplying types.

  Source:
    - uicomponent.js, line 19

#### removeClass(class)

  Removes a class or some classes from the visual elements for the given component. You can supply a space separated string of several classes if you wish.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `class` | String | The class(es) to remove.

  Source:
    - uicomponent.js, line 13

#### removeType(typeId, doNotRepaint)

  Removes the given type from the component.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `typeId` | String |  |  | Id of the type to remove.
  `doNotRepaint` | Boolean | <optional> | false | Tells jsPlumb not to repaint after removing the type.

  Source:
    - uicomponent.js, line 25

#### setHover(hover, ignoreAttachedElements)

  Sets/unsets the hover state of this component.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `hover` | Boolean |  |  | Hover state boolean
  `ignoreAttachedElements` | Boolean | <optional> | false | If true, does not notify any attached elements of the change in hover state. Used mostly by jsPlumb internally, to avoid infinite loops.

  Source:
    - uicomponent.js, line 33

#### setHoverPaintStyle(style, doNotRepaint)

  Sets the paint style to use when the mouse is hovering over the component. This is null by default. The hover paint style is applied as extensions to the paintStyle; it does not entirely replace it. This is because people will most likely want to change just one thing when hovering, say the color for example, but leave the rest of the appearance the same.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `style` | Object |  | Style to use when the mouse is hovering.
  `doNotRepaint` | Boolean | <optional> | If true, the component will not be repainted. Useful when setting things up initially.

  Source:
    - uicomponent.js, line 31

#### setPaintStyle(style, doNotRepaint)

  Sets the component's paint style and then repaints the component.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `style` | Object |  |  | Style to use.
  `doNotRepaint` | Boolean | <optional> | false | If true, the component will not be repainted.

  Source:
    - uicomponent.js, line 35

#### setParameter(name, value)

  Sets a parameter on the component

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `name` | String | Name of the parameter to set
  `value` | Object | Value to set

  Source:
    - uicomponent.js, line 5

#### setParameters(params)

  Sets all parameters on the component.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `params` | Object | Parameters to set.

  Source:
    - uicomponent.js, line 9

#### setType(typeId, params, doNotRepaint)

  This function sets a `type` for the given component. It replaces all existing types. For a full discussion of the concept of types, see the jsPlumb documentation.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `typeId` | String |  |  | Id of the type to set.
  `params` | Object | <optional> |  | Optional parameter object to expand.
  `doNotRepaint` | Boolean | <optional> | false | Tells jsPlumb not to repaint after setting the type.

  Source:
    - uicomponent.js, line 15

#### suspendEvents(val)

  Sets whether or not events are suspended.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `val` | Boolean | Whether or not to suspend events.

  Inherited From:
    - jsPlumbUtil.EventGenerator#suspendEvents
  Source:
    - util-api.js, line 26

#### toggleType(typeId, params, doNotRepaint)

  Toggles the given type on the component.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `typeId` | String |  |  | Id of the type to toggle.
  `params` | Object | <optional> |  | Optional params to use if the type does not exist and jsPlumb applies it.
  `doNotRepaint` | Boolean | <optional> | false | Tells jsPlumb not to repaint after toggling the type.

  Source:
    - uicomponent.js, line 27

#### unbind(event)

  Clears either all listeners, or listeners for some specific event.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `event` | String | <optional> | Optional. constrains the clear to just listeners for this event.

  Inherited From:
    - jsPlumbUtil.EventGenerator#unbind
  Source:
    - util-api.js, line 25