@@ -55,6 +55,11 @@ javaxt.dhtml.Window = function(parent, config) {
5555 */
5656 footer : null ,
5757
58+ /** Buttons to put in the footer. Only rendered if no "footer" config is
59+ * defined.
60+ */
61+ buttons : [ ] ,
62+
5863 /** Initial width of the window, in pixels.
5964 */
6065 width : null ,
@@ -182,6 +187,31 @@ javaxt.dhtml.Window = function(parent, config) {
182187
183188 } ,
184189
190+ footerButtonBar : {
191+ display : "inline-block" ,
192+ float : "right" ,
193+ padding : "7px 7px 14px 7px"
194+ } ,
195+
196+ //Style for individual buttons in the button bar (footer)
197+ footerButton : {
198+ borderRadius : "3px" ,
199+ color : "#363636" ,
200+ display : "inline-block" ,
201+ fontSize : "14px" ,
202+ width : "80px" ,
203+ height : "26px" ,
204+ lineHeight : "26px" ,
205+ verticalAlign : "middle" ,
206+ textAlign : "center" ,
207+ backgroundColor : "#e4e4e4" ,
208+ border : "1px solid #b4b4b4" ,
209+ boxShadow : "0 2px 4px 0 rgba(0, 0, 0, 0.2)" ,
210+ textShadow : "1px 1px 0px rgb(255, 255, 255)" ,
211+ cursor : "pointer" ,
212+ marginLeft : "7px"
213+ } ,
214+
185215 resizeHandle : {
186216 //should be about 20x20 px with rounded corner to match window
187217 } ,
@@ -198,7 +228,7 @@ javaxt.dhtml.Window = function(parent, config) {
198228
199229 } ;
200230
201- var mainDiv , header , body , footer , mask ;
231+ var mainDiv , header , body , footer , buttonRow , mask ;
202232 var titleDiv , iconDiv , buttonDiv ; //header elements
203233 var recenter = true ;
204234 var visible = false ;
@@ -298,9 +328,26 @@ javaxt.dhtml.Window = function(parent, config) {
298328
299329
300330 me . setContent ( config . body ) ;
301- me . setFooter ( config . footer ) ;
302331
303332
333+ //Populate the footer
334+ if ( config . footer ) {
335+ me . setFooter ( config . footer ) ;
336+ }
337+ else {
338+ if ( config . buttons ) {
339+ for ( var i = 0 ; i < config . buttons . length ; i ++ ) {
340+
341+ var button = config . buttons [ i ] ;
342+ var name = button . name ;
343+ var enabled = true ;
344+ var onclick = button . onclick ;
345+
346+ addButton ( name , enabled , onclick ) ;
347+ }
348+ }
349+ }
350+
304351
305352 //Create mask (used for modal dialogs and resize)
306353 mask = createElement ( 'div' , parent ) ;
@@ -808,6 +855,30 @@ javaxt.dhtml.Window = function(parent, config) {
808855 } ;
809856
810857
858+ //**************************************************************************
859+ //** addButton
860+ //**************************************************************************
861+ addButton = function ( name , enabled , onclick ) {
862+
863+ if ( ! buttonRow ) {
864+ var buttonDiv = createElement ( 'div' , footer , config . style . footerButtonBar ) ;
865+ buttonRow = createTable ( buttonDiv ) . addRow ( ) ;
866+ }
867+
868+ var td = buttonRow . addColumn ( ) ;
869+ if ( name . toLowerCase ( ) === "spacer" ) {
870+ td . style . width = "100%" ;
871+ }
872+ else {
873+ var input = createElement ( 'input' , td , config . style . footerButton ) ;
874+ input . type = "button" ;
875+ input . name = name ;
876+ input . value = name ;
877+ input . onclick = onclick ;
878+ }
879+ } ;
880+
881+
811882 //**************************************************************************
812883 //** addResizeHandles
813884 //**************************************************************************
0 commit comments