JavaTM Platform
Standard Ed. 6

javax.swing.text
클래스 PlainDocument

java.lang.Object 
  상위를 확장 javax.swing.text.AbstractDocument 
      상위를 확장 javax.swing.text.PlainDocument
모든 구현된 인터페이스:
Serializable , Document


public class PlainDocument
extends AbstractDocument

문자의 속성을 전혀 보관 유지하지 않는 프레인인 문서입니다. 디폴트에서는, 이 문서의 요소의 구조는, 텍스트내의 행을 맵 한 것이 됩니다. getDefaultRootElement 메소드가 돌려주는 Element 하행의 맵을 나타내, 각 자 요소는 단일의 행을 나타냅니다. 이 모델은 문자 레벨의 속성을 전혀 가지지 않습니다만, 각각의 행에는 임의의 속성 세트에 의한 태그를 붙일 수가 있습니다. 행으로부터 오프셋(offset), 및 오프셋(offset)로부터 행에의 변환은 디폴트의 루트 요소를 사용해 신속히 실행됩니다. 편집에 의해 트리거되는 DocumentEvent 의 구조에 대한 정보는, 행의 구조의 변경을 나타냅니다.

디폴트의 컨텐츠 기억역관리는, 갭 첨부 버퍼의 구현 (GapContent)에 의해 행해집니다. GapContent 는, 꽤 큰 문서의 편집을 지원하고 있어, 인접하는 결정된 영역에 대한 일반적인 편집을 효율적으로 처리할 수 있습니다.

경고: 이 클래스의 직렬화 된 객체는, 향후의 Swing 릴리스와 호환은 아니게 될 예정입니다. 현재의 직렬화의 지원는, 단기간의 운용이나, 같은 버젼의 Swing 를 실행하는 어플리케이션간의 RMI 에 적절하고 있습니다. JDK Version 1.4 이후, 모든 JavaBeans 의 장기간의 운용 지원는,java.beans 패키지에 추가되고 있습니다. 자세한 것은,XMLEncoder 를 참조해 주세요.

관련 항목:
Document , AbstractDocument

상자의 클래스의 개요
 
클래스 javax.swing.text. AbstractDocument 로부터 상속된 상자의 클래스/인터페이스
AbstractDocument.AbstractElement , AbstractDocument.AttributeContext , AbstractDocument.BranchElement , AbstractDocument.Content , AbstractDocument.DefaultDocumentEvent , AbstractDocument.ElementEdit , AbstractDocument.LeafElement
 
필드의 개요
static String lineLimitAttribute
          최대 길이이 있는 경우, 1 행의 최대 길이을 지정하는 속성의 이름입니다.
static String tabSizeAttribute
          컨텐츠내의 탭의 사이즈를 지정하는 속성의 이름입니다.
 
클래스 javax.swing.text. AbstractDocument 로부터 상속된 필드
BAD_LOCATION , BidiElementName , ContentElementName , ElementNameAttribute , listenerList , ParagraphElementName , SectionElementName
 
인터페이스 javax.swing.text. Document 로부터 상속된 필드
StreamDescriptionProperty , TitleProperty
 
생성자 의 개요
PlainDocument ()
          plaintext 문서를 구축합니다.
PlainDocument (AbstractDocument.Content  c)
          plaintext 문서를 구축합니다.
 
메소드의 개요
protected  AbstractDocument.AbstractElement createDefaultRoot ()
          디폴트의 문서 구조를 나타내기 위해서(때문에) 사용하는 루트 요소를 작성합니다.
 Element getDefaultRootElement ()
          문서 모델의 디폴트의 루트 요소를 가져옵니다.
 Element getParagraphElement (int pos)
          지정된 위치를 보관 유지하는 단락 요소를 가져옵니다.
 void insertString (int offs, String  str, AttributeSet  a)
          문서에 내용을 삽입합니다.
protected  void insertUpdate (AbstractDocument.DefaultDocumentEvent  chng, AttributeSet  attr)
          문서 구조를 텍스트 삽입의 결과로 갱신합니다.
protected  void removeUpdate (AbstractDocument.DefaultDocumentEvent  chng)
          문서 구조를 텍스트 삭제의 결과로 갱신합니다.
 
클래스 javax.swing.text. AbstractDocument 로부터 상속된 메소드
addDocumentListener , addUndoableEditListener , createBranchElement , createLeafElement , createPosition , dump , fireChangedUpdate , fireInsertUpdate , fireRemoveUpdate , fireUndoableEditUpdate , getAsynchronousLoadPriority , getAttributeContext , getBidiRootElement , getContent , getCurrentWriter , getDocumentFilter , getDocumentListeners , getDocumentProperties , getEndPosition , getLength , getListeners , getProperty , getRootElements , getStartPosition , getText , getText , getUndoableEditListeners , postRemoveUpdate , putProperty , readLock , readUnlock , remove , removeDocumentListener , removeUndoableEditListener , render , replace , setAsynchronousLoadPriority , setDocumentFilter , setDocumentProperties , writeLock , writeUnlock
 
