Fix initialization of text consumers & action handlers on sites list.
This commit is contained in:
parent
ec9c55ec4d
commit
9a04c28054
@ -87,8 +87,11 @@ public class DocumentModel implements Selectable<String, DocumentModel> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocumentModel selection(@Nullable final String selectedItem, @Nullable final Consumer<String> selectionConsumer) {
|
public DocumentModel selection(@Nullable final String selectedItem, @Nullable final Consumer<String> selectionConsumer) {
|
||||||
selection( selectionConsumer );
|
|
||||||
setText( selectedItem );
|
setText( selectedItem );
|
||||||
|
selection( selectionConsumer );
|
||||||
|
|
||||||
|
if (selectionConsumer != null)
|
||||||
|
selectionConsumer.accept( selectedItem );
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -542,6 +542,10 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener,
|
|||||||
add( Components.scrollPane( sitesList = Components.list(
|
add( Components.scrollPane( sitesList = Components.list(
|
||||||
sitesModel = new CollectionListModel<MPQuery.Result<? extends MPSite<?>>>().selection( this::showSiteItem ),
|
sitesModel = new CollectionListModel<MPQuery.Result<? extends MPSite<?>>>().selection( this::showSiteItem ),
|
||||||
this::getSiteDescription ) ) );
|
this::getSiteDescription ) ) );
|
||||||
|
sitesList.registerKeyboardAction( this::useSite, KeyStroke.getKeyStroke( KeyEvent.VK_ENTER, 0 ),
|
||||||
|
JComponent.WHEN_FOCUSED );
|
||||||
|
sitesList.registerKeyboardAction( this::useSite, KeyStroke.getKeyStroke( KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK ),
|
||||||
|
JComponent.WHEN_FOCUSED );
|
||||||
add( Components.strut() );
|
add( Components.strut() );
|
||||||
|
|
||||||
add( Components.label( strf(
|
add( Components.label( strf(
|
||||||
@ -1015,9 +1019,7 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener,
|
|||||||
if (siteItems.stream().noneMatch( MPQuery.Result::isExact ))
|
if (siteItems.stream().noneMatch( MPQuery.Result::isExact ))
|
||||||
siteItems.add( MPQuery.Result.allOf( new MPNewSite( user, query.getQuery() ), query.getQuery() ) );
|
siteItems.add( MPQuery.Result.allOf( new MPNewSite( user, query.getQuery() ), query.getQuery() ) );
|
||||||
|
|
||||||
Res.ui( () -> {
|
Res.ui( () -> sitesModel.set( siteItems ) );
|
||||||
sitesModel.set( siteItems );
|
|
||||||
} );
|
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user