Skip to content

Commit

Permalink
No reordering of items in the maintable via drag and drop
Browse files Browse the repository at this point in the history
Rename getEntriesFiltered to better distinguish it
  • Loading branch information
Siedlerchr committed Feb 23, 2018
1 parent 9eee5ae commit 9989f9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
16 changes: 4 additions & 12 deletions src/main/java/org/jabref/gui/maintable/MainTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import javax.swing.undo.UndoManager;

import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableRow;
Expand Down Expand Up @@ -111,7 +110,7 @@ public MainTable(MainTableDataModel model, JabRefFrame frame,
}
this.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

this.setItems(model.getEntriesFiltered());
this.setItems(model.getEntriesFilteredAndSorted());

// Enable sorting
model.bindComparator(this.comparatorProperty());
Expand Down Expand Up @@ -317,14 +316,7 @@ private void handleOnDragDropped(BibEntryTableViewModel originalItem, DragEvent

boolean success = false;

ObservableList<BibEntryTableViewModel> items = this.itemsProperty().get();

if (LocalDragboard.INSTANCE.hasType(DragAndDropDataFormats.BIBENTRY_LIST_CLASS)) {
List<BibEntry> parsedEntries = LocalDragboard.INSTANCE.getValue(DragAndDropDataFormats.BIBENTRY_LIST_CLASS);
success = true;
}
if (event.getDragboard().hasContent(DataFormat.FILES)) {

List<File> files = event.getDragboard().getFiles();
System.out.println(files);
}
Expand Down Expand Up @@ -439,7 +431,7 @@ else if (column == 0) {
*/

public BibEntry getEntryAt(int row) {
return model.getEntriesFiltered().get(row).getEntry();
return model.getEntriesFilteredAndSorted().get(row).getEntry();
}

public List<BibEntry> getSelectedEntries() {
Expand Down Expand Up @@ -573,7 +565,7 @@ private CellRendererMode getCellStatus(int row, int col, boolean checkResolved)
*/

public Optional<BibEntryTableViewModel> findEntry(BibEntry entry) {
return model.getEntriesFiltered().stream()
return model.getEntriesFilteredAndSorted().stream()
.filter(viewModel -> viewModel.getEntry().equals(entry))
.findFirst();
}
Expand Down Expand Up @@ -603,7 +595,7 @@ private int isMarked(int row) {

private Optional<BibEntry> getBibEntry(int row) {
try {
return Optional.of(model.getEntriesFiltered().get(row).getEntry());
return Optional.of(model.getEntriesFilteredAndSorted().get(row).getEntry());
} catch (IndexOutOfBoundsException e) {
return Optional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private Optional<MatcherSet> createGroupMatcher(List<GroupTreeNode> selectedGrou
return Optional.of(searchRules);
}

public ObservableList<BibEntryTableViewModel> getEntriesFiltered() {
public ObservableList<BibEntryTableViewModel> getEntriesFilteredAndSorted() {
return entriesSorted;
}

Expand Down

0 comments on commit 9989f9e

Please sign in to comment.