joo.classLoader.prepare("package joox.faces.taglib.jsf_core",[

"import joox.faces.component.UISelectItem",
"import joox.faces.component.Facet",
"import joox.faces.component.UIViewRoot",

"import joox.faces.TagLib",""],

"public class JsfCoreTagLib extends TagLib",function($jooPublic,$jooPrivate){with(joox.faces.taglib.jsf_core)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(Facet,UIViewRoot,UISelectItem);},

"public static const",{URI:"http://java.sun.com/jsf/core"},

"public static const",{INSTANCE:function(){return(new JsfCoreTagLib());}},

"public function JsfCoreTagLib",function(){
this[$super](URI,{
view:UIViewRoot,
facet:Facet,
selectItem:UISelectItem},
{
option:"selectItem"});
},
];},[]
);joo.classLoader.prepare("package joox.faces.component",[

"import joox.faces.component.UIComponent",
"import joox.el.ELContext",
"import joox.el.ExpressionFactory",
"import joox.el.ValueExpression",""],

"public class UIData extends UIComponent",function($jooPublic,$jooPrivate){with(joox.faces.component)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(ELContext,ExpressionFactory);},

"public function UIData",function(id){
this[$super](id);
},
"public function setVar",function(varName){
this[$varName]=varName;
},
"public function getVar",function(){
return this[$varName];
},
"public function setValue",function(value){
this[$value]=this.createEL(value);
},
"public function getValue",function(){
return this.evalEL(this[$value]);
},
"public function getFirst",function(){
return Number(this.evalEL(this[$first]));
},
"public function setFirst",function(first){
this[$first]=this.createEL(first);
},
"public function getRows",function(){
return Number(this.evalEL(this[$rows]));
},
"public function setRows",function(rows){
this[$rows]=this.createEL(rows);
},
"public function getRowCount",function(){

return this.getValue().length;
},
"public function setRowIndex",function(rowIndex,first){
this[$rowIndex]=rowIndex;
var expressionFactory=ExpressionFactory.instance;
var varExpression=rowIndex==-1
?expressionFactory.createObjectValueExpression(undefined)
:expressionFactory.createIndexValueExpression(this[$value],this[$first],
rowIndex-(first===undefined?this.getFirst():first));
ELContext.instance.getVariableMapper().setVariable(this.getVar(),varExpression);
},
"public function getRowIndex",function(){
return this[$rowIndex];
},
"override protected function restoreState",function(id){
var lastColonPos=id.lastIndexOf(":");
if(lastColonPos<0){
return this.getParent().restoreState(id);

}
if(this.getParent().restoreState(id.substring(0,lastColonPos))){
var thisFirst=this.getFirst();
var thisRowIndex=thisFirst+Number(id.substring(lastColonPos+1));
if(thisRowIndex<this.getRowCount()){
this.setRowIndex(thisRowIndex,thisFirst);
return true;
}
}
return false;
},
"private var",{value: undefined},
"private var",{first:0},
"private var",{rows:0},
"private var",{varName: undefined},
"private var",{rowIndex:-1},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.lang.JOObject",
"import joo.html.Element2",
"import joo.html.Event2",
"import joo.html.EventType",
"import joo.html.InputElementType",
"import joox.faces.component.UIInput",
"import joox.faces.component.UIComponent",
"import joox.faces.component.html.HtmlOutputText",""],









"public class HtmlRadioButton extends HtmlOutputText",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(InputElementType,EventType,UIInput);},

"public function HtmlRadioButton",function(id){
this[$super](id);
this.elementName="input";
},
"public function setName",function(name){

},
"override public function getValue",function(){
return null;
},
"public function getItemValue",function(){
return this[$getValue]();
},
"public function setDisabled",function(disabled){
this[$disabled]=this.createEL(disabled);
},
"public function isDisabled",function(){
return this.evalEL(this[$disabled]);
},
"public function setEnabled",function(enabled){
this.setDisabled(typeof enabled=="boolean"?!enabled:"#{!"+enabled.substring(2));
},
"public function setType",function(type){
if(type!="radio"){
throw new Error("HtmlSelectBooleanCheckbox only supports type='checkbox'.");
}
},
"public override function getType",function(){
return this.elementName=="input"?InputElementType.RADIO:null;
},
"override protected function createElement",function(idSuffix){
var element=this[$createElement](idSuffix);
element.addEventListener(EventType.CLICK,this[$changed],false);
return element;
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);
element.setBooleanAttribute("disabled",this.isDisabled());
var container=this.getContainer();
element.setBooleanAttribute("checked",JOObject.equal(container.getValue(),this.getItemValue()));
},
"private bound function changed",function(event){

var container=this.getContainer();
var elem=event.getTarget();
var clientId=elem.getId();
this.restoreState(clientId);
container.storeValue(this.getItemValue());
this.getView().render();
return true;
},
"private function findContainer",function(){
var component=this.getParent();
while(component){
if(is(component,UIInput)){
return component;
}
component=component.getParent();
}
throw new Error("HtmlRadioButton outside of any UIInput component.");
},
"public function getContainer",function(){
if(!this[$container]){
this[$container]=this[$findContainer]();
}
return this[$container];
},
"private var",{container: undefined},
"private var",{disabled:false},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.Element2",
"import joo.html.EventType",
"import joo.html.Event2",
"import joo.html.InputElementType",
"import joox.faces.component.UIInput",""],

"public class HtmlSelectBooleanCheckbox extends UIInput",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(InputElementType,EventType);},

"public function HtmlSelectBooleanCheckbox",function(id){
this[$super](id);
this.elementName="input";
},
"public function setType",function(type){
if(type!="checkbox"){
throw new Error("HtmlSelectBooleanCheckbox only supports type='checkbox'.");
}
},
"public override function getType",function(){
return InputElementType.CHECKBOX;
},
"override protected function createElement",function(idSuffix){
var element=this[$createElement](idSuffix);
element.addEventListener(EventType.CLICK,this[$changed],false);
return element;
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);
element.setBooleanAttribute("checked",this.getValue());
},
"private bound function changed",function(event){
var elem=event.getTarget();
this.restoreStateStoreValueAndRender(elem,elem.isChecked());
return true;
},
];},[]
);joo.classLoader.prepare("package joox.faces.component",[""],

"public class Facet",function($jooPublic,$jooPrivate){with(joox.faces.component)with($jooPublic)with($jooPrivate)return[

"public function setParent",function(component){
this[$parent]=component;
},
"public function getParent",function(){
return this[$parent];
},
"public function setName",function(name){
this[$name]=name;
},
"public function getName",function(){
return this[$name];
},
"private var",{parent: undefined},
"private var",{name: undefined},

"public function toString",function(){
return this[$name];
},
];},[]
);joo.classLoader.prepare("package joox.faces",[
"import joox.el.ELContext",
"import joox.el.ValueExpression",
"import joox.faces.BeanFactory",""],

"public class ELBeanFactory implements BeanFactory",function($jooPublic,$jooPrivate){with(joox.faces)with($jooPublic)with($jooPrivate)return[

"public function ELBeanFactory",function(valueExpression){this[$super]();
this[$valueExpression]=valueExpression;
},

"public function createValueExpression",function(elContext){
return this[$valueExpression].getValue(elContext);
},

"private var",{valueExpression: undefined},
];},[]
);joo.classLoader.prepare("package joox.faces.component",[

"import joo.html.Document2",
"import joo.html.Element2",
"import joox.faces.component.UIComponent",
"import joox.el.ELContext",
"import joox.el.ExpressionFactory",""],

"public class UISelectItem extends UIComponent",function($jooPublic,$jooPrivate){with(joox.faces.component)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(ELContext,ExpressionFactory);},


"public function UISelectItem",function(id){
this[$super](id);
this.elementName="option";
},
"public function setItemLabel",function(itemLabel){
this[$itemLabel]=ExpressionFactory.instance.createValueExpression(ELContext.instance,itemLabel);
},
"public function getItemLabel",function(){
return this[$itemLabel].getValue(ELContext.instance);
},
"public function setItemValue",function(itemValue){
this[$itemValue]=ExpressionFactory.instance.createValueExpression(ELContext.instance,itemValue);
},
"public function setValue",function(itemLabel){
this.setItemLabel(itemLabel);
},
"public function getItemValue",function(){
return this[$itemValue].getValue(ELContext.instance);
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);


var evalItemLabel=this.getItemLabel();
var textNode=element.getFirstChild();
if(textNode){
textNode.setData(evalItemLabel);
}else{
element.appendChild(Document2.getInstance().createTextNode(evalItemLabel));
}
},
"private var",{itemLabel: undefined},
"private var",{itemValue: undefined},
"override public function toString",function(){
return this.getItemLabel()+": "+this.getItemValue();
},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.Document2",
"import joo.html.Node2",
"import joo.html.Element2",
"import joox.faces.component.UIColumn",
"import joox.faces.component.UIData",
"import joox.faces.component.UIComponent",""],

