123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591 |
- function CStyle()
- {
- };
- CStyle.prototype = new AFeatureObject();
- CStyle.prototype.setup = function (aFeatureParams)
- {
- };
- function updateCommandBuffer(cmd)
- {
- var gcf = getConfigFrame();
- if ((getCommandBuffer() == null) || (getCommandBuffer() == ""))
- {
- gcf.cfgSet("commandBuffer",cmd);
- }
- else
- {
- var newCommandBuffer = getCommandBuffer() + ";" + cmd;
- gcf.cfgSet("commandBuffer",newCommandBuffer);
- }
- };
- function getCommandBuffer()
- {
- return getConfigFrame().cfgGet("commandBuffer");
- };
- function clearCommandBuffer()
- {
- getConfigFrame().cfgSet("commandBuffer","");
- };
- function sendBufferedCommands()
- {
- addColumnsForReselection();
- cmd = getCommandBuffer();
- if (cmd != "")
- {
- getConfigFrame().sendCmd(cmd, "", true);
- }
- };
- function toggleStyleCommand(s)
- {
- var cssAttribute = s;
- var cmd = "";
- var selectionController = goApplicationManager.getSelectionController();
- var reportSelectionController = getReportFrame().g_reportSelectionController;
- if (selectionController && (typeof selectionController != 'undefined' && selectionController.getSelections().length == 0) && (typeof reportSelectionController != 'undefined' && reportSelectionController.getSelections().length == 0))
- {
- dlgShowMessage("STYLE_DIALOG_TEXT_TITLE", "", "STYLE_NO_SELECTION");
- return;
- }
- if (selectionController && typeof selectionController != 'undefined')
- {
- var selections = selectionController.getSelections();
- if (selections.length != 0)
- {
- for (var i=0; i < selections.length; i++)
- {
-
-
- var queryIdString = "";
- var tag = selections[i].getTag()
- if (tag != "footertag")
- {
- queryIdString = selections[i].getColumnName();
- if (queryIdString == "")
- continue;
- }
- var type = "";
- var levelId = "";
- var intersectId = "";
- var measureId = "";
-
- var oColSpecialProperties = getColSpecialPropertiesFromSelectionObject(selections[i]);
- if (oColSpecialProperties.forcedType)
- {
- type = oColSpecialProperties.forcedType;
- }
- if (type == "")
- {
- var selectionType = selections[i].getCellRef().getAttribute("qsc").substring(0,2);
- type = getType(selectionType);
- if (type == "")
- {
- continue;
- }
- }
- if (oColSpecialProperties.levelId)
- {
- levelId = oColSpecialProperties.levelId;
- }
- if (oColSpecialProperties.intersectId)
- {
- intersectId = oColSpecialProperties.intersectId;
- }
- measureId = getColRefIdFromSelectionObject(selections[i]);
- if (i > 0)
- {
- cmd += ";";
- }
- if (tag != "footertag")
- {
- if (levelId == "")
- levelId = "none";
- if (intersectId == "")
- intersectId = "none";
- if (measureId == "")
- measureId = "none";
- cmd += getConfigFrame().createCommand("Z","Z", new Array( escapeParam(queryIdString) , escapeParam(type), escapeParam(cssAttribute), escapeParam(levelId), escapeParam(intersectId), escapeParam(measureId)));
- }
- else
- cmd += getConfigFrame().createCommand("Z","Y", new Array( escapeParam(type), escapeParam(cssAttribute)));
- }
- }
- }
-
- if (typeof reportSelectionController != 'undefined')
- {
- var selections = reportSelectionController.getSelections();
- var bFilterFlag = false;
- if (selections.length != 0)
- {
- for (var i=0; i < selections.length; i++)
- {
- var type = selections[i].getType();
- if (type != "FilterStyle" || bFilterFlag == false)
- {
- if (cmd != "")
- {
- cmd += ";";
- }
- cmd += getConfigFrame().createCommand("Z","Y", new Array( escapeParam(type), escapeParam(cssAttribute)));
- }
- if (type == "FilterStyle")
- bFilterFlag = true;
- }
- }
- }
- if (cmd != "")
- {
- updateCommandBuffer(cmd);
- sendBufferedCommands();
- }
- };
- function alignStyleToCSS(alignStyle)
- {
- var cssVerticalAlign = "vertical-align\:";
- var cssTextAlign = "text-align\:";
-
- if (alignStyle != "")
- {
- switch(alignStyle) {
- case "TL":
- cssVerticalAlign += "top";
- cssTextAlign += "left";
- break;
- case "TC":
- cssVerticalAlign += "top";
- cssTextAlign += "center";
- break;
- case "TR":
- cssVerticalAlign += "top";
- cssTextAlign += "right";
- break;
- case "ML":
- cssVerticalAlign += "middle";
- cssTextAlign += "left";
- break;
- case "MC":
- cssVerticalAlign += "middle";
- cssTextAlign += "center";
- break;
- case "MR":
- cssVerticalAlign += "middle";
- cssTextAlign += "right";
- break;
- case "BL":
- cssVerticalAlign += "bottom";
- cssTextAlign += "left";
- break;
- case "BC":
- cssVerticalAlign += "bottom";
- cssTextAlign += "center";
- break;
- case "BR":
- cssVerticalAlign += "bottom";
- cssTextAlign += "right";
- break;
- default:
- break;
- }
- }
-
- return cssVerticalAlign + ";" + cssTextAlign;
- };
- function alignStyleCommand(s)
- {
- var cssString = alignStyleToCSS(s);
- sendStyleCommand(cssString);
- };
- function selectStyleCommand(cssAttribute, o)
- {
- var cssString = cssAttribute + "\:";
- if (o.selectedIndex != -1)
- {
- var style = o.options[o.selectedIndex].value;
- cssString += style;
- sendStyleCommand(cssString);
- o.selectedIndex = 0;
- }
- };
- function textStyleCommand(cssAttribute, cssAttributeValue)
- {
- var cssString = cssAttribute + "\:" + cssAttributeValue;
- sendStyleCommand(cssString);
- };
- function colorStyleCommand(s)
- {
- textStyleCommand(COLOR, s);
- };
- function backgroundColorStyleCommand(s)
- {
- textStyleCommand(BACKGROUND_COLOR, s);
- };
- function sendStyleCommand(cssString, bSendCmd)
- {
-
- if (typeof bSendCmd == "undefined" || bSendCmd == null)
- {
- bSendCmd = true;
- }
-
- var cmd = "";
- var groupCols = new Array();
- var selectionController = goApplicationManager.getSelectionController();
- var reportSelectionController = goApplicationManager.getReportFrame().g_reportSelectionController;
-
- if (selectionController)
- {
- var selections = selectionController.getSelections();
-
- if ((typeof selectionController != 'undefined' && selections.length == 0) && (typeof reportSelectionController != 'undefined' && reportSelectionController.getSelections().length == 0))
- {
- dlgShowMessage("STYLE_DIALOG_TEXT_TITLE", "", "STYLE_NO_SELECTION");
- return;
- }
-
- for (var i=0; i < selections.length; i++)
- {
-
-
-
- var queryIdString = "";
- var tag = selections[i].getTag();
- if (tag != "footertag")
- {
- queryIdString = selections[i].getColumnName();
-
- if (queryIdString == "")
- continue;
- }
-
- var type = "";
- var levelId = "";
- var intersectId = "";
- var measureId = "";
-
- var oColSpecialProperties = getColSpecialPropertiesFromSelectionObject(selections[i]);
- if (oColSpecialProperties.forcedType)
- {
- type = oColSpecialProperties.forcedType;
- }
- if (type == "")
- {
- var selectionType = selections[i].getCellRef().getAttribute("qsc").substring(0,2);
- type = getType(selectionType);
- if (type == "")
- {
- continue;
- }
- }
-
- if (oColSpecialProperties.levelId)
- {
- levelId = oColSpecialProperties.levelId;
- }
- if (oColSpecialProperties.intersectId)
- {
- intersectId = oColSpecialProperties.intersectId;
- }
- measureId = getColRefIdFromSelectionObject(selections[i]);
-
- if (i > 0)
- {
- cmd += ";";
- }
-
- if (tag != "footertag")
- {
- if (levelId == "")
- levelId = "none";
- if (intersectId == "")
- intersectId = "none";
- if (measureId == "")
- measureId = "none";
- if (cssString != "" && cssString != null)
- cmd += getConfigFrame().createCommand("Z","C", new Array( escapeParam(queryIdString) , escapeParam(cssString), escapeParam(type), escapeParam(levelId), escapeParam(intersectId), escapeParam(measureId)));
- else
- cmd += getConfigFrame().createCommand("Z","D", new Array( escapeParam(queryIdString) , escapeParam(type), escapeParam(levelId), escapeParam(intersectId), escapeParam(measureId)));
- }
- else
- {
- if (cssString != "" && cssString != null)
- cmd += getConfigFrame().createCommand("Z","H", new Array( escapeParam(cssString) , escapeParam(type)));
- else
- cmd += getConfigFrame().createCommand("Z","I", new Array(escapeParam(type)));
- }
- }
- }
-
- if (typeof reportSelectionController != 'undefined')
- {
- selections = reportSelectionController.getSelections();
- if (selections.length != 0)
- {
- for (var i=0; i < selections.length; i++)
- {
- var type = selections[i].getType();
- if (cmd != "")
- {
- cmd += ";";
- }
- if (cssString != "" && cssString != null)
- cmd += getConfigFrame().createCommand("Z","H", new Array( escapeParam(cssString) , escapeParam(type)));
- else
- cmd += getConfigFrame().createCommand("Z","I", new Array(escapeParam(type)));
- }
- }
- }
- if (cmd != "")
- {
- updateCommandBuffer(cmd);
- addColumnsForReselection();
- if (bSendCmd)
- sendBufferedCommands();
- }
- };
- function sendBorderStyleCommand(cssString, type, bSendCmd)
- {
- if (typeof bSendCmd == "undefined" || bSendCmd == null)
- bSendCmd = true;
- var cmd = getConfigFrame().createCommand("Z","B", new Array( escapeParam(cssString) , escapeParam(type)));
- updateCommandBuffer(cmd);
- if (bSendCmd)
- sendBufferedCommands();
- };
- function getType(selectionType)
- {
- var type;
- if (typeof selectionType == "undefined" || selectionType == null || selectionType == "")
- return "";
- selectionType = selectionType.substring(0,2);
- switch (selectionType)
- {
- case "sh":
- type = COLUMN_SECTION_STYLE;
- break;
- case "lt":
- case "ml":
- case "xm":
- type = COLUMN_TITLE_STYLE;
- break;
- case "lc":
- case "mv":
- type = COLUMN_STYLE;
- break;
- case "if":
- case "il":
- type = COLUMN_GROUP_FOOTER_LABEL_STYLE;
- break;
- case "is":
- case "iv":
- type = COLUMN_GROUP_FOOTER_VALUE_STYLE;
- break;
- case "sf":
- type = COLUMN_SECTION_FOOTER_LABEL_STYLE;
- break;
- case "ss":
- type = COLUMN_SECTION_FOOTER_VALUE_STYLE;
- break;
- case "of":
- case "ol":
- type = COLUMN_FOOTER_LABEL_STYLE;
- break;
- case "os":
- case "ov":
- type = COLUMN_FOOTER_VALUE_STYLE;
- break;
- default:
- type = "";
- }
- return type;
- };
- function isTitleAreaStyle(style)
- {
- return (style == TITLE_STYLE ||
- style == SUBTITLE_STYLE ||
- style == FILTER_STYLE);
- };
- function isOverallSummaryStyle(style)
- {
- return (style == COLUMN_FOOTER_LABEL_STYLE);
- };
- function sendStyleAllCommand(cssString, selectionType, bSendCmd)
- {
- var oMQMgr = goApplicationManager.getMiniQueryManager();
- if (typeof bSendCmd == "undefined" || bSendCmd == null)
- bSendCmd = true;
- var gcf = getConfigFrame();
- var cmd ="";
- var groups = new Array();
- for (var i = 0; i < oMQMgr.getAllColumns().length; i++)
- {
- if (oMQMgr.getColumnRole(i) === MINI_QUERY_GROUP_LIST || oMQMgr.getColumnRole(i) === MINI_QUERY_GROUP_SECTION)
- {
- groups[groups.length] = oMQMgr.getColumnId(i);
- }
- }
- if (isTitleAreaStyle(selectionType) || isOverallSummaryStyle(selectionType))
- {
- if (cssString != "" && cssString != null)
- cmd = getConfigFrame().createCommand("Z","H", new Array( escapeParam(cssString) , escapeParam(selectionType)));
- else
- cmd = getConfigFrame().createCommand("Z","I", new Array(escapeParam(selectionType)));
- }
- else
- {
-
- for (var i = 0; i < oMQMgr.getAllColumns().length; i++)
- {
-
- if (cmd != "")
- {
- cmd += ";";
- }
- var queryIdString = oMQMgr.getColumnId(i);
- if (selectionType == COLUMN_GROUP_FOOTER_VALUE_STYLE || selectionType == COLUMN_SECTION_FOOTER_VALUE_STYLE)
- {
- for (var j = 0; j < groups.length; j++)
- {
- if (cssString != "" && cssString != null)
- cmd += getConfigFrame().createCommand("Z","C", new Array( escapeParam(queryIdString), escapeParam(cssString), escapeParam(selectionType), escapeParam(groups[j])));
- else
- cmd += getConfigFrame().createCommand("Z","D", new Array( escapeParam(queryIdString), escapeParam(selectionType), escapeParam(groups[j])));
- if (j+1 < groups.length)
- {
- cmd += ";";
- }
- }
- }
- else
- {
- if (cssString != "" && cssString != null)
- cmd += getConfigFrame().createCommand("Z","C", new Array( escapeParam(queryIdString), escapeParam(cssString), escapeParam(selectionType)));
- else
- cmd += getConfigFrame().createCommand("Z","D", new Array( escapeParam(queryIdString), escapeParam(selectionType)));
- }
- }
- }
- if (cmd != "")
- {
- updateCommandBuffer(cmd);
- if (bSendCmd)
- sendBufferedCommands();
- }
- };
- var COLUMN_SECTION_STYLE = "SectionStyle";
- var COLUMN_TITLE_STYLE = "ColumnTitleStyle";
- var COLUMN_STYLE = "ColumnStyle";
- var COLUMN_GROUP_FOOTER_LABEL_STYLE = "ColumnGroupFooterLabelStyle";
- var COLUMN_GROUP_FOOTER_VALUE_STYLE = "ColumnGroupFooterValueStyle";
- var COLUMN_SECTION_FOOTER_LABEL_STYLE = "ColumnSectionFooterLabelStyle";
- var COLUMN_SECTION_FOOTER_VALUE_STYLE = "ColumnSectionFooterValueStyle";
- var COLUMN_FOOTER_LABEL_STYLE = "ColumnFooterLabelStyle";
- var COLUMN_FOOTER_VALUE_STYLE = "ColumnFooterValueStyle";
- var TITLE_STYLE = "TitleStyle";
- var SUBTITLE_STYLE = "SubtitleStyle";
- var FILTER_STYLE = "FilterStyle";
- var SELECTED_STYLE = COLUMN_STYLE;
- var FONT_FAMILY = "font-family";
- var FONT_SIZE = "font-size";
- var COLOR = "color";
- var BACKGROUND_COLOR = "background-color";
|