Skip to content

Commit

Permalink
Added support for mutable componentIDs for arch data streams
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Mar 6, 2015
1 parent c2e3487 commit 93d8dbb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 5 additions & 2 deletions js/RadioButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ define( function( require ) {

options = _.extend( {
cursor: 'pointer',
focusable: true
focusable: true,
componentID: null
}, options );

this.componentID = options.componentID;

var thisNode = this;
Node.call( thisNode );

Expand All @@ -49,7 +52,7 @@ define( function( require ) {
// set property value on fire
thisNode.addInputListener( new ButtonListener( {
fire: function() {
var archID = arch && arch.start( 'user', options.componentID, 'radioButton', 'fire', { value: value } );
var archID = arch && arch.start( 'user', thisNode.componentID, thisNode.componentType, 'fire', { value: value } );
property.set( value );
arch && arch.end( archID );
}
Expand Down
7 changes: 5 additions & 2 deletions js/buttons/PushButtonModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ define( function( require ) {

options = _.extend( {
fireOnDown: false, // true: fire on pointer down; false: fire on pointer up if pointer is over button
listener: null
listener: null,
componentID: null
}, options );

this.componentID = options.componentID;

ButtonModel.call( this );

this.listeners = []; //@private
Expand Down Expand Up @@ -67,7 +70,7 @@ define( function( require ) {
// Fires all listeners.
// @private with the possible exception of hooking up for accessibility.
fire: function() {
var archID = arch && arch.start( 'user', this.componentID, 'button', 'fire' );
var archID = arch && arch.start( 'user', this.componentID, this.componentType, 'fire' );
var copy = this.listeners.slice( 0 );
copy.forEach( function( listener ) {
listener();
Expand Down
7 changes: 7 additions & 0 deletions js/buttons/RoundPushButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ define( function( require ) {
}

return inherit( RoundButtonView, RoundPushButton, {

set componentID( c ) {
this.buttonModel.componentID = c;
},
set componentType( c ) {
this.buttonModel.componentType = c;
},
addListener: function( listener ) {
this.buttonModel.addListener( listener );
},
Expand Down

0 comments on commit 93d8dbb

Please sign in to comment.