"public class HtmlDataTable extends UIData",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(UIColumn);},

"public function HtmlDataTable",function(id){
this[$super](id);
this.elementName="table";
},
"private function addColumns",function(component){
var children=component.getChildren();
for(var i=0;i<children.length;++i){
var child=children[i];
if(is(child,UIColumn)){
this[$columns].push(child);
}else{
this[$addColumns](child);
}
}
return this[$columns];
},
"public function getColumns",function(){
if(!this[$columns]){
this[$columns]=[];
this[$addColumns](this);
}
return this[$columns];
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);

this.getFirst();
this.getRows();
this.getValue();
},
"private function createCaption",function(table,idSuffix){
var caption=this.getFacet("caption");
if(caption){
var captionElement=Document2.getInstance().createElement("caption");
captionElement.appendChild(caption.render(idSuffix));
table.appendChild(captionElement);
}
},
"private function updateCaption",function(idSuffix){
var caption=this.getFacet("caption");
if(caption){
caption.render(idSuffix);
}
},
"private function createTableHeaderOrFooter",function(cellElementName,facetName,idSuffix){
var tableHeaderOrFooter=this.getFacet(facetName);
if(tableHeaderOrFooter){
var tr=Document2.getInstance().createElement("tr");
var cellElement=Document2.getInstance().createElement(cellElementName);
cellElement.setAttribute("colSpan",this.getColumns().length);

if(cellElementName=="th"){
cellElement.setAttribute("scope","colgroup");
}
var tableHeaderOrFooterElement=tableHeaderOrFooter.render(idSuffix);
cellElement.appendChild(tableHeaderOrFooterElement);
tr.appendChild(cellElement);
return tr;
}
return null;
},
"private function updateTableHeaderOrFooter",function(facetName,idSuffix){
var tableHeaderOrFooter=this.getFacet(facetName);
if(tableHeaderOrFooter){
tableHeaderOrFooter.render(idSuffix);
}
},
"private function createColumnHeaderOrFooter",function(cellElementName,facetName,idSuffix){
var tr=Document2.getInstance().createElement("tr");
var columns=this.getColumns();
for(var cellIndex=0;cellIndex<columns.length;++cellIndex){
var headerOrFooter=columns[cellIndex];
headerOrFooter=headerOrFooter.getFacet(facetName);
var headerOrFooterElement=headerOrFooter?headerOrFooter.render(idSuffix):null;
var cellElement=Document2.getInstance().createElement(cellElementName);
if(headerOrFooterElement){
this[$hasColumn][facetName]=true;
cellElement.appendChild(headerOrFooterElement);
}
tr.appendChild(cellElement);
}
return this[$hasColumn][facetName]?tr:null;
},
"private function updateColumnHeaderOrFooter",function(facetName,idSuffix){
if(this[$hasColumn][facetName]){
var columns=this.getColumns();
for(var cellIndex=0;cellIndex<columns.length;++cellIndex){
var headerOrFooter=columns[cellIndex];
headerOrFooter=headerOrFooter.getFacet(facetName);
if(headerOrFooter){
headerOrFooter.render(idSuffix);
}
}
}
},
"private function createSection",function(table,sectionElementName,member1,member2){
if(member1||member2){
var sectionElement=Document2.getInstance().createElement(sectionElementName);
if(member1)
sectionElement.appendChild(member1);
if(member2)
sectionElement.appendChild(member2);
table.appendChild(sectionElement);
}
},
"override protected function createElement",function(idSuffix){
var table=this[$createElement](idSuffix);
this[$createCaption](table,idSuffix);

var tableHeader=this[$createTableHeaderOrFooter]("th","header",idSuffix);
var columnHeader=this[$createColumnHeaderOrFooter]("th","header",idSuffix);
this[$createSection](table,"thead",tableHeader,columnHeader);

var columnFooter=this[$createColumnHeaderOrFooter]("td","footer",idSuffix);
var tableFooter=this[$createTableHeaderOrFooter]("td","footer",idSuffix);
this[$createSection](table,"tfoot",columnFooter,tableFooter);

return table;
},
"override protected function updateFacets",function(idSuffix){

this[$updateCaption](idSuffix);

this[$updateTableHeaderOrFooter]("header",idSuffix);
this[$updateColumnHeaderOrFooter]("header",idSuffix);

this[$updateColumnHeaderOrFooter]("footer",idSuffix);
this[$updateTableHeaderOrFooter]("footer",idSuffix);
},
"override protected function renderChildren",function(table,idSuffix){
var columns=this.getColumns();
var tBody=table.getElementsByTagName("tbody").item(0);
if(!tBody){
tBody=Document2.getInstance().createElement("tbody");
table.appendChild(tBody);
}
var first=this.getFirst();
var last=this.getRowCount();
var rows=this.getRows();
if(rows>0&&first+rows<last){
last=first+rows;
}
var rowElements=tBody.getChildNodes();
for(var rowIndex=first;rowIndex<last;++rowIndex){
this.setRowIndex(rowIndex,first);
var tableRowIndex=rowIndex-first;
var rowIdSuffix=idSuffix+":"+tableRowIndex;
var row;
if(tableRowIndex<rowElements.getLength()){
row=rowElements.item(tableRowIndex);

}else{
row=Document2.getInstance().createElement("tr");
tBody.appendChild(row);
}
for(var cellIndex=0;cellIndex<columns.length;++cellIndex){
var column=columns[cellIndex];
var cellElement=column.render(rowIdSuffix);
if(cellIndex>=row.getChildCount()||!cellElement.equals(row.getChildNode(cellIndex))){
row.appendChild(cellElement);
}
}
}
var rowCount=last-first;
while(tBody.getChildCount()>rowCount){
tBody.removeChild(tBody.getLastChild());
}
this.setRowIndex(-1,-1);
},
"private var",{hasColumn:function(){return({header:false,footer:false});}},
"private var",{columns: undefined},
];},[]
);joo.classLoader.prepare("package joox.faces",[

"import joox.el.ELContext",
"import joox.el.ELResolver",
"import joox.faces.ManagedBeanFacility",""],

"public class ManagedBeanELResolver extends ELResolver",function($jooPublic,$jooPrivate){with(joox.faces)with($jooPublic)with($jooPrivate)return[

"override public function getValue",function(elContext,base,property){
if(base===null){
var bean=ManagedBeanFacility.getBean(elContext,property);
if(bean){
return bean;
}
}
return this[$getValue](elContext,base,property);
},
];},[]

);joo.classLoader.prepare("package joox.faces.component",[

"import joox.faces.component.UIComponent",""],

"public class UIColumn extends UIComponent",function($jooPublic,$jooPrivate){with(joox.faces.component)with($jooPublic)with($jooPrivate)return[

"public function UIColumn",function(id){
this[$super](id);
this.elementName="td";
},
"public function getHeader",function(){
return this.getFacet("header");
},
"public function getFooter",function(){
return this.getFacet("footer");
},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.Element2",
"import joox.faces.component.UIComponent",
"import joox.el.ExpressionFactory",
"import joox.el.ELContext",""],

"public class HtmlGraphicImage extends UIComponent",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(ELContext,ExpressionFactory);},

"public function HtmlGraphicImage",function(id){
this[$super](id);
this.elementName="img";
},
"public function setSrc",function(src){
this[$src]=ExpressionFactory.instance.createValueExpression(ELContext.instance,src);
},
"public function getSrc",function(){
return this[$src].getValue(ELContext.instance);
},
"public function setAlt",function(alt){
this[$alt]=ExpressionFactory.instance.createValueExpression(ELContext.instance,alt);
},
"public function getAlt",function(){
return this[$alt].getValue(ELContext.instance);
},
"public function setComplete",function(complete){

},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);
element.setSrc(this.getSrc());
element.setAttribute("alt",this.getAlt());
},
"private var",{src: undefined},
"private var",{alt: undefined},
];},[]
);joo.classLoader.prepare("package joox.faces",[

"import joox.el.ELContext",""],




"public interface BeanFactory",function($jooPublic,$jooPrivate){with(joox.faces)with($jooPublic)with($jooPrivate)return[

,

];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.Element2",
"import joo.html.InputElementType",
"import joox.faces.component.html.HtmlCommandButton",""],

"public class HtmlCommandLink extends HtmlCommandButton",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[

"public function HtmlCommandLink",function(id){
this[$super](id);
this.elementName="a";
},
"override public function getType",function(){
return undefined;
},
"override protected function createElement",function(idSuffix){
var element=this[$createElement](idSuffix);
element.setAttribute("href","#");
element.setAttribute("tabIndex","0");
return element;
},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.Element2",
"import joo.html.InputElementType",
"import joo.html.Event2",
"import joo.html.EventType",
"import joo.css.Color",
"import joox.faces.component.UIInput",""],

"public class HtmlInputText extends UIInput",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(InputElementType,EventType,Color);},

