PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms 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
  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
 23package org.gjt.sp.jedit.buffer;
 24
 25//{{{ Imports
 26import javax.swing.text.*;
 27import org.gjt.sp.jedit.Buffer;
 28//}}}
 29
 30/**
 31 * A class internal to jEdit's document model. You should not use it
 32 * directly.
 33 *
 34 * @author Slava Pestov
 35 * @version $Id: RootElement.java 3843 2001-10-20 09:32:23Z spestov $
 36 * @since jEdit 4.0pre1
 37 */
 38public class RootElement implements Element
 39{
 40	//{{{ RootElement constructor
 41	public RootElement(Buffer buffer)
 42	{
 43		this.buffer = buffer;
 44	} //}}}
 45
 46	//{{{ getDocument() method
 47	public Document getDocument()
 48	{
 49		return null;
 50	} //}}}
 51
 52	//{{{ getParentElement() method
 53	public Element getParentElement()
 54	{
 55		return null;
 56	} //}}}
 57
 58	//{{{ getName() method
 59	public String getName()
 60	{
 61		return null;
 62	} //}}}
 63
 64	//{{{ getAttributes() method
 65	public AttributeSet getAttributes()
 66	{
 67		return null;
 68	} //}}}
 69
 70	//{{{ getStartOffset() method
 71	public int getStartOffset()
 72	{
 73		return 0;
 74	} //}}}
 75
 76	//{{{ getEndOffset() method
 77	public int getEndOffset()
 78	{
 79		return buffer.getLength() + 1;
 80	} //}}}
 81
 82	//{{{ getElementIndex() method
 83	public int getElementIndex(int offset)
 84	{
 85		return buffer.getLineOfOffset(offset);
 86	} //}}}
 87
 88	//{{{ getElementCount() method
 89	public int getElementCount()
 90	{
 91		return buffer.getLineCount();
 92	} //}}}
 93
 94	//{{{ getElement() method
 95	public Element getElement(int line)
 96	{
 97		return new LineElement(buffer,line);
 98	} //}}}
 99
100	//{{{ isLeaf() method
101	public boolean isLeaf()
102	{
103		return false;
104	} //}}}
105
106	//{{{ Private members
107	private Buffer buffer;
108	//}}}
109} //}}}