editor-commons.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <mxEditor>
  2. <ui>
  3. <resource basename="/wfEngine/graph/resources/mxApplication"/>
  4. </ui>
  5. <mxDefaultPopupMenu as="popupHandler">
  6. <add as="cut" action="cut" icon="/wfEngine/graph/images/cut.gif"/>
  7. <add as="copy" action="copy" icon="/wfEngine/graph/images/copy.gif"/>
  8. <add as="paste" action="paste" icon="/wfEngine/graph/images/paste.gif"/>
  9. <separator/>
  10. <add as="delete" action="delete" icon="/wfEngine/graph/images/delete.gif" if="cell"/>
  11. <separator/>
  12. <add as="properties" action="showProperties" icon="/wfEngine/graph/images/properties.gif"/>
  13. <separator/>
  14. </mxDefaultPopupMenu>
  15. <include name="/wfEngine/graph/config2/keyhandler-commons.xml"/>
  16. <Array as="actions">
  17. <add as="open"><![CDATA[
  18. function (editor)
  19. {
  20. editor.open(mxUtils.prompt('Enter filename', 'workflow.xml'));
  21. }
  22. ]]></add>
  23. <add as="openHref"><![CDATA[
  24. function (editor, cell)
  25. {
  26. cell = cell || editor.graph.getSelectionCell();
  27. if (cell == null)
  28. {
  29. cell = editor.graph.getCurrentRoot();
  30. if (cell == null)
  31. {
  32. cell = editor.graph.getModel().getRoot();
  33. }
  34. }
  35. if (cell != null)
  36. {
  37. var href = cell.getAttribute('href');
  38. if (href != null && href.length > 0)
  39. {
  40. window.open(href);
  41. }
  42. else
  43. {
  44. mxUtils.alert('No URL defined. Showing properties...');
  45. editor.execute('showProperties', cell);
  46. }
  47. }
  48. }
  49. ]]></add>
  50. <add as="editStyle"><![CDATA[
  51. function (editor)
  52. {
  53. var cell = editor.graph.getSelectionCell();
  54. if (cell != null)
  55. {
  56. var model = editor.graph.getModel();
  57. var style = mxUtils.prompt(mxResources.get('enterStyle'), model.getStyle(cell) || '');
  58. if (style != null)
  59. {
  60. model.setStyle(cell, style);
  61. }
  62. }
  63. }
  64. ]]></add>
  65. <add as="fillColor"><![CDATA[
  66. function (editor)
  67. {
  68. var color = mxUtils.prompt(mxResources.get('enterColorname'), 'red');
  69. if (color != null)
  70. {
  71. editor.graph.model.beginUpdate();
  72. try
  73. {
  74. editor.graph.setCellStyles("strokeColor", color);
  75. editor.graph.setCellStyles("fillColor", color);
  76. }
  77. finally
  78. {
  79. editor.graph.model.endUpdate();
  80. }
  81. }
  82. }
  83. ]]></add>
  84. <add as="gradientColor"><![CDATA[
  85. function (editor)
  86. {
  87. var color = mxUtils.prompt(mxResources.get('enterColorname'), 'white');
  88. if (color != null)
  89. {
  90. editor.graph.setCellStyles("gradientColor", color);
  91. }
  92. }
  93. ]]></add>
  94. <add as="strokeColor"><![CDATA[
  95. function (editor)
  96. {
  97. var color = mxUtils.prompt(mxResources.get('enterColorname'), 'red');
  98. if (color != null)
  99. {
  100. editor.graph.setCellStyles("strokeColor", color);
  101. }
  102. }
  103. ]]></add>
  104. <add as="fontColor"><![CDATA[
  105. function (editor)
  106. {
  107. var color = mxUtils.prompt(mxResources.get('enterColorname'), 'red');
  108. if (color != null)
  109. {
  110. editor.graph.setCellStyles("fontColor", color);
  111. }
  112. }
  113. ]]></add>
  114. <add as="fontFamily"><![CDATA[
  115. function (editor)
  116. {
  117. var family = mxUtils.prompt(mxResources.get('enterFontfamily'), 'Arial');
  118. if (family != null && family.length > 0)
  119. {
  120. editor.graph.setCellStyles("fontFamily", family);
  121. }
  122. }
  123. ]]></add>
  124. <add as="fontSize"><![CDATA[
  125. function (editor)
  126. {
  127. var size = mxUtils.prompt(mxResources.get('enterFontsize'), '10');
  128. if (size != null && size > 0 && size < 999)
  129. {
  130. editor.graph.setCellStyles("fontSize", size);
  131. }
  132. }
  133. ]]></add>
  134. <add as="image"><![CDATA[
  135. function (editor)
  136. {
  137. var image = mxUtils.prompt(mxResources.get('enterImageUrl'),
  138. '/wfEngine/graph/images/image.gif');
  139. if (image != null)
  140. {
  141. editor.graph.setCellStyles("image", image);
  142. }
  143. }
  144. ]]></add>
  145. <add as="opacity"><![CDATA[
  146. function (editor)
  147. {
  148. var opacity = mxUtils.prompt(mxResources.get('enterOpacity'), '100');
  149. if (opacity != null && opacity >= 0 && opacity <= 100)
  150. {
  151. editor.graph.setCellStyles("opacity", opacity);
  152. }
  153. }
  154. ]]></add>
  155. <add as="straightConnector"><![CDATA[
  156. function (editor)
  157. {
  158. editor.graph.setCellStyle("straightEdge");
  159. }
  160. ]]></add>
  161. <add as="elbowConnector"><![CDATA[
  162. function (editor)
  163. {
  164. editor.graph.setCellStyle("");
  165. }
  166. ]]></add>
  167. <add as="arrowConnector"><![CDATA[
  168. function (editor)
  169. {
  170. editor.graph.setCellStyle("arrowEdge");
  171. }
  172. ]]></add>
  173. <add as="toggleOrientation"><![CDATA[
  174. function (editor, cell)
  175. {
  176. editor.graph.toggleCellStyles(mxConstants.STYLE_HORIZONTAL, true);
  177. }
  178. ]]></add>
  179. <add as="toggleRounded"><![CDATA[
  180. function (editor)
  181. {
  182. editor.graph.toggleCellStyles(mxConstants.STYLE_ROUNDED);
  183. }
  184. ]]></add>
  185. <add as="toggleShadow"><![CDATA[
  186. function (editor)
  187. {
  188. editor.graph.toggleCellStyles(mxConstants.STYLE_SHADOW);
  189. }
  190. ]]></add>
  191. <add as="horizontalTree"><![CDATA[
  192. function (editor, cell)
  193. {
  194. cell = cell || editor.graph.getSelectionCell();
  195. if (cell == null)
  196. {
  197. cell = editor.graph.getDefaultParent();
  198. }
  199. editor.treeLayout(cell, true);
  200. }
  201. ]]></add>
  202. <add as="verticalTree"><![CDATA[
  203. function (editor, cell)
  204. {
  205. cell = cell || editor.graph.getSelectionCell();
  206. if (cell == null)
  207. {
  208. cell = editor.graph.getDefaultParent();
  209. }
  210. editor.treeLayout(cell, false);
  211. }
  212. ]]></add>
  213. </Array>
  214. </mxEditor>