"public function HtmlInputText",function(id){
this[$super](id);
this.elementName="input";
},
"public function setType",function(type){
if(type!="text"){
throw new Error("HtmlInputText only supports type='text'.");
}
},
"override protected function createElement",function(idSuffix){
var element=this[$createElement](idSuffix);
element.setType(InputElementType.TEXT);
element.addEventListener(EventType.FOCUS,function(){
element.getStyle().setBorderColor(Color.BLUE);
},false);
element.addEventListener(EventType.BLUR,function(){
element.getStyle().setBorderColor(null);
},false);
element.addEventListener(EventType.CHANGE,this[$changed]);
element.addEventListener(EventType.KEYPRESS,Event2.createAfterDispatchHandler(this[$changed]));
return element;
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);
element.setValue(this.getValue());
},
"private bound function changed",function(event){
this.restoreStateStoreValueAndRender(event.getTarget());
return true;
},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joox.faces.component.html.HtmlOutputText",
"import joox.el.ExpressionFactory",
"import joox.el.ELContext",
"import joox.el.ValueExpression",
"import joo.html.Element2",""],

"public class HtmlTableCell extends HtmlOutputText",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(ValueExpression,ELContext,ExpressionFactory);},

"private var",{colspan: undefined},
"private var",{rowspan: undefined},

"public function HtmlTableCell",function(id){
this[$super](id);
this.elementName="td";
},
"public function setColspan",function(colspan){
this[$colspan]=ExpressionFactory.instance.createValueExpression(ELContext.instance,colspan);
},
"public function getColspan",function(){
return getSpan(this[$colspan]);
},
"public function getRowspan",function(){
return getSpan(this[$rowspan]);
},
"private static function getSpan",function(span){
if(is(span,ValueExpression)){
return span.getValue(ELContext.instance);
}
return span?Number(span):1;
},
"private static function setSpan",function(element,attributeName,span){
if(span==1){
element.removeAttribute(attributeName);
}else{
element.setAttribute(attributeName,String(span));
}
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);
setSpan(element,"colspan",this.getColspan());
setSpan(element,"rowspan",this.getRowspan());
},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.Node2",
"import joo.html.Document2",
"import joo.html.Element2",
"import joo.html.Event2",
"import joo.html.EventType",
"import joo.html.Command",
"import joo.util.TimedExecutor",
"import joox.faces.component.html.HtmlInputTextarea",""],

"public class HtmlInputRichText extends HtmlInputTextarea",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(Command,EventType);},

"public function HtmlInputRichText",function(id){
this[$super](id);
},
"override protected function createElement",function(idSuffix){
this.elementName="iframe";
var element=this[$createElement](idSuffix);
element.setSrc("");
window.setTimeout(function(){
this[$frameDocument]=this[$initFrame](element);
}.bind(this),0);
return element;
},
"private function initFrame",function(element){
var document=element.getContentDocument();

document.write("<html>");
document.write("<head><title>RichText Editor</title><link rel='stylesheet' href='css/coremedia-richtext-1.0.css' /><link rel='stylesheet' href='css/coremedia-richtext-editing.css' /></head>");
document.write("<body></body>");
document.write("</html>");
document.close();
document.setDesignMode(true);
document.getWindow().addEventListener(EventType.BLUR,function(event){
this[$updateModel](event.getOwnerDocument());
return true;
}.bind(this),true);
if(this[$updateModelTimer]){
this[$updateModelTimer].stop();
}
this[$updateModelTimer]=new TimedExecutor(function(){
this[$updateModel](document);
}.bind(this),1000);
this[$updateModelTimer].start();
return document;
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);
window.setTimeout(function(){
this[$updateView](element.getContentDocument());
this[$updateModelTimer].start();
}.bind(this),250);
},
"private function updateView",function(document){
document.getBody().setInnerHTML(this.getValue());
},
"private function updateModel",function(document){
var frameElement=document.getWindow().getFrameElement();
if(frameElement){
var clientId=frameElement.getId();
this.restoreState(clientId);
this.storeValue(document.getBody().getInnerHTML());
this.getView().render();
}else{
this[$updateModelTimer].stop();
}
},
"override protected function removeNode",function(node){
this[$updateModelTimer].stop();
this[$removeNode](node);
},
"private function execute",function(cmd){




this[$frameDocument].ownerWindow.focus();
cmd.execute(this[$frameDocument]);
this.storeValue(this[$frameDocument].getBody().getInnerHTML());
},
"public function bold",function(){
this[$execute](Command.BOLD);
},
"public function italic",function(){
this[$execute](Command.ITALIC);
},

"private var",{frameDocument: undefined},
"private var",{updateModelTimer: undefined},
];},[]
);joo.classLoader.prepare("package joox.faces",[

"import joo.html.NodeList2",
"import joo.html.NodeList2Impl",
"import joox.faces.FacesConfigTransformer",
"import joox.faces.taglib.jsf_core.JsfCoreTagLib",
"import joox.faces.taglib.html_basic.HtmlBasicTagLib",
"import joo.html.Document2",
"import joo.html.Element2",
"import joox.faces.TagLib",
"import joox.faces.ManagedBeanFacility",
"import joox.faces.component.UIViewRoot",""],
















"public class Transformer",function($jooPublic,$jooPrivate){with(joox.faces)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(JsfCoreTagLib,HtmlBasicTagLib);},

"private static const",{DEBUG:false},

"public static function main",function(managedBeans){
if(managedBeans){
ManagedBeanFacility.add(managedBeans);
}
FacesConfigTransformer.transform(Document2.getInstance());
joo.classLoader.complete(transform);
},

"public static function transform",function(){
HtmlBasicTagLib.URI;

var document=Document2.getInstance();
var views=document.getElementsByTagNameNS(JsfCoreTagLib.URI,"view");
if(views.getLength()==0){

var divViews=new NodeList2Impl();
var divs=document.getElementsByTagName("div");
for(var j=0;j<divs.getLength();++j){
var div=divs.item(j);
if(div.getAttribute("jsfc")=="f:view"){
divViews.push(div);
}
}
views=divViews;
}
if(DEBUG){
trace("found "+views.length+" views.");
}
for(var i=0;i<views.getLength();++i){
var viewElem=views.item(i);
if(DEBUG)
trace("processing "+viewElem.getNodeName());
var view=TagLib.createComponentAndChildren(null,viewElem);
viewElem.setInnerHTML("");
var newViewElem=view.create();
if(DEBUG)
trace(viewElem.getNodeName()+" -> "+newViewElem.getNodeName());
viewElem.replace(newViewElem);

}
},
];},["main","transform"]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.Document2",
"import joo.html.Node2",
"import joo.html.NodeType",
"import joo.html.TextNode2",
"import joo.html.Element2",
"import joox.faces.component.UIComponent",
"import joox.faces.component.UIOutput",""],

"public class HtmlOutputText extends UIOutput",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(NodeType);},

"private var",{textNodeIndex: undefined},
"private var",{escape: undefined},

"public function HtmlOutputText",function(id){
this[$super](id);
this.elementName="span";
this[$textNodeIndex]=0;
this[$escape]=true;
},
"public function setEscape",function(escape){
this[$escape]=this.createEL(escape);
},
"public function isEscape",function(){
return this.evalEL(this[$escape]);
},
"override protected function createNode",function(idSuffix){
if(this.elementName=="#text"){
return Document2.getInstance().createTextNode("");
}
return this[$createNode](idSuffix);
},
"protected override function createElement",function(idSuffix){
var element=this[$createElement](idSuffix);
if(this.isEscape()){
element.appendChild(Document2.getInstance().createTextNode(""));
}
return element;
},
"override protected function getNode",function(clientId){
if(this.elementName=="#text"){
var parent=this.getParent();
var colonPos=clientId.indexOf(":");
clientId=parent.getId()+(colonPos?clientId.substring(colonPos):"");
var parentNode=parent.getNode(clientId);
return parentNode?parentNode.getChildNode(this[$textNodeIndex]):null;
}
return this[$getNode](clientId);
},
"override protected function updateNode",function(node){
this[$updateNode](node);
var value=this.getValue();
if(!value)
value="";
if(this.isEscape()){
var textNode;
if(node.getNodeType()===NodeType.TEXT_NODE){
textNode=node;
}else{
textNode=node.getChildNode(this[$textNodeIndex]);
}
textNode.setData(value);
}else{
(node).setInnerHTML(value);
}
},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.Element2",
"import joo.html.Event2",
"import joo.html.EventType",
"import joo.html.TextNode2",
"import joox.faces.component.UIInput",""],

