PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre14/org/gjt/sp/jedit/buffer/RootElement.java

#
Java | 109 lines | 51 code | 14 blank | 44 comment | 0 complexity | 0410b55e060aee9ad476dbabc68c051f MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. /*
  2. * RootElement.java - For compatibility with Swing document API
  3. * :tabSize=8:indentSize=8:noTabs=false:
  4. * :folding=explicit:collapseFolds=1:
  5. *
  6. * Copyright (C) 2001 Slava Pestov
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. */
  22. package org.gjt.sp.jedit.buffer;
  23. //{{{ Imports
  24. import javax.swing.text.*;
  25. import org.gjt.sp.jedit.Buffer;
  26. //}}}
  27. /**
  28. * A class internal to jEdit's document model. You should not use it
  29. * directly.
  30. *
  31. * @author Slava Pestov
  32. * @version $Id: RootElement.java 3843 2001-10-20 09:32:23Z spestov $
  33. * @since jEdit 4.0pre1
  34. */
  35. public class RootElement implements Element
  36. {
  37. //{{{ RootElement constructor
  38. public RootElement(Buffer buffer)
  39. {
  40. this.buffer = buffer;
  41. } //}}}
  42. //{{{ getDocument() method
  43. public Document getDocument()
  44. {
  45. return null;
  46. } //}}}
  47. //{{{ getParentElement() method
  48. public Element getParentElement()
  49. {
  50. return null;
  51. } //}}}
  52. //{{{ getName() method
  53. public String getName()
  54. {
  55. return null;
  56. } //}}}
  57. //{{{ getAttributes() method
  58. public AttributeSet getAttributes()
  59. {
  60. return null;
  61. } //}}}
  62. //{{{ getStartOffset() method
  63. public int getStartOffset()
  64. {
  65. return 0;
  66. } //}}}
  67. //{{{ getEndOffset() method
  68. public int getEndOffset()
  69. {
  70. return buffer.getLength() + 1;
  71. } //}}}
  72. //{{{ getElementIndex() method
  73. public int getElementIndex(int offset)
  74. {
  75. return buffer.getLineOfOffset(offset);
  76. } //}}}
  77. //{{{ getElementCount() method
  78. public int getElementCount()
  79. {
  80. return buffer.getLineCount();
  81. } //}}}
  82. //{{{ getElement() method
  83. public Element getElement(int line)
  84. {
  85. return new LineElement(buffer,line);
  86. } //}}}
  87. //{{{ isLeaf() method
  88. public boolean isLeaf()
  89. {
  90. return false;
  91. } //}}}
  92. //{{{ Private members
  93. private Buffer buffer;
  94. //}}}
  95. } //}}}