SimpleAssociationPanel
Extends: module:Activity.ActivityPanel
Source: SimpleAssociation.js:107
The ActivityPanel where SimpleAssociation activities are played.
Constructor
new SimpleAssociationPanel(
act: module:Activity.Activity,
ps: module:JClicPlayer.JClicPlayer,
$div?: external:jQuery,
): SimpleAssociationPanelSimpleAssociationPanel constructor
Parameters
act(module:Activity.Activity) — The Activity to which this Panel belongsps(module:JClicPlayer.JClicPlayer) — Any object implementing the methods defined in the
PlayStation Java interface.$div(external:jQuery, optional) — The jQuery DOM element where this Panel will deploy
Instance Methods
clear()
Performs miscellaneous cleaning operations
buildVisualComponents()
Prepares the visual components of the activity
initActivity()
Basic initialization procedure
updateContent(dirtyRegion: module:AWT.Rectangle)
Updates the graphic content of this panel.
This method will be called from module:AWT.Container#update when needed.
Parameters
dirtyRegion(module:AWT.Rectangle) — Specifies the area to be updated. Whennull,
it's the whole panel.
setDimension(
preferredMaxSize: module:AWT.Dimension,
): module:AWT.Dimension
Sets the real dimension of this panel.
Parameters
preferredMaxSize(module:AWT.Dimension) — The maximum surface available for the activity panel
Returns
setBounds(rect: module:AWT.Rectangle)
Sets the size and position of this activity panel
Parameters
rect(module:AWT.Rectangle)
buildAccessibleComponents()
Builds the accessible components needed for this ActivityPanel
This method is called when all main elements are placed and visible, when the activity is ready
to start or when resized.
processEvent(event: external:Event): boolean
Main handler used to process mouse, touch, keyboard and edit events
Parameters
event(external:Event) — The HTML event to be processed
Returns
boolean
setBounds(rect: module:AWT.Rectangle)
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#setBounds
Overrides: module:Activity.ActivityPanel#setBounds
Sets the size and position of this activity panel
Parameters
rect(module:AWT.Rectangle)
buildVisualComponents()
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#buildVisualComponents
Overrides: module:Activity.ActivityPanel#buildVisualComponents
Prepares the visual components of the activity
updateContent(dirtyRegion: module:AWT.Rectangle)
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#updateContent
Overrides: module:Activity.ActivityPanel#updateContent
Updates the graphic content of this panel.
This method will be called from module:AWT.Container#update when needed.
Parameters
dirtyRegion(module:AWT.Rectangle) — Specifies the area to be updated. Whennull,
it's the whole panel.
playEvent(event: string)
Inherited from module:Activity.ActivityPanel#playEvent
Overrides: module:Activity.ActivityPanel#playEvent
Plays the specified event sound
Parameters
event(string) — The type of event to be performed
initActivity()
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#initActivity
Overrides: module:Activity.ActivityPanel#initActivity
Basic initialization procedure
startActivity()
Inherited from module:Activity.ActivityPanel#startActivity
Overrides: module:Activity.ActivityPanel#startActivity
Called when the activity starts playing
activityReady()
Inherited from module:Activity.ActivityPanel#activityReady
Overrides: module:Activity.ActivityPanel#activityReady
Called by JClicPlayer when this activity panel is fully visible, just after the
initialization process.
showHelp()
Inherited from module:Activity.ActivityPanel#showHelp
Overrides: module:Activity.ActivityPanel#showHelp
Displays help about the activity
setDimension(
preferredMaxSize: module:AWT.Dimension,
): module:AWT.Dimension
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#setDimension
Overrides: module:Activity.ActivityPanel#setDimension
Sets the real dimension of this panel.
Parameters
preferredMaxSize(module:AWT.Dimension) — The maximum surface available for the activity panel
Returns
attachEvents()
Inherited from module:Activity.ActivityPanel#attachEvents
Overrides: module:Activity.ActivityPanel#attachEvents
Attaches the events specified in the events member to the $div member
attachEvent($obj: external:jQuery, evt: string)
Inherited from module:Activity.ActivityPanel#attachEvent
Overrides: module:Activity.ActivityPanel#attachEvent
Attaches a single event to the specified object
Parameters
$obj(external:jQuery) — The object to which the event will be attachedevt(string) — The event name
processEvent(event: external:Event): boolean
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#processEvent
Overrides: module:Activity.ActivityPanel#processEvent
Main handler used to process mouse, touch, keyboard and edit events
Parameters
event(external:Event) — The HTML event to be processed
Returns
boolean
fitTo(
proposed: module:AWT.Rectangle,
bounds: module:AWT.Rectangle,
)
Inherited from module:Activity.ActivityPanel#fitTo
Overrides: module:Activity.ActivityPanel#fitTo
Fits the panel within the proposed rectangle. The panel can occupy more space, but always
not surpassing the bounds rectangle.
Parameters
proposed(module:AWT.Rectangle) — The proposed rectanglebounds(module:AWT.Rectangle) — The maximum allowed bounds
buildAccessibleComponents()
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#buildAccessibleComponents
Overrides: module:Activity.ActivityPanel#buildAccessibleComponents
Builds the accessible components needed for this ActivityPanel
This method is called when all main elements are placed and visible, when the activity is ready
to start or when resized.
forceFinishActivity()
Inherited from module:Activity.ActivityPanel#forceFinishActivity
Overrides: module:Activity.ActivityPanel#forceFinishActivity
Forces the ending of the activity.
finishActivity(result: boolean)
Inherited from module:Activity.ActivityPanel#finishActivity
Overrides: module:Activity.ActivityPanel#finishActivity
Ordinary ending of the activity, usually called form processEvent
Parameters
result(boolean) —trueif the activity was successfully completed,falseotherwise
setAndPlayMsg(msgCode: string, eventSoundsCode?: string)
Inherited from module:Activity.ActivityPanel#setAndPlayMsg
Overrides: module:Activity.ActivityPanel#setAndPlayMsg
Sets the message to be displayed in the skin message box and optionally plays a sound event.
Parameters
msgCode(string) — Type of message (initial, final, finalError...)eventSoundsCode(string, optional) — Optional name of the event sound to be played.
end()
Inherited from module:Activity.ActivityPanel#end
Overrides: module:Activity.ActivityPanel#end
Ends the activity
clear()
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#clear
Overrides: module:Activity.ActivityPanel#clear
Performs miscellaneous cleaning operations
enableCounters(
eTime: boolean,
eScore: boolean,
eActions: boolean,
)
Inherited from module:Activity.ActivityPanel#enableCounters
Overrides: module:Activity.ActivityPanel#enableCounters
Enables or disables the three counters (time, score and actions)
Parameters
eTime(boolean) — Whether to enable or disable the time countereScore(boolean) — Whether to enable or disable the score countereActions(boolean) — Whether to enable or disable the actions counter
shuffle(
bg: Array.<module:boxes/ActiveBoxBag.ActiveBoxBag>,
visible: boolean,
fitInArea: boolean,
)
Inherited from module:Activity.ActivityPanel#shuffle
Overrides: module:Activity.ActivityPanel#shuffle
Shuffles the contents of the activity
Parameters
bg(Array.<module:boxes/ActiveBoxBag.ActiveBoxBag>) — The sets of boxes to be shuffledvisible(boolean) — The shuffle process must be animated on the screen (not yet implemented!)fitInArea(boolean) — Shuffled pieces cannot go out of the current area
invalidate(rect: module:AWT.Rectangle)
Inherited from module:AWT.Container#invalidate
Overrides: module:Activity.ActivityPanel#invalidate
Adds the provided rectangle to the invalidated area.
Parameters
rect(module:AWT.Rectangle)
update()
Inherited from module:AWT.Container#update
Overrides: module:Activity.ActivityPanel#update
Updates the invalidated area
getBounds(): module:AWT.Rectangle
Inherited from module:AWT.Rectangle#getBounds
Overrides: module:Activity.ActivityPanel#getBounds
Gets the enclosing Rectangle of this Shape.
Returns
equals(r: module:AWT.Shape): boolean
Inherited from module:AWT.Rectangle#equals
Overrides: module:Activity.ActivityPanel#equals
Checks if two shapes are equivalent.
Parameters
r(module:AWT.Shape) — The Shape to compare against
Returns
boolean
clone(): module:AWT.Rectangle
Inherited from module:AWT.Rectangle#clone
Overrides: module:Activity.ActivityPanel#clone
Clones this Rectangle
Returns
scaleBy(delta: Point | Dimension): module:AWT.Rectangle
Inherited from module:AWT.Rectangle#scaleBy
Overrides: module:Activity.ActivityPanel#scaleBy
Multiplies the dimension of the Shape by the specified delta amount.
Parameters
Returns
grow(dx: number, dy: number): module:AWT.Rectangle
Inherited from module:AWT.Rectangle#grow
Overrides: module:Activity.ActivityPanel#grow
Expands the boundaries of this shape. This affects the current position and dimension.
Parameters
dx(number) — The amount to grow (or decrease) in horizontal directiondy(number) — The amount to grow (or decrease) in vertical direction
Returns
getOppositeVertex(): module:AWT.Point
Inherited from module:AWT.Rectangle#getOppositeVertex
Overrides: module:Activity.ActivityPanel#getOppositeVertex
Gets the module:AWT.Point corresponding to the lower-right vertex of the Rectangle.
Returns
add(shape: module:AWT.Shape): module:AWT.Rectangle
Inherited from module:AWT.Rectangle#add
Overrides: module:Activity.ActivityPanel#add
Adds the boundaries of another shape to the current one
Parameters
shape(module:AWT.Shape) — The module:AWT.Shape to be added
Returns
getCoords(): string
Inherited from module:AWT.Rectangle#getCoords
Overrides: module:Activity.ActivityPanel#getCoords
Gets a string with the co-ordinates of the upper-left and lower-right vertexs of this rectangle,
(with values rounded to int)
Returns
string
getAttributes(): object
Inherited from module:AWT.Rectangle#getAttributes
Overrides: module:Activity.ActivityPanel#getAttributes
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
Returns
object
setAttributes(data: object): module:AWT.Rectangle
Inherited from module:AWT.Rectangle#setAttributes
Overrides: module:Activity.ActivityPanel#setAttributes
Reads the properties of this Rectangle from a data object
Parameters
data(object) — The data object to be parsed
Returns
moveBy(delta: Point | Dimension): module:AWT.Shape
Inherited from module:AWT.Shape#moveBy
Overrides: module:Activity.ActivityPanel#moveBy
Shifts the shape a specified amount in horizontal and vertical directions
Parameters
Returns
moveTo(newPos: module:AWT.Point): module:AWT.Shape
Inherited from module:AWT.Shape#moveTo
Overrides: module:Activity.ActivityPanel#moveTo
Moves this shape to a new position
Parameters
newPos(module:AWT.Point) — The new position of the shape
Returns
getShape(rect: module:AWT.Rectangle): module:AWT.Shape
Inherited from module:AWT.Shape#getShape
Overrides: module:Activity.ActivityPanel#getShape
Gets a clone of this shape moved to the pos component of the rectangle and scaled
by its dim value.
Parameters
rect(module:AWT.Rectangle) — The rectangle to be taken as a base for moving and scaling
this shape.
Returns
contains(_p: module:AWT.Point): boolean
Inherited from module:AWT.Shape#contains
Overrides: module:Activity.ActivityPanel#contains
Checks if the provided module:AWT.Point is inside this shape.
Parameters
_p(module:AWT.Point) — The point to check
Returns
boolean
intersects(_r: module:AWT.Rectangle): boolean
Inherited from module:AWT.Shape#intersects
Overrides: module:Activity.ActivityPanel#intersects
Checks if the provided Rectangle r intersects with this shape.
Parameters
_r(module:AWT.Rectangle)
Returns
boolean
fill(
ctx: external:CanvasRenderingContext2D,
dirtyRegion?: module:AWT.Rectangle,
): external:CanvasRenderingContext2D
Inherited from module:AWT.Shape#fill
Overrides: module:Activity.ActivityPanel#fill
Fills the Shape with the current style in the provided HTML canvas context
Parameters
ctx(external:CanvasRenderingContext2D) — The canvas 2D rendering context where to fill this shape.dirtyRegion(module:AWT.Rectangle, optional) — The context region to be updated. Used as clipping
region when drawing.
Returns
stroke(
ctx: external:CanvasRenderingContext2D,
): external:CanvasRenderingContext2D
Inherited from module:AWT.Shape#stroke
Overrides: module:Activity.ActivityPanel#stroke
Draws this shape in the provided HTML canvas 2D rendering context.
Parameters
ctx(external:CanvasRenderingContext2D) — The canvas 2D rendering context where to draw the shape.
Returns
preparePath(
ctx: external:CanvasRenderingContext2D,
): external:CanvasRenderingContext2D
Inherited from module:AWT.Shape#preparePath
Overrides: module:Activity.ActivityPanel#preparePath
Prepares an HTML canvas 2D rendering context with a path that can be used to stroke a line,
to fill a surface or to define a clipping region.
Parameters
Returns
clip(
ctx: external:CanvasRenderingContext2D,
fillRule?: string,
): external:CanvasRenderingContext2D
Inherited from module:AWT.Shape#clip
Overrides: module:Activity.ActivityPanel#clip
Creates a clipping region on the specified HTML canvas 2D rendering context
Parameters
ctx(external:CanvasRenderingContext2D) — The rendering contextfillRule(string, optional, default: "'nonzero'") — Can be 'nonzero' (default when not set) or 'evenodd'
Returns
isRect(): boolean
Inherited from module:AWT.Shape#isRect
Overrides: module:Activity.ActivityPanel#isRect
Shorthand method for determining if a Shape is an Rectangle
Returns
boolean
toString(): string
Inherited from module:AWT.Shape#toString
Overrides: module:Activity.ActivityPanel#toString
Overwrites the original 'Object.toString' method with a more descriptive text
Returns
string
setBounds(rect: module:AWT.Rectangle)
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#setBounds
Overrides: module:Activity.ActivityPanel#setBounds
Sets the size and position of this activity panel
Parameters
rect(module:AWT.Rectangle)
buildVisualComponents()
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#buildVisualComponents
Overrides: module:Activity.ActivityPanel#buildVisualComponents
Prepares the visual components of the activity
updateContent(dirtyRegion: module:AWT.Rectangle)
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#updateContent
Overrides: module:Activity.ActivityPanel#updateContent
Updates the graphic content of this panel.
This method will be called from module:AWT.Container#update when needed.
Parameters
dirtyRegion(module:AWT.Rectangle) — Specifies the area to be updated. Whennull,
it's the whole panel.
initActivity()
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#initActivity
Overrides: module:Activity.ActivityPanel#initActivity
Basic initialization procedure
setDimension(
preferredMaxSize: module:AWT.Dimension,
): module:AWT.Dimension
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#setDimension
Overrides: module:Activity.ActivityPanel#setDimension
Sets the real dimension of this panel.
Parameters
preferredMaxSize(module:AWT.Dimension) — The maximum surface available for the activity panel
Returns
processEvent(event: external:Event): boolean
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#processEvent
Overrides: module:Activity.ActivityPanel#processEvent
Main handler used to process mouse, touch, keyboard and edit events
Parameters
event(external:Event) — The HTML event to be processed
Returns
boolean
buildAccessibleComponents()
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#buildAccessibleComponents
Overrides: module:Activity.ActivityPanel#buildAccessibleComponents
Builds the accessible components needed for this ActivityPanel
This method is called when all main elements are placed and visible, when the activity is ready
to start or when resized.
clear()
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#clear
Overrides: module:Activity.ActivityPanel#clear
Performs miscellaneous cleaning operations
Static Methods
buildShape(data: object): module:AWT.Shape
Inherited from module:AWT.Shape
Builds a shape based on the provided data object.
Data should contain a 'type' member, specifying the type of shape requested ('rect', 'ellipse', 'rectangle' or 'path')
Parameters
data(object) — Specific data for this shape
Returns
Instance Fields
bgA: module:boxes/ActiveBoxBag.ActiveBoxBag
The ActiveBoxBag object containing the information to be displayed in the primary panel
bgB: module:boxes/ActiveBoxBag.ActiveBoxBag
The ActiveBoxBag object containing the information to be displayed in the secondary panel
bc: module:boxes/BoxConnector.BoxConnector
Overrides: module:Activity.ActivityPanel#bc
The box connector
events: Array.<string>
List of mouse, touch and keyboard events intercepted by this panel
act: module:Activity.Activity
Inherited from module:Activity.ActivityPanel#act
Overrides: module:Activity.ActivityPanel#act
The Activity this panel is related to
$div: external:jQuery
Inherited from module:Activity.ActivityPanel#$div
Overrides: module:Activity.ActivityPanel#$div
The jQuery div element used by this panel
$canvas: external:jQuery
Inherited from module:Activity.ActivityPanel#$canvas
Overrides: module:Activity.ActivityPanel#$canvas
The jQuery main canvas element used by this panel
accessibleCanvas: boolean
Inherited from module:Activity.ActivityPanel#accessibleCanvas
Overrides: module:Activity.ActivityPanel#accessibleCanvas
Always true, since canvas hit regions have been deprecated!
See: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Hit_regions_and_accessibility
skin: module:skins/Skin.Skin
Inherited from module:Activity.ActivityPanel#skin
Overrides: module:Activity.ActivityPanel#skin
The realized current Skin
$animatedBg: external:jQuery
Inherited from module:Activity.ActivityPanel#$animatedBg
Overrides: module:Activity.ActivityPanel#$animatedBg
Background element (currently a span) used to place animated GIFs when needed
$animatedBgB: external:jQuery
Inherited from module:Activity.ActivityPanel#$animatedBgB
Overrides: module:Activity.ActivityPanel#$animatedBgB
Additional background element for animated GIFs, used in associations
solved: boolean
Inherited from module:Activity.ActivityPanel#solved
Overrides: module:Activity.ActivityPanel#solved
true when the activity is solved, false otherwise
bgImage: external:HTMLImageElement
Inherited from module:Activity.ActivityPanel#bgImage
Overrides: module:Activity.ActivityPanel#bgImage
The realized image used as a background
playing: boolean
Inherited from module:Activity.ActivityPanel#playing
Overrides: module:Activity.ActivityPanel#playing
true while the activity is playing
firstRun: boolean
Inherited from module:Activity.ActivityPanel#firstRun
Overrides: module:Activity.ActivityPanel#firstRun
true if the activity is running for first time (not due to a click on the replay button)
currentItem: number
Inherited from module:Activity.ActivityPanel#currentItem
Overrides: module:Activity.ActivityPanel#currentItem
Currently selected item. Used in some types of activities.
ps: module:JClicPlayer.JClicPlayer
Inherited from module:Activity.ActivityPanel#ps
Overrides: module:Activity.ActivityPanel#ps
The PlayStation used to realize media objects and communicate with the player services
(usually a JClicPlayer
minimumSize: module:AWT.Dimension
Inherited from module:Activity.ActivityPanel#minimumSize
Overrides: module:Activity.ActivityPanel#minimumSize
The minimum size of this kind of ActivityPanel
preferredSize: module:AWT.Dimension
Inherited from module:Activity.ActivityPanel#preferredSize
Overrides: module:Activity.ActivityPanel#preferredSize
The preferred size of this kind of ActivityPanel
events: Array.<string>
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#events
Overrides: module:Activity.ActivityPanel#events
List of mouse, touch and keyboard events intercepted by this panel
invalidatedRect: module:AWT.Rectangle
Inherited from module:AWT.Container#invalidatedRect
Overrides: module:Activity.ActivityPanel#invalidatedRect
The currently "invalidated" area
type: string
Inherited from module:AWT.Rectangle#type
Overrides: module:Activity.ActivityPanel#type
Shape type id
dim: module:AWT.Dimension
Inherited from module:AWT.Rectangle#dim
Overrides: module:Activity.ActivityPanel#dim
The Dimension of the Rectangle
pos: module:AWT.Point
Inherited from module:AWT.Shape#pos
Overrides: module:Activity.ActivityPanel#pos
The current position of the shape
events: Array.<string>
Inherited from module:activities/associations/SimpleAssociation.SimpleAssociationPanel#events
Overrides: module:Activity.ActivityPanel#events
List of mouse, touch and keyboard events intercepted by this panel