/*!
 * SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
 * (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
 * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
 */
sap.ui.define(['jquery.sap.global','sap/ui/core/Element','sap/ui/core/EnabledPropagator','sap/ui/core/theming/Parameters','sap/ui/layout/library'],function(q,E,a,P,l){"use strict";var F=E.extend("sap.ui.layout.form.FormContainer",{metadata:{library:"sap.ui.layout",properties:{expanded:{type:"boolean",group:"Misc",defaultValue:true},expandable:{type:"boolean",group:"Misc",defaultValue:false},visible:{type:"boolean",group:"Misc",defaultValue:true}},defaultAggregation:"formElements",aggregations:{formElements:{type:"sap.ui.layout.form.FormElement",multiple:true,singularName:"formElement"},title:{type:"sap.ui.core.Title",altTypes:["string"],multiple:false}}}});(function(){F.prototype.init=function(){this._rb=sap.ui.getCore().getLibraryResourceBundle("sap.ui.layout");};F.prototype.exit=function(){if(this._oExpandButton){this._oExpandButton.destroy();delete this._oExpandButton;}this._rb=undefined;};F.prototype.setExpandable=function(e){this.setProperty("expandable",e);if(e){var t=this;if(!this._oExpandButton){this._oExpandButton=sap.ui.layout.form.FormHelper.createButton(this.getId()+"--Exp",b,t);this._oExpandButton.setParent(this);}_(t);}return this;};F.prototype.setExpanded=function(e){this.setProperty("expanded",e,true);var t=this;_(t);var f=this.getParent();if(f&&f.toggleContainerExpanded){f.toggleContainerExpanded(t);}return this;};F.prototype.contentOnAfterRendering=function(f,c){var p=this.getParent();if(p&&p.contentOnAfterRendering){p.contentOnAfterRendering(f,c);}};F.prototype.onLayoutDataChange=function(e){var p=this.getParent();if(p&&p.onLayoutDataChange){p.onLayoutDataChange(e);}};F.prototype._checkProperties=function(){var r=0;if(this.getExpandable()&&!this.getTitle()){q.sap.log.warning("Expander only displayed if title is set",this.getId(),"FormContainer");r=1;}return r;};function _(c){if(!c._oExpandButton){return;}var i,I,t,T;if(c.getExpanded()){i=P.get('sapUiFormContainerColImageURL');I=P.get('sapUiFormContainerColImageDownURL');t="-";T=c._rb.getText("FORM_COLLAPSE");}else{i=P.get('sapUiFormContainerExpImageURL');I=P.get('sapUiFormContainerExpImageDownURL');t="+";T=c._rb.getText("FORM_EXPAND");}if(i){i=q.sap.getModulePath("sap.ui.layout",'/')+"themes/"+sap.ui.getCore().getConfiguration().getTheme()+i;t="";}if(I){I=q.sap.getModulePath("sap.ui.layout",'/')+"themes/"+sap.ui.getCore().getConfiguration().getTheme()+I;}sap.ui.layout.form.FormHelper.setButtonContent(c._oExpandButton,t,T,i,I);}function b(e){this.setExpanded(!this.getExpanded());}}());return F;},true);
