S
- このTreeTableViewで使用されるTreeItemインスタンスの型。@DefaultProperty(value="root") public class TreeTableView<S> extends Control
TreeView
コントロールとTableView
コントロールに概念的に非常に似ており、この後の説明でわかるとおり、APIの大部分が同じです。ただし、高いレベルの概要から説明すると、TreeTableViewではTreeView
と同じTreeItem
APIを使用しているため、単にTreeTableViewでroot node
を設定する必要があることに注意してください。同様に、TreeTableViewコントロールでは、TableView
コントロールが使用している同じTableColumnベースのアプローチを使用しています。ただし、TableView固有のTableColumn
クラスを使用するかわりに、TreeTableView固有のTreeTableColumn
クラスを使用する必要があります。TreeTableViewインスタンスの作成方法の例については、後述の項「TreeTableViewの作成」を参照してください。
TableView
コントロールのように、TreeTableViewコントロールには、次のような多くの機能があります。
TreeTableColumn
API:
cell
コンテンツを簡単にカスタマイズするためのcell factories
のサポート。
minWidth
、prefWidth
、maxWidth
およびfixed width columns
の指定。
column nesting
の組込みサポート。
resizing policies
。
multiple column sorting
のサポート(複数の列でソートするには、キーボードの[Shift]キーを押しながらヘッダーをクリックします)。
TreeTableViewの作成は、複数のステップからなるプロセスで、表現する必要がある基礎となるデータ・モデルに応じて異なります。この例では、ファイル・システムを視覚化するためにTreeTableViewを使用し、次のように定義された仮想の(および大幅に簡略化された) Fileクラスを使用します。
public class File {
private StringProperty name;
public void setName(String value) { nameProperty().set(value); }
public String getName() { return nameProperty().get(); }
public StringProperty nameProperty() {
if (name == null) name = new SimpleStringProperty(this, "name");
return name;
}
private LongProperty lastModified;
public void setLastModified(long value) { lastModifiedProperty().set(value); }
public long getLastModified() { return lastModifiedProperty().get(); }
public LongProperty lastModifiedProperty() {
if (lastModified == null) lastModified = new SimpleLongProperty(this, "lastModified");
return lastModified;
}
}
最初に、次のように、TreeTableViewインスタンスを定義する必要があります。
TreeTableView<File> treeTable = new TreeTableView<>();
次に、インスタンス化された基本的なTreeTableViewで、データ・モデルをフォーカスします。前述のとおり、この例では、Fileインスタンスを使用してファイル・システムを表現します。これを行うには、次のように、ツリー表のルート・ノードを定義する必要があります。
TreeItem<File> root = new TreeItem<>(new File("/"));
treeTable.setRoot(root);
このように設定されたルートにより、ルートのchildren
が変更されると、TreeTableViewが自動的に更新されます。
この時点で、ルートのTreeItemインスタンスを監視するために、TreeTableViewが構成されました。この時点で欠けている構成要素は、モデル内に含まれているデータを分割する方法と、それを1つ以上のTreeTableColumn
インスタンスで表現する方法です。2列のTreeTableViewを作成して、ファイル名と最終変更のプロパティを表示するには、次のように前述のコードを拡張します。
TreeTableColumns<File,String> fileNameCol = new TreeTableColumn<>("Filename");
TreeTableColumns<File,Long> lastModifiedCol = new TreeTableColumn<>("Size");
table.getColumns().setAll(fileNameCol, lastModifiedCol);
前述のコードで、TreeTableViewインスタンスの作成に最低限必要なプロパティをほぼ完全に定義しました。欠落しているものは、2つの列のcell value factories
のみです。これは、特定の行のセルの値を決定します。一般的に、これらはTreeItemPropertyValueFactory
クラスを使用して指定できますが、それが失敗する場合は、匿名内部クラスを作成して、必要なことを実行することもできます。たとえば、TreeItemPropertyValueFactory
を使用して、次のことを行います。
fileNameCol.setCellValueFactory(new TreeItemPropertyValueFactory("name"));
lastModifiedCol.setCellValueFactory(new TreeItemPropertyValueFactory("lastModified"));
このコード(ファイル・システム構造がメモリー内におそらく構築されていると想定しています)を実行すると、nameとlastModifiedの2つの列を持つTreeTableViewが表示されます。Fileクラスの他のプロパティは、それらに対してTreeTableColumnが定義されない場合は、表示されません。
前述のコードは、ドメイン・オブジェクトがJavaFXプロパティを考慮して設計されている場合にTreeTableViewを作成するための最低限の短いコードです(また、TreeItemPropertyValueFactory
は標準のJavaBeanプロパティもサポートしますが、これに対する注意事項があるため、クラスのドキュメントで詳細を参照してください)。これに当てはまらない場合は、カスタムのセル値ファクトリを指定する必要があります。セル値ファクトリの詳細情報は、TreeTableColumn
APIのドキュメントに記載されていますが、ここでは簡潔にTreeTableColumnの指定方法を示します。
firstNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() {
public ObservableValue<String> call(CellDataFeatures<Person, String> p) {
// p.getValue() returns the TreeItem<Person> instance for a particular TreeTableView row,
// p.getValue().getValue() returns the Person instance inside the TreeItem<Person>
return p.getValue().getValue().firstNameProperty();
}
});
}
選択およびフォーカスを追跡するには、SelectionModel
クラスおよびFocusModel
クラスに習熟することが必要です。TreeTableViewには、selectionModel
とfocusModel
のプロパティからそれぞれ入手できる、これらのクラスのインスタンスを最大で1つずつ指定できます。このAPIを使用すると新しい選択モデルを設定できますが、ほとんどの場合は、デフォルトの選択モデルおよびフォーカス・モデルが機能するため、このことは必要ありません。
デフォルトのSelectionModel
は、TreeTableViewのインスタンス化がMultipleSelectionModel
抽象クラスの実装の場合に使用されます。ただし、selectionMode
プロパティのAPIドキュメントに示されているように、デフォルト値はSelectionMode.SINGLE
です。したがって、デフォルトのTreeTableViewインスタンスでの複数選択を可能にするには、次を実行する必要があります。
treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
TreeTableViewのビジュアルは、デフォルトのrow factory
を置換することで、全体的にカスタマイズできます。行ファクトリは、TreeTableViewの行全体を表すために使用されるTreeTableRow
インスタンスを生成するために使用されます。
ただし、行ごとの基準ではなく、列ごとの基準でセルをカスタマイズすることがより一般的であるため、多くの場合、このことは望ましくありません。したがって、TreeTableRow
はTreeTableCell
ではないことに注意することが重要です。TreeTableRow
は単にゼロ個以上のTreeTableCell
のコンテナで、ほとんどの状況において、TreeTableRowよりも、カスタムのTreeTableCellを作成することの方が多くなります。カスタムのTreeTableRowインスタンスを作成する主なユースケースでは、通常、なんらかの形式の複数の列の範囲を処理するためのサポートを導入します。
TreeTableColumnのcell factory
プロパティに適切な関数を割り当てて、列ごとにカスタムのTreeTableCell
インスタンスを作成できます。
カスタム・セルを作成する方法の詳細は、Cell
クラスのドキュメントを参照してください。
このコントロールは値のインライン編集をサポートしており、このセクションでは使用可能なAPIの概要とその使用方法を示します。
まず、通常、セルを編集する場合は、セルを編集しないときとは異なるユーザー・インタフェースが必要となります。このことは、使用するCell
実装によって行います。TreeTableViewに対してはper row
ではなくper-TreeTableColumn
にすることを強くお薦めします。これは、ユーザーが各列の値を個別に編集できるようにする場合が多く、かつ、このアプローチでは列ごとに固有の編集者が許可されるためです。セルを永続的に編集状態にするか(たとえば、このことはCheckBox
セルでは一般的です)、編集が開始されたとき(たとえば、セルでダブルクリックを受け取ったとき)に別のUIに切り替えるかは任意です。
セルに対する編集がいつリクエストされたかを知るには、単にCell.startEdit()
メソッドをオーバーライドし、セルのtext
プロパティおよびgraphic
プロパティを適切に更新します(たとえば、textをnullに設定し、graphicをTextField
に設定します)。また、編集が完了したときにUIを元の視覚的状態にリセットするようにCell.cancelEdit()
もオーバーライドします。どちらの場合も、スーパー・メソッドを呼び出して、編集モードを開始または終了するために必要なすべての作業をセルで実行するようにすることが重要です。
セルが編集状態になったら、次に、現在行っている編集をコミットまたは取り消す方法を確認しておきましょう。このことは、セル・ファクトリ・プロバイダとしてユーザーが行います。セル実装は、ユーザー入力に基づいて(たとえば、ユーザーがキーボードで[Enter]キーまたは[Esc]キーを押したとき)、編集の終了を認識します。このことが発生したときは、Cell.commitEdit(Object)
またはCell.cancelEdit()
を適切に呼び出す必要があります。
Cell.commitEdit(Object)
を呼び出すと、TreeTableViewに対してイベントが起動され、これはTreeTableColumn.setOnEditCommit(javafx.event.EventHandler)
を介してEventHandler
を追加することで監視できます。また、edit start
とedit cancel
の編集イベントを監視することもできます。
デフォルトでは、TreeTableColumnの編集コミット・ハンドラはnull以外であり、デフォルトのハンドラでは、現在編集中の行のアイテムのプロパティ値を上書きすることを試みます。このことは、Cell.commitEdit(Object)
メソッドに新しい値が渡され、これが、起動されたCellEditEvent
を介して編集コミット・ハンドラに渡されると、実行可能になります。これは単に、この値を取得するためのTreeTableColumn.CellEditEvent.getNewValue()
の呼出しの問題です。
独自のEventHandler
でTreeTableColumn.setOnEditCommit(javafx.event.EventHandler)
を呼び出す場合に、デフォルトのハンドラを削除することに注意することが非常に重要です。その後、プロパティ(または関連するデータ・ソース)へのライトバックを処理しないかぎり、何も実行されません。このことは、TableColumnBase.addEventHandler(javafx.event.EventType, javafx.event.EventHandler)
メソッドを使用し、2番目の引数を目的のEventHandler
として、TreeTableColumn.EDIT_COMMIT_EVENT
EventType
を追加することによって回避できます。このメソッドを使用すると、デフォルトの実装は置き換えられず、編集コミットが発生したときに通知されるようになります。
このサマリーでは、よくある質問に対して答えを示すことを意図しています。JavaFXには、かわりにすべての編集要件を処理する、数多くの事前作成のセル・ファクトリが付属しています。これらの事前作成のセル・ファクトリは、javafx.scene.control.cellパッケージにあります。
TreeTableColumn
、TreeTablePosition
Type | プロパティと説明 |
---|---|
ObjectProperty<Callback<TreeTableView.ResizeFeatures,Boolean>> |
columnResizePolicy
これは、ユーザーが列のサイズ変更操作を完了する場合に呼び出されるファンクションです。
|
ReadOnlyObjectProperty<Comparator<TreeItem<S>>> |
comparator
コンパレータ・プロパティは、
sort order リストの現在の状態を表す読取り専用プロパティです。 |
BooleanProperty |
editable
このTreeTableViewが編集可能かどうかを指定します - TreeTableViewおよびその中のTreeCellが両方とも編集可能な場合にのみ、TreeCellが編集状態になります。
|
ReadOnlyObjectProperty<TreeTablePosition<S,?>> |
editingCell
編集されている現在のセルか、編集されているセルがない場合はnullを表します。
|
ReadOnlyIntegerProperty |
expandedItemCount
TreeTableViewに現在表示できるツリー・ノードの数を表します。
|
DoubleProperty |
fixedCellSize
このコントロールが指定された値の固定された高さであるセルを持つかどうかを指定します。
|
ObjectProperty<TreeTableView.TreeTableViewFocusModel<S>> |
focusModel
FocusModelには、TreeTableViewで0または1行のフォーカスを制御できるAPIが用意されています。
|
ObjectProperty<EventHandler<ScrollToEvent<TreeTableColumn<S,?>>>> |
onScrollToColumn
scrollToColumn(TreeTableColumn) またはscrollToColumnIndex(int) を使用して、ビューの列をスクロールするリクエストがある場合に呼び出されます。 |
ObjectProperty<EventHandler<ScrollToEvent<Integer>>> |
onScrollTo
scrollTo(int) を使用してビューのインデックスをスクロールするリクエストがある場合に呼び出されます。 |
ObjectProperty<EventHandler<SortEvent<TreeTableView<S>>>> |
onSort
コントロールをソートするリクエストがある場合に呼び出されます。
|
ObjectProperty<Node> |
placeholder
表示するコンテンツが表にない場合は、このノードがユーザーに表示されます。
|
ObjectProperty<TreeItem<S>> |
root
TreeTableViewのルート・ノードを表すプロパティ。
|
ObjectProperty<Callback<TreeTableView<S>,TreeTableRow<S>>> |
rowFactory
TreeTableRowを生成する関数。
|
ObjectProperty<TreeTableView.TreeTableViewSelectionModel<S>> |
selectionModel
SelectionModelには、TreeTableView内の1つまたは複数のアイテムを選択でき、ユーザーがどの行を選択したかを調べることもできるAPIが用意されています。
|
BooleanProperty |
showRoot
TreeTableViewルート・ノードが表示可能であるかどうかを表すプロパティ。
|
ObjectProperty<TreeSortMode> |
sortMode
列を
sort order リストで指定する場合、このTreeTableViewのコンテンツをソートするときに使用するソート・モードを指定します。 |
ObjectProperty<Callback<TreeTableView<S>,Boolean>> |
sortPolicy
ソート・ポリシーでは、このTreeTableViewのソートの実行方法を指定します。
|
BooleanProperty |
tableMenuButtonVisible
これは、TableView内の指定されたスペースをユーザーがクリックするとメニュー・ボタンを使用可能にするかどうかを制御します。ここには、この表の各TreeTableColumnのラジオ・メニュー・アイテムが表示されます。
|
ObjectProperty<TreeTableColumn<S,?>> |
treeColumn
公開ノードが内部に表示される列(つまり、矢印を使用した列)を表すプロパティ。
|
contextMenu、skin、tooltip
background、border、cacheShape、centerShape、height、insets、maxHeight、maxWidth、minHeight、minWidth、opaqueInsets、padding、prefHeight、prefWidth、scaleShape、shape、snapToPixel、width
needsLayout
accessibleHelp、accessibleRoleDescription、accessibleRole、accessibleText、blendMode、boundsInLocal、boundsInParent、cacheHint、cache、clip、cursor、depthTest、disabled、disable、effectiveNodeOrientation、effect、eventDispatcher、focused、focusTraversable、hover、id、inputMethodRequests、layoutBounds、layoutX、layoutY、localToParentTransform、localToSceneTransform、managed、mouseTransparent、nodeOrientation、onContextMenuRequested、onDragDetected、onDragDone、onDragDropped、onDragEntered、onDragExited、onDragOver、onInputMethodTextChanged、onKeyPressed、onKeyReleased、onKeyTyped、onMouseClicked、onMouseDragEntered、onMouseDragExited、onMouseDragged、onMouseDragOver、onMouseDragReleased、onMouseEntered、onMouseExited、onMouseMoved、onMousePressed、onMouseReleased、onRotate、onRotationFinished、onRotationStarted、onScrollFinished、onScroll、onScrollStarted、onSwipeDown、onSwipeLeft、onSwipeRight、onSwipeUp、onTouchMoved、onTouchPressed、onTouchReleased、onTouchStationary、onZoomFinished、onZoom、onZoomStarted、opacity、parent、pickOnBounds、pressed、rotate、rotationAxis、scaleX、scaleY、scaleZ、scene、style、translateX、translateY、translateZ、visible
修飾子と型 | クラスと説明 |
---|---|
static class |
TreeTableView.EditEvent<S>
編集関連イベントを表すために特にTreeTableViewで使用される
Event サブクラス。 |
static class |
TreeTableView.ResizeFeatures<S>
TableView
column resize 機能で使用される不変のラッパー・クラス。 |
static class |
TreeTableView.TreeTableViewFocusModel<S>
TableViewコントロールの要件をサポートする追加機能を持つ
FocusModel 。 |
static class |
TreeTableView.TreeTableViewSelectionModel<S>
TreeTableViewコントロールの特別なサポートを可能にする
SelectionModel 抽象クラスの単純な拡張。 |
修飾子と型 | フィールドと説明 |
---|---|
static Callback<TreeTableView.ResizeFeatures,Boolean> |
CONSTRAINED_RESIZE_POLICY
この表内の表示可能なすべてのリーフ列の幅を合計すると、この表自体の幅と等しくなるようにする単純なポリシー。
|
static Callback<TreeTableView,Boolean> |
DEFAULT_SORT_POLICY
他のポリシーが指定されていない場合に、このTreeTableViewで使用されるデフォルトの
sort policy 。 |
static Callback<TreeTableView.ResizeFeatures,Boolean> |
UNCONSTRAINED_RESIZE_POLICY
単に、指定された列を指定されたデルタでサイズ変更し、(指定された列の右側にある)他のすべての列を(デルタが正の場合には)右側に、または(デルタが負の場合には)左側にシフトする、非常に単純なサイズ変更ポリシー。
|
USE_COMPUTED_SIZE、USE_PREF_SIZE
BASELINE_OFFSET_SAME_AS_HEIGHT
コンストラクタと説明 |
---|
TreeTableView()
空のTreeTableViewを作成します。
|
TreeTableView(TreeItem<S> root)
指定されたルート・ノードを使用してTreeTableViewを作成します。
|
修飾子と型 | メソッドと説明 |
---|---|
ObjectProperty<Callback<TreeTableView.ResizeFeatures,Boolean>> |
columnResizePolicyProperty()
これは、ユーザーが列のサイズ変更操作を完了する場合に呼び出されるファンクションです。
|
ReadOnlyObjectProperty<Comparator<TreeItem<S>>> |
comparatorProperty()
コンパレータ・プロパティは、
sort order リストの現在の状態を表す読取り専用プロパティです。 |
protected Skin<?> |
createDefaultSkin()
このコントロールのデフォルト・スキンの新しいインスタンスを作成します。
|
void |
edit(int row, TreeTableColumn<S,?> column)
指定された行/列のビュー・インデックスのセルが、まだ編集モードでない場合は編集モードに切り替わり、TableViewおよび列も編集可能とみなされます。
|
BooleanProperty |
editableProperty()
このTreeTableViewが編集可能かどうかを指定します - TreeTableViewおよびその中のTreeCellが両方とも編集可能な場合にのみ、TreeCellが編集状態になります。
|
static <S> EventType<TreeTableView.EditEvent<S>> |
editAnyEvent()
なんらかの編集イベントが発生したことを示すEventType。
|
static <S> EventType<TreeTableView.EditEvent<S>> |
editCancelEvent()
TreeTableViewに対して起動された編集イベントが取り消されたことを示すEventType。
|
static <S> EventType<TreeTableView.EditEvent<S>> |
editCommitEvent()
TreeTableViewの編集がコミットされたことを示すEventType。
|
ReadOnlyObjectProperty<TreeTablePosition<S,?>> |
editingCellProperty()
編集されている現在のセルか、編集されているセルがない場合はnullを表します。
|
static <S> EventType<TreeTableView.EditEvent<S>> |
editStartEvent()
TreeTableViewに対して起動された編集イベントが開始されたことを示すEventType。
|
ReadOnlyIntegerProperty |
expandedItemCountProperty()
TreeTableViewに現在表示できるツリー・ノードの数を表します。
|
DoubleProperty |
fixedCellSizeProperty()
このコントロールが指定された値の固定された高さであるセルを持つかどうかを指定します。
|
ObjectProperty<TreeTableView.TreeTableViewFocusModel<S>> |
focusModelProperty()
FocusModelには、TreeTableViewで0または1行のフォーカスを制御できるAPIが用意されています。
|
static List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
Callback<TreeTableView.ResizeFeatures,Boolean> |
getColumnResizePolicy()
プロパティcolumnResizePolicyの値を取得します。
|
ObservableList<TreeTableColumn<S,?>> |
getColumns()
このTableViewの一部であるTreeTableColumn。
|
Comparator<TreeItem<S>> |
getComparator()
プロパティcomparatorの値を取得します。
|
List<CssMetaData<? extends Styleable,?>> |
getControlCssMetaData() |
TreeTablePosition<S,?> |
getEditingCell()
プロパティeditingCellの値を取得します。
|
int |
getExpandedItemCount()
プロパティexpandedItemCountの値を取得します。
|
double |
getFixedCellSize()
固定セル・サイズ値を返します。
|
TreeTableView.TreeTableViewFocusModel<S> |
getFocusModel()
現在インストールされている
FocusModel を返します。 |
static int |
getNodeLevel(TreeItem<?> node)
非推奨。
このメソッドでは、指定されたTreeItemからTreeTableViewのルートまでの距離が正しく計算されません。JavaFX 8.0_20では、これを行う適切な方法は、
getTreeItemLevel(TreeItem) を使用することです。 |
EventHandler<ScrollToEvent<Integer>> |
getOnScrollTo()
プロパティonScrollToの値を取得します。
|
EventHandler<ScrollToEvent<TreeTableColumn<S,?>>> |
getOnScrollToColumn()
プロパティonScrollToColumnの値を取得します。
|
EventHandler<SortEvent<TreeTableView<S>>> |
getOnSort()
プロパティonSortの値を取得します。
|
Node |
getPlaceholder()
プロパティ・プレースホルダの値を取得します。
|
TreeItem<S> |
getRoot()
このTreeTableViewの現在のルート・ノードを返すか、ルート・ノードが指定されていない場合はnullを返します。
|
int |
getRow(TreeItem<S> item)
各TreeItemの現在の状態を考慮して、指定されたTreeItemのインデックス位置を返します。
|
Callback<TreeTableView<S>,TreeTableRow<S>> |
getRowFactory()
プロパティrowFactoryの値を取得します。
|
TreeTableView.TreeTableViewSelectionModel<S> |
getSelectionModel()
現在インストールされている選択モデルを返します。
|
TreeSortMode |
getSortMode()
プロパティsortModeの値を取得します。
|
ObservableList<TreeTableColumn<S,?>> |
getSortOrder()
sortOrderリストは、
TreeTableColumn インスタンスのソート順序を定義します。 |
Callback<TreeTableView<S>,Boolean> |
getSortPolicy()
プロパティsortPolicyの値を取得します。
|
TreeTableColumn<S,?> |
getTreeColumn()
プロパティtreeColumnの値を取得します。
|
TreeItem<S> |
getTreeItem(int row)
指定されたインデックスのTreeItemを返すか、範囲外である場合はnullを返します。
|
int |
getTreeItemLevel(TreeItem<?> node)
getParent()を再帰的に呼び出すことができる回数に基づいて、指定されたTreeItemのインデントのレベル数を返します。
|
TreeTableColumn<S,?> |
getVisibleLeafColumn(int column)
他のすべての表示されているリーフ列に対して相対的な、指定された列インデックスのTreeTableColumnを返します。
|
ObservableList<TreeTableColumn<S,?>> |
getVisibleLeafColumns()
現在表示されているリーフ列を含む変更不可能なリストを返します。
|
int |
getVisibleLeafIndex(TreeTableColumn<S,?> column)
他のすべての表示されているリーフ列に対して相対的な、指定された列の位置を返します。
|
boolean |
isEditable()
プロパティeditableの値を取得します。
|
boolean |
isShowRoot()
TreeTableViewのルートが表示される場合はtrue、されない場合はfalseを返します。
|
boolean |
isTableMenuButtonVisible()
プロパティtableMenuButtonVisibleの値を取得します。
|
protected void |
layoutChildren()
この
Parent の子をレイアウトするレイアウト・パス中に起動されます。 |
ObjectProperty<EventHandler<ScrollToEvent<TreeTableColumn<S,?>>>> |
onScrollToColumnProperty()
scrollToColumn(TreeTableColumn) またはscrollToColumnIndex(int) を使用して、ビューの列をスクロールするリクエストがある場合に呼び出されます。 |
ObjectProperty<EventHandler<ScrollToEvent<Integer>>> |
onScrollToProperty()
scrollTo(int) を使用してビューのインデックスをスクロールするリクエストがある場合に呼び出されます。 |
ObjectProperty<EventHandler<SortEvent<TreeTableView<S>>>> |
onSortProperty()
コントロールをソートするリクエストがある場合に呼び出されます。
|
ObjectProperty<Node> |
placeholderProperty()
表示するコンテンツが表にない場合は、このノードがユーザーに表示されます。
|
Object |
queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)
*アクセシビリティ処理* *
|
boolean |
resizeColumn(TreeTableColumn<S,?> column, double delta)
現在導入されているサイズ変更ポリシーを指定された列に適用し、指定されたデルタ値に基づいてサイズ変更します。
|
ObjectProperty<TreeItem<S>> |
rootProperty()
TreeTableViewのルート・ノードを表すプロパティ。
|
ObjectProperty<Callback<TreeTableView<S>,TreeTableRow<S>>> |
rowFactoryProperty()
TreeTableRowを生成する関数。
|
void |
scrollTo(int index)
特定のインデックスのアイテムがエンド・ユーザーに表示されるように、TreeTableViewをスクロールします。
|
void |
scrollToColumn(TreeTableColumn<S,?> column)
TreeTableViewをスクロールして、指定された列がビューポート内に表示されるようにします。
|
void |
scrollToColumnIndex(int columnIndex)
特定のインデックスがビューポート内に表示されるように、TreeTableViewをスクロールします。
|
ObjectProperty<TreeTableView.TreeTableViewSelectionModel<S>> |
selectionModelProperty()
SelectionModelには、TreeTableView内の1つまたは複数のアイテムを選択でき、ユーザーがどの行を選択したかを調べることもできるAPIが用意されています。
|
void |
setColumnResizePolicy(Callback<TreeTableView.ResizeFeatures,Boolean> callback)
プロパティcolumnResizePolicyの値を設定します。
|
void |
setEditable(boolean value)
プロパティeditableの値を設定します。
|
void |
setFixedCellSize(double value)
このコントロールの新しい固定セル・サイズを設定します。
|
void |
setFocusModel(TreeTableView.TreeTableViewFocusModel<S> value)
FocusModel をTreeTableViewで使用されるように設定します。 |
void |
setOnScrollTo(EventHandler<ScrollToEvent<Integer>> value)
プロパティonScrollToの値を設定します。
|
void |
setOnScrollToColumn(EventHandler<ScrollToEvent<TreeTableColumn<S,?>>> value)
プロパティonScrollToColumnの値を設定します。
|
void |
setOnSort(EventHandler<SortEvent<TreeTableView<S>>> value)
プロパティonSortの値を設定します。
|
void |
setPlaceholder(Node value)
プロパティ・プレースホルダの値を設定します。
|
void |
setRoot(TreeItem<S> value)
このTreeTableViewのルート・ノードを設定します。
|
void |
setRowFactory(Callback<TreeTableView<S>,TreeTableRow<S>> value)
プロパティrowFactoryの値を設定します。
|
void |
setSelectionModel(TreeTableView.TreeTableViewSelectionModel<S> value)
MultipleSelectionModel をTreeTableViewで使用されるように設定します。 |
void |
setShowRoot(boolean value)
ルート
TreeItem がこのTreeTableView内で表示されるかどうかを指定します。 |
void |
setSortMode(TreeSortMode value)
プロパティsortModeの値を設定します。
|
void |
setSortPolicy(Callback<TreeTableView<S>,Boolean> callback)
プロパティsortPolicyの値を設定します。
|
void |
setTableMenuButtonVisible(boolean value)
プロパティtableMenuButtonVisibleの値を設定します。
|
void |
setTreeColumn(TreeTableColumn<S,?> value)
プロパティtreeColumnの値を設定します。
|
BooleanProperty |
showRootProperty()
TreeTableViewルート・ノードが表示可能であるかどうかを表すプロパティ。
|
void |
sort()
sortメソッドにより、TreeTableViewでそのソート・アルゴリズムが強制的に再実行されます。
|
ObjectProperty<TreeSortMode> |
sortModeProperty()
列を
sort order リストで指定する場合、このTreeTableViewのコンテンツをソートするときに使用するソート・モードを指定します。 |
ObjectProperty<Callback<TreeTableView<S>,Boolean>> |
sortPolicyProperty()
ソート・ポリシーでは、このTreeTableViewのソートの実行方法を指定します。
|
BooleanProperty |
tableMenuButtonVisibleProperty()
これは、TableView内の指定されたスペースをユーザーがクリックするとメニュー・ボタンを使用可能にするかどうかを制御します。ここには、この表の各TreeTableColumnのラジオ・メニュー・アイテムが表示されます。
|
ObjectProperty<TreeTableColumn<S,?>> |
treeColumnProperty()
公開ノードが内部に表示される列(つまり、矢印を使用した列)を表すプロパティ。
|
computeMaxHeight、computeMaxWidth、computeMinHeight、computeMinWidth、computePrefHeight、computePrefWidth、contextMenuProperty、executeAccessibleAction、getBaselineOffset、getContextMenu、getCssMetaData、getSkin、getTooltip、isResizable、setContextMenu、setSkin、setTooltip、skinProperty、tooltipProperty
backgroundProperty、borderProperty、cacheShapeProperty、centerShapeProperty、getBackground、getBorder、getHeight、getInsets、getMaxHeight、getMaxWidth、getMinHeight、getMinWidth、getOpaqueInsets、getPadding、getPrefHeight、getPrefWidth、getShape、getUserAgentStylesheet、getWidth、heightProperty、insetsProperty、isCacheShape、isCenterShape、isScaleShape、isSnapToPixel、layoutInArea、layoutInArea、layoutInArea、layoutInArea、maxHeight、maxHeightProperty、maxWidth、maxWidthProperty、minHeight、minHeightProperty、minWidth、minWidthProperty、opaqueInsetsProperty、paddingProperty、positionInArea、positionInArea、prefHeight、prefHeightProperty、prefWidth、prefWidthProperty、resize、scaleShapeProperty、setBackground、setBorder、setCacheShape、setCenterShape、setHeight、setMaxHeight、setMaxSize、setMaxWidth、setMinHeight、setMinSize、setMinWidth、setOpaqueInsets、setPadding、setPrefHeight、setPrefSize、setPrefWidth、setScaleShape、setShape、setSnapToPixel、setWidth、shapeProperty、snappedBottomInset、snappedLeftInset、snappedRightInset、snappedTopInset、snapPosition、snapSize、snapSpace、snapToPixelProperty、widthProperty
getChildren、getChildrenUnmodifiable、getManagedChildren、getStylesheets、isNeedsLayout、layout、lookup、needsLayoutProperty、requestLayout、requestParentLayout、setNeedsLayout、updateBounds
accessibleHelpProperty、accessibleRoleDescriptionProperty、accessibleRoleProperty、accessibleTextProperty、addEventFilter、addEventHandler、applyCss、autosize、blendModeProperty、boundsInLocalProperty、boundsInParentProperty、buildEventDispatchChain、cacheHintProperty、cacheProperty、clipProperty、computeAreaInScreen、contains、contains、cursorProperty、depthTestProperty、disabledProperty、disableProperty、effectiveNodeOrientationProperty、effectProperty、eventDispatcherProperty、fireEvent、focusedProperty、focusTraversableProperty、getAccessibleHelp、getAccessibleRole、getAccessibleRoleDescription、getAccessibleText、getBlendMode、getBoundsInLocal、getBoundsInParent、getCacheHint、getClip、getContentBias、getCursor、getDepthTest、getEffect、getEffectiveNodeOrientation、getEventDispatcher、getId、getInputMethodRequests、getLayoutBounds、getLayoutX、getLayoutY、getLocalToParentTransform、getLocalToSceneTransform、getNodeOrientation、getOnContextMenuRequested、getOnDragDetected、getOnDragDone、getOnDragDropped、getOnDragEntered、getOnDragExited、getOnDragOver、getOnInputMethodTextChanged、getOnKeyPressed、getOnKeyReleased、getOnKeyTyped、getOnMouseClicked、getOnMouseDragEntered、getOnMouseDragExited、getOnMouseDragged、getOnMouseDragOver、getOnMouseDragReleased、getOnMouseEntered、getOnMouseExited、getOnMouseMoved、getOnMousePressed、getOnMouseReleased、getOnRotate、getOnRotationFinished、getOnRotationStarted、getOnScroll、getOnScrollFinished、getOnScrollStarted、getOnSwipeDown、getOnSwipeLeft、getOnSwipeRight、getOnSwipeUp、getOnTouchMoved、getOnTouchPressed、getOnTouchReleased、getOnTouchStationary、getOnZoom、getOnZoomFinished、getOnZoomStarted、getOpacity、getParent、getProperties、getPseudoClassStates、getRotate、getRotationAxis、getScaleX、getScaleY、getScaleZ、getScene、getStyle、getStyleableParent、getStyleClass、getTransforms、getTranslateX、getTranslateY、getTranslateZ、getTypeSelector、getUserData、hasProperties、hoverProperty、idProperty、inputMethodRequestsProperty、intersects、intersects、isCache、isDisable、isDisabled、isFocused、isFocusTraversable、isHover、isManaged、isMouseTransparent、isPickOnBounds、isPressed、isVisible、layoutBoundsProperty、layoutXProperty、layoutYProperty、localToParent、localToParent、localToParent、localToParent、localToParent、localToParentTransformProperty、localToScene、localToScene、localToScene、localToScene、localToScene、localToScene、localToScene、localToScene、localToScene、localToScene、localToSceneTransformProperty、localToScreen、localToScreen、localToScreen、localToScreen、localToScreen、lookupAll、managedProperty、mouseTransparentProperty、nodeOrientationProperty、notifyAccessibleAttributeChanged、onContextMenuRequestedProperty、onDragDetectedProperty、onDragDoneProperty、onDragDroppedProperty、onDragEnteredProperty、onDragExitedProperty、onDragOverProperty、onInputMethodTextChangedProperty、onKeyPressedProperty、onKeyReleasedProperty、onKeyTypedProperty、onMouseClickedProperty、onMouseDragEnteredProperty、onMouseDragExitedProperty、onMouseDraggedProperty、onMouseDragOverProperty、onMouseDragReleasedProperty、onMouseEnteredProperty、onMouseExitedProperty、onMouseMovedProperty、onMousePressedProperty、onMouseReleasedProperty、onRotateProperty、onRotationFinishedProperty、onRotationStartedProperty、onScrollFinishedProperty、onScrollProperty、onScrollStartedProperty、onSwipeDownProperty、onSwipeLeftProperty、onSwipeRightProperty、onSwipeUpProperty、onTouchMovedProperty、onTouchPressedProperty、onTouchReleasedProperty、onTouchStationaryProperty、onZoomFinishedProperty、onZoomProperty、onZoomStartedProperty、opacityProperty、parentProperty、parentToLocal、parentToLocal、parentToLocal、parentToLocal、parentToLocal、pickOnBoundsProperty、pressedProperty、pseudoClassStateChanged、relocate、removeEventFilter、removeEventHandler、requestFocus、resizeRelocate、rotateProperty、rotationAxisProperty、scaleXProperty、scaleYProperty、scaleZProperty、sceneProperty、sceneToLocal、sceneToLocal、sceneToLocal、sceneToLocal、sceneToLocal、sceneToLocal、sceneToLocal、sceneToLocal、screenToLocal、screenToLocal、screenToLocal、setAccessibleHelp、setAccessibleRole、setAccessibleRoleDescription、setAccessibleText、setBlendMode、setCache、setCacheHint、setClip、setCursor、setDepthTest、setDisable、setDisabled、setEffect、setEventDispatcher、setEventHandler、setFocused、setFocusTraversable、setHover、setId、setInputMethodRequests、setLayoutX、setLayoutY、setManaged、setMouseTransparent、setNodeOrientation、setOnContextMenuRequested、setOnDragDetected、setOnDragDone、setOnDragDropped、setOnDragEntered、setOnDragExited、setOnDragOver、setOnInputMethodTextChanged、setOnKeyPressed、setOnKeyReleased、setOnKeyTyped、setOnMouseClicked、setOnMouseDragEntered、setOnMouseDragExited、setOnMouseDragged、setOnMouseDragOver、setOnMouseDragReleased、setOnMouseEntered、setOnMouseExited、setOnMouseMoved、setOnMousePressed、setOnMouseReleased、setOnRotate、setOnRotationFinished、setOnRotationStarted、setOnScroll、setOnScrollFinished、setOnScrollStarted、setOnSwipeDown、setOnSwipeLeft、setOnSwipeRight、setOnSwipeUp、setOnTouchMoved、setOnTouchPressed、setOnTouchReleased、setOnTouchStationary、setOnZoom、setOnZoomFinished、setOnZoomStarted、setOpacity、setPickOnBounds、setPressed、setRotate、setRotationAxis、setScaleX、setScaleY、setScaleZ、setStyle、setTranslateX、setTranslateY、setTranslateZ、setUserData、setVisible、snapshot、snapshot、startDragAndDrop、startFullDrag、styleProperty、toBack、toFront、toString、translateXProperty、translateYProperty、translateZProperty、usesMirroring、visibleProperty
public final ObjectProperty<TreeItem<S>> rootProperty
public final BooleanProperty showRootProperty
public final ObjectProperty<TreeTableColumn<S,?>> treeColumnProperty
visible leaf columns
リストに含まれていることを想定しています)。public final ObjectProperty<TreeTableView.TreeTableViewSelectionModel<S>> selectionModelProperty
public final ObjectProperty<TreeTableView.TreeTableViewFocusModel<S>> focusModelProperty
public final ReadOnlyIntegerProperty expandedItemCountProperty
TreeTableViewに現在表示できるツリー・ノードの数を表します。これは基本的に、すべての展開されたツリー・アイテムとその子の数です。
たとえば、ルート・ノードのみが表示されている場合は、expandedItemCountは1になります。ルートに3つの子があり、ルートが展開されていた場合は、値は4になります。
getExpandedItemCount()
public final BooleanProperty editableProperty
public final ReadOnlyObjectProperty<TreeTablePosition<S,?>> editingCellProperty
getEditingCell()
public final BooleanProperty tableMenuButtonVisibleProperty
public final ObjectProperty<Callback<TreeTableView.ResizeFeatures,Boolean>> columnResizePolicyProperty
UNCONSTRAINED_RESIZE_POLICY
とCONSTRAINED_RESIZE_POLICY
を使用できます。public final ObjectProperty<Callback<TreeTableView<S>,TreeTableRow<S>>> rowFactoryProperty
TreeTableRowはTableCellではないことに注意してください。TreeTableRowは単にTableCellのコンテナで、ほとんどの状況において、TreeTableRowよりも、カスタムのTableCellを作成することの方が多くなります。カスタムのTreeTableRowインスタンスを作成する主なユースケースでは、通常、なんらかの形式の複数の列の範囲を処理するためのサポートを導入します。
TreeTableColumnクラスのcellFactoryプロパティに適切な関数を割り当てて、列ごとにカスタムのTableCellインスタンスを作成できます。
public final ObjectProperty<Node> placeholderProperty
public final DoubleProperty fixedCellSizeProperty
CSSでこのプロパティを設定するには、-fx-fixed-cell-sizeプロパティを使用します。これを-fx-cell-sizeプロパティと混同しないでください。この2つのCSSプロパティ間の違いは、-fx-cell-sizeではすべてのセルを指定されたサイズに設定しますが、これが唯一のサイズとはならないことです(このため、可変セル・サイズが許容され、パフォーマンスの向上を妨げる可能性があります)。このため、パフォーマンスを重視する場合は、-fx-cell-sizeではなく-fx-fixed-cell-sizeを使用してください。CSSに両方のプロパティを指定した場合は、-fx-fixed-cell-sizeが優先されます。
getFixedCellSize()
、setFixedCellSize(double)
public final ObjectProperty<TreeSortMode> sortModeProperty
sort order
リストで指定する場合、このTreeTableViewのコンテンツをソートするときに使用するソート・モードを指定します。public final ReadOnlyObjectProperty<Comparator<TreeItem<S>>> comparatorProperty
sort order
リストの現在の状態を表す読取り専用プロパティです。ソート順序のリストには、プログラムによって、またはヘッダー自体をユーザーがクリックしてそれに追加された列が含まれます。getComparator()
public final ObjectProperty<Callback<TreeTableView<S>,Boolean>> sortPolicyProperty
TreeTableViewには、前述のとおり、単にインプレースでツリー階層のソートを試行するdefault sort policy
が付属しています。
sort
メソッドのオーバーライドではなく、かわりに別のソート・ポリシーを指定することをお薦めします。
public ObjectProperty<EventHandler<SortEvent<TreeTableView<S>>>> onSortProperty
public ObjectProperty<EventHandler<ScrollToEvent<Integer>>> onScrollToProperty
scrollTo(int)
を使用してビューのインデックスをスクロールするリクエストがある場合に呼び出されます。public ObjectProperty<EventHandler<ScrollToEvent<TreeTableColumn<S,?>>>> onScrollToColumnProperty
scrollToColumn(TreeTableColumn)
またはscrollToColumnIndex(int)
を使用して、ビューの列をスクロールするリクエストがある場合に呼び出されます。public static final Callback<TreeTableView.ResizeFeatures,Boolean> UNCONSTRAINED_RESIZE_POLICY
単に、指定された列を指定されたデルタでサイズ変更し、(指定された列の右側にある)他のすべての列を(デルタが正の場合には)右側に、または(デルタが負の場合には)左側にシフトする、非常に単純なサイズ変更ポリシー。
また、これは、新しいスペースを共有することによって、または削除されたスペースをすべての直下の子の列間で均等に差し引くことによって、列をネストしているケースも処理します。直下の子はそれ自体をネストでき、次にそれらがその子に対してこのポリシーを使用します。
public static final Callback<TreeTableView.ResizeFeatures,Boolean> CONSTRAINED_RESIZE_POLICY
この表内の表示可能なすべてのリーフ列の幅を合計すると、この表自体の幅と等しくなるようにする単純なポリシー。
ユーザーがこのポリシーで列の幅をサイズ変更すると、表で右側の列の幅が自動的に調整されます。ユーザーが列の幅を拡大すると、表で右端の列の幅がその最小幅に達するまでそれが縮小されます。次に、右から2番目の列の幅がその最小幅に達するまでそれが縮小されます(以下同様)。すべての右側の列が最小サイズに達すると、ユーザーはサイズ変更する列のサイズをそれ以上拡大できません。
public static final Callback<TreeTableView,Boolean> DEFAULT_SORT_POLICY
sort policy
。ソート・ポリシーは、TreeTableViewを唯一の引数として受け入れて、ソートが成功したかどうかを表すブールのレスポンスを期待する単純なCallback
です。ブールのtrueのレスポンスは成功を表し、false (またはnull)のレスポンスは失敗を表すとみなされます。public TreeTableView()
その他のプロパティのデフォルトの状態の詳細は、TreeTableView
クラスのドキュメントを参照してください。
public TreeTableView(TreeItem<S> root)
その他のプロパティのデフォルトの状態の詳細は、TreeTableView
クラスのドキュメントを参照してください。
root
- このTreeTableViewのルートとなるノード。public static <S> EventType<TreeTableView.EditEvent<S>> editAnyEvent()
editStartEvent()
、editCommitEvent()
およびeditCancelEvent()
)の親タイプです。public static <S> EventType<TreeTableView.EditEvent<S>> editStartEvent()
public static <S> EventType<TreeTableView.EditEvent<S>> editCancelEvent()
public static <S> EventType<TreeTableView.EditEvent<S>> editCommitEvent()
@Deprecated public static int getNodeLevel(TreeItem<?> node)
getTreeItemLevel(TreeItem)
を使用することです。TreeItem.getParent()
を再帰的に呼び出すことができる回数に基づいて、特定のTreeItemのインデントのレベル数を返します。TreeItemに親セットがない場合は、返される値はゼロになります。getParent()が再帰的に呼び出されるたびに、返される値が1つずつ増えていきます。
重要な注意: このメソッドはルート・ノードを考慮しないため、それは非推奨です。これは、ルート・ノードに親がある場合に、このメソッドがTreeTableViewコントロールのルート・ノードを超えて繰り返されることを意味します。このことが重要である場合は、かわりにgetTreeItemLevel(TreeItem)
を呼び出します。
node
- レベルが必要なTreeItem。public final void setRoot(TreeItem<S> value)
TreeItem
クラス・レベルのドキュメントを参照してください。value
- TreeTableViewのルートに配置されるTreeItem
。public final TreeItem<S> getRoot()
public final ObjectProperty<TreeItem<S>> rootProperty()
public final void setShowRoot(boolean value)
TreeItem
がこのTreeTableView内で表示されるかどうかを指定します。value
- trueの場合はルートTreeItemが表示され、falseの場合はそれが非表示になります。public final boolean isShowRoot()
public final BooleanProperty showRootProperty()
public final ObjectProperty<TreeTableColumn<S,?>> treeColumnProperty()
visible leaf columns
リストに含まれていることを想定しています)。public final void setTreeColumn(TreeTableColumn<S,?> value)
visible leaf columns
リストに含まれていることを想定しています)。public final TreeTableColumn<S,?> getTreeColumn()
visible leaf columns
リストに含まれていることを想定しています)。public final void setSelectionModel(TreeTableView.TreeTableViewSelectionModel<S> value)
MultipleSelectionModel
をTreeTableViewで使用されるように設定します。MultipleSelectionModel
を必要とするTreeTableViewでも、単一選択のみが許可されるように設定できます(詳細は、MultipleSelectionModel.setSelectionMode(javafx.scene.control.SelectionMode)
を参照)。public final TreeTableView.TreeTableViewSelectionModel<S> getSelectionModel()
public final ObjectProperty<TreeTableView.TreeTableViewSelectionModel<S>> selectionModelProperty()
public final void setFocusModel(TreeTableView.TreeTableViewFocusModel<S> value)
FocusModel
をTreeTableViewで使用されるように設定します。public final TreeTableView.TreeTableViewFocusModel<S> getFocusModel()
FocusModel
を返します。public final ObjectProperty<TreeTableView.TreeTableViewFocusModel<S>> focusModelProperty()
public final ReadOnlyIntegerProperty expandedItemCountProperty()
TreeTableViewに現在表示できるツリー・ノードの数を表します。これは基本的に、すべての展開されたツリー・アイテムとその子の数です。
たとえば、ルート・ノードのみが表示されている場合は、expandedItemCountは1になります。ルートに3つの子があり、ルートが展開されていた場合は、値は4になります。
getExpandedItemCount()
public final int getExpandedItemCount()
TreeTableViewに現在表示できるツリー・ノードの数を表します。これは基本的に、すべての展開されたツリー・アイテムとその子の数です。
たとえば、ルート・ノードのみが表示されている場合は、expandedItemCountは1になります。ルートに3つの子があり、ルートが展開されていた場合は、値は4になります。
public final void setEditable(boolean value)
public final boolean isEditable()
public final BooleanProperty editableProperty()
public final TreeTablePosition<S,?> getEditingCell()
public final ReadOnlyObjectProperty<TreeTablePosition<S,?>> editingCellProperty()
getEditingCell()
public final BooleanProperty tableMenuButtonVisibleProperty()
public final void setTableMenuButtonVisible(boolean value)
public final boolean isTableMenuButtonVisible()
public final void setColumnResizePolicy(Callback<TreeTableView.ResizeFeatures,Boolean> callback)
UNCONSTRAINED_RESIZE_POLICY
とCONSTRAINED_RESIZE_POLICY
を使用できます。public final Callback<TreeTableView.ResizeFeatures,Boolean> getColumnResizePolicy()
UNCONSTRAINED_RESIZE_POLICY
とCONSTRAINED_RESIZE_POLICY
を使用できます。public final ObjectProperty<Callback<TreeTableView.ResizeFeatures,Boolean>> columnResizePolicyProperty()
UNCONSTRAINED_RESIZE_POLICY
とCONSTRAINED_RESIZE_POLICY
を使用できます。public final ObjectProperty<Callback<TreeTableView<S>,TreeTableRow<S>>> rowFactoryProperty()
TreeTableRowはTableCellではないことに注意してください。TreeTableRowは単にTableCellのコンテナで、ほとんどの状況において、TreeTableRowよりも、カスタムのTableCellを作成することの方が多くなります。カスタムのTreeTableRowインスタンスを作成する主なユースケースでは、通常、なんらかの形式の複数の列の範囲を処理するためのサポートを導入します。
TreeTableColumnクラスのcellFactoryプロパティに適切な関数を割り当てて、列ごとにカスタムのTableCellインスタンスを作成できます。
public final void setRowFactory(Callback<TreeTableView<S>,TreeTableRow<S>> value)
TreeTableRowはTableCellではないことに注意してください。TreeTableRowは単にTableCellのコンテナで、ほとんどの状況において、TreeTableRowよりも、カスタムのTableCellを作成することの方が多くなります。カスタムのTreeTableRowインスタンスを作成する主なユースケースでは、通常、なんらかの形式の複数の列の範囲を処理するためのサポートを導入します。
TreeTableColumnクラスのcellFactoryプロパティに適切な関数を割り当てて、列ごとにカスタムのTableCellインスタンスを作成できます。
public final Callback<TreeTableView<S>,TreeTableRow<S>> getRowFactory()
TreeTableRowはTableCellではないことに注意してください。TreeTableRowは単にTableCellのコンテナで、ほとんどの状況において、TreeTableRowよりも、カスタムのTableCellを作成することの方が多くなります。カスタムのTreeTableRowインスタンスを作成する主なユースケースでは、通常、なんらかの形式の複数の列の範囲を処理するためのサポートを導入します。
TreeTableColumnクラスのcellFactoryプロパティに適切な関数を割り当てて、列ごとにカスタムのTableCellインスタンスを作成できます。
public final ObjectProperty<Node> placeholderProperty()
public final void setPlaceholder(Node value)
public final Node getPlaceholder()
public final void setFixedCellSize(double value)
value
- 新しい固定セル・サイズ値。無効にするには、ゼロ以下の値(または、Region.USE_COMPUTED_SIZE)にします。public final double getFixedCellSize()
public final DoubleProperty fixedCellSizeProperty()
CSSでこのプロパティを設定するには、-fx-fixed-cell-sizeプロパティを使用します。これを-fx-cell-sizeプロパティと混同しないでください。この2つのCSSプロパティ間の違いは、-fx-cell-sizeではすべてのセルを指定されたサイズに設定しますが、これが唯一のサイズとはならないことです(このため、可変セル・サイズが許容され、パフォーマンスの向上を妨げる可能性があります)。このため、パフォーマンスを重視する場合は、-fx-cell-sizeではなく-fx-fixed-cell-sizeを使用してください。CSSに両方のプロパティを指定した場合は、-fx-fixed-cell-sizeが優先されます。
getFixedCellSize()
、setFixedCellSize(double)
public final ObjectProperty<TreeSortMode> sortModeProperty()
sort order
リストで指定する場合、このTreeTableViewのコンテンツをソートするときに使用するソート・モードを指定します。public final void setSortMode(TreeSortMode value)
sort order
リストで指定する場合、このTreeTableViewのコンテンツをソートするときに使用するソート・モードを指定します。public final TreeSortMode getSortMode()
sort order
リストで指定する場合、このTreeTableViewのコンテンツをソートするときに使用するソート・モードを指定します。public final Comparator<TreeItem<S>> getComparator()
sort order
リストの現在の状態を表す読取り専用プロパティです。ソート順序のリストには、プログラムによって、またはヘッダー自体をユーザーがクリックしてそれに追加された列が含まれます。public final ReadOnlyObjectProperty<Comparator<TreeItem<S>>> comparatorProperty()
sort order
リストの現在の状態を表す読取り専用プロパティです。ソート順序のリストには、プログラムによって、またはヘッダー自体をユーザーがクリックしてそれに追加された列が含まれます。getComparator()
public final void setSortPolicy(Callback<TreeTableView<S>,Boolean> callback)
TreeTableViewには、前述のとおり、単にインプレースでツリー階層のソートを試行するdefault sort policy
が付属しています。
sort
メソッドのオーバーライドではなく、かわりに別のソート・ポリシーを指定することをお薦めします。
public final Callback<TreeTableView<S>,Boolean> getSortPolicy()
TreeTableViewには、前述のとおり、単にインプレースでツリー階層のソートを試行するdefault sort policy
が付属しています。
sort
メソッドのオーバーライドではなく、かわりに別のソート・ポリシーを指定することをお薦めします。
public final ObjectProperty<Callback<TreeTableView<S>,Boolean>> sortPolicyProperty()
TreeTableViewには、前述のとおり、単にインプレースでツリー階層のソートを試行するdefault sort policy
が付属しています。
sort
メソッドのオーバーライドではなく、かわりに別のソート・ポリシーを指定することをお薦めします。
public void setOnSort(EventHandler<SortEvent<TreeTableView<S>>> value)
public EventHandler<SortEvent<TreeTableView<S>>> getOnSort()
public ObjectProperty<EventHandler<SortEvent<TreeTableView<S>>>> onSortProperty()
protected void layoutChildren()
Parent
の子をレイアウトするレイアウト・パス中に起動されます。デフォルトでは、管理対象のサイズ変更可能なコンテンツのサイズをその優先サイズに合せて設定するのみで、ノードの配置は行われません。
サブクラスは必要に応じてこの関数をオーバーライドし、コンテンツをレイアウトする必要があります。
layoutChildren
、クラス: Control
public void scrollTo(int index)
index
- ユーザーに表示されるようにするインデックス。0以上で、TreeTableViewの表示可能なアイテムの数未満であることを想定しています。public void setOnScrollTo(EventHandler<ScrollToEvent<Integer>> value)
scrollTo(int)
を使用してビューのインデックスをスクロールするリクエストがある場合に呼び出されます。public EventHandler<ScrollToEvent<Integer>> getOnScrollTo()
scrollTo(int)
を使用してビューのインデックスをスクロールするリクエストがある場合に呼び出されます。public ObjectProperty<EventHandler<ScrollToEvent<Integer>>> onScrollToProperty()
scrollTo(int)
を使用してビューのインデックスをスクロールするリクエストがある場合に呼び出されます。public void scrollToColumn(TreeTableColumn<S,?> column)
column
- ユーザーに表示される列。public void scrollToColumnIndex(int columnIndex)
columnIndex
- ユーザーに表示される列のインデックス。public void setOnScrollToColumn(EventHandler<ScrollToEvent<TreeTableColumn<S,?>>> value)
scrollToColumn(TreeTableColumn)
またはscrollToColumnIndex(int)
を使用して、ビューの列をスクロールするリクエストがある場合に呼び出されます。public EventHandler<ScrollToEvent<TreeTableColumn<S,?>>> getOnScrollToColumn()
scrollToColumn(TreeTableColumn)
またはscrollToColumnIndex(int)
を使用して、ビューの列をスクロールするリクエストがある場合に呼び出されます。public ObjectProperty<EventHandler<ScrollToEvent<TreeTableColumn<S,?>>>> onScrollToColumnProperty()
scrollToColumn(TreeTableColumn)
またはscrollToColumnIndex(int)
を使用して、ビューの列をスクロールするリクエストがある場合に呼び出されます。public int getRow(TreeItem<S> item)
item
- インデックスが検索されるTreeItem。public TreeItem<S> getTreeItem(int row)
row
- 検索されているTreeItemのインデックス。public int getTreeItemLevel(TreeItem<?> node)
node
- レベルが必要なTreeItem。public final ObservableList<TreeTableColumn<S,?>> getColumns()
注意: TableViewにデータを表示するには、このObservableListに1つ以上のTreeTableColumnが必要です。
public final ObservableList<TreeTableColumn<S,?>> getSortOrder()
TreeTableColumn
インスタンスのソート順序を定義します。空のsortOrderリストは、TableViewにソートが適用されていないことを意味します。sortOrderリスト内に1つのTreeTableColumnがある場合は、このTreeTableColumnのsortType
とcomparator
のプロパティを使用してTableViewがソートされます(TreeTableColumn.sortable
がtrueであることを想定しています)。sortOrderリストに複数のTreeTableColumnインスタンスが含まれる場合は、まず最初のTreeTableColumnのプロパティに基づいて、TableViewがソートされます。2つの要素が等しいとみなされる場合は、リストの2つ目のTreeTableColumnが使用されて順序が決定します。これは、必要に応じてすべてのTreeTableColumnコンパレータからの結果が考慮されるまで繰り返されます。public boolean resizeColumn(TreeTableColumn<S,?> column, double delta)
public void edit(int row, TreeTableColumn<S,?> column)
public ObservableList<TreeTableColumn<S,?>> getVisibleLeafColumns()
public int getVisibleLeafIndex(TreeTableColumn<S,?> column)
public TreeTableColumn<S,?> getVisibleLeafColumn(int column)
public void sort()
sort order
、sort policy
またはTreeTableColumnのsort type
プロパティの状態が変更されたときに自動的に呼び出されるため、多くの場合、それを直接呼び出す必要はありません。つまり、このメソッドは、外部のものが変更されソートが必要な場合にのみ、直接呼び出される必要があります。public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public List<CssMetaData<? extends Styleable,?>> getControlCssMetaData()
getControlCssMetaData
、クラス: Control
protected Skin<?> createDefaultSkin()
-fx-skin
を介してスキンが提供されていない場合にコントロール用のスキンを作成するために、またはsetSkin(...)
を使用してサブクラスで明示的に設定するために呼び出されます。createDefaultSkin
、クラス: Control
public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)
queryAccessibleAttribute
、クラス: Control
attribute
- リクエストされた属性parameters
- オプションのパラメータ・リストAccessibleAttribute
Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.