--- title: Instantiating Views slug: orphaned/Places/Instantiating_Views tags: - Places original_slug: Places/Instantiating_Views ---

여러분의 확장이나 애플리케이션에서 북마크나 히스토리의 내용을 보여주려면 내장 플레이스 뷰를 사용할 수 있습니다. 이는 포괄적이며, 기본 기능을 작성하는 시간을 많이 아껴주므로 여러분은 애플리케이션을 작성하는데 집중할 수 있습니다.

다른 콘트롤 형식을 위해서 또는 더욱 사용자 정의된 뷰를 얻기 위해서 여러분 자신의 뷰를 구현할 수도 있습니다. Places:Views는 이 주제에 대해서 다룹니다.

보기

플레이스에서는 다음과 같은 내장 뷰를 이용할 수 있습니다.

XUL에서 생성하기

  <!-- include the places stylesheet to get the XBL bindings -->
  <?xml-stylesheet href="chrome://browser/content/places/places.css"?>

  <!-- include the required .js files -->
  <script type="application/x-javascript"
          src="chrome://global/content/globalOverlay.js"/>
  <script type="application/x-javascript"
          src="chrome://browser/content/places/utils.js"/>
  <script type="application/x-javascript"
          src="chrome://browser/content/places/controller.js"/>
  <script type="application/x-javascript"
          src="chrome://browser/content/places/treeView.js"/>

  <!-- Tree View -->
  <tree type="places" id="your_tree" place="place:..." ...>
    <treecols>
      <treecol id="title" flex="1" primary="true" .../>
      ...
    </treecols>
    <treechildren flex="1"/>
  </tree>

  <!-- Menu View -->
  <menu label="Your Menu">
    <menupopup type="places" place="place:..."/>
  </menu>

  <!-- Toolbar View -->
  <toolbaritem type="places" id="your_item" place="place:..."
               .../>

스크립트에서 DOM 개체를 생성할 수도 있습니다.

스크립트 가로채기(Hookup)

var view = document.getElementById("your_view");
view.init(null);
view.appendController(PlacesController);

뷰는 null로 초기화되고(기본 뷰 구성입니다. ViewConfig 개체를 사용하여 뷰의 기능을 수정하는 것에 대한 자세한 정보는 Places:View Configurations를 참고하십시오.) 콘트롤러가 붙습니다. 뷰는 이제 사용할 준비가 되었습니다.

플레이스뷰 인터페이스

플레이스뷰 인터페이스를 통하여 뷰와 상호작용하는 것에 대한 정보는 Places:PlacesView Interface를 참고하시기 바랍니다.