Skip to content

Instantly share code, notes, and snippets.

@teotigraphix
Created June 15, 2015 19:29
Show Gist options
  • Save teotigraphix/c301463185bb62aa7853 to your computer and use it in GitHub Desktop.
Save teotigraphix/c301463185bb62aa7853 to your computer and use it in GitHub Desktop.
/**
* Main
*
* @fileoverview
*
* @suppress {checkTypes}
*/
goog.provide('Main');
goog.require('org_apache_flex_utils_Language');
/**
* @constructor
*/
Main = function() {
var self = this;
var /** @type {Element} */ button = document.createElement("button");
button.onclick = function() {
alert("Hello browser from FalconJX!");
};
button.textContent = "Say Hello";
document.body.appendChild(button);
/**
* @const
* @type {HTMLBodyElement}
*/
body = org_apache_flex_utils_Language.as(document.getElementsByClassName("body")[0], HTMLBodyElement);
/**
* @const
* @type {HTMLTableElement}
*/
oTable = org_apache_flex_utils_Language.as(document.createElement("table"), HTMLTableElement);
/**
* @const
* @type {HTMLTableSectionElement}
*/
oTBody0 = org_apache_flex_utils_Language.as(document.createElement("tbody"), HTMLTableSectionElement);
/**
* @const
* @type {HTMLTableSectionElement}
*/
oTBody1 = org_apache_flex_utils_Language.as(document.createElement("tbody"), HTMLTableSectionElement);
/**
* @const
* @type {HTMLTableSectionElement}
*/
oTHead = org_apache_flex_utils_Language.as(oTable.createTHead(), HTMLTableSectionElement);
/**
* @const
* @type {HTMLTableSectionElement}
*/
oTFoot = org_apache_flex_utils_Language.as(oTable.createTFoot(), HTMLTableSectionElement);
/**
* @const
* @type {HTMLTableCaptionElement}
*/
oCaption = org_apache_flex_utils_Language.as(oTable.createCaption(), HTMLTableCaptionElement);
var /** @type {HTMLTableRowElement} */ oRow, /** @type {HTMLTableCellElement} */ oCell;
var /** @type {number} */ i, /** @type {number} */ j;
/**
* @const
* @type {Array}
*/
heading = [];
heading[0] = "Stock symbol";
heading[1] = "High";
heading[2] = "Low";
heading[3] = "Close";
/**
* @const
* @type {Array}
*/
stock = [];
stock[0] = ["ABCD", "88.625", "85.50", "85.81"];
stock[1] = ["EFGH", "102.75", "97.50", "100.063"];
stock[2] = ["IJKL", "56.125", "54.50", "55.688"];
stock[3] = ["MNOP", "71.75", "69.00", "69.00"];
oRow = org_apache_flex_utils_Language.as(oTHead.insertRow(-1), HTMLTableRowElement);
oTHead.setAttribute("bgColor", "lightskyblue");
for (i = 0; i < heading.length; i++) {
oCell = org_apache_flex_utils_Language.as(oRow.insertCell(-1), HTMLTableCellElement);
oCell.align = "center";
oCell.style.fontWeight = "bold";
oCell.innerHTML = heading[i];
}
for (i = 0; i < stock.length; i++) {
var /** @type {HTMLTableSectionElement} */ oBody = (i < 2) ? oTBody0 : oTBody1;
oRow = org_apache_flex_utils_Language.as(oBody.insertRow(-1), HTMLTableRowElement);
for (j = 0; j < stock[i].length; j++) {
oCell = org_apache_flex_utils_Language.as(oRow.insertCell(-1), HTMLTableCellElement);
oCell.innerHTML = stock[i][j];
}
}
oTBody0.setAttribute("bgColor", "lemonchiffon");
oTBody1.setAttribute("bgColor", "goldenrod");
oRow = org_apache_flex_utils_Language.as(oTFoot.insertRow(0), HTMLTableRowElement);
oCell = org_apache_flex_utils_Language.as(oRow.insertCell(0), HTMLTableCellElement);
oCell.innerHTML = "Quotes are for example only.";
oCell.colSpan = 4;
oCell.bgColor = "lightskyblue";
oCaption.innerHTML = "Created using Table Object Model.";
oCaption.style.fontSize = "10px";
oCaption.align = "bottom";
document.body.appendChild(oTable);
};
/**
* Metadata
*
* @type {Object.<string, Array.<Object>>}
*/
Main.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Main', qName: 'Main'}] };
// Ensures the symbol will be visible after compiler renaming.
goog.exportSymbol('Main', Main);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment