cellslineheight.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. TrexMessage.addMsg({
  2. '@cellslineheight.subtitle1': '1pt',
  3. '@cellslineheight.subtitle2': '2pt',
  4. '@cellslineheight.subtitle3': '3pt',
  5. '@cellslineheight.subtitle4': '4pt',
  6. '@cellslineheight.subtitle5': '5pt'
  7. });
  8. TrexConfig.addTool(
  9. "cellslineheight",
  10. {
  11. sync: _FALSE,
  12. status: _TRUE,
  13. options: [
  14. { label: TXMSG('@cellslineheight.subtitle1'), title: '1pt', data: 1, klass: 'tx-cellslineheight-1' },
  15. { label: TXMSG('@cellslineheight.subtitle2'), title: '2pt', data: 2, klass: 'tx-cellslineheight-2' },
  16. { label: TXMSG('@cellslineheight.subtitle3'), title: '3pt', data: 3, klass: 'tx-cellslineheight-3' },
  17. { label: TXMSG('@cellslineheight.subtitle4'), title: '4pt', data: 4, klass: 'tx-cellslineheight-4' },
  18. { label: TXMSG('@cellslineheight.subtitle5'), title: '5pt', data: 5, klass: 'tx-cellslineheight-5' }
  19. ]
  20. }
  21. );
  22. Trex.Tool.Cellslineheight = Trex.Class.create({
  23. $const: {
  24. __Identity: 'cellslineheight'
  25. },
  26. $extend: Trex.Tool,
  27. oninitialized: function(config) {
  28. var self = this;
  29. self.createListStyleMap(config);
  30. self.weave(
  31. new Trex.Button.CellslineheightList(self.buttonCfg),
  32. new Trex.Menu.Select(self.menuCfg),
  33. self.handler
  34. );
  35. },
  36. createListStyleMap: function(config) {
  37. var listStyleMap = this.listStyleMap = {};
  38. config.options.each(function(option) {
  39. listStyleMap[option.data] = {
  40. type: option.type,
  41. klass: option.klass
  42. };
  43. });
  44. },
  45. handler: function(data) {
  46. var self = this;
  47. if (!self.listStyleMap[data]) {
  48. return;
  49. }
  50. // 실제 로직은 여기부분 입니다.
  51. self.canvas.query(function(processor){
  52. if (processor.table) {
  53. processor.table.setBorderHeight(data);
  54. }
  55. });
  56. },
  57. getButtonClassByValue: function(value) {
  58. var listStyleMap = this.listStyleMap;
  59. if(listStyleMap[value]) {
  60. return listStyleMap[value].klass;
  61. } else {
  62. return listStyleMap[this.getDefaultProperty()].klass;
  63. }
  64. }
  65. });
  66. Trex.Button.CellslineheightList = Trex.Class.create({
  67. $extend: Trex.Button.Select
  68. });