Verified Owner
Top Inners Fields Constructors Methods
org.jabref.http.server.cayw.gui

public Class SearchResultContainer

extends ListView<CAYWEntry>
Class Inheritance
Imports
java.util.Arrays, javafx.beans.binding.Bindings, javafx.collections.ObservableList, javafx.scene.control.ListCell, .ListView, .Tooltip, javafx.scene.layout.VBox, javafx.scene.text.Text, org.jabref.logic.os.OS, org.jabref.logic.util.strings.StringUtil

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final double
private ObservableList<CAYWEntry>
private static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
Inherited from javafx.scene.control.ListView:
cellFactoryPropertycreateDefaultSkinediteditablePropertyeditAnyEventeditCancelEventeditCommitEventeditingIndexPropertyeditStartEventfixedCellSizePropertyfocusModelPropertygetCellFactorygetClassCssMetaDatagetControlCssMetaDatagetEditingIndexgetFixedCellSizegetFocusModelgetItemsgetOnEditCancelgetOnEditCommitgetOnEditStartgetOnScrollTogetOrientationgetPlaceholdergetSelectionModelisEditableitemsPropertyonEditCancelPropertyonEditCommitPropertyonEditStartPropertyonScrollToPropertyorientationPropertyplaceholderPropertyqueryAccessibleAttributerefreshscrollToscrollToselectionModelPropertysetCellFactorysetEditablesetFixedCellSizesetFocusModelsetItemssetOnEditCancelsetOnEditCommitsetOnEditStartsetOnScrollTosetOrientationsetPlaceholdersetSelectionModel

Field Detail

ESTIMATED_CHARS_PER_LINEback to summary
private static final int ESTIMATED_CHARS_PER_LINE
MAX_LINESback to summary
private static final int MAX_LINES
PREF_WIDTHback to summary
private static final double PREF_WIDTH
selectedEntriesback to summary
private ObservableList<CAYWEntry> selectedEntries
TOOLTIP_WIDTHback to summary
private static final int TOOLTIP_WIDTH

Constructor Detail

SearchResultContainerback to summary
public SearchResultContainer(ObservableList<CAYWEntry> entries, ObservableList<CAYWEntry> selectedEntries)

Method Detail

setupback to summary
private void setup()
org.jabref.http.server.cayw.gui back to summary

private Class SearchResultContainer.SearchResultCell

extends ListCell<CAYWEntry>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final VBox
private final Text
private final Text
private final Tooltip

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private String
protected void
updateItem(CAYWEntry item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell.

Inherited from javafx.scene.control.ListCell:
cancelEditcommitEditcreateDefaultSkinexecuteAccessibleActiongetListViewlayoutChildrenlistViewPropertyqueryAccessibleAttributestartEditupdateListView

Field Detail

contentback to summary
private final VBox content
descriptionTextback to summary
private final Text descriptionText
labelTextback to summary
private final Text labelText
tooltipback to summary
private final Tooltip tooltip

Hides javafx.scene.control.Control.tooltip.

Constructor Detail

SearchResultCellback to summary
public SearchResultCell()

Method Detail

truncateToThreeLinesback to summary
private String truncateToThreeLines(String text)
updateItemback to summary
protected void updateItem(CAYWEntry item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

Doc from javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell. To clarify, developers should never call this method in their code (they should leave it up to the UI control, such as the javafx.scene.control.ListView control) to call this method. However, the purpose of having the updateItem method is so that developers, when specifying custom cell factories (again, like the ListView cell factory), the updateItem method can be overridden to allow for complete customisation of the cell.

It is very important that subclasses of Cell override the updateItem method properly, as failure to do so will lead to issues such as blank cells or cells with unexpected content appearing within them. Here is an example of how to properly override the updateItem method:

protected void updateItem(T item, boolean empty) {
    super.updateItem(item, empty);

    if (empty || item == null) {
        setText(null);
        setGraphic(null);
    } else {
        setText(item.toString());
    }
}

Note in this code sample two important points:

  1. We call the super.updateItem(T, boolean) method. If this is not done, the item and empty properties are not correctly set, and you are likely to end up with graphical issues.
  2. We test for the empty condition, and if true, we set the text and graphic properties to null. If we do not do this, it is almost guaranteed that end users will see graphical artifacts in cells unexpectedly.
Annotations
@Override