클래스 java.lang. Object 로부터 상속된 메소드
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
 

필드의 상세

tabSizeAttribute

public static final String  tabSizeAttribute
컨텐츠내의 탭의 사이즈를 지정하는 속성의 이름입니다. 값의 형태는 정수형입니다.

관련 항목:
정수 필드치

lineLimitAttribute

public static final String  lineLimitAttribute
최대 길이이 있는 경우, 1 행의 최대 길이을 지정하는 속성의 이름입니다. 값의 형태는 정수형입니다.

관련 항목:
정수 필드치
생성자 의 상세

PlainDocument

public PlainDocument()
plaintext 문서를 구축합니다. GapContent 를 사용하는 디폴트 모델이 구축되어, 설정됩니다.


PlainDocument

public PlainDocument(AbstractDocument.Content  c)
plaintext 문서를 구축합니다. 디폴트의 루트 요소가 작성되어 탭의 사이즈가 8 으로 설정됩니다.

파라미터:
c - 컨텐츠의 컨테이너
메소드의 상세

insertString

public void insertString(int offs,
                         String  str,
                         AttributeSet  a)
                  throws BadLocationException 
문서에 내용을 삽입합니다. 내용의 삽입에 의해, 실제의 변경이 일어날 때까지는 기입 락이 보관 유지됩니다. 그 후로, 기입 락을 글로브 하고 있는 thread상의 옵저버에 통지를 합니다.

이 메소드는 thread에 대해서 안전합니다만, 대부분의 Swing 메소드는 다릅니다. 자세한 것은,「How to Use Threads」를 참조해 주세요.

정의:
인터페이스 Document 내의 insertString
오버라이드(override):
클래스 AbstractDocument 내의 insertString
파라미터:
offs - 개시 오프셋(offset) <= 0
str - 삽입하는 캐릭터 라인. null 나 빈 상태(empty)의 캐릭터 라인의 경우는 아무것도 하지 않는
a - 삽입된 컨텐츠의 속성
예외:
BadLocationException - 지정된 삽입 위치가 문서내의 유효한 위치가 아닌 경우
관련 항목:
Document.insertString(int, java.lang.String, javax.swing.text.AttributeSet)

getDefaultRootElement

public Element  getDefaultRootElement()
문서 모델의 디폴트의 루트 요소를 가져옵니다.

정의:
인터페이스 Document 내의 getDefaultRootElement
정의:
클래스 AbstractDocument 내의 getDefaultRootElement
반환값:
루트
관련 항목:
Document.getDefaultRootElement()

createDefaultRoot

protected AbstractDocument.AbstractElement  createDefaultRoot()
디폴트의 문서 구조를 나타내기 위해서(때문에) 사용하는 루트 요소를 작성합니다.

반환값:
요소 베이스

getParagraphElement

public Element  getParagraphElement(int pos)
지정된 위치를 보관 유지하는 단락 요소를 가져옵니다. 이 문서는 행을 모델화할 뿐(만큼)이므로, 대신에 목적의 행을 돌려줍니다.

정의:
클래스 AbstractDocument 내의 getParagraphElement
파라미터:
pos - 개시 오프셋(offset) >= 0
반환값:
요소

insertUpdate

protected void insertUpdate(AbstractDocument.DefaultDocumentEvent  chng,
                            AttributeSet  attr)
문서 구조를 텍스트 삽입의 결과로 갱신합니다. 이것은, 기입 락내에서 발생합니다. 이 문서는 행을 맵 할 뿐(만큼)이므로, 사용자가 행 맵을 갱신합니다.

오버라이드(override):
클래스 AbstractDocument 내의 insertUpdate
파라미터:
chng - 편집을 기술하는 변경 이벤트
attr - 삽입 텍스트의 속성 세트

removeUpdate

protected void removeUpdate(AbstractDocument.DefaultDocumentEvent  chng)
문서 구조를 텍스트 삭제의 결과로 갱신합니다. 이것은, 기입 락내에서 발생합니다. 구조는 행 맵을 나타내므로, 삭제의 스팬이 복수의 행을 차지하고 있는지 어떤지를 체크할 뿐입니다. 삭제의 스팬이 복수의 행을 차지하고 있는 경우는, 삭제 범위를 사이에 두는 전후의 2 행이 결합됩니다.

오버라이드(override):
클래스 AbstractDocument 내의 removeUpdate
파라미터:
chng - 편집을 기술하는 변경 이벤트

JavaTM Platform
Standard Ed. 6

버그의 보고와 기능의 요청
한층 더 자세한 API 레퍼런스 및 개발자 문서에 대해서는,Java SE 개발자용 문서를 참조해 주세요. 개발자전용의 상세한 해설, 개념의 개요, 용어의 정의, 버그의 회피책, 및 코드 실례가 포함되어 있습니다.

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.