01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08: package com.gwtext.client.widgets.layout;
09:
10: import com.google.gwt.core.client.JavaScriptObject;
11: import com.gwtext.client.util.JavaScriptObjectHelper;
12: import com.gwtext.client.widgets.Component;
13:
14: /**
15: * Every layout is composed of one or more Ext.Container elements internally, and ContainerLayout provides the basic foundation
16: * for all other layout classes in GWT-Ext. It is a non-visual class that simply provides the base logic required for a Container
17: * to function as a layout.
18: */
19: public abstract class ContainerLayout {
20:
21: protected JavaScriptObject configJS = JavaScriptObjectHelper
22: .createObject();
23: private JavaScriptObject jsObj;
24: private String spacing;
25:
26: public JavaScriptObject getJsObj() {
27: if (jsObj == null) {
28: jsObj = create(configJS);
29: }
30: return jsObj;
31: }
32:
33: protected native JavaScriptObject create(JavaScriptObject config) /*-{
34: return new $wnd.Ext.layout.ContainerLayout(config);
35: }-*/;
36:
37: public JavaScriptObject getContainerAttributes() {
38: return null;
39: }
40:
41: /**
42: * An optional extra CSS class that will be added to the container (defaults to ''). This can be useful for adding
43: * customized styles to the container or any of its children using standard CSS rules.
44: *
45: * @param extraCls an optional extra CSS class that will be added to the container (defaults to '').
46: */
47: public void setExtraCls(String extraCls) {
48: JavaScriptObjectHelper.setAttribute(configJS, "extraCls",
49: extraCls);
50: }
51:
52: /**
53: * True to hide each contained item on render (defaults to false).
54: *
55: * @param renderHidden true to hide each contained item on render (defaults to false).
56: */
57: public void setRenderHidden(boolean renderHidden) {
58: JavaScriptObjectHelper.setAttribute(configJS, "renderHidden",
59: renderHidden);
60: }
61:
62: public native Component getActiveItem() /*-{
63: var layout = this.@com.gwtext.client.widgets.layout.ContainerLayout::getJsObj()();
64: var jsoActiveItem = layout.activeItem;
65: return jsoActiveItem == null ? null : @com.gwtext.client.widgets.ComponentFactory::getComponent(Lcom/google/gwt/core/client/JavaScriptObject;)(jsoActiveItem);
66: }-*/;
67:
68: public String getSpacing() {
69: return spacing;
70: }
71:
72: public void setSpacing(String spacing) {
73: this.spacing = spacing;
74: }
75: }
|