joo.Class.prepare(
"package joo.util",

"public class PropertyAware",function($jscContext){with(joo.util)with($jscContext)return[

"public static const",{SET:"set"},
"public static const",{GET:"get"},
"public static const",{IS:"is"},

"public static",function toMethodSuffix(prop){
return prop.charAt(0).toUpperCase()+prop.substring(1);
},
"public",function PropertyAware(props){
this[_super]();
if(props){
this.updateProperties(props);
}
},

"public",function updateProperties(props){
setProperties(this,props);
},

"public static",function setProperties(bean,props){
for(var prop in props){
setProperty(bean,prop,props[prop]);
}
},
"public static",function setProperty(bean,prop,value){
var propSetterName=SET+toMethodSuffix(prop);
if(typeof bean[propSetterName]=="function"){

bean[propSetterName](value);
}else if(typeof bean.getClass!="function"||typeof bean[prop]!="undefined"){

bean[prop]=value;
}else{

throw new Error("Unknown property "+bean+"."+prop+" set to '"+value+"'.");
}
},
"public static",function getProperty(bean,prop){
var methodSuffix=toMethodSuffix(prop);
var propGetterName=GET+methodSuffix;
if(typeof bean[propGetterName]=="function"){

return bean[propGetterName]();
}
var boolPropGetterName=IS+methodSuffix;
if(typeof bean[boolPropGetterName]=="function"){

return bean[boolPropGetterName]();
}
return bean[prop];
},
]});joo.Class.prepare(
"package joo.util",

"public class StringBuffer",function($jscContext){with(joo.util)with($jscContext)return[

"public",function StringBuffer(){
this[_super]();
this.append(arguments);
},
"private static",function getStrings(params){
return params.length==1&&typeof params[0].length=="number"&&typeof params[0]=="object"
?params[0]
:params;
},
"public",function append(){
var params=getStrings(arguments);
for(var i=0;i<params.length;++i){
if(typeof params[i]=="object")
throw"IllegalArgumentException: "+params[i];
this[_buf].push(params[i]);
}
return this;
},
"public",function clear(){
this[_buf]=[];
},
"private var",{buf:function(){return [];}},
"public",function toString(){
return this[_buf].join("");
},
]});joo.Class.prepare(
"package joox.cache",

"public class Dependency",function($jscContext){with(joox.cache)with($jscContext)return[

"public",function Dependency(base,property){
this[_super]();
this.base=base;
this.property=property;
this[_hashCode]=joo.util.HashSet_().getHashCode(this.base)+"#"+this.property;
},
"public",function hashCode(){
return this[_hashCode];
},
"public var",{base: undefined},
"public var",{property: undefined},
"private var",{hashCode: undefined},
]});joo.Class.prepare("package joox.cache",

"public class DependencyAware extends joo.util.PropertyAware",function($jscContext){with(joox.cache)with($jscContext)return[

"public static",function createGetter(propertyName){
return function(){
DependencyTracker_().addDependency(this,propertyName);
return this[propertyName];
};
},

"public static",function createSetter(propertyName){
return function(value){
this[propertyName]=value;
DependencyTracker_().fireDependency(this,propertyName);
};
},

"public static",function createPropertyForBean(bean,propertyName,type){
var PropertyAware=joo.util.PropertyAware_();
var methodSuffix=PropertyAware.toMethodSuffix(propertyName);
bean[(type=="boolean"?PropertyAware.IS:PropertyAware.GET)+methodSuffix]=createGetter(propertyName);
bean[PropertyAware.SET+methodSuffix]=createSetter(propertyName);
},

"public",function DependencyAware(obj){
this[_super]();
for(var m in obj){
this[m]=obj[m];
this[_createProperty](m,typeof obj[m]);
}
},

"private",function createProperty(propertyName,type){
createPropertyForBean(this,propertyName,type);
},

]});joo.Class.prepare(



"package joox.cache",

"public class DependencySet extends joo.util.HashSet",function($jscContext){with(joox.cache)with($jscContext)return[

"public",function DependencySet(listener){
this[_super]();
this[_listener]=listener;
},
"public",function add(dependency){
if(this[_add](dependency)){
var base=dependency.base;
var propertyChangeListenersByName=base._pcl;
if(!propertyChangeListenersByName){
propertyChangeListenersByName=base._pcl={};
}
var property=dependency.property;
var propertyChangeListeners=propertyChangeListenersByName[property];
if(!propertyChangeListeners){
propertyChangeListeners=propertyChangeListenersByName[property]=new joo.util.HashSet();
}
propertyChangeListeners.add(this);
}
},
"public",function remove(base,property){
this[_remove](new Dependency(base,property));
base._pcl[property].remove(this);
},
"public",function clear(){
var it=this.iterator();
while(it.hasNext()){
var dependency=it.next();
dependency.base._pcl[dependency.property].remove(this);
}
this[_clear]();
},
"public",function propertyChanged(){
this[_listener].invalidated(this);
},
"private var",{listener: undefined},
]});joo.Class.prepare(
"package joox.cache",

"public class DependencyTracker",function($jscContext){with(joox.cache)with($jscContext)return[

"public static",function start(listener){
dependencies.push(new DependencySet(listener));
},
"public static",function addDependency(base,property){
var dependencyStack=dependencies;
if(dependencyStack.length>0){
dependencyStack[dependencyStack.length-1].add(new Dependency(base,property));
}
},
"public static",function stop(){
return dependencies.pop();
},
"public static",function fireDependency(base,property){
if(typeof base._pcl=="object"){
var listeners=base._pcl[property];
if(listeners){
for(var listenerI=listeners.iterator();listenerI.hasNext();){
var listener=listenerI.next();
listener.propertyChanged();
}
}
}
},
"private static var",{dependencies:function(){return [];}},
]});joo.Class.prepare(
"package org.joo.el",

"public class Token",function($jscContext){with(org.joo.el)with($jscContext)return[

"public static const",{MATCHES:function(){return {};}},
"public",function Token(token,matches){
this[_token]=token;
if(matches.length>0){
this[_unparsed]=matches[0];
var MATCHES=org.joo.el.Token_().MATCHES;
for(var i=0;i<matches.length;++i){
MATCHES[matches[i]]=this;
}
}
},
"public",function hashCode(){
return this[_token];
},

"public",function contains(token){
return this==token;
},
"public",function unparse(){
return this[_unparsed];
},
"public",function toString(){
return this[_token];
},
"private var",{token: undefined},
"private var",{unparsed:""},
]});joo.Class.prepare(
"package org.joo.el",

"public class ELParser",function($jscContext){with(org.joo.el)with($jscContext)return[

"public static const",{EXPRESSION_START_REG_EXP:/(?:^|[^\\])(#\{)/g},
"public static const",{TOKENS:function(){
var tokens=[
new Token("COLON",[":"]),
new Token("QUESTIONMARK",["?"]),
new Token("BRACKET_OPEN",["("]),
new Token("BRACKET_CLOSE",[")"]),
new Token("AND",["&&","and"]),
new Token("OR",["||","or"]),
new Token("PLUS",["+"]),
new Token("MINUS",["-"]),
new Token("MULT",["*"]),
new Token("DIV",["/","div"]),
new Token("MOD",["%","mod"]),
new Token("GT",[">","gt"]),
new Token("LT",["<","lt"]),
new Token("GE",[">=","ge"]),
new Token("LE",["<=","le"]),
new Token("EQ",["==","eq"]),
new Token("NE",["!=","ne"]),
new Token("NOT",["!","not"]),
new Token("EMPTY",["empty"]),
new Token("DOT",["."]),
new Token("SQUARE_BRACKET_OPEN",["["]),
new Token("SQUARE_BRACKET_CLOSE",["]"]),
new Token("COMMA",[","]),
new Token("WHITE_SPACE",[" "]),
new Token("EXPRESSION_START",["#{"]),
new Token("EXPRESSION_END",["}"]),
new Token("EOS",[])
];
var tokensByName={};
for(var i=0;i<tokens.length;++i){
tokensByName[tokens[i]]=tokens[i];
}
return tokensByName;
}},
"public static const",{IDENTIFIER:"[a-zA-Z\\$_][a-zA-Z\\$_]*"},
"public static const",{INTEGER_LITERAL:"[0-9]+"},
"public static const",{EXPONENT:"([eE][\\+-]?[0-9]+)"},
"public static const",{FLOATING_POINT_LITERAL:function(){return "[0-9]+\\.[0-9]*"+EXPONENT+"?|\\.[0-9]+"+EXPONENT+"?|[0-9]+"+EXPONENT;}},
"public static const",{FLOATING_POINT_REG_EXP:function(){return RegExp.compile("^("+FLOATING_POINT_LITERAL+")$");}},
"public static const",{STRING_LITERAL:"'([^'\\\\]|\\\\'|\\\\\\\\)*'"
+"|\"([^\"\\\\]|\\\\\"|\\\\\\\\)*\""},
"public static const",{BOOLEAN_LITERAL:"true|false"},
"public static const",{NULL_LITERAL:"null"},
"public static const",{LITERAL:function(){return FLOATING_POINT_LITERAL+"|"+INTEGER_LITERAL+"|"+STRING_LITERAL+"|"+BOOLEAN_LITERAL+"|"+NULL_LITERAL;}},
"public static const",{LITERAL_REG_EXP:function(){return RegExp.compile("^("+LITERAL+")$");}},
"public static const",{TOKEN:function(){
var tokens=[IDENTIFIER,"|",LITERAL];
var SPECIAL_CHARS=/(\\|\^|\$|\*|\+|\?|\.|\(|\)|\||\{|\}|\,|\[|\])/g;
for(var token in Token_().MATCHES){
tokens.push("|");
tokens.push(token.replace(SPECIAL_CHARS,"\\$1"));
}
return tokens.join("");
}},
"public static const",{TOKEN_REG_EXP:function(){return RegExp.compile(TOKEN,"g");}},
"public static const",{BINARY_OP:function(){return new joo.util.HashSet([
TOKENS.AND,TOKENS.OR,TOKENS.PLUS,TOKENS.MINUS,TOKENS.MULT,
TOKENS.DIV,TOKENS.MOD,TOKENS.GT,TOKENS.LT,TOKENS.GE,
TOKENS.LE,TOKENS.EQ,TOKENS.NE
]);}},
"public static const",{UNARY_OP:function(){return new joo.util.HashSet([
TOKENS.MINUS,TOKENS.NOT,TOKENS.EMPTY
]);}},
"public static const",{VALUE_SUFFIX:function(){return new joo.util.HashSet([
TOKENS.DOT,TOKENS.SQUARE_BRACKET_OPEN
]);}},

"public",function toHTML(exp){
var out=[exp.getLabel()];
var subexps=exp.getSubexpressions();
if(subexps.length>0){
out.push("<ul>");
for(var i=0;i<subexps.length;++i){
out.push("<li>");
out.push(this.toHTML(subexps[i]));
out.push("</li>");
}
out.push("</ul>");
}
return out.join("");
},
"public",function getType(value){
if(value==null){
return"null";
}
var type=typeof value;
if(type=="number"){
type=org.joo.el.Literal_().FLOATING_POINT_REG_EXP.test(literal)?"float":"integer";
}
return type;
},
"private",function startTokenize(el){
this[_el]=el;
this[_token]=undefined;
this[_tokenEndPos]=0;
this[_nextToken]();
},
"private",function nextToken(){
var el=this[_el];

var startIndex=this[_tokenEndPos];
if(startIndex==el.length){

return this[_setToken](TOKENS.EOS,startIndex,0);
}
var token=this[_token];
var match;
if(!token||token==TOKENS.EXPRESSION_END){
EXPRESSION_START_REG_EXP.lastIndex=startIndex==0?0:startIndex-1;
match=EXPRESSION_START_REG_EXP.exec(el);
var string;
if(match){
var endIndex=match[0].length==3?match.index+1:match.index;
string=el.substring(startIndex,endIndex);
}else{
string=el.substring(startIndex);
}
if(string){
return this[_setToken](new Literal(null,string.replace(/\\#\{/g,"#{")),startIndex,string.length);
}
}
TOKEN_REG_EXP.lastIndex=startIndex;
var WHITE_SPACE=TOKENS.WHITE_SPACE;
while((match=TOKEN_REG_EXP.exec(el))!=null){
if(match.index!=startIndex){
throw"Syntax error: No token starts at "+startIndex+".";
}

var c=match[0];


token=Token_().MATCHES[c];
if(!token){
if(LITERAL_REG_EXP.test(c)){
token=new Literal(c);
}else{
token=new Identifier(c);
}
}else if(token==WHITE_SPACE){
++startIndex;
continue;
}
return this[_setToken](token,startIndex,c.length);
}
},
"private",function setToken(token,start,length){
this[_tokenStartPos]=start;
this[_tokenEndPos]=start+length;
this[_token]=token;
return token;
},
"private",function consume(tokenSet){
var token=this[_token];
if(tokenSet.contains(token)){

this[_nextToken]();
return token;
}

return null;
},
"private",function syntaxError(expected){
return new Error(["syntax error: expected ",expected,", found ",this[_token]," at character range ",this[_tokenStartPos],"-",this[_tokenEndPos],"."].join(""));
},
"private",function expect(tokenSet){
var token=this[_consume](tokenSet);
if(!token)
throw this[_syntaxError](tokenSet);
return token;
},

"public",function parseLValue(el){
this[_startTokenize](el);
this[_expect](TOKENS.EXPRESSION_START);
var identifier=this[_consume](Identifier_().TYPE);
var exp=identifier?new BeanExpression(identifier)
:this[_parseNonLiteralValuePrefix]();
if(!exp){
this[_syntaxError]("Identifier or NonLiteralValuePrefix");
}
exp=this[_parseValueSuffixes](exp);
this[_expect](TOKENS.EXPRESSION_END);
this[_expect](TOKENS.EOS);
return exp;
},

"public",function parseMethodExpression(el){
return this.parseLValue(el);
},

"public",function parseRValue(el){
this[_startTokenize](el);
var PLUS=TOKENS.PLUS;
var EOS=TOKENS.EOS;
var exp=null;
while(!this[_consume](EOS)){
var nextExp=this[_consume](Literal_().TYPE);
if(!nextExp){
this[_expect](TOKENS.EXPRESSION_START);
nextExp=this[_parseExpression]();
this[_expect](TOKENS.EXPRESSION_END);
}
exp=exp?BinaryExpression_().create(exp,PLUS,nextExp):nextExp;
}
if(!exp){
exp=new Literal(null,"");
}
return exp;
},

"private",function parseExpression(){
var exp=this[_parseUnaryExpression]();
if(!exp)
throw this[_syntaxError]("expression");
exp=this[_parseExpressionRest](exp);
var binaryOp;
while(binaryOp=this[_consume](BINARY_OP)){
var rightExp=this[_parseUnaryExpression]();
exp=BinaryExpression_().create(exp,binaryOp,rightExp);
exp=this[_parseExpressionRest](exp);
}
return exp;
},

"private",function parseExpressionRest(exp){
if(this[_consume](TOKENS.QUESTIONMARK)){
var thenExp=this[_parseExpression]();
this[_expect](TOKENS.COLON);
var elseExp=this[_parseExpression]();
exp=ConditionalExpression_().create(exp,thenExp,elseExp);
}
return exp;
},

"private",function parseUnaryExpression(){
var token;
if(token=this[_consume](UNARY_OP)){
return UnaryExpression_().create(token,this[_parseUnaryExpression]());
}else{
var exp=this[_consume](Literal_().TYPE)||this[_parseNonLiteralValuePrefix]();
exp=this[_parseValueSuffixes](exp);
return exp;
}
},

"private",function parseNonLiteralValuePrefix(){
var exp=null;
if(this[_consume](TOKENS.BRACKET_OPEN)){
exp=this[_parseExpression]();
this[_expect](TOKENS.BRACKET_CLOSE);
}else{
var identifier=this[_consume](Identifier_().TYPE);
if(identifier){
var scopeIdentifier=null;
var isFunction=this[_consume](TOKENS.COLON);
if(isFunction){
scopeIdentifier=identifier;
identifier=this[_expect](Identifier_().TYPE);
}
if(this[isFunction?_expect:_consume](TOKENS.BRACKET_OPEN)){
var paramExps=[];
if(!this[_consume](TOKENS.BRACKET_CLOSE)){
do{
var paramExp=this[_parseExpression]();
paramExps.push(paramExp);
}while(this[_consume](TOKENS.COMMA));
this[_expect](TOKENS.BRACKET_CLOSE);
}
exp=new FunctionExpression(scopeIdentifier,identifier,paramExps);
}else{
exp=new BeanExpression(identifier);
}
}
}
return exp;
},

"private",function parseValueSuffixes(exp){
var valueSuffix;
while(valueSuffix=this[_parseValueSuffix]()){
exp=new PropertyExpression(exp,valueSuffix);
}
return exp;
},

"private",function parseValueSuffix(){
var exp=null;
if(this[_consume](TOKENS.DOT)){
var propertyIdentifier=this[_expect](Identifier_().TYPE);
exp=new Literal("\""+propertyIdentifier.getName()+"\"");
}else if(this[_consume](TOKENS.SQUARE_BRACKET_OPEN)){
exp=this[_parseExpression]();
this[_expect](TOKENS.SQUARE_BRACKET_CLOSE);
}
return exp;
},
"private var",{el: undefined},
"private var",{token: undefined},
"private var",{tokenStartPos:-1},
"private var",{tokenEndPos:-1},
]});joo.Class.prepare(
"package org.joo.el",

"public class AbstractExpression",function($jscContext){with(org.joo.el)with($jscContext)return[

"private static const",{NO_SUBEXPS:function(){return [];}},
"public",function getSubexpressions(){
return NO_SUBEXPS;
},
"public",function evaluate(elContext){
if(!this[_expFunc]){
var expFuncText=
"with(new org.joo.el.EvalAdapter(elContext)) { return "+this.toString()+"; }";
this[_expFunc]=new Function("elContext",expFuncText);
}
return this[_expFunc](elContext);
},
"private var",{expFunc: undefined},
]});joo.Class.prepare(
"package org.joo.el",

"public class Identifier",function($jscContext){with(org.joo.el)with($jscContext)return[

"public static const",{TYPE:function(){return new Identifier();}},
"public",function Identifier(name){
this[_name]=name;
},
"public",function getName(){
return this[_name];
},

"public",function contains(token){
return token.getClass()==Identifier;
},
"public",function toString(){
return"IDENTIFIER";
},
"private var",{name: undefined},
]});joo.Class.prepare(
"package org.joo.el",

"public class Literal extends org.joo.el.AbstractExpression",function($jscContext){with(org.joo.el)with($jscContext)return[

"public static const",{TYPE:function(){return new Literal();}},
"public",function Literal(unparsedValue,value){
this[_super]();
if(value===undefined){
this[_unparsedValue]=unparsedValue;
}else{
this[_value]=value;
}
},
"public",function getUnparsedValue(){
return this[_unparsedValue];
},

"public",function contains(token){
return token.getClass()===Literal;
},
"public",function hashCode(){
return"LITERAL";
},
"public",function getLabel(){
return this.hashCode()+" "+this.toString();
},
"public",function evaluate(){
if(this[_value]===undefined){
this[_value]=eval(this.getUnparsedValue());
}
return this[_value];
},
"public",function toString(){
var value=this.evaluate();
if(typeof value=="string"){
return'"'+value.replace('"',"\\\"","g").replace(/\\/g,"\\\\")+'"';
}
return String(value);
},
"private var",{unparsedValue: undefined},
"private var",{value: undefined},
]});joo.Class.prepare(
"package org.joo.el",

"public class BeanExpression extends org.joo.el.AbstractExpression",function($jscContext){with(org.joo.el)with($jscContext)return[

"public",function BeanExpression(identifier){
this[_super]();
this[_beanName]=identifier.getName();
},
"public",function getBeanName(){
return this[_beanName];
},
"public",function getLabel(){
return"BEAN "+this.getBeanName();
},
"public",function toString(){
return["b(\"",this.getBeanName(),"\")"].join("");
},
"private var",{beanName: undefined},
]});joo.Class.prepare(
"package org.joo.el",

"public class PropertyExpression extends org.joo.el.AbstractExpression",function($jscContext){with(org.joo.el)with($jscContext)return[

"public",function PropertyExpression(beanExp,propertyExp){
this[_super]();
this[_beanExp]=beanExp;
this[_propertyExp]=propertyExp;
},
"public",function getLabel(){
return"PROPERTY";
},
"public",function getSubexpressions(){
return[this[_beanExp],this[_propertyExp]];
},
"public",function toString(){
return["p(",this[_beanExp],",",this[_propertyExp],")"].join("");
},
"private var",{beanExp: undefined},
"private var",{propertyExp: undefined},
]});joo.Class.prepare(
"package org.joo.el",

"public class BinaryExpression extends org.joo.el.AbstractExpression",function($jscContext){with(org.joo.el)with($jscContext)return[

"public static",function create(leftExp,binaryOp,rightExp){
if(leftExp.getClass()===Literal){
if(rightExp.getClass()===Literal){
var binaryExp=new BinaryExpression(leftExp,binaryOp,rightExp);
return new Literal(binaryExp.toString());
}else{
var TOKENS=ELParser_().TOKENS;

if(binaryOp==TOKENS.AND||binaryOp==TOKENS.OR){
var leftValue=leftExp.evaluate();
return binaryOp==TOKENS.AND&&leftValue||binaryOp==TOKENS.OR&&!leftValue
?rightExp:leftExp;
}
}
}
return new BinaryExpression(leftExp,binaryOp,rightExp);
},
"public",function BinaryExpression(leftExp,binaryOp,rightExp){
this[_super]();
this[_leftExp]=leftExp;
this[_binaryOp]=binaryOp;
this[_rightExp]=rightExp;
},
"public",function getLabel(){
return this[_binaryOp].toString();
},
"public",function getSubexpressions(){
return[this[_leftExp],this[_rightExp]];
},
"public",function toString(){
return["(",this[_leftExp],this[_binaryOp].unparse(),this[_rightExp],")"].join("");
},
"private var",{leftExp: undefined},
"private var",{binaryOp: undefined},
"private var",{rightExp: undefined},
]});joo.Class.prepare(
"package org.joo.el",

"public class UnaryExpression extends org.joo.el.AbstractExpression",function($jscContext){with(org.joo.el)with($jscContext)return[

"public static",function create(unaryOp,exp){
var unaryExp=new UnaryExpression(unaryOp,exp);
if(exp.getClass()===Literal){
return new Literal(unaryExp.toString());
}
return unaryExp;
},
"public",function UnaryExpression(unaryOp,exp){
this[_super]();
this[_unaryOp]=unaryOp;
this[_exp]=exp;
},
"public",function getLabel(){
return this[_unaryOp].toString();
},
"public",function getSubexpressions(){
return[this[_exp]];
},
"public",function toString(){
var unaryOp=this[_unaryOp];
return["(",unaryOp.unparse(),"(",this[_exp],"))"].join("");
},
"private var",{unaryOp: undefined},
"private var",{exp: undefined},
]});joo.Class.prepare(
"package org.joo.el",

"public class ConditionalExpression extends org.joo.el.AbstractExpression",function($jscContext){with(org.joo.el)with($jscContext)return[

"public static",function create(conditionExp,thenExp,elseExp){
if(conditionExp.getClass()===Literal){
if(thenExp.getClass()===Literal&&elseExp.getClass()===Literal){
var conditionalExp=new ConditionalExpression(conditionExp,thenExp,elseExp);
return new Literal(conditionalExp.toString());
}else{
return conditionExp.evaluate()?thenExp:elseExp;
}
}
return new ConditionalExpression(conditionExp,thenExp,elseExp);
},
"public",function ConditionalExpression(conditionExp,thenExp,elseExp){
this[_super]();
this[_conditionExp]=conditionExp;
this[_thenExp]=thenExp;
this[_elseExp]=elseExp;
},
"public",function getLabel(){
return"? ... :";
},
"public",function getSubexpressions(){
return[this[_conditionExp],this[_thenExp],this[_elseExp]];
},
"public",function toString(){
return["(",this[_conditionExp],"?",this[_thenExp],":",this[_elseExp],")"].join(" ");
},
"private var",{conditionExp: undefined},
"private var",{thenExp: undefined},
"private var",{elseExp: undefined},
]});joo.Class.prepare(
"package org.joo.el",

"public class FunctionExpression extends org.joo.el.AbstractExpression",function($jscContext){with(org.joo.el)with($jscContext)return[

"public",function FunctionExpression(scopeIdentifier,functionIdentifier,paramExps){
this[_super]();
if(scopeIdentifier)
this[_scopeIdentifier]=scopeIdentifier.getName();
this[_functionIdentifier]=functionIdentifier.getName();
this[_paramExps]=paramExps;
},
"public",function getName(){
return(this[_scopeIdentifier]?this[_scopeIdentifier]+":":"")+this[_functionIdentifier];
},
"public",function getLabel(){
return this.getName()+"(...)";
},
"public",function getSubexpressions(){
return this[_paramExps];
},
"public",function evaluate(){
var theFunction=eval(this[_scopeIdentifier].getName()+"."+this[_functionIdentifier].getName());
var params=[];
var paramExps=this[_paramExps];
for(var i=0;i<paramExps.length;++i){
params.push(paramExps[i].evaluate());
}
theFunction.apply(null,params);
},
"public",function toString(){
return["f(",this[_scopeIdentifier],",",this[_functionIdentifier],")(",this[_paramExps].join(", "),")"].join("");
},
"private var",{scopeIdentifier: undefined},
"private var",{functionIdentifier: undefined},
"private var",{paramExps: undefined},
]});joo.Class.prepare(
"package org.joo.el",

"public class EvalAdapter",function($jscContext){with(org.joo.el)with($jscContext)return[

"public",function EvalAdapter(elContext){
this[_elContext]=elContext;
},
"public",function b(beanName){
return this.p(null,beanName);
},
"public",function p(base,property){
var elContext=this[_elContext];
return elContext.getELResolver().getValue(elContext,base,property);
},
"public",function f(prefix,localName){
return this[_elContext].getFunctionMapper().resolveFunction(prefix,localName);
},
"public",function empty(obj){
if(obj===null)
return true;
var type=typeof obj;
if(type=="undefined"||type=="string"&&obj.length===0)
return true;
if(obj.constructor==Array){
return obj.length===0;
}
if(type=="object"){


for(var m in obj){
return false;
}
return true;
}
return false;
},
"private var",{elContext: undefined},
]});joo.Class.prepare(
"package joox.el",

"public class VariableMapper",function($jscContext){with(joox.el)with($jscContext)return[

"public",function setVariable(name,valueExpression){
if(typeof valueExpression=="string"){
valueExpression=joox.el.ExpressionFactory_().instance.createValueExpression(valueExpression);
}
this[_variables][name]=valueExpression;
},
"public",function resolveVariable(name){
var exp=this[_variables][name];
if(exp)
return exp;

return ExpressionFactory_().instance.createObjectValueExpression(eval(name));
},
"private var",{variables:function(){return {};}},
]});joo.Class.prepare(
"package joox.el",

"public class MethodExpression extends joox.el.Expression",function($jscContext){with(joox.el)with($jscContext)return[

"public",function MethodExpression(expressionString,expression){
this[_super](expressionString,expression);
},
"public",function invoke(elContext,parameters){

var exps=this.getExpression().getSubexpressions();
var bean=exps[0].evaluate(elContext);
var methodName=exps[1].evaluate(elContext);
var method=bean[methodName];
return method.apply(bean,parameters);
},
]});joo.Class.prepare(
"package joox.el",

"public class ValueExpression extends joox.el.Expression",function($jscContext){with(joox.el)with($jscContext)return[

"public",function ValueExpression(expressionString,expression,readOnly){
this[_super](expressionString,expression);
this[_readOnly]=readOnly;
},
"public",function getValue(elContext){
return this.getExpression().evaluate(elContext);
var value=this[_cachedValue];
if(value===undefined){
joox.cache.DependencyTracker_().start(this);
value=this[_cachedValue]=this.getExpression().evaluate(elContext);
joox.cache.DependencyTracker_().stop();
}
return value;
},
"public",function invalidated(dependencySet){
this[_cachedValue]=undefined;
dependencySet.clear();
},
"public",function isReadOnly(elContext){
return this[_readOnly];
},
"public",function setValue(elContext,newValue){
if(this.isReadOnly())
throw"Trying to set read-only property in expression "+this+".";
var exp=this.getExpression();

if(exp.getClass()===org.joo.el.PropertyExpression){
var exps=exp.getSubexpressions();
var base=exps[0].evaluate(elContext);
var property=exps[1].evaluate(elContext);
elContext.getELResolver().setValue(elContext,base,property,newValue);
}else if(exp.getClass()===org.joo.el.BeanExpression){
elContext.getVariableMapper().setVariable(exp.getBeanName(),newValue);
}

},
"private var",{readOnly:false},
"private var",{cachedValue: undefined},
]});joo.Class.prepare(
"package joox.el",

"public abstract class Expression",function($jscContext){with(joox.el)with($jscContext)return[

"protected static const",{PARSER:function(){return new org.joo.el.ELParser();}},

"protected",function Expression(expressionString,expression,literalText){
this[_expressionString]=expressionString;
this[_expression]=expression;
if(typeof literalText=="boolean"){
this[_literalText]=! !literalText;
}
},
"public",function getExpressionString(){
return this[_expressionString];
},
"public",function getExpression(){
return this[_expression];
},
"public",function isLiteralText(){
return this[_literalText];
},
"public",function toString(){
return this.getExpressionString();
},
"private var",{expressionString: undefined},
"private var",{expression: undefined},
"private var",{literalText:false},
]});joo.Class.prepare(
"package joox.el",

"public abstract class ExpressionFactory",function($jscContext){with(joox.el)with($jscContext)return[

"public static const",{instance:function(){return new ExpressionFactory(new org.joo.el.ELParser());}},
"public",function ExpressionFactory(parser){
this[_super]();
this[_parser]=parser;
},
"public",function createValueExpression(elContext,expressionString){
var parser=this[_parser];
var expression;
var readOnly=false;
try{
expression=parser.parseLValue(expressionString);
}catch(e){
expression=parser.parseRValue(expressionString);
readOnly=true;
}
return new ValueExpression(expressionString,expression,readOnly);
},
"public",function createIndexValueExpression(valueExpression,offsetValueExpression,relativeIndex){

if(typeof offsetValueExpression=="number"){
offsetValueExpression=this.createObjectValueExpression(offsetValueExpression);
}


return new ValueExpression(["(",valueExpression.getExpressionString(),")[",offsetValueExpression.getExpressionString(),
"+",relativeIndex,"]"].join(""),
new org.joo.el.PropertyExpression(valueExpression.getExpression(),
org.joo.el.BinaryExpression_().create(offsetValueExpression.getExpression(),
org.joo.el.ELParser_().TOKENS.PLUS,
new org.joo.el.Literal(null,relativeIndex))),
false);
},
"public",function createObjectValueExpression(object){
if(typeof object=="object"){

return{getClass:function(){return joox.el.ValueExpression;},getValue:function(){return object;}};
}
return new ValueExpression(String(object),new org.joo.el.Literal(null,object));
},
"public",function createMethodExpression(elContext,expressionString){
return new MethodExpression(expressionString,this[_parser].parseMethodExpression(expressionString));
},
"private var",{parser: undefined},
]});joo.Class.prepare(
"package joox.el",

"public class ELContext",function($jscContext){with(joox.el)with($jscContext)return[

"public static const",{instance:function(){return new ELContext(new ELResolver(),new FunctionMapper(),new VariableMapper());}},
"public",function ELContext(elResolver,functionMapper,variableMapper){
this[_elResolver]=elResolver;
this[_functionMapper]=functionMapper;
this[_variableMapper]=variableMapper;
},
"public",function getELResolver(){
return this[_elResolver];
},
"public",function getFunctionMapper(){
return this[_functionMapper];
},
"public",function getVariableMapper(){
return this[_variableMapper];
},
"private var",{elResolver: undefined},
"private var",{functionMapper: undefined},
"private var",{variableMapper: undefined},
]});joo.Class.prepare(
"package joox.el",

"public class ELResolver",function($jscContext){with(joox.el)with($jscContext)return[

"public",function getValue(elContext,base,property){
if(base==null||base===undefined){
var valueExp=elContext.getVariableMapper().resolveVariable(property);
return valueExp?valueExp.getValue(elContext):undefined;
}
joox.cache.DependencyTracker_().addDependency(base,property);
if(typeof property=="string"){
return joo.util.PropertyAware_().getProperty(base,property);
}

return base[property];
},
"public",function getType(elContext,base,property){
return joo.typeOf(base[property]);
},
"public",function isReadOnly(elContext,base,property){
return false;

},
"public",function setValue(elContext,base,property,value){
var oldValue;
if(typeof property=="string"){
oldValue=joo.util.PropertyAware_().getProperty(base,property);
joo.util.PropertyAware_().setProperty(base,property,value);
}else{
oldValue=base[property];
base[property]=value;
}
if(oldValue!=value){
joox.cache.DependencyTracker_().fireDependency(base,property);
}




},
]});joo.Class.prepare(
"package joox.el",

"public class FunctionMapper",function($jscContext){with(joox.el)with($jscContext)return[

"public",function setFunction(prefix,fun){
var withPrefix=this[_functions][prefix];
if(!withPrefix)
this[_functions][prefix]=withPrefix={};
withPrefix[fun.getName()]=fun;
},
"public",function resolveFunction(prefix,localName){
return this[_functions][localName];
},
"private var",{functions:function(){return {};}},
]});joo.Class.prepare(
"package joox.faces",

"public class TagLib",function($jscContext){with(joox.faces)with($jscContext)return[

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

"public",function TagLib(uri,tagHandlers){
this[_super]();
this[_uri]=uri;
this[_componentClassByTagName]=tagHandlers;
},
"public",function getUri(){
return this[_uri];
},
"public",function createComponent(parent,tagName,element){
var componentClass=this[_componentClassByTagName][tagName];
var namespaceURI=Transformer_().getNamespaceURI(element);
var htmlElementName;
if(namespaceURI=="http://www.w3.org/1999/xhtml"){
htmlElementName=element.localName?element.localName:element.nodeName.toLowerCase();
}
if(typeof componentClass=="function"){
var properties={};
if(element.nodeType==Node.ELEMENT_NODE){
var attributes=element.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(htmlElementName=="a"&&propName=="href"){
propName="value";
}else if(htmlElementName=="option"&&propName=="value"){
propName="itemValue";
}
var value=attr.name=="class"?element.className:attr.name=="for"?element.htmlFor:attr.value;
if(propName!="jsfc"){
if(propName=="class"){
propName="styleClass";
}


if(typeof properties[propName]=="undefined"||propParts.length>0){
properties[propName]=value;
if(DEBUG)
console.debug("setting attribute "+attr.name+" as property "+propName+" to "+value);
}
}
}
}
}else if(element.nodeType==Node.TEXT_NODE){
properties.value=element.data;
}
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"
&&element.firstChild&&element.firstChild.nodeType==Node.TEXT_NODE){
var textValue=element.firstChild.data;
if(textValue){
if(DEBUG)
console.debug("setting attribute value to text node child's data '"+textValue+"'.");
properties.value=textValue;

element.removeChild(element.firstChild);
}
}
}
joo.util.PropertyAware_().setProperties(component,properties);
if(DEBUG)
console.debug("returning component "+component);
return component;
}
return null;
},
"private var",{uri: undefined},
"private var",{componentClassByTagName:function(){return {};}},

"private static var",{idCnt:0},
]});joo.Class.prepare(
"package joox.faces",

"public class Transformer",function($jscContext){with(joox.faces)with($jscContext)return[

"private static const",{DEBUG:false},
"private static const",{tagLibByUri:function(){return [];}},
"private static const",{namespaceByPrefix:function(){return {f:"http://java.sun.com/jsf/core",
h:"http://java.sun.com/jsf/html",
t:"http://myfaces.apache.org/tomahawk",
HTML:"http://www.w3.org/1999/xhtml"};}},
"private static const",{jscfByElementName:function(){return {h1:"h:outputText",
p:"h:outputText",
span:"h:outputText",
label:"h:outputLabel",
input:{text:"h:inputText",checkbox:"h:selectBooleanCheckbox"},
div:"h:panelGroup",
a:"h:outputLink",
button:"h:commandButton",
select:"h:selectOneMenu",
img:"h:graphicImage",
option:"f:selectItem"};}},

"private static",function registerTagLib(tagLib){
tagLibByUri[tagLib.getUri()]=tagLib;
},
"public static",function getNamespaceURI(element){
var namespaceURI=element.namespaceURI;
if(namespaceURI){

namespaceURI=""+namespaceURI;
}else if(element.scopeName){
namespaceURI=namespaceByPrefix[element.scopeName];
}
return namespaceURI;
},
"private static",function createTextNodeComponent(parent,childNodes,index){
if(typeof parent.getId=="function"){
var textNode=childNodes[index];
var data=textNode.data;
if(!/^[ \n]*$/.test(data)){
if(DEBUG)
console.debug("Found textNode "+parent.getId()+"["+index+"]: '"+data+"'.");
tagLibByUri["http://java.sun.com/jsf/html"].createComponent(parent,"outputText",textNode);
}
}
},

"private static",function createComponent(parent,element){
var tagName=element.localName?element.localName:element.nodeName;
var namespaceURI=getNamespaceURI(element);
if(namespaceURI=="http://www.w3.org/1999/xhtml"){
var jsfc=element.getAttribute("jsfc");
if(!jsfc){
jsfc=jscfByElementName[element.nodeName.toLowerCase()];
if(!jsfc){
return parent;
}
if(typeof jsfc=="object"){


jsfc=jsfc[element.type];
}
}
var parts=jsfc.split(":");
if(!parts.length==2){
throw new Error("jsfc must be of format namespace ':' tag.");
}
namespaceURI=namespaceByPrefix[parts[0]];
tagName=parts[1];
}
var tagLib=tagLibByUri[namespaceURI];
if(typeof tagLib=="object"){
if(DEBUG)
console.debug("creating component from tag-lib "+namespaceURI+" for tag "+tagName+" and element "+element.nodeName);
var component=tagLib.createComponent(parent,tagName,element);
if(DEBUG)
console.debug("created component from tag-lib "+namespaceURI+" for tag "+tagName+" and element "+element.nodeName+": "+component);
return component;
}
return null;
},
"private static",function createComponentAndChildren(parent,element){
var component=createComponent(parent,element);
if(component){
var childNodes=element.childNodes;
for(var i=0;i<childNodes.length;++i){
switch(childNodes[i].nodeType){
case Node.ELEMENT_NODE:
createComponentAndChildren(component,childNodes[i]);
break;
case Node.TEXT_NODE:
createTextNodeComponent(component,childNodes,i);
break;
}
}
}
return component;
},
"private static",function registerManagedBeans(){
var expressionFactory=joox.el.ExpressionFactory_().instance;
var variableMapper=joox.el.ELContext_().instance.getVariableMapper();
var PropertyAware=joo.util.PropertyAware_();
while(true){
var mBeanElem=document.getElementsByTagName("bean")[0];
if(!mBeanElem){
break;
}
var id=mBeanElem.getAttribute("id");
var clazz=mBeanElem.getAttribute("class");
if(!clazz){
clazz=mBeanElem.getAttribute("className");
}
var bean=eval("new "+clazz+"()");
var properties=mBeanElem.getElementsByTagName("property");
for(var c=0;c<properties.length;++c){
var property=properties[c];
var propertyName=property.getAttribute("name");
var value=property.getAttribute("value");
PropertyAware.setProperty(bean,propertyName,value);
}
mBeanElem.parentNode.removeChild(mBeanElem);
if(typeof bean.getObject=="function"){

bean=bean.getObject();
}
if(id){
variableMapper.setVariable(id,expressionFactory.createObjectValueExpression(bean));
}
}
},

"public static",function main(){

registerTagLib(new TagLib("http://java.sun.com/jsf/core",
{view:component.UIViewRoot,
facet:component.Facet,
selectItem:component.UISelectItem}
));
registerTagLib(new TagLib("http://java.sun.com/jsf/html",
{panelGroup:component.UIComponent,
outputText:component.html.HtmlOutputText,
outputLabel:component.html.HtmlOutputLabel,
outputLink:component.html.HtmlOutputLink,
commandButton:component.html.HtmlCommandButton,
commandLink:component.html.HtmlCommandLink,
inputText:component.html.HtmlInputText,
inputKey:component.html.HtmlInputKey,
dataTable:component.html.HtmlDataTable,
column:component.UIColumn,
graphicImage:component.html.HtmlGraphicImage,
selectOneMenu:component.html.HtmlSelectOneMenu,
selectBooleanCheckbox:component.html.HtmlSelectBooleanCheckbox}
));
registerTagLib(new TagLib("http://myfaces.apache.org/tomahawk",
{dataList:org.apache.myfaces.custom.datalist.HtmlDataList}
));










registerManagedBeans();
var views=typeof document.getElementsByTagNameNS=="function"
?document.getElementsByTagNameNS("http://java.sun.com/jsf/core","view")
:document.getElementsByTagName("view");
if(views.length==0){
views=[];
var divs=document.getElementsByTagName("div");
for(var i=0;i<divs.length;++i){
if(divs[i].getAttribute("jsfc")=="f:view"){
views.push(divs[i]);
}
}
}
if(DEBUG&&console.open)
console.open();
if(DEBUG)
console.debug("found "+views.length+" views.");
for(var i=0;i<views.length;++i){
var viewElem=views[i];
if(viewElem.getAttribute("jsfc")=="f:view"||typeof viewElem.scopeName=="undefined"||viewElem.scopeName=="f"){
if(DEBUG)
console.debug("processing "+viewElem.nodeName);
var view=createComponentAndChildren(null,viewElem);
var newViewElem=view.create();
if(DEBUG)
console.debug(viewElem.nodeName+" -> "+newViewElem.nodeName);
viewElem.parentNode.replaceChild(newViewElem,viewElem);

}
}
},
]});joo.Class.prepare(
"package joox.faces.component",

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

"public",function setParent(component){
this[_parent]=component;
},
"public",function getParent(){
return this[_parent];
},
"public",function setName(name){
this[_name]=name;
},
"public",function getName(){
return this[_name];
},
"private var",{parent: undefined},
"private var",{name: undefined},
"public",function toString(){
return this[_name];
},
]});joo.Class.prepare(
"package joox.faces.component",

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

"protected const",{elementName:"td"},
"public",function UIColumn(id){
this[_super](id);
},
"public",function getHeader(){
return this.getFacet("header");
},
"public",function getFooter(){
return this.getFacet("footer");
},
]});joo.Class.prepare(
"package joox.faces.component",

"public class UIComponent",function($jscContext){with(joox.faces.component)with($jscContext)return[

"protected const",{elementName:"div"},
"protected",function UIComponent(id){
this[_super]();
this[_id]=id;
},
"public",function getId(){
return this[_id];
},
"public",function setBinding(binding){
var elContext=joox.el.ELContext_().instance;
var bindingVB=joox.el.ExpressionFactory_().instance.createValueExpression(elContext,binding);
bindingVB.setValue(elContext,this);
},
"protected",function createEL(value){
return typeof value=="string"&&value.indexOf("#{")>=0
?joox.el.ExpressionFactory_().instance.createValueExpression(joox.el.ELContext_().instance,value)
:value;
},
"protected",function evalEL(value){
return joo.typeOf(value)=="object"&&value.getClass()===joox.el.ValueExpression
?value.getValue(joox.el.ELContext_().instance)
:value;
},
"public",function isRendered(){
return this.evalEL(this[_rendered]);
},
"public",function setRendered(rendered){
this[_rendered]=this.createEL(rendered);
},
"public",function setElementName(elementName){
this.elementName=elementName;
},
"public",function getStyle(){
return this.evalEL(this[_style]);
},
"public",function setStyle(style){
this[_style]=this.createEL(style);
},
"public",function getStyleClass(){
return this.evalEL(this[_styleClass]);
},
"public",function setStyleClass(styleClass){
this[_styleClass]=this.createEL(styleClass);
},
"public",function getTitle(){
return this.evalEL(this[_title]);
},
"public",function setTitle(title){
this[_title]=this.createEL(title);
},
"public",function getParent(){
return this[_parent];
},
"public",function setParent(parent){
if(!parent){

this[_view]=this;
}else{
if(parent.getClass()===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(){
return this[_children];
},
"public",function getFacet(facetName){
return this[_facets][facetName];
},
"public",function getFacets(){
return this[_facets];
},
"public",function getView(){
return this[_view];
},
"protected",function getNode(clientId){
return document.getElementById(clientId);
},
"public",function render(idSuffix){
var clientId=this[_id]+idSuffix;
var element=this.getNode(clientId);
if(element&&typeof element.scopeName!="undefined"&&element.scopeName!="HTML"){

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

this.renderChildren(element,idSuffix);
return element;
}else{
view.revalidate(clientId);
joox.cache.DependencyTracker_().start({
invalidated:function(dependencySet){
view.invalidate(clientId);
dependencySet.clear();
}
});

var result=this[_internalRender](element,idSuffix);

joox.cache.DependencyTracker_().stop();

return result;
}
},
"private",function internalRender(element,idSuffix){
if(!this.isRendered()){
if(element){
this.removeElement(element);
}
return null;
}
if(element&&element.nodeName.toLowerCase()!=this.elementName){
this.removeElement(element);
element=null;
}
if(!element){
element=this.createElement(idSuffix);
this.updateAttributes(element);
}else{
this.updateAttributes(element);
this.updateFacets(idSuffix);
}
this.renderChildren(element,idSuffix);
return element;
},

"protected",function removeElement(element){
element.parentNode.removeChild(element);
},
"protected",function createElement(idSuffix){
var elementName=this.getCreateElementName();

var element=document.createElement(elementName);
element.id=this[_id]+idSuffix;
return element;
},
"protected",function getCreateElementName(){
return this.elementName;
},
"protected",function updateFacets(idSuffix){

},
"protected",function updateAttributes(element){
var styleClass=this.getStyleClass();
if(styleClass)

element.className=styleClass;
var style=this.getStyle();
if(style)
element.style.cssText=style;
var title=this.getTitle();
if(typeof title=="string")
element.title=title;
},
"protected",function updateBooleanAttribute(element,name,value){
if(document.all&&name=="checked"){
element.defaultChecked=value;
}
if(value){
element.setAttribute(name,name);
element[name]=value;
}else{
element.removeAttribute(name);
element[name]=value;
}
return value;
},





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

child.isRendered();
var childElement=child.render(idSuffix);
if(childElement){
if(i>=element.childNodes.length||element.childNodes[i]!=childElement){
element.appendChild(childElement);
}

}
}
},
"protected",function restoreState(id){
return this.getParent().restoreState(id);
},
"protected",function addEventListener(element,eventName,handlerFunction,handlerObject){
var srcComponent=this;
if(typeof handlerObject=="undefined"){
handlerObject=this;
}
var eventHandlerFunction=handlerObject
?function(event){return handlerObject[handlerFunction.getName()](event,srcComponent);}
:function(event){return handlerFunction(event,srcComponent);};
if(typeof element.addEventListener=="function"){
element.addEventListener(eventName,eventHandlerFunction,false);
}else{
element.attachEvent("on"+eventName,function(){
return eventHandlerFunction(window.event);
});
}
},
"private var",{view: undefined},
"private var",{id: undefined},
"private var",{rendered:function(){return joox.el.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 {};}},

"public",function toString(){
return this[_id];
},
]});joo.Class.prepare(
"package joox.faces.component",

"public class UIData extends joox.faces.component.UIComponent",function($jscContext){with(joox.faces.component)with($jscContext)return[

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

return this.getValue().length;
},
"public",function setRowIndex(rowIndex,first){
this[_rowIndex]=rowIndex;
var expressionFactory=joox.el.ExpressionFactory_().instance;
var varExpression=rowIndex==-1
?expressionFactory.createObjectValueExpression(undefined)
:expressionFactory.createIndexValueExpression(this[_value],this[_first],
rowIndex-(first===undefined?this.getFirst():first));
joox.el.ELContext_().instance.getVariableMapper().setVariable(this.getVar(),varExpression);
},
"public",function getRowIndex(){
return this[_rowIndex];
},
"protected",function restoreState(id){
var lastColonPos=id.lastIndexOf(":");
if(lastColonPos<0){
return this.getParent().restoreState(id);

}
if(this.getParent().restoreState(id.substring(0,lastColonPos))){
var first=this.getFirst();
var rowIndex=first+Number(id.substring(lastColonPos+1));
if(rowIndex<this.getRowCount()){
this.setRowIndex(rowIndex,first);
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.Class.prepare(
"package joox.faces.component",

"public class UISelectItem extends joox.faces.component.UIComponent",function($jscContext){with(joox.faces.component)with($jscContext)return[

"protected const",{elementName:"option"},
"public",function SelectItem(id){
this[_super](id);
},
"public",function setItemLabel(itemLabel){
this[_itemLabel]=joox.el.ExpressionFactory_().instance.createValueExpression(joox.el.ELContext_().instance,itemLabel);
},
"public",function getItemLabel(){
return this[_itemLabel].getValue(joox.el.ELContext_().instance);
},
"public",function setItemValue(itemValue){
this[_itemValue]=joox.el.ExpressionFactory_().instance.createValueExpression(joox.el.ELContext_().instance,itemValue);
},
"public",function setValue(itemLabel){
this.setItemLabel(itemLabel);
},
"public",function getItemValue(){
return this[_itemValue].getValue(joox.el.ELContext_().instance);
},
"protected",function updateAttributes(element){
this[_updateAttributes](element);
var itemValue=this.getItemValue();
element.setAttribute("value",itemValue);
this.updateBooleanAttribute(element,"selected",itemValue==this.getParent().getValue());
var itemLabel=this.getItemLabel();
var textNode=element.firstChild;
if(textNode){
textNode.data=itemLabel;
}else{
element.appendChild(document.createTextNode(itemLabel));
}
},
"private var",{itemLabel: undefined},
"private var",{itemValue: undefined},
"public",function toString(){
return this.getItemLabel()+": "+this.getItemValue();
},
]});joo.Class.prepare(
"package joox.faces.component",

"public class UIInput extends joox.faces.component.UIOutput",function($jscContext){with(joox.faces.component)with($jscContext)return[

"public",function UIInput(id){
this[_super](id);
},
"protected",function isReadOnly(){
return this.getValueExpression().isReadOnly(joox.el.ELContext_().instance);
},
"public",function isDisabled(){
return this.evalEL(this[_disabled]);
},
"public",function setDisabled(disabled){
this[_disabled]=this.createEL(disabled);
},
"protected",function storeValue(value){
return this.getValueExpression().setValue(joox.el.ELContext_().instance,value);
},
"protected",function updateAttributes(element){
this[_updateAttributes](element);
this.updateBooleanAttribute(element,"disabled",this.isReadOnly()||this.isDisabled());
},

"private var",{disabled:false},
]});joo.Class.prepare(
"package joox.faces.component",

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

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

"public class HtmlCommandButton extends joox.faces.component.html.HtmlOutputText",function($jscContext){with(joox.faces.component.html)with($jscContext)return[

"protected const",{elementName:"button"},
"public",function HtmlCommandButton(id){
this[_super](id);
},
"public",function setAction(action){
this[_action]=joox.el.ExpressionFactory_().instance.createMethodExpression(joox.el.ELContext_().instance,action);
},
"public",function setDisabled(disabled){
this[_disabled]=this.createEL(disabled);
},
"public",function isDisabled(){
return this.evalEL(this[_disabled]);
},
"public",function setEnabled(enabled){
this.setDisabled(typeof enabled=="boolean"?!enabled:"#{!"+enabled.substring(2));
},
"public",function setType(type){
this[_type]=this.createEL(type);
},
"public",function getType(){
return this.evalEL(this[_type]);
},
"private",function invokeAction(event){
var clientId=event.srcElement.id;
this.restoreState(clientId);
var actionEvent={component:this,componentId:this.getId(),clientId:clientId};
var outcome=this[_action].invoke(joox.el.ELContext_().instance,[actionEvent]);
this.getView().render();
event.returnValue=false;
return false;
},
"protected",function getCreateElementName(){
if(window.navigator.userAgent.indexOf("MSIE")!=-1){

var type=this.getType();
if(type){
return"<"+this.elementName+" type='"+type+"'>";
}
}
return this[_getCreateElementName]();
},
"protected",function createElement(idSuffix){
var element=this[_createElement](idSuffix);
var type=this.getType();
if(type){
element.setAttribute("type",type);
}
if(this[_action]){
this.addEventListener(element,"click",this[_invokeAction]);
}
return element;
},
"protected",function updateAttributes(element){
this[_updateAttributes](element);
this.updateBooleanAttribute(element,"disabled",this.isDisabled());
},
"private var",{action: undefined},
"private var",{disabled:false},
"private var",{type:"button"},
]});joo.Class.prepare(
"package joox.faces.component.html",

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

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

"public class HtmlGraphicImage extends joox.faces.component.UIComponent",function($jscContext){with(joox.faces.component.html)with($jscContext)return[

"protected const",{elementName:"img"},
"public",function HtmlGraphicImage(id){
this[_super](id);
},
"public",function setSrc(src){
this[_src]=joox.el.ExpressionFactory_().instance.createValueExpression(joox.el.ELContext_().instance,src);
},
"public",function getSrc(){
return this[_src].getValue(joox.el.ELContext_().instance);
},
"public",function setAlt(alt){
this[_alt]=joox.el.ExpressionFactory_().instance.createValueExpression(joox.el.ELContext_().instance,alt);
},
"public",function getAlt(){
return this[_alt].getValue(joox.el.ELContext_().instance);
},
"protected",function updateAttributes(element){
this[_updateAttributes](element);
element.setAttribute("src",this.getSrc());
element.setAttribute("alt",this.getAlt());
},
"private var",{src: undefined},
"private var",{alt: undefined},
]});joo.Class.prepare(
"package joox.faces.component.html",

"public class HtmlInputText extends joox.faces.component.UIInput",function($jscContext){with(joox.faces.component.html)with($jscContext)return[

"protected const",{elementName:"input"},
"public",function HtmlInputText(id,props){
this[_super](id,props);
},
"public",function setType(type){
if(type!="text"){
throw new Error("HtmlInputText only supports type='text'.");
}
},
"protected",function createElement(idSuffix){
var element=this[_createElement](idSuffix);
element.setAttribute("type","text");
this.addEventListener(element,"focus",function(event,srcComponent){
element.style.borderColor="blue";
},null);
this.addEventListener(element,"blur",function(event,srcComponent){
element.style.borderColor="";
},null);
this.addEventListener(element,"change",this[_changed]);
return element;
},
"protected",function updateAttributes(element){
this[_updateAttributes](element);
element.value=this.getValue();
},
"private",function changed(event,srcComponent){

var elem=event.srcElement;
var clientId=elem.id;
this.restoreState(clientId);
this.storeValue(elem.value);
this.getView().render();
return true;
},
]});joo.Class.prepare("package joox.faces.component.html",

"public class HtmlInputKey extends joox.faces.component.UIInput",function($jscContext){with(joox.faces.component.html)with($jscContext)return[

"protected const",{elementName:"a"},
"public",function HtmlInputText(id,props){
this[_super](id,props);
},
"public",function setType(type){
if(type!="text"){
throw new Error("HtmlInputText only supports type='text'.");
}
},
"public",function render(idSuffix){
this.elementName=this.isDisabled()?"span":"a";
return this[_render](idSuffix);
},
"protected",function createElement(idSuffix){
var element=this[_createElement](idSuffix);
if(element.nodeName.toLowerCase()=="a"){
element.setAttribute("href","#");
element.setAttribute("tabIndex","0");
this.addEventListener(element,"focus",function(event,srcComponent){
element.style.backgroundColor="lightblue";
},null);
this.addEventListener(element,"blur",function(event,srcComponent){
element.style.backgroundColor="";
},null);
this.addEventListener(element,"keydown",this[_changed]);
}
return element;
},
"protected",function updateAttributes(element){
this[_updateAttributes](element);
var value=this.getValue();
var data;
if(value===undefined){
data="--";
}else if(value>=37&&value<=40){

data=String.fromCharCode(8592+value-37);
}else{

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

data=String(value);
}
}
var textNode=element.firstChild;
if(textNode){
textNode.data=data;
}else{
element.appendChild(document.createTextNode(data));
}
},
"private",function changed(event,srcComponent){

if(event.keyCode>32){
var elem=event.srcElement;
var clientId=elem.id;
this.restoreState(clientId);
this.storeValue(event.keyCode);
this.getView().render();
}
return true;
},
]});joo.Class.prepare(
"package joox.faces.component.html",

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

"protected const",{elementName:"a"},
"public",function HtmlOutputLink(id){
this[_super](id);
},
"public",function setTarget(target){
this[_target]=this.createEL(target);
},
"public",function getTarget(){
return this.evalEL(this[_target]);
},
"protected",function updateAttributes(element){
this[_updateAttributes](element);
element.setAttribute("href",this.getValue());
element.setAttribute("target",this.getTarget());
},
"private var",{target: undefined},
]});joo.Class.prepare(
"package joox.faces.component.html",

"public class HtmlOutputText extends joox.faces.component.UIOutput",function($jscContext){with(joox.faces.component.html)with($jscContext)return[

"protected const",{elementName:"span"},
"private var",{textNodeIndex: undefined},

"public",function HtmlOutputText(id){
this[_super](id);
},
"protected",function createElement(idSuffix){
if(this.elementName=="#text"){
return document.createTextNode("");
}
return this[_createElement](idSuffix);
},
"protected",function getNode(clientId){
var element=this[_getNode](clientId);
if(this.elementName=="#text"){
return element.childNodes[this[_textNodeIndex]];
}
return element;
},
"public",function updateAttributes(element){
if(this.elementName=="#text")
return;
this[_updateAttributes](element);
var value=this.getValue();
var textNode=element.firstChild;
if(textNode){
textNode.data=value;
}else{
element.appendChild(document.createTextNode(value));
}
},
]});joo.Class.prepare(
"package joox.faces.component.html",

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

"protected const",{elementName:"label"},
"private var",{forId: undefined},

"public",function HtmlOutputLabel(id){
this[_super](id);
},
"public",function setFor(forId){
this[_forId]=forId;
},
"public",function getFor(){
return this[_forId];
},
"private",function focusForElement(){
var forElement=document.getElementById(this.getFor());
if(forElement){
var method=forElement.nodeName=="INPUT"&&(forElement.type=="checkbox"||forElement.type=="radio")
?"click":"focus";

window.setTimeout(function(){forElement[method]();});


}
},
"protected",function createElement(idSuffix){
var element=this[_createElement](idSuffix);
if(window.navigator.userAgent.indexOf("MSIE")!=-1){
var forId=this.getFor();

if(forId){
this.addEventListener(element,"click",this[_focusForElement]);
}
}
return element;
},
"public",function updateAttributes(element){
this[_updateAttributes](element);
var forId=this.getFor();
if(forId){
element.setAttribute("for",forId);
}
},
]});joo.Class.prepare(
"package joox.faces.component.html",

"public class HtmlSelectOneMenu extends joox.faces.component.UIInput",function($jscContext){with(joox.faces.component.html)with($jscContext)return[

"protected const",{elementName:"select"},
"public",function HtmlSelectOneMenu(id){
this[_super](id);
},
"private",function updateProperty(event){
var clientId=event.srcElement.id;
this.restoreState(clientId);
var newValue=event.srcElement.value;

var children=this.getChildren();
for(var i=0;i<children.length;++i){
var itemValue=children[i].getItemValue();
if(String(itemValue)==newValue){

newValue=itemValue;
this.storeValue(itemValue);
this.getView().render();
return true;
}
}
return false;
},
"protected",function createElement(idSuffix){
var element=this[_createElement](idSuffix);
if(this.getValueExpression()){
this.addEventListener(element,"change",this[_updateProperty]);
}
return element;
},
]});joo.Class.prepare(
"package joox.faces.component.html",

"public class HtmlSelectBooleanCheckbox extends joox.faces.component.UIInput",function($jscContext){with(joox.faces.component.html)with($jscContext)return[

"protected const",{elementName:"input"},
"public",function HtmlSelectBooleanCheckbox(id,props){
this[_super](id,props);
},
"public",function setType(type){
if(type!="checkbox"){
throw new Error("HtmlSelectBooleanCheckbox only supports type='checkbox'.");
}
},
"protected",function getCreateElementName(){
if(window.navigator.userAgent.indexOf("MSIE")!=-1){

return"<"+this.elementName+" type='checkbox'>";
}
return this[_getCreateElementName]();
},
"protected",function createElement(idSuffix){
var element=this[_createElement](idSuffix);
element.setAttribute("type","checkbox");
this.addEventListener(element,"click",this[_changed]);
return element;
},
"protected",function updateAttributes(element){
this[_updateAttributes](element);
this.updateBooleanAttribute(element,"checked",this.getValue());
},
"private",function changed(event,srcComponent){
var elem=event.srcElement;
var clientId=elem.id;
this.restoreState(clientId);
this.storeValue(! !elem.checked);
this.getView().render();
return true;
},
]});joo.Class.prepare(
"package joox.faces.component.html",

"public class HtmlDataTable extends joox.faces.component.UIData",function($jscContext){with(joox.faces.component.html)with($jscContext)return[

"protected const",{elementName:"table"},
"public",function HtmlDataTable(id){
this[_super](id);
},
"protected",function updateAttributes(element){
this[_updateAttributes](element);

this.getFirst();
this.getRows();
this.getValue();
},
"private",function createCaption(table,idSuffix){
var caption=this.getFacet("caption");
if(caption){
var captionElement=document.createElement("caption");
captionElement.appendChild(caption.render(idSuffix));
table.appendChild(captionElement);
}
},
"private",function updateCaption(idSuffix){
var caption=this.getFacet("caption");
if(caption){
caption.render(idSuffix);
}
},
"private",function createTableHeaderOrFooter(cellElementName,facetName,idSuffix){
var tableHeaderOrFooter=this.getFacet(facetName);
if(tableHeaderOrFooter){
var tr=document.createElement("tr");
var cellElement=document.createElement(cellElementName);
cellElement.setAttribute("colSpan",this.getChildren().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(facetName,idSuffix){
var tableHeaderOrFooter=this.getFacet(facetName);
if(tableHeaderOrFooter){
tableHeaderOrFooter.render(idSuffix);
}
},
"private",function createColumnHeaderOrFooter(cellElementName,facetName,idSuffix){
var tr=document.createElement("tr");
var children=this.getChildren();
for(var cellIndex=0;cellIndex<children.length;++cellIndex){
var headerOrFooter=children[cellIndex].getFacet(facetName);
var headerOrFooterElement=headerOrFooter?headerOrFooter.render(idSuffix):null;
var cellElement=document.createElement(cellElementName);
if(headerOrFooterElement){
this[_hasColumn][facetName]=true;
cellElement.appendChild(headerOrFooterElement);
}
tr.appendChild(cellElement);
}
return this[_hasColumn][facetName]?tr:null;
},
"private",function updateColumnHeaderOrFooter(facetName,idSuffix){
if(this[_hasColumn][facetName]){
var children=this.getChildren();
for(var cellIndex=0;cellIndex<children.length;++cellIndex){
var headerOrFooter=children[cellIndex].getFacet(facetName);
if(headerOrFooter){
headerOrFooter.render(idSuffix);
}
}
}
},
"private",function createSection(table,sectionElementName,member1,member2){
if(member1||member2){
var sectionElement=document.createElement(sectionElementName);
if(member1)
sectionElement.appendChild(member1);
if(member2)
sectionElement.appendChild(member2);
table.appendChild(sectionElement);
}
},
"protected",function createElement(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;
},
"protected",function updateFacets(idSuffix){

this[_updateCaption](idSuffix);

var tableHeader=this[_updateTableHeaderOrFooter]("header",idSuffix);
var columnHeader=this[_updateColumnHeaderOrFooter]("header",idSuffix);

var columnFooter=this[_updateColumnHeaderOrFooter]("footer",idSuffix);
var tableFooter=this[_updateTableHeaderOrFooter]("footer",idSuffix);
},
"protected",function renderChildren(table,idSuffix){
var children=this.getChildren();
var tBody=table.tBodies[0];
if(!tBody){
tBody=document.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 varName=this.getVar();
for(var rowIndex=first;rowIndex<last;++rowIndex){
this.setRowIndex(rowIndex,first);
var tableRowIndex=rowIndex-first;
var rowIdSuffix=idSuffix+":"+tableRowIndex;
var row=tBody.rows[tableRowIndex];
if(!row){
row=document.createElement("tr");
tBody.appendChild(row);
}
for(var cellIndex=0;cellIndex<children.length;++cellIndex){
var cellElement=children[cellIndex].render(rowIdSuffix);
if(cellIndex>=row.cells.length||row.cells[cellIndex]!=cellElement){
row.appendChild(cellElement);
}
}
}
var lastRowIndex=last-first;
for(var rowIndex=tBody.rows.length-1;rowIndex>=lastRowIndex;--rowIndex){
tBody.removeChild(tBody.lastChild);
}
this.setRowIndex(-1,-1);
},
"private var",{hasColumn:function(){return {header:false,footer:false};}},
]});joo.Class.prepare(
"package joox.faces.component",

"public class UIViewRoot extends joox.faces.component.UIComponent",function($jscContext){with(joox.faces.component)with($jscContext)return[

"private static const",{IS_OPERA:function(){return window.navigator.userAgent.indexOf("Opera")!=-1;}},

"public",function UIViewRoot(id){
this[_super](id);
this.registerComponent(this);
},
"protected",function restoreState(id){
if(id.indexOf(":")>=0)
throw"Assertion failed: View#restoreState must receive id without colon (':').";
return true;
},
"public",function create(){
var element=this.render("");
this[_invalidComponentClientIds]=new joo.util.HashSet();
return element;
},
"public",function render(){
var invalidComponentClientIds=this[_invalidComponentClientIds];
if(this.isInvalid(this.getId())){

return this[_render]("");
}



var componentById=this[_componentById];
for(var clientIdI=invalidComponentClientIds.iterator();clientIdI.hasNext();){
var clientId=clientIdI.next();
if(clientId){
var parts=clientId.split(":");
var id=parts[0];
var component=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.className;
var dummyClassIndex=className.indexOf(" opera");
viewRootElement.className=dummyClassIndex==-1?className+" opera":className.substring(0,dummyClassIndex);
}
},
"public",function beansChanged(){
this.render();
},
"private",function isParentInvalid(component){
var invalidComponentClientIds=this[_invalidComponentClientIds];
for(var parent=component.getParent();parent;parent=parent.getParent()){
if(invalidComponentClientIds.contains(parent.getId())){
return true;
}
}
return false;
},
"public",function isInvalid(componentClientId){
var invalidComponentClientIds=this[_invalidComponentClientIds];
return invalidComponentClientIds==null||invalidComponentClientIds.contains(componentClientId);
},
"public",function invalidate(componentClientId){
var invalidComponentClientIds=this[_invalidComponentClientIds];
if(invalidComponentClientIds!=null){
invalidComponentClientIds.add(componentClientId);
}
},
"public",function revalidate(componentClientId){
var invalidComponentClientIds=this[_invalidComponentClientIds];
if(invalidComponentClientIds!=null){
invalidComponentClientIds.remove(componentClientId);
}
},
"public",function registerComponent(component){
this[_componentById]["_"+component.getId()]=component;
},
"private var",{invalidComponentClientIds: undefined},
"private var",{componentById:function(){return {};}},
]});joo.Class.prepare(
"package joox.faces.controller",

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

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

"public",function setUiData(uiData){
this[_uiData]=uiData;
},
"public",function getUiData(){
return this[_uiData];
},
"public",function getSelected(){
return! !this[_selection][this.getUiData().getRowIndex()];
},
"public",function setSelected(selected){
var index=this.getUiData().getRowIndex();
var selection=this[_selection];
if(selection[index]!=selected){
selection[index]=selected;
this[_selectionCount]+=selected?1:-1;
}
},
"public",function getSelectionCount(){
return this[_selectionCount];
},
"public",function toggleSelectAll(){
var rowCount=this.getUiData().getRowCount();
if(this.getSelectionCount()==rowCount){
this[_selection]=[];
this[_selectionCount]=0;
}else{
var selection=this[_selection];
for(var i=0;i<rowCount;++i){
selection[i]=true;
}
this[_selectionCount]=rowCount;
}
},
"public",function refresh(){
joo.remote.BeanCache_().invalidateAll();
var view=this.getUiData().getView();
view.invalidate(view.getId());
view.render();
},
"private var",{uiData: undefined},
"private var",{first:0},
"private var",{rows:0},
"private var",{selection:function(){return [];}},
"private var",{selectionCount:0},

"public",function toString(){
return["DataPageController[",this[_uiData],"]"].join("");
},
]});joo.Class.prepare(
"package org.apache.myfaces.custom.datalist",

"public class HtmlDataList extends joox.faces.component.UIData",function($jscContext){with(org.apache.myfaces.custom.datalist)with($jscContext)return[

"protected const",{elementName:"span"},
"public",function HtmlDataList(id){
this[_super](id);
},
"protected",function renderChildren(container,idSuffix){
var children=this.getChildren();
var dataCount=this.getValue().length;
var varName=this.getVar();
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 childElement=children[childIndex].render(rowIdSuffix);

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

container.replaceChild(childElement,oldChildElement);
}
}
}
while(container.childNodes[childElementIndex]){
container.removeChild(container.lastChild);
}
this.setRowIndex(-1,-1);
return container;
},
]});joo.Class.prepare("package net.jangaron.ui",

"public class Tab",function($jscContext){with(net.jangaron.ui)with($jscContext)return[

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

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

"public",function select(){
this.tabs.setSelectedIndex(this.index);
},
]});joo.Class.prepare("package net.jangaron.ui",

"public class Tabs extends joox.cache.DependencyAware",function($jscContext){with(net.jangaron.ui)with($jscContext)return[

"public",function Tabs(names){
this[_super]({selectedIndex:0,tabs:joo.Array()});
for(var i=0;i<names.length;++i){
this.tabs.push(new Tab(this,i,names[i]));
}
},

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

]});joo.Class.prepare("package net.jangaron.ui",

"public class Player extends joox.cache.DependencyAware",function($jscContext){with(net.jangaron.ui)with($jscContext)return[

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

"public",function Player(props){
this[_super](props);
},

"public",function getHasViewPort(){
var hasViewPort=this.isVisible()||this.isUser();
if(DEBUG)
console.log("Player["+this+"].getHasViewPort("+hasViewPort+")="+hasViewPort);
return hasViewPort;
},

"public",function setHasViewPort(hasViewPort){
if(DEBUG)
console.log("Player["+this+"].setHasViewPort("+hasViewPort+")");
return this.setVisible(hasViewPort);
},

"public",function toString(){
return this.name;
},

]});joo.Class.prepare("package net.jangaron.ui",

"public class Settings extends joox.cache.DependencyAware",function($jscContext){with(net.jangaron.ui)with($jscContext)return[

"private const",{namedColors:function(){return {
orange:new joo.css.Color(228,108,10),
red:new joo.css.Color(228,10,10),
blue:new joo.css.Color(0,0,192),
violet:new joo.css.Color(192,0,192),
green:new joo.css.Color(10,228,108),
yellow:new joo.css.Color(228,228,0)
};}},
"private const",{initializers:function(){return [
new Player({user:true,visible:true,name:"Flynn",color:this[_namedColors].orange,
keyMap:new joox.cache.DependencyAware({left:KeyEvent.DOM_VK_LEFT,right:KeyEvent.DOM_VK_RIGHT,faster:KeyEvent.DOM_VK_UP,slower:KeyEvent.DOM_VK_DOWN})}),
new Player({user:false,visible:false,name:"Sark",color:this[_namedColors].blue,
keyMap:new joox.cache.DependencyAware({left:KeyEvent.DOM_VK_A,right:KeyEvent.DOM_VK_D,faster:KeyEvent.DOM_VK_W,slower:KeyEvent.DOM_VK_S})}),
new Player({user:false,visible:false,name:"Ram",color:this[_namedColors].green,
keyMap:new joox.cache.DependencyAware({left:KeyEvent.DOM_VK_F,right:KeyEvent.DOM_VK_H,faster:KeyEvent.DOM_VK_T,slower:KeyEvent.DOM_VK_G})}),
new Player({user:false,visible:false,name:"Tron",color:this[_namedColors].yellow,
keyMap:new joox.cache.DependencyAware({left:KeyEvent.DOM_VK_J,right:KeyEvent.DOM_VK_L,faster:KeyEvent.DOM_VK_I,slower:KeyEvent.DOM_VK_K})}),
new Player({user:false,visible:false,name:"Bit",color:this[_namedColors].red,
keyMap:new joox.cache.DependencyAware({left:undefined,right:undefined,faster:undefined,slower:undefined})}),
new Player({user:false,visible:false,name:"Clu",color:this[_namedColors].violet,
keyMap:new joox.cache.DependencyAware({left:undefined,right:undefined,faster:undefined,slower:undefined})})
];}},

"public",function Settings(){
this[_super]({tabIndex:0,width:200,height:200,transparentCycleWalls:false,generateObstacles:false,obstacleCnt:10,players:joo.Array(),
tabs:new Tabs(["About","Game play","Players","Grid settings"])});
this.addPlayer();
this.addPlayer();
this.colors=joo.Array();
for(var c in this[_namedColors]){
this.colors.push(new joox.cache.DependencyAware({color:this[_namedColors][c],name:c}));
}
window.settings=this;
},

"public",function isPlayerMaximumReached(){
return this.getPlayers().length>=this[_initializers].length;
},

"public",function isViewMaximumReached(){
var players=this.getPlayers();
if(players.length>=4){
var views=0;
for(var i=0;i<players.length;++i){
var player=players[i];
if(player.getHasViewPort()){
++views;
if(views>=4){
return true;
}
}
}
}
return false;
},

"public",function addPlayer(){
for(var i=0;i<this[_initializers].length;++i){
var initializer=this[_initializers][i];
if(!this.players.contains(initializer)){
this.players.push(initializer);
this.setPlayers(this.players);
break;
}
}
},

"public",function deletePlayer(actionEvent){
var i=actionEvent.component.getParent().getParent().getRowIndex();
this.players.splice(i,1);
this.setPlayers(this.players);
},

"public",function start(actionEvent){
var view=actionEvent.component.getView();
view.setRendered(false);
view.invalidate(view.getId());
net.jangaron.Grid_().main(Number(this.width),Number(this.height),
this.transparentCycleWalls?.75:1,
this.generateObstacles?this.obstacleCnt:0,this.players);
},

"public",function getJangaronEMail(){
return["mailto:jangaron","arcor.de"].join("@");
},
]});
