function IsSet (val) { return val !== undefined && val !== null; } InfoTable = function (parent) { this.table = $('
| ').html (name).appendTo (tableRow); $(' | ').html (value).appendTo (tableRow); }; InfoTable.prototype.AddColorRow = function (name, color) { var tableRow = $(' |
| ').html (name).appendTo (tableRow); var valueColumn = document.createElement ('td'); var valueColumn = $(' | ').appendTo (tableRow);
var colorDiv = $(' ').addClass ('colorbutton').appendTo (valueColumn);
colorDiv.attr ('title', '(' + color[0] + ', ' + color[1] + ', ' + color[2] + ')');
var hexColor = JSM.RGBComponentsToHexColor (color[0] * 255.0, color[1] * 255.0, color[2] * 255.0);
var colorString = hexColor.toString (16);
while (colorString.length < 6) {
colorString = '0' + colorString;
}
colorDiv.css ('background', '#' + colorString);
};
ImporterMenuItem = function (parentDiv, name, parameters)
{
this.parentDiv = parentDiv;
this.parameters = parameters;
this.menuItemDiv = null;
this.isOpen = null;
this.openCloseImage = null;
this.contentDiv = null;
this.Initialize (name);
};
ImporterMenuItem.prototype.Initialize = function (name)
{
this.menuItemDiv = $(' ').addClass ('menuitem').appendTo (this.parentDiv);
if (IsSet (this.parameters)) {
if (IsSet (this.parameters.id)) {
this.menuItemDiv.attr ('id', this.parameters.id);
}
if (IsSet (this.parameters.openCloseButton)) {
this.AddOpenCloseButton ();
}
if (IsSet (this.parameters.userButtons)) {
var i, userButton;
for (i = 0; i < this.parameters.userButtons.length; i++) {
userButton = this.parameters.userButtons[i];
this.AddUserButton (userButton);
}
}
}
var menuItemTextDiv = $(' ').addClass ('menuitem').html (name).attr ('title', name).appendTo (this.menuItemDiv);
if (IsSet (this.parameters) && IsSet (this.parameters.openCloseButton)) {
menuItemTextDiv.css ('cursor', 'pointer');
}
};
ImporterMenuItem.prototype.AddSubItem = function (name, parameters)
{
return new ImporterMenuItem (this.contentDiv, name, parameters);
};
ImporterMenuItem.prototype.GetContentDiv = function ()
{
return this.contentDiv;
};
ImporterMenuItem.prototype.AddOpenCloseButton = function ()
{
var myThis = this;
this.isOpen = false;
this.contentDiv = $(' ').addClass ('menugroup').hide ().appendTo (this.parentDiv);
this.openCloseImage = $(' ').addClass ('buttons').appendTo (parent);
};
ImporterButtons.prototype.AddLogo = function (title, onClick)
{
var logoDiv = $(' ').addClass ('logo').html (title).appendTo (this.buttonsDiv);
logoDiv.click (onClick);
};
ImporterButtons.prototype.AddButton = function (image, title, onClick)
{
var buttonImage = $(' ').addClass ('rightbuttons').appendTo (parent);
};
ExtensionButtons.prototype.GetButtonsDiv = function ()
{
return this.buttonsDiv;
};
ImporterProgressBar = function (parent)
{
this.parent = parent;
this.borderDiv = null;
this.contentDiv = null;
this.maxCount = null;
this.maxWidth = null;
};
ImporterProgressBar.prototype.Init = function (maxCount)
{
this.borderDiv = $(' ').addClass ('progressbarborder').appendTo (this.parent);
this.contentDiv = $(' ').addClass ('progressbarcontent').appendTo (this.borderDiv);
this.maxCount = maxCount;
this.maxWidth = this.borderDiv.width ();
this.Step (0);
};
ImporterProgressBar.prototype.Step = function (count)
{
var step = this.maxWidth / this.maxCount;
var width = count * step;
if (count == this.maxCount) {
width = this.maxWidth;
}
this.contentDiv.width (width);
};
|