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.isOpen = null;
this.openCloseImage = null;
this.contentDiv = null;
this.Initialize (name);
};
ImporterMenuItem.prototype.Initialize = function (name)
{
var myThis = this;
var menuItemDiv = $(' ').addClass ('menuitem').appendTo (this.parentDiv);
var menuItemClickHandler = null;
var menuContent = null;
if (this.parameters !== undefined && this.parameters !== null) {
if (this.parameters.id !== undefined && this.parameters.id !== null) {
menuItemDiv.attr ('id', this.parameters.id);
}
if (this.parameters.openCloseButton !== undefined && this.parameters.openCloseButton !== null) {
this.contentDiv = $(' ').addClass ('menugroup').hide ().appendTo (this.parentDiv);
this.isOpen = false;
this.openCloseImage = $(' ').addClass ('menuitem').html (name).attr ('title', name).appendTo (menuItemDiv);
if (menuItemClickHandler != null) {
menuItemTextDiv.css ('cursor', 'pointer');
menuItemTextDiv.click (menuItemClickHandler);
}
};
ImporterMenuItem.prototype.AddSubItem = function (name, parameters)
{
return new ImporterMenuItem (this.contentDiv, name, parameters);
};
ImporterMenuItem.prototype.GetContentDiv = function ()
{
return this.contentDiv;
};
ImporterMenuItem.prototype.OnOpenCloseClick = function ()
{
this.isOpen = !this.isOpen;
if (this.isOpen) {
if (this.parameters.openCloseButton.onOpen !== undefined && this.parameters.openCloseButton.onOpen !== null) {
this.parameters.openCloseButton.onOpen (this.contentDiv, this.parameters.openCloseButton.userData);
}
} else {
if (this.parameters.openCloseButton.onClose !== undefined && this.parameters.openCloseButton.onClose !== null) {
this.parameters.openCloseButton.onClose (this.contentDiv, this.parameters.openCloseButton.userData);
}
}
this.contentDiv.toggle ();
this.openCloseImage.attr ('src', this.isOpen ? 'images/opened.png' : 'images/closed.png');
};
ImporterMenu = function (parentDiv)
{
this.parentDiv = parentDiv;
this.parentDiv.empty ();
};
ImporterMenu.prototype.AddGroup = function (name, parameters)
{
return new ImporterMenuItem (this.parentDiv, name, parameters);
};
ImporterButtons = function (parent)
{
this.buttonsDiv = $(' ').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);
};
|