You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PaintTarget.java 10KB

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