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.

Document.java 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package com.dmdirc.ui.messages;
  2. import com.dmdirc.events.DisplayPropertyMap;
  3. import java.time.LocalDateTime;
  4. /**
  5. * Models the content of a window, as a series of lines.
  6. */
  7. public interface Document {
  8. /**
  9. * Returns the number of lines in this document.
  10. *
  11. * @return Number of lines
  12. */
  13. int getNumLines();
  14. /**
  15. * Returns the Line at the specified number.
  16. *
  17. * @param lineNumber Line number to retrieve
  18. *
  19. * @return Line at the specified number or null
  20. */
  21. Line getLine(int lineNumber);
  22. /**
  23. * Adds the stylised string to the canvas.
  24. *
  25. * @param timestamp The timestamp to show along with the text.
  26. * @param displayPropertyMap The display properties to use
  27. * @param text stylised string to add to the document
  28. */
  29. void addText(LocalDateTime timestamp, DisplayPropertyMap displayPropertyMap, String text);
  30. /**
  31. * Trims the document to the specified number of lines.
  32. *
  33. * @param numLines Number of lines to trim the document to
  34. */
  35. void trim(int numLines);
  36. /** Clears all lines from the document. */
  37. void clear();
  38. /**
  39. * Adds a DocumentListener to the listener list.
  40. *
  41. * @param listener Listener to add
  42. */
  43. void addIRCDocumentListener(DocumentListener listener);
  44. /**
  45. * Removes a DocumentListener from the listener list.
  46. *
  47. * @param listener Listener to remove
  48. */
  49. void removeIRCDocumentListener(DocumentListener listener);
  50. /**
  51. * Returns the line height of the specified.
  52. *
  53. * @param line Line
  54. *
  55. * @return Line height
  56. */
  57. int getLineHeight(int line);
  58. }