Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow selecting entries on create #98

Open
wants to merge 2 commits into
base: testing/fabric/1.19.x/early_port_3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ public void refreshFilteredEntries()
{
this.reAddFilteredEntries();
this.onEntriesRefreshed();
this.selectEntries();
this.notifyListWidgetFactory();
this.reCreateListEntryWidgets();
}
Expand All @@ -689,6 +690,10 @@ protected void reAddFilteredEntries()
{
}

protected void selectEntries()
{
}

protected void notifyListWidgetFactory()
{
if (this.listEntryWidgetFactory != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class DataListEntrySelectionHandler<DATATYPE>
protected final Supplier<List<DATATYPE>> dataListSupplier;

@Nullable protected Set<DATATYPE> selectedEntries;
@Nullable protected Collection<DATATYPE> selectedEntriesOnCreate;
@Nullable protected SelectionListener<DATATYPE> selectionListener;
@Nullable protected DATATYPE lastSelectedEntry;
protected boolean allowMultiSelection;
Expand Down Expand Up @@ -338,4 +339,18 @@ protected Set<DATATYPE> rebuildSelectedEntries()

return selectedEntries;
}

protected void selectEntries()
{
if (this.selectedEntriesOnCreate != null)
{
this.setSelectedEntries(this.selectedEntriesOnCreate);
this.selectedEntriesOnCreate = null;
}
}

public void setEntriesOnCreate(Collection<DATATYPE> entries)
{
this.selectedEntriesOnCreate = entries;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,14 @@ protected void reAddFilteredEntries()
}
}

protected void selectEntries()
{
if (this.selectionHandler != null)
{
this.selectionHandler.selectEntries();
}
}

protected void addNonFilteredContents(List<DATATYPE> entries)
{
this.filteredDataList.addAll(entries);
Expand Down