pdSpec.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*******************************************************************************
  2. * IBM Confidential
  3. *
  4. * OCO Source Materials
  5. *
  6. * A and PM: PD
  7. *
  8. * (c) Copyright IBM Corp. 2014
  9. *
  10. * The source code for this program is not published or otherwise divested of
  11. * its trade secrets, irrespective of what has been deposited with the U.S.
  12. * Copyright Office.
  13. ******************************************************************************/
  14. define(["pd/i18n"], function() {
  15. return [
  16. {
  17. itemName: "usage",
  18. noresize: true,
  19. hidden: false,
  20. width: dojo.isSafari?"26px":"16px",
  21. label: " ",
  22. formatter: function(value){
  23. var titleVal = (value == "fact")? PDMSG.IPT.IDS_IPT_COLUMN_USAGE_TYPE_FACT : PDMSG.IPT.IDS_IPT_COLUMN_USAGE_TYPE_ATTRIBUTE;
  24. var className = (value == "fact")? "factGridCell" : "attributeGridCell";
  25. return "<div title='"+titleVal+"' class='"+className+"'><span style='visibility:hidden'>"+titleVal+"</span></div>";
  26. },
  27. listener: {
  28. itemName: "regularAggregate",
  29. map: [{unsupported: "attribute"}],
  30. defaultValue: "fact"
  31. }
  32. },{
  33. itemName: "name",
  34. noresize: false,
  35. hidden: false,
  36. width: "100%",
  37. label: PDMSG.IPT.IDS_IPT_SPEC_LABEL_COLUMN_NAME,
  38. editable: false,
  39. formatter: function(value){
  40. return "<div title='"+value+"'>"+value+"</div>";
  41. }
  42. },{
  43. itemName: "ID",
  44. noresize: true,
  45. hidden: true,
  46. },{
  47. itemName: "simpletype",
  48. noresize: false,
  49. hidden: false,
  50. width: "60px",
  51. label: PDMSG.IPT.IDS_IPT_SPEC_LABEL_DATA_TYPE,
  52. formatter: function (data) {
  53. var valueLabelMap = {
  54. "integer": PDMSG.IPT.IDS_IPT_COLUMN_DATA_TYPE_INTEGER,
  55. "text": PDMSG.IPT.IDS_IPT_COLUMN_DATA_TYPE_TEXT,
  56. "date": PDMSG.IPT.IDS_IPT_COLUMN_DATA_TYPE_DATE,
  57. "datetime": PDMSG.IPT.IDS_IPT_COLUMN_DATA_TYPE_DATETIME,
  58. "time": PDMSG.IPT.IDS_IPT_COLUMN_DATA_TYPE_TIME,
  59. "decimal": PDMSG.IPT.IDS_IPT_COLUMN_DATA_TYPE_DECIMAL,
  60. "boolean": PDMSG.IPT.IDS_IPT_COLUMN_DATA_TYPE_BOOLEAN
  61. };
  62. return valueLabelMap[data.toLowerCase()];
  63. }
  64. },{
  65. itemName: "regularAggregate",
  66. noresize: false,
  67. label: PDMSG.IPT.IDS_IPT_SPEC_LABEL_REGULAR_AGGREGATE,
  68. width: "100px",
  69. hidden: false,
  70. editable: true,
  71. type: "pd.widgets.grid.cells.Select",
  72. options: [
  73. PDMSG.IPT.IDS_IPT_COLUMN_AGGREGATE_TYPE_SUM,
  74. PDMSG.IPT.IDS_IPT_COLUMN_AGGREGATE_TYPE_AVERAGE,
  75. PDMSG.IPT.IDS_IPT_COLUMN_AGGREGATE_TYPE_MAXIMUM,
  76. PDMSG.IPT.IDS_IPT_COLUMN_AGGREGATE_TYPE_MINIMUM,
  77. PDMSG.IPT.IDS_IPT_COLUMN_AGGREGATE_TYPE_COUNT,
  78. PDMSG.IPT.IDS_IPT_COLUMN_AGGREGATE_TYPE_UNSUPPORTED
  79. ],
  80. values: ["sum", "average", "maximum", "minimum", "count", "unsupported"],
  81. formatter: function (data, rowIndex, scope) {
  82. var item = scope.grid.getItem(rowIndex);
  83. var factTypes = ["Integer","Decimal"];
  84. var value = scope.options[scope.values.indexOf(data)];
  85. //override the default editable
  86. if (factTypes.indexOf(item.simpletype) > -1) {
  87. item.regularAggregateEditable = true;
  88. return "<div title='"+PDMSG.IPT.IDS_IPT_COLUMN_AGGREGATE_EDIT_HINT+"' class='editableGridCell'>"+value+"</div>"
  89. } else {
  90. item.regularAggregateEditable = false;
  91. return "<div style='visibility:hidden'>"+PDMSG.IPT.IDS_IPT_COLUMN_AGGREGATE_TYPE_UNSUPPORTED+"</div>";
  92. }
  93. }
  94. },{
  95. itemName: "semiAggregate",
  96. noresize: true,
  97. hidden: true
  98. },{
  99. itemName: "hidden",
  100. noresize: true,
  101. hidden: true
  102. }
  103. ]
  104. });