Verified Owner
Top Inners Fields Constructors Methods
org.jabref.gui.commonfxcontrols

public Class CitationKeyPatternSuggestionCell

extends TextFieldTableCell<CitationKeyPatternsPanelItemModel, String>
Class Inheritance
Imports
java.util.ArrayList, .List, .Map, java.util.stream.Collectors, javafx.application.Platform, javafx.geometry.Bounds, javafx.scene.control.ContextMenu, .CustomMenuItem, .Label, .Menu, .MenuItem, .TextField, javafx.scene.control.cell.TextFieldTableCell, javafx.stage.Window, org.jabref.logic.citationkeypattern.CitationKeyPattern, org.jabref.logic.l10n.Localization

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final CitationKeyPatternSuggestionCell.CitationKeyPatternSuggestionTextField

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
cancelEdit()

Overrides javafx.scene.control.cell.TextFieldTableCell.cancelEdit.

Cancels an edit to the value of the cell.

public void
commitEdit(String newValue)

Overrides javafx.scene.control.TableCell.commitEdit.

Commits an edit to the value of the cell.

public void
startEdit()

Overrides javafx.scene.control.cell.TextFieldTableCell.startEdit.

Starts an edit to the value of the cell.

public void
updateItem(String item, boolean empty)

Overrides javafx.scene.control.cell.TextFieldTableCell.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.cell.TextFieldTableCell:
converterPropertyforTableColumnforTableColumngetConvertersetConverter

Field Detail

searchFieldback to summary
private final CitationKeyPatternSuggestionCell.CitationKeyPatternSuggestionTextField searchField

Constructor Detail

CitationKeyPatternSuggestionCellback to summary
public CitationKeyPatternSuggestionCell(List<String> citationKeyPatterns)

Method Detail

cancelEditback to summary
public void cancelEdit()

Overrides javafx.scene.control.cell.TextFieldTableCell.cancelEdit.

Doc from javafx.scene.control.cell.TextFieldTableCell.cancelEdit.

Cancels an edit to the value of the cell. Call this function to transition from an editing state into a non-editing state, without saving any user input.

Annotations
@Override
commitEditback to summary
public void commitEdit(String newValue)

Overrides javafx.scene.control.TableCell.commitEdit.

Doc from javafx.scene.control.TableCell.commitEdit.

Commits an edit to the value of the cell. Call this function when appropriate (based on the user interaction requirements of your cell editing user interface) to do two things:

  1. Fire the appropriate events back to the backing UI control (e.g., ListView). This will begin the process of pushing this edit back to the relevant data source / property (although it does not guarantee that this will be successful - that is dependent upon the specific edit commit handler being used). Refer to the UI control class javadoc for more detail.
  2. Begin the transition from an editing state into a non-editing state.

In general there is no need to override this method in custom cell implementations - it should be sufficient to simply call this method when appropriate (e.g., when the user pressed the Enter key, you may do something like cell.commitEdit(converter.fromString(textField.getText()));

Annotations
@Override
startEditback to summary
public void startEdit()

Overrides javafx.scene.control.cell.TextFieldTableCell.startEdit.

Doc from javafx.scene.control.cell.TextFieldTableCell.startEdit.

Starts an edit to the value of the cell. Call this function to transition from a non-editing state into an editing state, if the cell is editable. If this cell is already in an editing state, it will stay in it.

Annotations
@Override
updateItemback to summary
public void updateItem(String item, boolean empty)

Overrides javafx.scene.control.cell.TextFieldTableCell.updateItem.

Doc from javafx.scene.control.cell.TextFieldTableCell.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
org.jabref.gui.commonfxcontrols back to summary

pack-priv Class CitationKeyPatternSuggestionCell.CitationKeyPatternSuggestionTextField

extends TextField
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final List<String>
private int
private final ContextMenu
Inherited from javafx.scene.control.TextField:
DEFAULT_PREF_COLUMN_COUNT

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private Menu
public static double
private void
populatePopup(List<String> searchResult)

private void
Inherited from javafx.scene.control.TextField:
alignmentPropertycreateDefaultSkingetAlignmentgetCharactersgetClassCssMetaDatagetControlCssMetaDatagetOnActiongetPrefColumnCountonActionPropertyprefColumnCountPropertysetAlignmentsetOnActionsetPrefColumnCount

Field Detail

citationKeyPatternsback to summary
private final List<String> citationKeyPatterns
heightOfMenuItemback to summary
private int heightOfMenuItem
suggestionsListback to summary
private final ContextMenu suggestionsList

Constructor Detail

CitationKeyPatternSuggestionTextFieldback to summary
public CitationKeyPatternSuggestionTextField(List<String> citationKeyPatterns)

Method Detail

createPatternsSubMenuback to summary
private Menu createPatternsSubMenu()
getAvailableSpaceBelowback to summary
public static double getAvailableSpaceBelow(TextField textField)
populatePopupback to summary
private void populatePopup(List<String> searchResult)
setListenerback to summary
private void setListener()