Google Apps Script

Class CaptionPanel

A panel that wraps its contents in a border with a caption that appears in the upper left corner of the border. This is an implementation of the fieldset HTML element.

Note that this panel can contain at most one direct child widget. To add more children, make the child of this panel a different panel that can contain more than one child.

Note also that the placement of the caption in a caption panel will vary slightly from browser to browser, so this widget is not a good choice when precise cross-browser layout is needed.

Here is an example of how to use this widget:

 
function doGet() {
   var app = UiApp.createApplication();
   var panel = app.createCaptionPanel("my caption!");
   panel.add(app.createButton("a button inside..."));
   app.add(panel);
   return app;
 }
 

Internally, UiApp widgets are built on top of the Google Web Toolkit, and it can sometimes be helpful to look at the GWT documentation directly. You can find the CaptionPanel documentation here.

Methods

MethodReturn typeBrief description
add(widget)CaptionPanelAdd a widget to the CaptionPanel.
addStyleDependentName(styleName)CaptionPanelSets the dependent style name of this CaptionPanel.
addStyleName(styleName)CaptionPanelAdds a style name to this CaptionPanel.
clear()CaptionPanelRemove all widgets from the CaptionPanel.
getId()StringReturns the id that has been assigned to this object.
getTag()StringGets the text tag of this CaptionPanel.
getType()StringGets the type of this object.
setHeight(height)CaptionPanelSets the height of this CaptionPanel.
setId(id)CaptionPanelSets the id of this CaptionPanel.
setPixelSize(width, height)CaptionPanelSets the size of this CaptionPanel in pixels.
setSize(width, height)CaptionPanelSets the size of this CaptionPanel.
setStyleAttribute(attribute, value)CaptionPanelSets one of this CaptionPanel's style attributes to a new value.
setStyleAttributes(attributes)CaptionPanelSets this CaptionPanel's style attributes.
setStyleName(styleName)CaptionPanelSets the style name of this CaptionPanel.
setStylePrimaryName(styleName)CaptionPanelSets the primary style name of this CaptionPanel.
setTag(tag)CaptionPanelSets the text tag of this CaptionPanel.
setText(text)CaptionPanelSet the display text of this CaptionPanel.
setTitle(title)CaptionPanelSets the hover title of this CaptionPanel.
setVisible(visible)CaptionPanelSets whether this CaptionPanel is visible.
setWidget(widget)CaptionPanelSets the widget inside this CaptionPanel, removing anything previously there.
setWidth(width)CaptionPanelSets the width of this CaptionPanel.

Detailed documentation

add(widget)

Add a widget to the CaptionPanel. This is a synonym for setWidget(widget).

Parameters

NameTypeDescription
widgetWidgetthe widget to add.

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


addStyleDependentName(styleName)

Sets the dependent style name of this CaptionPanel.

This is useful for debugging but is otherwise of minimal use since there is no way to use custom stylesheets in UiApp.

Parameters

NameTypeDescription
styleNameStringthe new style name.

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


addStyleName(styleName)

Adds a style name to this CaptionPanel.

This is useful for debugging but is otherwise of minimal use since there is no way to use custom stylesheets in UiApp.

Parameters

NameTypeDescription
styleNameStringthe new style name.

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


clear()

Remove all widgets from the CaptionPanel.

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


getId()

Returns the id that has been assigned to this object.

This can be used in conjunction with app.getElementById() to retrieve a reference to this object.

Return

String — the id that has been assigned to this object


getTag()

Gets the text tag of this CaptionPanel.

Return

String — the text tag.


getType()

Gets the type of this object.

Return

String — the object type


setHeight(height)

Sets the height of this CaptionPanel.

Parameters

NameTypeDescription
heightStringthe new height in any CSS unit such as "10px" or "50%".

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setId(id)

Sets the id of this CaptionPanel.

Parameters

NameTypeDescription
idStringthe new id, which can be used to retrieve the CaptionPanel from app.getElementById(id).

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setPixelSize(width, height)

Sets the size of this CaptionPanel in pixels.

Parameters

NameTypeDescription
widthIntegerthe new width in pixels.
heightIntegerthe new height in pixels.

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setSize(width, height)

Sets the size of this CaptionPanel.

Parameters

NameTypeDescription
widthStringthe new width in any CSS unit such as "10px" or "50%".
heightStringthe new height in any CSS unit such as "10px" or "50%".

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setStyleAttribute(attribute, value)

Sets one of this CaptionPanel's style attributes to a new value. Valid attributes are listed here; the values for each attribute are the same as those available in CSS style sheets.

 
// Change the widget's background to black and text color to green.
 widget.setStyleAttribute("background", "black")
     .setStyleAttribute("color", "green");
 

Parameters

NameTypeDescription
attributeStringthe CSS attribute, in camel-case ("fontSize", not "font-size"), as listed here
valueStringthe CSS value

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setStyleAttributes(attributes)

Sets this CaptionPanel's style attributes. This is a convenience method that is equivalent to calling setStyleAttribute with every key/value pair in the attributes object. Valid attributes are listed here; the values for each attribute are the same as those available in CSS style sheets.

 
// Change the widget's background to black and text color to green.
 widget.setStyleAttributes({background: "black", color: "green"});
 

Parameters

NameTypeDescription
attributesObjectan object of key/value pairs for the CSS attributes and values to set; valid attributes are listed here

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setStyleName(styleName)

Sets the style name of this CaptionPanel.

This is useful for debugging but is otherwise of minimal use since there is no way to use custom stylesheets in UiApp.

Parameters

NameTypeDescription
styleNameStringthe new style name.

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setStylePrimaryName(styleName)

Sets the primary style name of this CaptionPanel.

This is useful for debugging but is otherwise of minimal use since there is no way to use custom stylesheets in UiApp.

Parameters

NameTypeDescription
styleNameStringthe new style name.

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setTag(tag)

Sets the text tag of this CaptionPanel.

Parameters

NameTypeDescription
tagStringthe new text tag, which can be anything you wish to store with the widget.

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setText(text)

Set the display text of this CaptionPanel.

Parameters

NameTypeDescription
textStringthe new text.

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setTitle(title)

Sets the hover title of this CaptionPanel.

Not all browsers will show this.

Parameters

NameTypeDescription
titleStringthe hover title.

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setVisible(visible)

Sets whether this CaptionPanel is visible.

Parameters

NameTypeDescription
visibleBooleanwhether this CaptionPanel should be visible or not.

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setWidget(widget)

Sets the widget inside this CaptionPanel, removing anything previously there.

Parameters

NameTypeDescription
widgetWidgetthe widget to put in this CaptionPanel.

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.


setWidth(width)

Sets the width of this CaptionPanel.

Parameters

NameTypeDescription
widthStringthe new width in any CSS unit such as "10px" or "50%".

Return

CaptionPanel — the CaptionPanel itself, useful for chaining.

Deprecated methods



Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.