"public class HtmlInputTextarea extends UIInput",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(EventType);},

"public function HtmlInputTextarea",function(id){
this[$super](id);
this.elementName="textarea";
},
"public function getCols",function(){
return this.evalEL(this[$cols]);
},
"public function setCols",function(cols){
this[$cols]=this.createEL(cols);
},
"public function getRows",function(){
return this.evalEL(this[$rows]);
},
"public function setRows",function(rows){
this[$rows]=this.createEL(rows);
},
"override protected function createElement",function(idSuffix){
var element=this[$createElement](idSuffix);
element.appendChild(element.ownerDocument.createTextNode(""));
element.addEventListener(EventType.CHANGE,this[$changed]);
element.addEventListener(EventType.KEYPRESS,Event2.createAfterDispatchHandler(this[$changed]));
return element;
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);
element.setAttribute("cols",this.getCols());
element.setAttribute("rows",this.getRows());
(element.getFirstChild()).setData(this.getValue());
},
"private bound function changed",function(event){
this.restoreStateStoreValueAndRender(event.getTarget());
return true;
},
"private var",{cols: undefined,rows: undefined},
];},[]
);joo.classLoader.prepare("package org.apache.myfaces.custom",[

"import org.apache.myfaces.custom.datalist.HtmlDataList",
"import joox.faces.TagLib",""],

"public class TomahawkTagLib extends TagLib",function($jooPublic,$jooPrivate){with(org.apache.myfaces.custom)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(HtmlDataList);},

"public static const",{INSTANCE:function(){return(new TomahawkTagLib());}},

"public function TomahawkTagLib",function(){
this[$super]("http://myfaces.apache.org/tomahawk",{
dataList:HtmlDataList},{});
},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joox.faces.component.html.HtmlOutputText",
"import joo.html.Element2",""],

"public class HtmlOutputLabel extends HtmlOutputText",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[

"private var",{forId: undefined},

"public function HtmlOutputLabel",function(id){
this[$super](id);
this.elementName="label";
},
"public function setFor",function(forId){
this[$forId]=forId;
},
"public function getFor",function(){
return this[$forId];
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);
var thisForId=this.getFor();
if(thisForId){
element.setFor(thisForId);
}
},
];},[]
);joo.classLoader.prepare("package joox.faces.component",[

"import joo.lang.JOObject",
"import joo.html.Document2",
"import joo.html.Node2",
"import joo.html.NodeType",
"import joo.html.Element2",
"import joo.html.InputElementType",
"import joox.el.ExpressionFactory",
"import joox.el.ELContext",
"import joox.el.ValueExpression",
"import joox.cache.DependencyTracker",
"import joox.faces.component.Facet",""],

"public class UIComponent extends JOObject",function($jooPublic,$jooPrivate){with(joox.faces.component)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(ValueExpression,ELContext,NodeType,Facet,ExpressionFactory);},

"public var",{elementName:"div"},
"public function UIComponent",function(id){
this[$super]();
this[$id]=id;
},
"public function getId",function(){
return this[$id];
},
"public function setBinding",function(binding){
var elContext=ELContext.instance;
var bindingVB=ExpressionFactory.instance.createValueExpression(elContext,binding);
bindingVB.setValue(elContext,this);
},
"protected function createEL",function(value){
return typeof value=="string"&&value.indexOf("#{")>=0
?ExpressionFactory.instance.createValueExpression(ELContext.instance,value)
:value;
},
"protected function evalEL",function(value){
return is(value,ValueExpression)
?value.getValue(ELContext.instance)
:value;
},
"public function isRendered",function(){
return this.evalEL(this[$rendered]);
},
"public function setRendered",function(rendered){
this[$rendered]=this.createEL(rendered);
},
"public function setElementName",function(elementName){
this.elementName=elementName;
},
"public function getType",function(){
return null;
},
"public function getStyle",function(){
return this.evalEL(this[$style]);
},
"public function setStyle",function(style){
this[$style]=this.createEL(style);
},
"public function getStyleClass",function(){
return this.evalEL(this[$styleClass]);
},
"public function setStyleClass",function(styleClass){
this[$styleClass]=this.createEL(styleClass);
},
"public function getTitle",function(){
return this.evalEL(this[$title]);
},
"public function setTitle",function(title){
this[$title]=this.createEL(title);
},
"public function getParent",function(){
return this[$parent];
},
"public function setParent",function(parent){
if(is(parent,Facet)){
var facet=parent;
parent=facet.getParent();
parent.getFacets()[facet.getName()]=this;
}else{
parent.getChildren().push(this);
}
this[$parent]=parent;
this[$view]=parent.getView();
this[$view].registerComponent(this);
},
"public function getChildren",function(){
return this[$children];
},
"public function getChild",function(index){
return this.getChildren()[index];
},
"public function getFacet",function(facetName){
return this[$facets][facetName];
},
"public function getFacets",function(){
return this[$facets];
},
"public function getView",function(){
return this[$view];
},
"protected function getNode",function(clientId){
return Document2.getInstance().getElementById(clientId);
},
"public function render",function(idSuffix){if(arguments.length<1){idSuffix="";}
var clientId=this[$id]+idSuffix;
var node=this.getNode(clientId);
var peer=node?node.getPeerNode():null;
if(peer&&"scopeName"in peer&&peer["scopeName"]!="HTML"){

node=null;
}
var thisView=this.getView();
if(!thisView.isInvalid(clientId)&&node){

if(node.getNodeType()===NodeType.ELEMENT_NODE){
this.renderChildren(node,idSuffix);
}
return node;
}else{
thisView.revalidate(clientId);
DependencyTracker.start({
invalidated:function(dependencySet){
thisView.invalidate(clientId);
dependencySet.clear();
}
},"component rendition "+clientId);

var result=this[$internalRender](node,idSuffix);

DependencyTracker.stop();

return result;
}
},
"private function internalRender",function(node,idSuffix){
if(!this.isRendered()){
if(node){
this.removeNode(node);
}
return null;
}
if(node&&node.getNodeName().toLowerCase()!=this.elementName){
this.removeNode(node);
node=null;
}
var isNewNode=!node;
if(isNewNode){
node=this.createNode(idSuffix);
}
this.updateNode(node);
if(node.getNodeType()===NodeType.ELEMENT_NODE){
if(!isNewNode)
this.updateFacets(idSuffix);
this.renderChildren(node,idSuffix);
}
return node;
},

"protected function removeNode",function(node){
node.remove();
},
"protected function createNode",function(idSuffix){
return this.createElement(idSuffix);
},
"protected function createElement",function(idSuffix){

var type=this.getType();
var element=Document2.getInstance().createElement(this.elementName,type);
element.setId(this[$id]+idSuffix);
return element;
},
"protected function updateFacets",function(idSuffix){

},
"protected function updateNode",function(node){
if(node.getNodeType()===NodeType.ELEMENT_NODE){
this.updateAttributes(node);
}
},
"protected function updateAttributes",function(element){
var thisStyleClass=this.getStyleClass();
if(typeof thisStyleClass=="string")
element.setClassName(thisStyleClass);
var thisStyle=this.getStyle();
if(typeof thisStyle=="string")
element.setCssText(thisStyle);
var thisTitle=this.getTitle();
if(typeof thisTitle=="string")
element.setAttribute("title",thisTitle);
},





"protected function renderChildren",function(element,idSuffix){
var thisChildren=this.getChildren();
for(var i=0;i<thisChildren.length;++i){
var child=thisChildren[i];

child.isRendered();
var childElement=child.render(idSuffix);
if(childElement){
if(i>=element.getChildCount()||!childElement.equals(element.getChildNode(i))){
element.appendChild(childElement);
}

}
}
},
"protected function restoreState",function(id){
return this.getParent().restoreState(id);
},
"private var",{view: undefined},
"private var",{id: undefined},
"private var",{rendered:function(){return(ExpressionFactory.instance.createObjectValueExpression(true));}},
"private var",{style: undefined},
"private var",{styleClass: undefined},
"private var",{title: undefined},
"private var",{parent: undefined},
"private var",{children:function(){return([]);}},
"private var",{facets:function(){return({});}},

"override public function toString",function(){
return this[$id];
},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.Element2",
"import joo.html.Event2",
"import joo.html.EventType",
"import joo.lang.JOObject",
"import joox.faces.component.UIInput",
"import joox.faces.component.UISelectItem",""],

"public class HtmlSelectOneList extends UIInput",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(EventType);},

"public function HtmlSelectOneList",function(id){
this[$super](id);
this.elementName="select";
},



"public function getSelectItem",function(index){
return this.getChild(index);
},
"private bound function updateProperty",function(event){
var target=event.getTarget();
var clientId=target.getId();
this.restoreState(clientId);
var childIndex=target.getPeer().selectedIndex;
if(childIndex>=0){
var itemValue=this.getSelectItem(childIndex).getItemValue();
this.storeValue(itemValue);
this.getView().render();
return true;
}
return false;
},
"override protected function createElement",function(idSuffix){
var element=this[$createElement](idSuffix);
if(this.getValueExpression()){
element.addEventListener(EventType.CHANGE,this[$updateProperty],false);
}
return element;
},
"private function findOption",function(newValue){

var childCount=this.getChildren().length;
for(var i=0;i<childCount;++i){
if(JOObject.equal(newValue,this.getSelectItem(i).getItemValue())){
return i;
}
}
return-1;
},
"override protected function renderChildren",function(element,idSuffix){
this[$renderChildren](element,idSuffix);
var selectedIndex=this[$findOption](this.getValue());
if(selectedIndex>=0){
element.setSelectedIndex(selectedIndex);
}
},
];},[]
);joo.classLoader.prepare("package joox.faces",[

"import joo.html.Node2",
"import joo.html.NodeType",
"import joo.html.TextNode2",
"import joo.html.Element2",
"import joo.util.PropertyAware",
"import joox.faces.component.UIComponent",""],

"public class TagLib",function($jooPublic,$jooPrivate){with(joox.faces)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(Element2,NodeType);},

"private static const",{DEBUG:false},

"private static const",{tagLibs:function(){return([]);}},
"private static const",{tagLibByUri:function(){return({});}},

"private static function registerTagLib",function(tagLib){
tagLibs.push(tagLib);
tagLibByUri[tagLib.getUri()]=tagLib;
},

"public static function byUri",function(uri){
return tagLibByUri[uri];
},

"private static function createComponentFromHtmlNode",function(parent,node){

for(var i=0;i<tagLibs.length;++i){
var tagLib=tagLibs[i];
var component=tagLib.createComponent(parent,null,node);
if(component){
return component;
}
}
return parent;
},

"public static function createComponentFromNode",function(parent,node){
if(node.getNodeType()===NodeType.TEXT_NODE){
return createComponentFromHtmlNode(parent,node);
}
var tagName=node.getLocalName();
var namespaceURI=node.getNamespaceURI();
var tagLib;
var component;
if(namespaceURI==Element2.XHTML_NAMESPACE_URI){
tagName=tagName.toLowerCase();
var element=node;
var jsfc=element.getAttribute("jsfc");
if(!jsfc){

return createComponentFromHtmlNode(parent,node);
}
var parts=jsfc.split(":");
if(!parts.length==2){
throw new Error("jsfc must be of format namespace ':' tag.");
}
namespaceURI=element.findNamespaceURIDefinition(parts[0]);
tagName=parts[1];
}
tagLib=tagLibByUri[namespaceURI];
if(typeof tagLib=="object"){
if(DEBUG)
trace("creating component from tag-lib "+namespaceURI+" for tag "+tagName+" and element "+node.getLocalName());
component=tagLib.createComponent(parent,tagName,node);
if(DEBUG)
trace("created component from tag-lib "+namespaceURI+" for tag "+tagName+" and element "+node.getLocalName()+": "+component);
return component;
}
return null;
},

"public static function createComponentAndChildren",function(parent,node){
var component=createComponentFromNode(parent,node);
if(component){
for(var i=0;i<node.getChildCount();++i){
createComponentAndChildren(component,node.getChildNode(i));
}
}
return component;
},

"public function TagLib",function(uri,tagHandlers,jscfByElementName){
this[$super]();
this[$uri]=uri;
this[$componentClassByTagName]=tagHandlers;
this[$jscfByElementName]=jscfByElementName;
registerTagLib(this);
},
"public function getUri",function(){
return this[$uri];
},
"public function createComponent",function(parent,tagName,node){
var namespaceURI=node.getNamespaceURI();
if(namespaceURI==Element2.XHTML_NAMESPACE_URI){
var htmlElementName=node.getLocalName().toLowerCase();
if(!tagName){
tagName=this[$jscfByElementName][htmlElementName];
if(typeof tagName=="object"){

tagName=tagName[node.getPeerNode()["type"]];
}
}
}
var componentClass=this[$componentClassByTagName][tagName];
if(typeof componentClass=="function"){
var textNode;
var properties={};
var nodeType=node.getNodeType();
if(nodeType===NodeType.ELEMENT_NODE){
var element=node;
var peer=element.getPeer();
var attributes=peer.attributes;
for(var i=0;i<attributes.length;++i){
var attr=attributes.item(i);
if(attr.specified){
var propParts=attr.name.split(":");
var propName=propParts.pop();
if(propParts.length==0){

propName=propName.toLowerCase();
}
if(htmlElementName=="a"&&propName=="href"){
propName="value";
}else if(htmlElementName=="option"&&propName=="value"){
propName="itemValue";
}
var value=propName=="class"?element.getClassName():propName=="for"?element.getFor():attr.value;
if(propName!="jsfc"){
if(propName=="class"){
propName="styleClass";
}


if(!(propName in properties)||propParts.length>0){
properties[propName]=value;
if(DEBUG)
trace("setting attribute "+attr.name+" as property "+propName+" to "+value);
}
}
}
}
}else if(nodeType==NodeType.TEXT_NODE){
textNode=node;
properties.value=textNode.getData();
}
var id=properties.id;
if(id){
delete properties.id;
}else{
id="_id"+(++idCnt);
}
var component=new componentClass(id);
component.setParent(parent);
if(htmlElementName){
component.elementName=htmlElementName;
if(typeof properties.value=="undefined"&&typeof component["setValue"]=="function"){
var textValue="";
if(node.getFirstChild()&&node.getFirstChild().getNodeType()===NodeType.TEXT_NODE){
textNode=node.getFirstChild();
textValue=textNode.getData();

node.removeChild(textNode);
}
if(DEBUG)
trace("setting attribute value to text node child's data '"+textValue+"'.");
properties.value=textValue;
}
}
PropertyAware.setProperties(component,properties);
if(DEBUG)
trace("returning component "+component);
return component;
}
return null;
},
"private var",{uri: undefined},
"private var",{componentClassByTagName:function(){return({});}},
"private var",{jscfByElementName:function(){return({});}},

"private static var",{idCnt:0},
];},["byUri","createComponentFromNode","createComponentAndChildren"]
);joo.classLoader.prepare("package joox.faces.controller",[

"import joo.lang.JOObject",""],

"public class Tab extends JOObject",function($jooPublic,$jooPrivate){with(joox.faces.controller)with($jooPublic)with($jooPrivate)return[

"public function Tab",function(tabs,index,name){
this[$super]();
this.tabs=tabs;
this.index=index;
this.name=name;
},

"public function isSelected",function(){
return this.tabs.getSelectedIndex()==this.index;
},

"public function select",function(){
this.tabs.setSelectedIndex(this.index);
},

"public var",{tabs: undefined},
"public var",{index: undefined},
"public var",{name: undefined},
];},[]
);joo.classLoader.prepare("package joox.faces.controller",[

"import joox.cache.DependencyAwareAspect",
"import joox.faces.component.UIData",""],

"public class DataPageController",function($jooPublic,$jooPrivate){with(joox.faces.controller)with($jooPublic)with($jooPrivate)return[function()

{
DependencyAwareAspect.instrumentClass(DataPageController);
},

"public function getRowCount",function(){
return this.getUiData().getRowCount();
},
"public function setFirst",function(first){
this[$first]=Number(first);
},
"public function getFirst",function(){
return this[$first];
},
"public function setRows",function(rows){
this[$rows]=Number(rows);
},
"public function getRows",function(){
return this[$rows];
},
"public function isPreviousPageEnabled",function(){
return this.getFirst()>0;
},
"public function previousPage",function(){
if(this.isPreviousPageEnabled()){
var newFirst=this.getFirst();
var thisRows=this.getRows();
newFirst=thisRows==0?0:Math.max(0,newFirst-thisRows);
this.setFirst(newFirst);
}
},
"public function isNextPageEnabled",function(){
return this.getRows()>0&&this.getFirst()+this.getRows()<this.getRowCount();
},
"public function nextPage",function(){
if(this.isNextPageEnabled()){
this.getUiData();
this.setFirst(this.getFirst()+this.getRows());
}
},

"public function setUiData",function(uiData){
this[$uiData]=uiData;
},
"public function getUiData",function(){
return this[$uiData];
},
"public function getSelected",function(){
return! !this[$selection][this.getUiData().getRowIndex()];
},
"public function setSelected",function(selected){
var index=this.getUiData().getRowIndex();
var thisSelection=this[$selection];
if(thisSelection[index]!=selected){
thisSelection[index]=selected;
this[$selectionCount]+=selected?1:-1;
}
},
"public function getSelectionCount",function(){
return this[$selectionCount];
},
"public function toggleSelectAll",function(){
var rowCount=this.getUiData().getRowCount();
if(this.getSelectionCount()==rowCount){
this[$selection]=[];
this[$selectionCount]=0;
}else{
var thisSelection=this[$selection];
for(var i=0;i<rowCount;++i){
thisSelection[i]=true;
}
this[$selectionCount]=rowCount;
}
},
"private var",{uiData: undefined},
"private var",{first:0},
"private var",{rows:0},
"private var",{selection:function(){return([]);}},
"private var",{selectionCount:0},

"public function toString",function(){
return["DataPageController[",this[$uiData],"]"].join("");
},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.Document2",
"import joo.html.Node2",
"import joo.html.TextNode2",
"import joo.html.Element2",
"import joo.html.EventType",
"import joo.html.Event2",
"import joo.css.Color",
"import joox.faces.component.UIInput",
"import KeyEvent",""],

"public class HtmlInputKey extends UIInput",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(KeyEvent,EventType,Color);},

"public function HtmlInputKey",function(id){
this[$super](id);
this.elementName="a";
},
"public function setType",function(type){
if(type!="text"){
throw new Error("HtmlInputKey only supports type='text'.");
}
},
"override public function render",function(idSuffix){if(arguments.length<1){idSuffix="";}
this.elementName=this.isDisabled()?"span":"a";
return this[$render](idSuffix);
},
"override protected function createElement",function(idSuffix){
var element=this[$createElement](idSuffix);
if(element.getNodeName().toLowerCase()=="a"){
element.setAttribute("href","#");
element.setAttribute("tabIndex","0");
element.addEventListener(EventType.CLICK,function(){
element.focus();
return false;
},false);
element.addEventListener(EventType.FOCUS,function(){
element.getStyle().setBackgroundColor(Color.LIGHT_BLUE);
},false);
element.addEventListener(EventType.BLUR,function(){
element.getStyle().setBackgroundColor(null);
},false);
element.addEventListener(EventType.KEYDOWN,this[$changed]);
}
return element;
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);
var value=this.getValue();
var data;
if(value===undefined){
data="--";
}else if(value>=KeyEvent.DOM_VK_LEFT&&value<=KeyEvent.DOM_VK_DOWN){

data=String.fromCharCode(8592+value-37);
}else if(value>=KeyEvent.DOM_VK_F1&&value<=KeyEvent.DOM_VK_F24){
data="F"+(value-KeyEvent.DOM_VK_F1+1);
}else if(value>=KeyEvent.DOM_VK_NUMPAD0&&value<=KeyEvent.DOM_VK_NUMPAD9){
data="N"+(value-KeyEvent.DOM_VK_NUMPAD0);
}else{
switch(value){
case KeyEvent.DOM_VK_ADD:data="N+";break;
case KeyEvent.DOM_VK_SUBTRACT:data="N-";break;
case KeyEvent.DOM_VK_MULTIPLY:data="N*";break;
case KeyEvent.DOM_VK_DIVIDE:data="N/";break;
case KeyEvent.DOM_VK_PERIOD:data="N.";break;
default:

data=String.fromCharCode(value);
if(data.match(/\W/)){

data=String(value);
}
}
}
var textNode=element.getFirstChild();
if(textNode){
textNode.setData(data);
}else{
element.appendChild(Document2.getInstance().createTextNode(data));
}
},
"private bound function changed",function(event){

if(event.getKeyCode()>32){
this.restoreStateStoreValueAndRender(event.getTarget(),event.getKeyCode());
event.preventDefault();
event.stopPropagation();
return false;
}
return true;
},
];},[]
);joo.classLoader.prepare("package joox.faces.component",[

"import joox.faces.component.UIComponent",""],

"public class UIOutput extends UIComponent",function($jooPublic,$jooPrivate){with(joox.faces.component)with($jooPublic)with($jooPrivate)return[

"public function UIOutput",function(id){
this[$super](id);
},
"public function setValue",function(value){
this[$value]=this.createEL(value);
},
"public function getValue",function(){
return this.evalEL(this[$value]);
},
"protected function getValueExpression",function(){
return this[$value];
},
"private var",{value: undefined},
];},[]
);joo.classLoader.prepare("package joox.faces.component",[

"import joo.html.Document2",
"import joo.html.Node2",
"import joo.html.Element2",
"import joo.css.Border",
"import joo.css.Length",
"import joo.css.BorderStyle",
"import joo.css.Color",
"import joox.faces.component.UIComponent",
"import joo.html.Browser",
"import joo.util.HashSet",
"import joo.util.GapArrayIterator",""],

"public class UIViewRoot extends UIComponent",function($jooPublic,$jooPrivate){with(joox.faces.component)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(Browser,BorderStyle,Color);},

"private static const",{DEBUG:false},
"private static const",{IS_OPERA:function(){return(Browser.ENGINE===Browser.ENGINE_OPERA);}},

"public function UIViewRoot",function(id){
this[$super](id);
this.registerComponent(this);
},
"public override function setParent",function(parent){


},
"override public function getView",function(){
return this;
},
"override protected function restoreState",function(id){
if(id.indexOf(":")>=0)
throw"Assertion failed: View#restoreState must receive id without colon (':').";
return true;
},
"public function create",function(){
var element=this.render();
this[$invalidComponentClientIds]=new HashSet();
return element;
},
"private static const",{LOWLIGHT_BORDER:function(){return(new Border(Length.px(1),BorderStyle.SOLID,Color.YELLOW));}},
"private static const",{HIGHLIGHT_BORDER:function(){return(new Border(Length.px(1),BorderStyle.SOLID,Color.GREEN));}},
"override public function render",function(idSuffix1){if(arguments.length<1){idSuffix1="";}
if(this.isInvalid(this.getId())){

return this[$render]();
}



var document=Document2.getInstance();
var clientIdI;
var clientId;
if(DEBUG){
var oldBorders={};
for(clientIdI=this[$invalidComponentClientIds].iterator();clientIdI.hasNext();){
clientId=clientIdI.next();
var element=document.getElementById(clientId);
if(element){
oldBorders[clientId]=element.getStyle().getBorder();
element.getStyle().setBorder(this[$isParentInvalid](this[$componentById]["_"+clientId.split(":")[0]])
?LOWLIGHT_BORDER:HIGHLIGHT_BORDER);
}
}

window.alert("start rendering...");

for(var clientId2 in oldBorders){
document.getElementById(clientId2).getStyle().setBorder(oldBorders[clientId2]);
}
}
for(clientIdI=this[$invalidComponentClientIds].iterator();clientIdI.hasNext();){
clientId=clientIdI.next();
if(clientId){
var parts=clientId.split(":");
var id=parts[0];
var component=this[$componentById]["_"+id];
if(!this[$isParentInvalid](component)){
var idSuffix=parts[1]?":"+parts[1]:"";
if(component.restoreState(clientId)){
component.render(idSuffix);
}

}

}
}

if(IS_OPERA){
var viewRootElement=this.getNode(this.getId());
var className=viewRootElement.getClassName();
var dummyClassIndex=className.indexOf(" opera");
viewRootElement.setClassName(dummyClassIndex==-1?className+" opera":className.substring(0,dummyClassIndex));
}
return null;
},
"public function beansChanged",function(){
this.render();
},
"private function isParentInvalid",function(component){
for(var parent=component.getParent();parent;parent=parent.getParent()){
if(this[$invalidComponentClientIds].contains(parent.getId())){
return true;
}
}
return false;
},
"public function isInvalid",function(componentClientId){
return this[$invalidComponentClientIds]==null||this[$invalidComponentClientIds].contains(componentClientId);
},
"public function invalidate",function(componentClientId){
if(this[$invalidComponentClientIds]!=null){
this[$invalidComponentClientIds].add(componentClientId);
}
},
"public function revalidate",function(componentClientId){
if(this[$invalidComponentClientIds]!=null){
this[$invalidComponentClientIds].remove(componentClientId);
}
},
"public function registerComponent",function(component){
this[$componentById]["_"+component.getId()]=component;
},
"public function findComponent",function(id){
return this[$componentById]["_"+id];
},
"private var",{invalidComponentClientIds: undefined},
"private var",{componentById:function(){return({});}},
];},[]
);joo.classLoader.prepare("package joox.faces.component",[

"import joo.html.Element2",
"import joox.faces.component.UIOutput",
"import joox.el.ELContext",
"import joox.el.ValueExpression",""],

"public class UIInput extends UIOutput",function($jooPublic,$jooPrivate){with(joox.faces.component)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(ValueExpression,ELContext);},

"public function UIInput",function(id){
this[$super](id);
},
"protected function isReadOnly",function(){
var value=this.getValueExpression();
return is(value,ValueExpression)?value.isReadOnly(ELContext.instance):false;
},
"public function isDisabled",function(){
return this.evalEL(this[$disabled]);
},
"public function setDisabled",function(disabled){
this[$disabled]=this.createEL(disabled);
},
"internal function storeValue",function(value){
var valueExpression=this.getValueExpression();
if(is(valueExpression,ValueExpression)){
valueExpression.setValue(ELContext.instance,value);
}
},
"internal function restoreStateStoreValueAndRender",function(elem,value){
if(value===undefined){
value=elem.getValue();
}
var clientId=elem.getId();
this.restoreState(clientId);
this.storeValue(value);
this.getView().render();
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);
element.setBooleanAttribute("disabled",this.isReadOnly()||this.isDisabled());
},

