







































Module('ca.carleton.gcrc.atlas.dynamicText','$Revision: 3675 $',function(mod){

var modObservable=imprt('ca.carleton.gcrc.mvc.observable');
var modDisplayWidget=imprt('ca.carleton.gcrc.atlas.displayWidget');
var domUtil=imprt('ca.carleton.gcrc.dom.util');







mod.DynamicTextLiteral=Class(function(publ,priv){



publ.__init__=function(
literal_
){
this.literal=literal_;
}




publ.Terminate=function(){

}







publ.RenderHTML=function(
dataModel_,
htmlNode_,
feature_
)
{
var textNode=htmlNode_.ownerDocument.createTextNode(this.literal);
htmlNode_.appendChild(textNode);
}
});





mod.DynamicTextCollection=Class(function(publ,priv){



publ.__init__=function(
){
this.children=new Array();
}

publ.AddChild=function(childNode_){
this.children.push(childNode_);
}




publ.Terminate=function(){
var loop;
for(loop=0;loop<this.children.length;++loop){
var child=this.children[loop];
child.Terminate();
}
}







publ.RenderHTML=function(
dataModel_,
htmlNode_,
feature_
)
{
var loop;
for(loop=0;loop<this.children.length;++loop){
var child=this.children[loop];
child.RenderHTML(dataModel_,htmlNode_,feature_);
}
}
});





mod.DynamicTextHeader=Class(mod.DynamicTextCollection,function(publ,priv,supr){




publ.__init__=function(
level_
){

supr.__init__.call(this);

this.level=level_;
}







publ.RenderHTML=function(
dataModel_,
htmlNode_,
feature_
)
{
var headerNode=htmlNode_.ownerDocument.createElement('h'+this.level);
htmlNode_.appendChild(headerNode);

var loop;
for(loop=0;loop<this.children.length;++loop){
var child=this.children[loop];
child.RenderHTML(dataModel_,headerNode,feature_);
}
}
});





mod.DynamicTextPara=Class(mod.DynamicTextCollection,function(publ,priv,supr){



publ.__init__=function(
){

supr.__init__.call(this);
}







publ.RenderHTML=function(
dataModel_,
htmlNode_,
feature_
)
{
var node=htmlNode_.ownerDocument.createElement('p');
htmlNode_.appendChild(node);

var loop;
for(loop=0;loop<this.children.length;++loop){
var child=this.children[loop];
child.RenderHTML(dataModel_,node,feature_);
}
}
});





mod.DynamicTextList=Class(mod.DynamicTextCollection,function(publ,priv,supr){



publ.__init__=function(
style_
){

supr.__init__.call(this);

this.style=style_;
}







publ.RenderHTML=function(
dataModel_,
htmlNode_,
feature_
)
{
var tag='ul';
if('itemize'==this.style){
tag='ul';
}else if('enumerate'==this.style){
tag='ol';
}

var listNode=htmlNode_.ownerDocument.createElement(tag);
htmlNode_.appendChild(listNode);

var loop;
for(loop=0;loop<this.children.length;++loop){
var child=this.children[loop];

var itemNode=htmlNode_.ownerDocument.createElement('li');
listNode.appendChild(itemNode);

child.RenderHTML(dataModel_,itemNode,feature_);
}
}
});





mod.DynamicTextInline=Class(mod.DynamicTextCollection,function(publ,priv,supr){



publ.__init__=function(
style_
){

supr.__init__.call(this);

this.style=style_;
}







publ.RenderHTML=function(
dataModel_,
htmlNode_,
feature_
)
{

var tag='span';
if('emphasis'==this.style){
tag='i';
}else if('strong'==this.style){
tag='b';
}else if('break'==this.style){
tag='br';
}

var node=htmlNode_.ownerDocument.createElement(tag);
htmlNode_.appendChild(node);

var loop;
for(loop=0;loop<this.children.length;++loop){
var child=this.children[loop];
child.RenderHTML(dataModel_,node,feature_);
}
}
});






mod.DynamicTextAttribute=Class(function(publ,priv){



publ.__init__=function(
layer_,
feature_,
attribute_
){
this.layerName=layer_;
this.featureId=feature_;
this.attributeName=attribute_;
}




publ.Terminate=function(){
if(null!=this.observingToken){
this.observingToken.RemoveObserver();
this.observingToken=null;
}

this.textElem=null;
}







publ.RenderHTML=function(
dataModel_,
htmlNode_,
feature_
)
{
this.Terminate();

this.targetFeature=feature_;
if(null!=this.layerName||null!=this.featureId){
var layer=feature_.layerModel;
if(null!=this.layerName){
layer=dataModel_.LayerFromName(this.layerName);
}

if(null!=this.featureId){
this.targetFeature=layer.FeatureFromId(this.featureId);
}else{
this.targetFeature=layer.FeatureFromId(feature_.id);
}
}

this.observingToken=this.targetFeature.AddObserver(this.attributeName,this,this.Update,null);

this.textElem=htmlNode_.ownerDocument.createTextNode('');
htmlNode_.appendChild(this.textElem);

this.Update();
}




publ.Update=function(){
if(null==this.textElem||null==this.textElem.parentNode){
return;
}

var value=this.targetFeature.GetVariableValue(this.attributeName,'');

var node=this.textElem.ownerDocument.createTextNode(value);
this.textElem.parentNode.replaceChild(node,this.textElem);
this.textElem=node;
}

});






mod.DynamicTextPeer=Class(mod.DynamicTextCollection,function(publ,priv,supr){



publ.__init__=function(
layer_
,feature_
){

supr.__init__.call(this);

this.layerName=layer_;
this.featureId=feature_;
}




publ.Terminate=function(){
supr.Terminate.call(this);

if(null!=this.observingToken){
this.observingToken.RemoveObserver();
this.observingToken=null;
}

this.targetFeature=null;
this.spanElem=null;
}







publ.RenderHTML=function(
dataModel_
,htmlNode_
,feature_
)
{
this.targetFeature=feature_;
if(null!=this.layerName||null!=this.featureId){
var layer=feature_.layerModel;
if(null!=this.layerName){
layer=dataModel_.LayerFromName(this.layerName);
}

if(null!=this.featureId){
this.targetFeature=layer.FeatureFromId(this.featureId);
}else{
this.targetFeature=layer.FeatureFromId(feature_.id);
}
}

this.observingToken=this.targetFeature.AddObserver('display_state',this,this.Update,null);

this.spanElem=htmlNode_.ownerDocument.createElement('span');
htmlNode_.appendChild(this.spanElem);

var targetFeature=this.targetFeature;
this.spanElem.onmouseover=function(event){

if(!event){
event=window.event;
}


if(null==event.text3Processed){
event.text3Processed=true;

targetFeature.FocusOnInit(event);
}
};
this.spanElem.onmouseout=function(event){

if(!event){
event=window.event;
}


if(null==event.text3Processed){
event.text3Processed=true;

targetFeature.FocusOffInit();
}
};
this.spanElem.onclick=function(event){

if(!event){
event=window.event;
}


if(null==event.text3Processed){
event.text3Processed=true;

targetFeature.SelectionOnInit();
}
};

supr.RenderHTML.call(this,dataModel_,this.spanElem,feature_);

this.Update();
}




publ.Update=function(){
if(null==this.spanElem||null==this.targetFeature){
return;
}

var isSelected=this.targetFeature.IsSelected();
var isInFocus=this.targetFeature.IsInFocus();


if(isSelected&&isInFocus){
this.spanElem.className='text3 text3peer text3SelectedFocus';

}else if(isSelected){
this.spanElem.className='text3 text3peer text3Selected';

}else if(isInFocus){
this.spanElem.className='text3 text3peer text3Focus';

}else{
this.spanElem.className='text3 text3peer';
}
}

});






mod.DynamicTextImage=Class(function(publ,priv){



publ.__init__=function(
urlFactory_,
widthFactory_,
heightFactory_,
captionFactory_
){
this.urlFactory=urlFactory_;
this.widthFactory=widthFactory_;
this.heightFactory=heightFactory_;
this.captionFactory=captionFactory_;

var modSelector=imprt('ca.carleton.gcrc.atlas.itemSelector');



var receiver=this;
this.itemSelector=new modSelector.ItemSelector(function(where_,what_){
receiver.Draw(where_,what_);
});
this.itemSelector.StartRandom(true);
this.itemSelector.EnableSlideShow(3000);
}




publ.Terminate=function(){
this._Cleanup();
this.imageElem=null;
}

publ._Cleanup=function(){
if(null!=this.urlNode){
this.urlNode.Terminate();
this.urlNode=null;
}
if(null!=this.widthNode){
this.widthNode.Terminate();
this.widthNode=null;
}
if(null!=this.heightNode){
this.heightNode.Terminate();
this.heightNode=null;
}
if(null!=this.captionNode){
this.captionNode.Terminate();
this.captionNode=null;
}
if(null!=this.imageElem){
domUtil.RemoveChildren(this.imageElem);
this.imageElem=null;
}
}







publ.RenderHTML=function(
dataModel_,
htmlNode_,
feature_
)
{
this._Cleanup();

this.urlNode=null;
if(null!=this.urlFactory){
this.urlNode=this.urlFactory.Create(feature_);
this.urlNode.Parent(this);
}

this.widthNode=null;
if(null!=this.widthFactory){
this.widthNode=this.widthFactory.Create(feature_);
this.widthNode.Parent(this);
}

this.heightNode=null;
if(null!=this.heightFactory){
this.heightNode=this.heightFactory.Create(feature_);
this.heightNode.Parent(this);
}

this.captionNode=null;
if(null!=this.captionFactory){
this.captionNode=this.captionFactory.Create(feature_);
this.captionNode.Parent(this);
}

this.imageElem=htmlNode_.ownerDocument.createElement('span');
htmlNode_.appendChild(this.imageElem);

this.itemSelector.SetItemSelectorElem(this.imageElem);
this.itemSelector.SetItemArray(this.urlNode.Values());
this.Update();
}





publ.Update=function()
{
if(null==this.imageElem){
return;
}

if(null==this.urlNode){



var newElem=this.imageElem.ownerDocument.createElement('div');

domUtil.RemoveChildren(this.imageElem);
if(null!=newElem){
this.imageElem.appendChild(newElem);
}
}else{

this.itemSelector.SetItemArray(this.urlNode.Values());
this.itemSelector.Draw();
}
}

publ.Draw=function(where_,what_){
if(this.imageElem==null||this.urlNode==null)
return;

var doc=this.imageElem.ownerDocument;
var imgElem=null;

outerElem=doc.createElement('div');
if(this.captionNode!=null&&this.captionNode.Values()[what_]!=null){
captionElem=doc.createElement('p');
captionElem.appendChild(doc.createTextNode(this.captionNode.Values()[what_]));
captionElem.setAttribute('style','font-style: italic;font-size: smaller;text-indent: 0;margin:0;');
outerElem.appendChild(captionElem);
}

imgElem=doc.createElement('img');
imgElem.setAttribute('src',this.urlNode.Values()[what_]);

outerElem.appendChild(imgElem);

if(null!=this.widthNode){
var width=this.widthNode.Values()[0];
imgElem.setAttribute('width',''+(1*width)+'px');
}

if(null!=this.heightNode){
var height=this.heightNode.Values()[0];
imgElem.setAttribute('height',''+(1*height)+'px');
}
where_.appendChild(outerElem);
}

});






mod.DynamicTextAudio=Class(function(publ,priv){



publ.__init__=function(
urlFactory_,
widthFactory_,
heightFactory_,
captionFactory_
){
this.urlFactory=urlFactory_;
this.widthFactory=widthFactory_;
this.heightFactory=heightFactory_;
this.captionFactory=captionFactory_;

var modSelector=imprt('ca.carleton.gcrc.atlas.itemSelector');


var receiver=this;
this.itemSelector=new modSelector.ItemSelector(function(where_,what_){
receiver.Draw(where_,what_);
});
this.itemSelector.StartRandom(true);
}




publ.Terminate=function(){
if(null!=this.urlNode){
this.urlNode.Terminate();
this.urlNode=null;
}

if(null!=this.widthNode){
this.widthNode.Terminate();
this.widthNode=null;
}

if(null!=this.heightNode){
this.heightNode.Terminate();
this.heightNode=null;
}

if(null!=this.captionNode){
this.captionNode.Terminate();
this.captionNode=null;
}

if(null!=this.audioElem){
domUtil.RemoveChildren(this.audioElem);
this.audioElem=null;
}
}







publ.RenderHTML=function(
dataModel_,
htmlNode_,
feature_
)
{
this.Terminate();

this.urlNode=null;
if(null!=this.urlFactory){
this.urlNode=this.urlFactory.Create(feature_);
this.urlNode.Parent(this);
}

this.widthNode=null;
if(null!=this.widthFactory){
this.widthNode=this.widthFactory.Create(feature_);
this.widthNode.Parent(this);
}

this.heightNode=null;
if(null!=this.heightFactory){
this.heightNode=this.heightFactory.Create(feature_);
this.heightNode.Parent(this);
}

this.captionNode=null;
if(null!=this.captionFactory){
this.captionNode=this.captionFactory.Create(feature_);
this.captionNode.Parent(this);
}

this.audioElem=htmlNode_.ownerDocument.createElement('span');
htmlNode_.appendChild(this.audioElem);

this.itemSelector.SetItemSelectorElem(this.audioElem);
this.itemSelector.SetItemArray(this.urlNode.Values());
this.Update();
}





publ.Update=function()
{
if(null==this.audioElem){
return;
}

if(null==this.urlNode){
var newElem=null;


domUtil.RemoveChildren(this.audioElem);
if(null!=newElem){
this.audioElem.appendChild(newElem);
}
}else{

this.itemSelector.SetItemArray(this.urlNode.Values());
this.itemSelector.Draw();
}

}






publ.Draw=function(where_,what_){
if(this.audioElem==null||this.urlNode==null)
return;

var doc=this.audioElem.ownerDocument;
var audElem=null;

outerElem=doc.createElement('div');
if(this.captionNode!=null&&this.captionNode.Values()[what_]!=null){
captionElem=doc.createElement('p');
captionElem.appendChild(doc.createTextNode(this.captionNode.Values()[what_]));
captionElem.setAttribute('style','font-style: italic;font-size: smaller;text-indent: 0;margin:0;');
outerElem.appendChild(captionElem);
}

audElem=doc.createElement('embed');
audElem.setAttribute('src',this.urlNode.Values()[what_]);
audElem.setAttribute('height','15');
audElem.setAttribute('width','320');
audElem.setAttribute('cache','false');
audElem.setAttribute('controller','true');
audElem.setAttribute('loop','false');
audElem.setAttribute('autoplay','false');
audElem.setAttribute('pluginspage','http://www.apple.com/quicktime/download/');
outerElem.appendChild(audElem);

if(null!=this.widthNode){
var width=this.widthNode.Values()[0];
audElem.setAttribute('width',''+(1*width)+'px');
}

if(null!=this.heightNode){
var height=this.heightNode.Values()[0];
audElem.setAttribute('height',''+(1*height)+'px');
}

where_.appendChild(outerElem);
}
});






mod.DynamicTextMovie=Class(function(publ,priv){



publ.__init__=function(
urlFactory_,
widthFactory_,
heightFactory_,
captionFactory_
){
this.urlFactory=urlFactory_;
this.widthFactory=widthFactory_;
this.heightFactory=heightFactory_;
this.captionFactory=captionFactory_;

var modSelector=imprt('ca.carleton.gcrc.atlas.itemSelector');


var receiver=this;
this.itemSelector=new modSelector.ItemSelector(function(where_,what_){
receiver.Draw(where_,what_);
});
this.itemSelector.StartRandom(true);
}




publ.Terminate=function(){
if(null!=this.urlNode){
this.urlNode.Terminate();
this.urlNode=null;
}
if(null!=this.widthNode){
this.widthNode.Terminate();
this.widthNode=null;
}
if(null!=this.heightNode){
this.heightNode.Terminate();
this.heightNode=null;
}

if(null!=this.captionNode){
this.captionNode.Terminate();
this.captionNode=null;
}
if(null!=this.movieElem){
domUtil.RemoveChildren(this.movieElem);
this.movieElem=null;
}
}







publ.RenderHTML=function(
dataModel_,
htmlNode_,
feature_
)
{
this.Terminate();

this.urlNode=null;
if(null!=this.urlFactory){
this.urlNode=this.urlFactory.Create(feature_);
this.urlNode.Parent(this);
}

this.widthNode=null;
if(null!=this.widthFactory){
this.widthNode=this.widthFactory.Create(feature_);
this.widthNode.Parent(this);
}

this.heightNode=null;
if(null!=this.heightFactory){
this.heightNode=this.heightFactory.Create(feature_);
this.heightNode.Parent(this);
}

this.captionNode=null;
if(null!=this.captionFactory){
this.captionNode=this.captionFactory.Create(feature_);
this.captionNode.Parent(this);
}

this.movieElem=htmlNode_.ownerDocument.createElement('div');
htmlNode_.appendChild(this.movieElem);

this.itemSelector.SetItemSelectorElem(this.movieElem);
this.itemSelector.SetItemArray(this.urlNode.Values());

this.Update();
}





publ.Update=function()
{
if(null==this.movieElem){
return;
}

var doc=this.movieElem.ownerDocument;

var movElem=null;
if(null==this.urlNode){



movElem=doc.createElement('div');


domUtil.RemoveChildren(this.movieElem);
if(null!=movElem){
this.movieElem.appendChild(movElem);
}

}else{

this.itemSelector.SetItemArray(this.urlNode.Values());
this.itemSelector.Draw();
}
}

publ.Draw=function(where_,what_){
if(this.movieElem==null||this.urlNode==null)
return;

var doc=this.movieElem.ownerDocument;

outerElem=doc.createElement('div');
if(this.captionNode!=null&&this.captionNode.Values()[what_]!=null){
captionElem=doc.createElement('p');
captionElem.appendChild(doc.createTextNode(this.captionNode.Values()[what_]));
captionElem.setAttribute('style','font-style: italic;font-size: smaller;text-indent: 0;margin:0;');
outerElem.appendChild(captionElem);
}

var newElem=doc.createElement('embed');
newElem.setAttribute('src',this.urlNode.Values()[what_]);
newElem.setAttribute('autoplay','false');
outerElem.appendChild(newElem);

if(null!=this.widthNode){
var width=this.widthNode.Values()[0];
newElem.setAttribute('width',''+(1*width)+'px');
}

if(null!=this.heightNode){
var height=this.heightNode.Values()[0];
newElem.setAttribute('height',''+(1*height)+'px');
}
where_.appendChild(outerElem);
}
});







mod.DynamicTextFeatureContext=Class(function(publ,priv){






publ.__init__=function(
layerName_
,dynamicTextNode_
,defaultTextNode_
){

this.layerName=layerName_;
this.dynamicTextNode=dynamicTextNode_;
this.defaultTextNode=defaultTextNode_;

this.dataModel=null;
this.observingToken=null;
this.divElem=null;
this.currentContent=null;
}




publ.Terminate=function(){
if(null!=this.observingToken){
this.observingToken.RemoveObserver();
this.observingToken=null;
}

if(null!=this.currentContent){
this.currentContent.Terminate();
this.currentContent=null;
}

domUtil.RemoveChildren(this.divElem);
}







publ.RenderHTML=function(
dataModel_
,htmlNode_
,feature_
)
{
this.dataModel=dataModel_;


var layer=dataModel_.LayerFromName(this.layerName);
this.observingToken=layer.AddObserver('selected',this,this.Update,null);


this.divElem=htmlNode_.ownerDocument.createElement('div');
htmlNode_.appendChild(this.divElem);

if(null!=this.defaultTextNode){
var feature=this.dataModel.LayerFromName('_fake').FeatureFromId('fake');
this.defaultTextNode.RenderHTML(this.dataModel,this.divElem,feature);
this.currentContent=this.defaultTextNode;
}
}




publ.Update=function(mvcEvent_){
var feature=mvcEvent_.originator;

if(null!=this.currentContent){
this.currentContent.Terminate();
this.currentContent=null;
}

domUtil.RemoveChildren(this.divElem);

if(null!=this.dynamicTextNode){
this.dynamicTextNode.RenderHTML(this.dataModel,this.divElem,feature);
this.currentContent=this.dynamicTextNode;
}
};

});






mod.DynamicTextFeatureList=Class(function(publ,priv){








publ.__init__=function(
layerName_
,labelAttribute_
,sortAttribute_
,visibleAttribute_
){

this.layerName=layerName_;
this.labelAttribute=labelAttribute_;
this.sortAttribute=sortAttribute_;
this.visibleAttribute=visibleAttribute_;

this.observingTokens=new Array();
};




publ.Terminate=function(){
while(this.observingTokens.length>0){
var observingToken=this.observingTokens.shift();
observingToken.RemoveObserver();
}

this.Erase();
};







publ.RenderHTML=function(
dataModel_
,htmlNode_
,feature_
)
{
this.element=htmlNode_.ownerDocument.createElement('ul');
htmlNode_.appendChild(this.element);

this.layer=dataModel_.LayerFromName(this.layerName);

this.observedFeatures={};
this.redrawNeeded=false;
this.registered=false;


this.model=dataModel_;

this.observingTokens.push(this.layer.AddObserver('add_feature',this,this.AddFeatureCallback,null));
this.observingTokens.push(this.layer.AddObserver('display_state',this,this.DisplayStateChanged,null));
this.observingTokens.push(this.layer.AddObserver(this.labelAttribute,this,this.LabelAttributeChanged,null));
if(null!=this.sortAttribute){
this.observingTokens.push(this.layer.AddObserver(this.sortAttribute,this,this.SortAttributeChanged,null));
}
if(null!=this.visibleAttribute){
this.observingTokens.push(this.layer.AddObserver(this.visibleAttribute,this,this.VisibleAttributeChanged,null));
}


this.Redraw();
};





publ.AddFeatureCallback=function(event_){
this.Redraw();
};




publ.Redraw=function(){
this.redrawNeeded=true;
this.CheckRedraw();
};




publ.CheckRedraw=function(){
if(this.redrawNeeded){
if(false==this.model.busy){
this.Erase();
this.Draw();

this.redrawNeeded=false;
this.registered=false;
}else{
if(false==this.registered){
var receiver=this;
this.model.RegisterForEndProcessing(function(){
receiver.CheckRedraw();
});
this.registered=true;
}
}
}
};




publ.Erase=function(){

this.observedFeatures={};


domUtil.RemoveChildren(this.element);
};




publ.Draw=function(){

var features;
if(null!=this.sortAttribute){
features=this.layer.FeaturesSorted(this.sortAttribute);
}else{
features=this.layer.Features();
}


if(null!=this.visibleAttribute){
var oldFeatures=features;
features=[];
for(var loop=0;loop<oldFeatures.length;++loop){
var feature=oldFeatures[loop];
if(0!=feature.GetVariableValue(this.visibleAttribute)){
features.push(feature);
}
}
}


var loop;
for(loop=0;loop<features.length;++loop){
var feature=features[loop];

this.observedFeatures[feature.id]={};

var liElem=this.element.ownerDocument.createElement('li');
this.element.appendChild(liElem);

var spanElem=this.element.ownerDocument.createElement('span');
spanElem.setAttribute('class','text3 text3peer');
spanElem.onmouseover=function(event){
if(!event){
event=window.event;
}
this.featureObject.FocusOnInit(event);
};
spanElem.onmouseout=function(event){
this.featureObject.FocusOffInit();
};
spanElem.onclick=function(event){
this.featureObject.SelectionOnInit();
};
spanElem.featureObject=feature;
liElem.appendChild(spanElem);

this.observedFeatures[feature.id].spanElem=spanElem;

this.DrawLabel(feature);
this.AdjustFromDisplayState(feature);
}
};





publ.DisplayStateChanged=function(event_){
var feature=event_.originator;

this.AdjustFromDisplayState(feature);
};





publ.AdjustFromDisplayState=function(feature_){
var info=this.observedFeatures[feature_.id];
if(null==info)return;
var element=info.spanElem;
if(null==element)return;

var isSelected=feature_.IsSelected();
var isInFocus=feature_.IsInFocus();


if(isSelected&&isInFocus){
element.className='text3 text3peer text3SelectedFocus';
}else if(isSelected){
element.className='text3 text3peer text3Selected';
}else if(isInFocus){
element.className='text3 text3peer text3Focus';
}else{
element.className='text3 text3peer';
}
};





publ.LabelAttributeChanged=function(event_){
var feature=event_.originator;

this.DrawLabel(feature);
};





publ.DrawLabel=function(feature_){
var info=this.observedFeatures[feature_.id];
if(null==info)return;
var element=info.spanElem;
if(null==element)return;


domUtil.RemoveChildren(element);


var textNode=this.element.ownerDocument.createTextNode(feature_.GetVariableValue(this.labelAttribute,'?'));
element.appendChild(textNode);
};





publ.SortAttributeChanged=function(event_){
this.Redraw();
};





publ.VisibleAttributeChanged=function(event_){
this.Redraw();
};
});






mod.DynamicTextLink=Class(mod.DynamicTextCollection,function(publ,priv,supr){




publ.__init__=function(
urlFactory_
){

supr.__init__.call(this);

this.urlFactory=urlFactory_;

this.urlNode=null;
this.spanElem=null;
}




publ.Terminate=function(){
supr.Terminate.call(this);

if(null!=this.urlNode){
this.urlNode.Terminate();
this.urlNode=null;
}

if(null!=this.spanElem){
domUtil.RemoveChildren(this.spanElem);
this.spanElem=null;
}
}







publ.RenderHTML=function(
dataModel_
,htmlNode_
,feature_
)
{
this.currentDataModel=dataModel_;
this.currentFeatureContext=feature_;


this.spanElem=htmlNode_.ownerDocument.createElement('span');
htmlNode_.appendChild(this.spanElem);


if(null!=this.urlFactory){
this.urlNode=this.urlFactory.Create(feature_);
this.urlNode.Parent(this);
}

this.Update();
}




publ.Update=function(){
supr.Terminate.call(this);
domUtil.RemoveChildren(this.spanElem);

var currentUrl="#";
if(null!=this.urlNode){
currentUrl=this.urlNode.Values()[0];
}

var aElem=this.spanElem.ownerDocument.createElement('a');
aElem.setAttribute('href',currentUrl);
this.spanElem.appendChild(aElem);


if(0==this.children.length){
var textNode=this.spanElem.ownerDocument.createTextNode(currentUrl);
aElem.appendChild(textNode);
}

supr.RenderHTML.call(this,this.currentDataModel,aElem,this.currentFeatureContext);
};

});






mod.DynamicTextTopicLink=Class(mod.DynamicTextCollection,function(publ,priv,supr){




publ.__init__=function(
topicIdentifier_
){

supr.__init__.call(this);

this.topicIdentifier=topicIdentifier_;

this.spanElem=null;
this.aElem=null;
}




publ.Terminate=function(){
supr.Terminate.call(this);

if(null!=this.stateObservingToken){
this.stateObservingToken.RemoveObserver();
this.stateObservingToken=null;
}
if(null!=this.titleObservingToken){
this.titleObservingToken.RemoveObserver();
this.titleObservingToken=null;
}

if(null!=this.spanElem){
domUtil.RemoveChildren(this.spanElem);
this.spanElem=null;
this.aElem=null;
}
}







publ.RenderHTML=function(
dataModel_
,htmlNode_
,feature_
)
{
this.feature=dataModel_.Feature('_topics',this.topicIdentifier);
this.stateObservingToken=this.feature.AddObserver('display_state',this,this.TopicStateCallback,null);
this.titleObservingToken=this.feature.AddObserver('title',this,this.TopicTitleCallback,null);


var receiver=this;
this.spanElem=htmlNode_.ownerDocument.createElement('span');
this.spanElem.onclick=function(e){
if(!e){e=window.event;}
if(null==e.dynTextProcessed){
e.dynTextProcessed=true;
receiver.feature.SelectionOnInit();
}
return false;
};
this.spanElem.onmouseover=function(e){
if(!e){e=window.event;}
if(null==e.dynTextProcessed){
e.dynTextProcessed=true;
receiver.feature.FocusOnInit(e);
}
return false;
};
this.spanElem.onmouseout=function(e){
if(!e){e=window.event;}
if(null==e.dynTextProcessed){
e.dynTextProcessed=true;
receiver.feature.FocusOffInit();
}
return false;
};
htmlNode_.appendChild(this.spanElem);


this.aElem=htmlNode_.ownerDocument.createElement('a');
this.aElem.setAttribute('href','#');
this.spanElem.appendChild(this.aElem);

supr.RenderHTML.call(this,dataModel_,this.aElem,feature_);

this.TopicStateCallback();
this.TopicTitleCallback();
};




publ.TopicStateCallback=function()
{
var isSelected=this.feature.IsSelected();
var isInFocus=this.feature.IsInFocus();


if(isSelected&&isInFocus){
this.spanElem.className='text3 text3topicLink text3SelectedFocus';

}else if(isSelected){
this.spanElem.className='text3 text3topicLink text3Selected';

}else if(isInFocus){
this.spanElem.className='text3 text3topicLink text3Focus';

}else{
this.spanElem.className='text3 text3topicLink';
}
};




publ.TopicTitleCallback=function()
{

if(this.children.length>0){
return;
}

var newValue=this.feature.GetVariableValue('title','?');


domUtil.RemoveChildren(this.aElem);


var text=this.aElem.ownerDocument.createTextNode(''+newValue);
this.aElem.appendChild(text);
};
});
});