12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Viewer
- *| (C) Copyright IBM Corp. 2001, 2011
- *|
- *| US Government Users Restricted Rights - Use, duplication or
- *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- *|
- *+------------------------------------------------------------------------+
- */
- /*-----------------------------------------------------------------------------------------------------
- Class : CToolbarSelect
- Description :
- -----------------------------------------------------------------------------------------------------*/
- function CToolbarSelect(parent, name, command, label, toolTip) {
- this.m_parent = parent;
- this.m_name = name;
- this.m_command = command;
- this.m_label = label;
- this.m_toolTip = toolTip;
- this.m_items = [];
- if(typeof this.m_parent == "object" && typeof this.m_parent.add == "function")
- {
- this.m_parent.add(this);
- }
- //add a defalt item
- if (label)
- {
- this.add("", label);
- }
- }
- function CSelectItem (sUse, sDisplay) {
- this.m_sUse = sUse;
- this.m_sDisplay = sDisplay;
- }
- function CSelectItem_getUse() {
- return this.m_sUse;
- }
- function CSelectItem_getDisplay() {
- return this.m_sDisplay;
- }
- CSelectItem.prototype.getUse = CSelectItem_getUse;
- CSelectItem.prototype.getDisplay = CSelectItem_getDisplay;
- function CToolbarSelect_draw() {
- var html = '<select id="' + this.m_name + '" name="' + this.m_name + '" onchange="' + this.m_command + '"';
- if (this.m_toolTip != "") {
- html += ' title="' + this.m_toolTip + '"';
- }
- html += '>';
- html += this.drawItems();
- html += '</select>';
- return html;
- }
- function CToolbarSelect_drawItems()
- {
- var html='';
- for (var i=0; i<this.m_items.length; i++)
- {
- html += '<option value="'+ this.m_items[i].getUse() +'">'+ this.m_items[i].getDisplay() +'</option>';
- }
- return html;
- }
- function CToolbarSelect_add(sUse, sDisplay)
- {
- var newItem = new CSelectItem(sUse, sDisplay);
- this.m_items = this.m_items.concat(newItem);
- }
- function CToolbarSelect_isVisible() {
- //return this.m_bVisible;
- return true;
- }
- CToolbarSelect.prototype.draw = CToolbarSelect_draw;
- CToolbarSelect.prototype.drawItems = CToolbarSelect_drawItems;
- CToolbarSelect.prototype.isVisible = CToolbarSelect_isVisible;
- CToolbarSelect.prototype.add = CToolbarSelect_add;
|