"private var",{disabled:false},
];},[]
);joo.classLoader.prepare("package joox.faces.taglib.html_basic",[

"import joo.html.Node2",
"import joo.html.NodeType",
"import joo.html.TextNode2",
"import joox.faces.component.UIComponent",
"import joox.faces.component.html.HtmlOutputText",
"import joox.faces.component.html.HtmlOutputLabel",
"import joox.faces.component.html.HtmlOutputLink",
"import joox.faces.component.html.HtmlCommandButton",
"import joox.faces.component.html.HtmlCommandLink",
"import joox.faces.component.html.HtmlRadioButton",
"import joox.faces.component.UIInput",
"import joox.faces.component.html.HtmlInputText",
"import joox.faces.component.html.HtmlInputTextarea",
"import joox.faces.component.html.HtmlInputRichText",
"import joox.faces.component.html.HtmlInputKey",
"import joox.faces.component.html.HtmlDataTable",
"import joox.faces.component.UIColumn",
"import joox.faces.component.html.HtmlGraphicImage",
"import joox.faces.component.html.HtmlSelectOneMenu",
"import joox.faces.component.html.HtmlSelectBooleanCheckbox",
"import joox.faces.component.html.HtmlTableCell",
"import joox.faces.TagLib",""],

"public class HtmlBasicTagLib extends TagLib",function($jooPublic,$jooPrivate){with(joox.faces.taglib.html_basic)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(UIComponent,HtmlRadioButton,UIColumn,HtmlOutputLabel,HtmlInputText,HtmlInputRichText,HtmlGraphicImage,HtmlSelectBooleanCheckbox,HtmlCommandButton,HtmlCommandLink,HtmlInputTextarea,HtmlDataTable,HtmlInputKey,HtmlOutputText,NodeType,HtmlSelectOneMenu,HtmlTableCell,UIInput,HtmlOutputLink);},

"private static const",{DEBUG:false},

"public static const",{URI:"http://java.sun.com/jsf/html"},

"public static const",{INSTANCE:function(){return(new HtmlBasicTagLib());}},

"public function HtmlBasicTagLib",function(){
this[$super](URI,{
panelGroup:UIComponent,
outputText:HtmlOutputText,
outputLabel:HtmlOutputLabel,
outputLink:HtmlOutputLink,
commandButton:HtmlCommandButton,
commandLink:HtmlCommandLink,
radioButton:HtmlRadioButton,
inputText:HtmlInputText,
inputTextarea:HtmlInputTextarea,
inputRichText:HtmlInputRichText,
inputKey:HtmlInputKey,
dataTable:HtmlDataTable,
column:UIColumn,
graphicImage:HtmlGraphicImage,
selectOne:UIInput,
selectOneMenu:HtmlSelectOneMenu,
selectBooleanCheckbox:HtmlSelectBooleanCheckbox,
tableCell:HtmlTableCell},
{
h1:"outputText",
h2:"outputText",
p:"outputText",
span:"outputText",
label:"outputLabel",
input:{
text:"inputText",
checkbox:"selectBooleanCheckbox",
radio:"radioButton"},
textarea:"inputTextarea",
div:"panelGroup",
ul:"panelGroup",
li:"outputText",
a:"outputLink",
button:"commandButton",
select:"selectOneMenu",
img:"graphicImage",
table:"panelGroup",
thead:"panelGroup",
tfoot:"panelGroup",
tbody:"panelGroup",
tr:"panelGroup",
th:"tableCell",
td:"tableCell"
});
},

"private static const",{WHITE_SPACE_ONLY:/^[ \n]*$/},
"public override function createComponent",function(parent,tagName,node){
if(node.getNodeType()===NodeType.TEXT_NODE){
if(typeof parent.getId=="function"){
var textNode=node;
var data=textNode.getData();
if(!WHITE_SPACE_ONLY.test(data)){
if(DEBUG)
trace("Found textNode "+parent.getId()+": '"+data+"'.");
return this[$createComponent](parent,"outputText",textNode);
}
}
return null;
}
return this[$createComponent](parent,tagName,node);
},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.Element2",
"import joox.faces.component.UIOutput",""],

