Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

PaintTarget.java 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.itmill.toolkit.terminal;
  5. /**
  6. * This interface defines the methods for painting XML to the UIDL stream.
  7. *
  8. * @author IT Mill Ltd.
  9. * @version
  10. * @VERSION@
  11. * @since 3.0
  12. */
  13. public interface PaintTarget {
  14. /**
  15. * Prints single XMLsection.
  16. *
  17. * Prints full XML section. The section data is escaped from XML tags and
  18. * surrounded by XML start and end-tags.
  19. *
  20. * @param sectionTagName
  21. * the name of the tag.
  22. * @param sectionData
  23. * the scetion data.
  24. * @throws PaintException
  25. * if the paint operation failed.
  26. */
  27. public void addSection(String sectionTagName, String sectionData)
  28. throws PaintException;
  29. /**
  30. * Prints element start tag of a paintable section. Starts a paintable
  31. * section using the given tag. The PaintTarget may implement a caching
  32. * scheme, that checks the paintable has actually changed or can a cached
  33. * version be used instead. This method should call the startTag method.
  34. * <p>
  35. * If the Paintable is found in cache and this function returns true it may
  36. * omit the content and close the tag, in which case cached content should
  37. * be used.
  38. * </p>
  39. *
  40. * @param paintable
  41. * the paintable to start.
  42. * @param tag
  43. * the name of the start tag.
  44. * @return <code>true</code> if paintable found in cache,
  45. * <code>false</code> otherwise.
  46. * @throws PaintException
  47. * if the paint operation failed.
  48. * @see #startTag(String)
  49. * @since 3.1
  50. */
  51. public boolean startTag(Paintable paintable, String tag)
  52. throws PaintException;
  53. /**
  54. * Prints element start tag.
  55. *
  56. * <pre>
  57. * Todo:
  58. * Checking of input values
  59. * </pre>
  60. *
  61. * @param tagName
  62. * the name of the start tag.
  63. * @throws PaintException
  64. * if the paint operation failed.
  65. */
  66. public void startTag(String tagName) throws PaintException;
  67. /**
  68. * Prints element end tag.
  69. *
  70. * If the parent tag is closed before every child tag is closed an
  71. * PaintException is raised.
  72. *
  73. * @param tagName
  74. * the name of the end tag.
  75. * @throws PaintException
  76. * if the paint operation failed.
  77. */
  78. public void endTag(String tagName) throws PaintException;
  79. /**
  80. * Adds a boolean attribute to component. Atributes must be added before any
  81. * content is written.
  82. *
  83. * @param name
  84. * the Attribute name.
  85. * @param value
  86. * the Attribute value.
  87. *
  88. * @throws PaintException
  89. * if the paint operation failed.
  90. */
  91. public void addAttribute(String name, boolean value) throws PaintException;
  92. /**
  93. * Adds a integer attribute to component. Atributes must be added before any
  94. * content is written.
  95. *
  96. * @param name
  97. * the Attribute name.
  98. * @param value
  99. * the Attribute value.
  100. *
  101. * @throws PaintException
  102. * if the paint operation failed.
  103. */
  104. public void addAttribute(String name, int value) throws PaintException;
  105. /**
  106. * Adds a resource attribute to component. Atributes must be added before
  107. * any content is written.
  108. *
  109. * @param name
  110. * the Attribute name
  111. * @param value
  112. * the Attribute value
  113. *
  114. * @throws PaintException
  115. * if the paint operation failed.
  116. */
  117. public void addAttribute(String name, Resource value) throws PaintException;
  118. /**
  119. * Adds a long attribute to component. Atributes must be added before any
  120. * content is written.
  121. *
  122. * @param name
  123. * the Attribute name.
  124. * @param value
  125. * the Attribute value.
  126. *
  127. * @throws PaintException
  128. * if the paint operation failed.
  129. */
  130. public void addAttribute(String name, long value) throws PaintException;
  131. /**
  132. * Adds a float attribute to component. Atributes must be added before any
  133. * content is written.
  134. *
  135. * @param name
  136. * the Attribute name.
  137. * @param value
  138. * the Attribute value.
  139. *
  140. * @throws PaintException
  141. * if the paint operation failed.
  142. */
  143. public void addAttribute(String name, float value) throws PaintException;
  144. /**
  145. * Adds a double attribute to component. Atributes must be added before any
  146. * content is written.
  147. *
  148. * @param name
  149. * the Attribute name.
  150. * @param value
  151. * the Attribute value.
  152. *
  153. * @throws PaintException
  154. * if the paint operation failed.
  155. */
  156. public void addAttribute(String name, double value) throws PaintException;
  157. /**
  158. * Adds a string attribute to component. Atributes must be added before any
  159. * content is written.
  160. *
  161. * @param name
  162. * the Boolean attribute name.
  163. * @param value
  164. * the Boolean attribute value.
  165. *
  166. * @throws PaintException
  167. * if the paint operation failed.
  168. */
  169. public void addAttribute(String name, String value) throws PaintException;
  170. /**
  171. * Adds a string type variable.
  172. *
  173. * @param owner
  174. * the Listener for variable changes.
  175. * @param name
  176. * the Variable name.
  177. * @param value
  178. * the Variable initial value.
  179. *
  180. * @throws PaintException
  181. * if the paint operation failed.
  182. */
  183. public void addVariable(VariableOwner owner, String name, String value)
  184. throws PaintException;
  185. /**
  186. * Adds a int type variable.
  187. *
  188. * @param owner
  189. * the Listener for variable changes.
  190. * @param name
  191. * the Variable name.
  192. * @param value
  193. * the Variable initial value.
  194. *
  195. * @throws PaintException
  196. * if the paint operation failed.
  197. */
  198. public void addVariable(VariableOwner owner, String name, int value)
  199. throws PaintException;
  200. /**
  201. * Adds a long type variable.
  202. *
  203. * @param owner
  204. * the Listener for variable changes.
  205. * @param name
  206. * the Variable name.
  207. * @param value
  208. * the Variable initial value.
  209. *
  210. * @throws PaintException
  211. * if the paint operation failed.
  212. */
  213. public void addVariable(VariableOwner owner, String name, long value)
  214. throws PaintException;
  215. /**
  216. * Adds a float type variable.
  217. *
  218. * @param owner
  219. * the Listener for variable changes.
  220. * @param name
  221. * the Variable name.
  222. * @param value
  223. * the Variable initial value.
  224. *
  225. * @throws PaintException
  226. * if the paint operation failed.
  227. */
  228. public void addVariable(VariableOwner owner, String name, float value)
  229. throws PaintException;
  230. /**
  231. * Adds a double type variable.
  232. *
  233. * @param owner
  234. * the Listener for variable changes.
  235. * @param name
  236. * the Variable name.
  237. * @param value
  238. * the Variable initial value.
  239. *
  240. * @throws PaintException
  241. * if the paint operation failed.
  242. */
  243. public void addVariable(VariableOwner owner, String name, double value)
  244. throws PaintException;
  245. /**
  246. * Adds a boolean type variable.
  247. *
  248. * @param owner
  249. * the Listener for variable changes.
  250. * @param name
  251. * the Variable name.
  252. * @param value
  253. * the Variable initial value.
  254. *
  255. * @throws PaintException
  256. * if the paint operation failed.
  257. */
  258. public void addVariable(VariableOwner owner, String name, boolean value)
  259. throws PaintException;
  260. /**
  261. * Adds a string array type variable.
  262. *
  263. * @param owner
  264. * the Listener for variable changes.
  265. * @param name
  266. * the Variable name.
  267. * @param value
  268. * the Variable initial value.
  269. *
  270. * @throws PaintException
  271. * if the paint operation failed.
  272. */
  273. public void addVariable(VariableOwner owner, String name, String[] value)
  274. throws PaintException;
  275. /**
  276. * Adds a upload stream type variable.
  277. *
  278. * @param owner
  279. * the Listener for variable changes.
  280. * @param name
  281. * the Variable name.
  282. *
  283. * @throws PaintException
  284. * if the paint operation failed.
  285. */
  286. public void addUploadStreamVariable(VariableOwner owner, String name)
  287. throws PaintException;
  288. /**
  289. * Prints single XML section.
  290. * <p>
  291. * Prints full XML section. The section data must be XML and it is
  292. * surrounded by XML start and end-tags.
  293. * </p>
  294. *
  295. * @param sectionTagName
  296. * the tag name.
  297. * @param sectionData
  298. * the section data to be printed.
  299. * @param namespace
  300. * the namespace.
  301. * @throws PaintException
  302. * if the paint operation failed.
  303. */
  304. public void addXMLSection(String sectionTagName, String sectionData,
  305. String namespace) throws PaintException;
  306. /**
  307. * Adds UIDL directly. The UIDL must be valid in accordance with the
  308. * UIDL.dtd
  309. *
  310. * @param uidl
  311. * the UIDL to be added.
  312. * @throws PaintException
  313. * if the paint operation failed.
  314. */
  315. public void addUIDL(java.lang.String uidl) throws PaintException;
  316. /**
  317. * Adds text node. All the contents of the text are XML-escaped.
  318. *
  319. * @param text
  320. * the Text to add
  321. * @throws PaintException
  322. * if the paint operation failed.
  323. */
  324. void addText(String text) throws PaintException;
  325. /**
  326. * Adds CDATA node to target UIDL-tree.
  327. *
  328. * @param text
  329. * the Character data to add
  330. * @throws PaintException
  331. * if the paint operation failed.
  332. * @since 3.1
  333. */
  334. void addCharacterData(String text) throws PaintException;
  335. public void addAttribute(String string, Object[] keys);
  336. }