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 9.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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 string attribute to component. Atributes must be added before any
  160. * content is written.
  161. *
  162. * @param name
  163. * the Boolean attribute name.
  164. * @param value
  165. * the Boolean attribute value.
  166. *
  167. * @throws PaintException
  168. * if the paint operation failed.
  169. */
  170. public void addAttribute(String name, String value) throws PaintException;
  171. /**
  172. * Adds a string type variable.
  173. *
  174. * @param owner
  175. * the Listener for variable changes.
  176. * @param name
  177. * the Variable name.
  178. * @param value
  179. * the Variable initial value.
  180. *
  181. * @throws PaintException
  182. * if the paint operation failed.
  183. */
  184. public void addVariable(VariableOwner owner, String name, String value)
  185. throws PaintException;
  186. /**
  187. * Adds a int type variable.
  188. *
  189. * @param owner
  190. * the Listener for variable changes.
  191. * @param name
  192. * the Variable name.
  193. * @param value
  194. * the Variable initial value.
  195. *
  196. * @throws PaintException
  197. * if the paint operation failed.
  198. */
  199. public void addVariable(VariableOwner owner, String name, int value)
  200. throws PaintException;
  201. /**
  202. * Adds a long type variable.
  203. *
  204. * @param owner
  205. * the Listener for variable changes.
  206. * @param name
  207. * the Variable name.
  208. * @param value
  209. * the Variable initial value.
  210. *
  211. * @throws PaintException
  212. * if the paint operation failed.
  213. */
  214. public void addVariable(VariableOwner owner, String name, long value)
  215. throws PaintException;
  216. /**
  217. * Adds a float type variable.
  218. *
  219. * @param owner
  220. * the Listener for variable changes.
  221. * @param name
  222. * the Variable name.
  223. * @param value
  224. * the Variable initial value.
  225. *
  226. * @throws PaintException
  227. * if the paint operation failed.
  228. */
  229. public void addVariable(VariableOwner owner, String name, float value)
  230. throws PaintException;
  231. /**
  232. * Adds a boolean type variable.
  233. *
  234. * @param owner
  235. * the Listener for variable changes.
  236. * @param name
  237. * the Variable name.
  238. * @param value
  239. * the Variable initial value.
  240. *
  241. * @throws PaintException
  242. * if the paint operation failed.
  243. */
  244. public void addVariable(VariableOwner owner, String name, boolean value)
  245. throws PaintException;
  246. /**
  247. * Adds a string array type variable.
  248. *
  249. * @param owner
  250. * the Listener for variable changes.
  251. * @param name
  252. * the Variable name.
  253. * @param value
  254. * the Variable initial value.
  255. *
  256. * @throws PaintException
  257. * if the paint operation failed.
  258. */
  259. public void addVariable(VariableOwner owner, String name, String[] value)
  260. throws PaintException;
  261. /**
  262. * Adds a upload stream type variable.
  263. *
  264. * @param owner
  265. * the Listener for variable changes.
  266. * @param name
  267. * the Variable name.
  268. *
  269. * @throws PaintException
  270. * if the paint operation failed.
  271. */
  272. public void addUploadStreamVariable(VariableOwner owner, String name)
  273. throws PaintException;
  274. /**
  275. * Prints single XML section.
  276. * <p>
  277. * Prints full XML section. The section data must be XML and it is
  278. * surrounded by XML start and end-tags.
  279. * </p>
  280. *
  281. * @param sectionTagName
  282. * the tag name.
  283. * @param sectionData
  284. * the section data to be printed.
  285. * @param namespace
  286. * the namespace.
  287. * @throws PaintException
  288. * if the paint operation failed.
  289. */
  290. public void addXMLSection(String sectionTagName, String sectionData,
  291. String namespace) throws PaintException;
  292. /**
  293. * Adds UIDL directly. The UIDL must be valid in accordance with the
  294. * UIDL.dtd
  295. *
  296. * @param uidl
  297. * the UIDL to be added.
  298. * @throws PaintException
  299. * if the paint operation failed.
  300. */
  301. public void addUIDL(java.lang.String uidl) throws PaintException;
  302. /**
  303. * Adds text node. All the contents of the text are XML-escaped.
  304. *
  305. * @param text
  306. * the Text to add
  307. * @throws PaintException
  308. * if the paint operation failed.
  309. */
  310. void addText(String text) throws PaintException;
  311. /**
  312. * Adds CDATA node to target UIDL-tree.
  313. *
  314. * @param text
  315. * the Character data to add
  316. * @throws PaintException
  317. * if the paint operation failed.
  318. * @since 3.1
  319. */
  320. void addCharacterData(String text) throws PaintException;
  321. public void addAttribute(String string, Object[] keys);
  322. }