"public class HtmlOutputLink extends UIOutput",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[

"public function HtmlOutputLink",function(id){
this[$super](id);
this.elementName="a";
},
"public function setTarget",function(target){
this[$target]=this.createEL(target);
},
"public function getTarget",function(){
return this.evalEL(this[$target]);
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);
element.setAttribute("href",this.getValue());
var target=this.getTarget();
if(target){
element.setAttribute("target",target);
}else{
element.removeAttribute("target");
}
},
"private var",{target: undefined},
];},[]
);joo.classLoader.prepare("package joox.faces",[
"import joo.util.PropertyAware",
"import joox.el.ELContext",
"import joox.faces.BeanFactory",""],

"public class ManagedBeanFactory implements BeanFactory",function($jooPublic,$jooPrivate){with(joox.faces)with($jooPublic)with($jooPrivate)return[

"public function ManagedBeanFactory",function(className,properties){this[$super]();
this[$className]=className||"Object";
this[$properties]=properties||new Object();
},

"private static function eval",function(dotExpr){
var parts=dotExpr.split(".");
var current=window;
for(var i=0;i<parts.length;++i){
current=current[parts[i]];
}
return current;
},
"public function createValueExpression",function(elContext){
if(!this[$clazz]){
this[$clazz]=eval(this[$className]);
}
var clazz=this[$clazz];
var bean=new clazz();
for(var propertyName in this[$properties]){
var value=this[$properties][propertyName];
if(typeof value.createValueExpression=="function"){
value=(value).createValueExpression(elContext);
}
PropertyAware.setProperty(bean,propertyName,value);
}
return bean;
},

"private var",{className: undefined},
"private var",{clazz: undefined},
"private var",{properties: undefined},
];},[]

);joo.classLoader.prepare("package joox.faces",[
"import joo.html.Document2",
"import joo.html.Element2",
"import joo.html.NodeList2",
"import joo.html.TextNode2",
"import joox.faces.ManagedBeanFacility",""],

"public class FacesConfigTransformer",function($jooPublic,$jooPrivate){with(joox.faces)with($jooPublic)with($jooPrivate)return[
"public static const",{JAVAEE_NAMESPACE:"http://java.sun.com/xml/ns/javaee"},

"public static function transform",function(document){
var facesConfigs=document.getElementsByTagNameNS(JAVAEE_NAMESPACE,"faces-config");

var beans={};
for(var i=0;i<facesConfigs.getLength();++i){
var facesConfig=facesConfigs.item(i);
var managedBeans=facesConfig.getElementsByTagNameNS(JAVAEE_NAMESPACE,"managed-bean");
for(var mb=0;mb<managedBeans.getLength();++mb){
var managedBean=managedBeans.item(mb);
var managedBeanName=getElementContentByTagName(managedBean,"managed-bean-name");
beans[managedBeanName]={};
var managedBeanClass=getElementContentByTagName(managedBean,"managed-bean-class");
if(managedBeanClass){
beans[managedBeanName]["$class"]=managedBeanClass;
}

var managedProperties=managedBean.getElementsByTagNameNS(JAVAEE_NAMESPACE,"managed-property");
for(var mp=0;mp<managedProperties.getLength();++mp){
var managedProperty=managedProperties.item(mp);
var propertyName=getElementContentByTagName(managedProperty,"property-name");
beans[managedBeanName][propertyName]=getElementContentByTagName(managedProperty,"value");
}
}
facesConfig.remove();
}

ManagedBeanFacility.add(beans);
},

"private static function getElementContentByTagName",function(parentElement,tagName){
return((parentElement.getElementsByTagNameNS(JAVAEE_NAMESPACE,tagName).item(0))
.getFirstChild()).getData();
},

];},["transform"]

);joo.classLoader.prepare("package org.apache.myfaces.custom.datalist",[

"import joo.html.Node2",
"import joo.html.Element2",
"import joox.faces.component.UIData",
"import joox.faces.component.UIComponent",""],

"public class HtmlDataList extends UIData",function($jooPublic,$jooPrivate){with(org.apache.myfaces.custom.datalist)with($jooPublic)with($jooPrivate)return[

"public function HtmlDataList",function(id){
this[$super](id);
this.elementName="span";
},
"override protected function renderChildren",function(container,idSuffix){
var children=this.getChildren();
var dataCount=this.getValue().length;
var childElementIndex=0;
for(var rowIndex=0;rowIndex<dataCount;++rowIndex){

this.setRowIndex(rowIndex,0);
var rowIdSuffix=idSuffix+":"+rowIndex;
for(var childIndex=0;childIndex<children.length;++childIndex){

var child=children[childIndex];
var childElement=child.render(rowIdSuffix);

var oldChildElement=container.getChildNode(childElementIndex++);
if(!oldChildElement){
container.appendChild(childElement);
}else if(oldChildElement!=childElement){

container.replaceChild(childElement,oldChildElement);
}
}
}
while(container.getChildNode(childElementIndex)){
container.removeChild(container.getLastChild());
}
this.setRowIndex(-1,-1);
},
];},[]
);joo.classLoader.prepare("package joox.faces",[

"import joox.el.ELContext",
"import joox.el.ExpressionFactory",
"import joox.faces.ELBeanFactory",
"import joox.faces.ManagedBeanFactory",
"import joox.faces.ManagedBeanELResolver",""],


















"public class ManagedBeanFacility",function($jooPublic,$jooPrivate){with(joox.faces)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(ELContext,ExpressionFactory);},function()

{
ELContext.instance.setELResolver(new ManagedBeanELResolver());
},

"public static function add",function(newManagedBeans){
for(var beanName in newManagedBeans){
convertBeanDef(ELContext.instance,beanName,newManagedBeans[beanName]);
}
},

"private static function consume",function(bean,property){
var result=bean[property];
delete bean[property];
return result;
},

"private static function convertBeanDef",function(elContext,name,beanDef){
var value;
if(typeof beanDef=="string"){
value=beanDef;
}else{

value=consume(beanDef,"$value");
}
var expressionFactory=ExpressionFactory.instance;
var beanFactory;
if(value){
beanFactory=new ELBeanFactory(expressionFactory.createValueExpression(elContext,value));
}else{
var className=consume(beanDef,"$class")||"Object";
joo.classLoader.import_(className);
for(var propertyName in beanDef){
var subBeanDef=beanDef[propertyName];
convertBeanDef(elContext,consume(subBeanDef,"$name"),subBeanDef);
}
beanFactory=new ManagedBeanFactory(className,beanDef);
}
if(name){
beanFactoryByName[name]=beanFactory;
}
return beanDef;
},

"public static function getBean",function(elContext,beanName){
if(beanName in applicationScope){
return applicationScope[beanName];
}
var beanFactory=beanFactoryByName[beanName];
if(beanFactory){
return applicationScope[beanName]=beanFactory.createValueExpression(elContext);
}
return undefined;
},

"private static var",{applicationScope:function(){return({});}},
"private static var",{beanFactoryByName:function(){return({});}},
];},["add","getBean"]

);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.InputElementType",
"import joo.html.Element2",
"import joo.html.Event2",
"import joo.html.EventType",
"import joox.faces.component.html.HtmlOutputText",
"import joox.el.ELContext",
"import joox.el.ExpressionFactory",""],

"public class HtmlCommandButton extends HtmlOutputText",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(ELContext,ExpressionFactory,EventType);},

"public function HtmlCommandButton",function(id){
this[$super](id);
this.elementName="button";
},
"public function setAction",function(action){
this[$action]=ExpressionFactory.instance.createMethodExpression(ELContext.instance,action);
},
"public function setDisabled",function(disabled){
this[$disabled]=this.createEL(disabled);
},
"public function isDisabled",function(){
return this.evalEL(this[$disabled]);
},
"public function setEnabled",function(enabled){
this.setDisabled(typeof enabled=="boolean"?!enabled:"#{!"+enabled.substring(2));
},
"public function setType",function(type){
this[$type]=this.createEL(type);
},
"public override function getType",function(){
return InputElementType.fromString(this.evalEL(this[$type]));
},
"private bound function invokeAction",function(event){
var target=event.getTarget();
var clientId=target.getId();
this.restoreState(clientId);
var actionEvent={component:this,componentId:this.getId(),clientId:clientId};
this[$action].invoke(ELContext.instance,[actionEvent]);

this.getView().render();
event.preventDefault();
return false;
},
"override protected function createElement",function(idSuffix){
var element=this[$createElement](idSuffix);
if(this[$action]){
element.addEventListener(EventType.CLICK,this[$invokeAction],false);
}
return element;
},
"override protected function updateAttributes",function(element){
this[$updateAttributes](element);
element.setBooleanAttribute("disabled",this.isDisabled());
},
"private var",{action: undefined},
"private var",{disabled:false},
"private var",{type:"button"},
];},[]
);joo.classLoader.prepare("package joox.faces.component.html",[

"import joo.html.Element2",
"import joo.html.Event2",
"import joo.html.EventType",
"import joo.lang.JOObject",
"import joox.faces.component.UIInput",
"import joox.faces.component.UISelectItem",""],

"public class HtmlSelectOneMenu extends UIInput",function($jooPublic,$jooPrivate){with(joox.faces.component.html)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(EventType);},

"public function HtmlSelectOneMenu",function(id){
this[$super](id);
this.elementName="select";
},



"public function getSelectItem",function(index){
return this.getChild(index);
},
"private bound function updateProperty",function(event){
var target=event.getTarget();
var clientId=target.getId();
this.restoreState(clientId);
var childIndex=target.getPeer().selectedIndex;
if(childIndex>=0){
var itemValue=this.getSelectItem(childIndex).getItemValue();
this.storeValue(itemValue);
this.getView().render();
return true;
}
return false;
},
"override protected function createElement",function(idSuffix){
var element=this[$createElement](idSuffix);
if(this.getValueExpression()){
element.addEventListener(EventType.CHANGE,this[$updateProperty],false);
}
return element;
},
"private function findOption",function(newValue){

var childCount=this.getChildren().length;
for(var i=0;i<childCount;++i){
if(JOObject.equal(newValue,this.getSelectItem(i).getItemValue())){
return i;
}
}
return-1;
},
"override protected function renderChildren",function(element,idSuffix){
this[$renderChildren](element,idSuffix);
var selectedIndex=this[$findOption](this.getValue());
if(selectedIndex>=0){
element.setSelectedIndex(selectedIndex);
}
},
];},[]
);joo.classLoader.prepare("package joox.faces.controller",[

"import joo.lang.JOObject",
"import joox.cache.DependencyAwareAspect",
"import joox.faces.controller.Tab",""],

"public class Tabs extends JOObject",function($jooPublic,$jooPrivate){with(joox.faces.controller)with($jooPublic)with($jooPrivate)return[function()

{
DependencyAwareAspect.instrumentClass(Tabs);
},

"public function Tabs",function(names){
this[$super]();
for(var i=0;i<names.length;++i){
this.tabs.push(new Tab(this,i,names[i]));
}
},

"public function getSelectedIndex",function(){
return this.selectedIndex;
},

"public function setSelectedIndex",function(selectedIndex){
this.selectedIndex=selectedIndex;
},

"public function getTabs",function(){
return this.tabs;
},

"public function getSelectedTab",function(){
return this.getTabs()[this.getSelectedIndex()];
},

"public var",{selectedIndex:0},
"public var",{tabs:function(){return([]);}},
];},[]
);
