diff --git a/changelog.txt b/changelog.txt index cc5d4425ca..bbdc746528 100644 --- a/changelog.txt +++ b/changelog.txt @@ -9848,4 +9848,5 @@ SelectionProvider renamed Selector and moved to SelectionDialogBuilder, select() parameter now JComponent dialogOwner EntitySearchModel.limit() added, along with builder method and configuration value EntitySearchField now displays a message in case the search result limit has been reached - EntitySearchField.Builder.limit() convenience method added \ No newline at end of file + EntitySearchField.Builder.limit() convenience method added + EntitySearchField, limit added to settings panel \ No newline at end of file diff --git a/swing/framework-ui/src/main/java/is/codion/swing/framework/ui/component/EntitySearchField.java b/swing/framework-ui/src/main/java/is/codion/swing/framework/ui/component/EntitySearchField.java index 302a522165..b5ec7971a1 100644 --- a/swing/framework-ui/src/main/java/is/codion/swing/framework/ui/component/EntitySearchField.java +++ b/swing/framework-ui/src/main/java/is/codion/swing/framework/ui/component/EntitySearchField.java @@ -83,6 +83,7 @@ import static is.codion.swing.common.ui.Colors.darker; import static is.codion.swing.common.ui.Utilities.linkToEnabledState; import static is.codion.swing.common.ui.border.Borders.emptyBorder; +import static is.codion.swing.common.ui.component.Components.gridLayoutPanel; import static is.codion.swing.common.ui.component.Components.menu; import static is.codion.swing.common.ui.component.text.TextComponents.selectAllOnFocusGained; import static is.codion.swing.common.ui.layout.Layouts.borderLayout; @@ -476,9 +477,7 @@ private void initializeUI(EntitySearchModel searchModel) { setLayout(borderLayout()); setBorder(emptyBorder()); add(createSearchColumnPanel(searchModel), BorderLayout.CENTER); - if (!searchModel.singleSelection()) { - add(createSeparatorPanel(searchModel), BorderLayout.SOUTH); - } + add(createSouthPanel(searchModel), BorderLayout.SOUTH); } private static JPanel createSearchColumnPanel(EntitySearchModel searchModel) { @@ -503,17 +502,39 @@ private static JPanel createSearchColumnPanel(EntitySearchModel searchModel) { .build(); } + private static JPanel createSouthPanel(EntitySearchModel searchModel) { + PanelBuilder southPanelBuilder = gridLayoutPanel(1, 0) + .border(BorderFactory.createTitledBorder("")); + if (!searchModel.singleSelection()) { + southPanelBuilder.add(createSeparatorPanel(searchModel)); + } + else { + southPanelBuilder.add(new JLabel()); + } + southPanelBuilder.add(createLimitPanel(searchModel)); + + return southPanelBuilder.build(); + } + private static JPanel createSeparatorPanel(EntitySearchModel searchModel) { return Components.borderLayoutPanel() - .border(BorderFactory.createTitledBorder("")) - .centerComponent(new JLabel(MESSAGES.getString("multiple_item_separator"))) - .westComponent(Components.textField(searchModel.separator()) + .westComponent(new JLabel(MESSAGES.getString("multiple_item_separator"))) + .centerComponent(Components.textField(searchModel.separator()) .columns(1) .maximumLength(1) .build()) .build(); } + private static JPanel createLimitPanel(EntitySearchModel searchModel) { + return Components.borderLayoutPanel() + .westComponent(new JLabel(MESSAGES.getString("result_limit"))) + .centerComponent(Components.integerField(searchModel.limit()) + .columns(4) + .build()) + .build(); + } + private static JPanel createColumnSettingsPanel(EntitySearchModel.SearchSettings settings) { return Components.gridLayoutPanel(3, 1) .add(Components.checkBox(settings.caseSensitive()) diff --git a/swing/framework-ui/src/main/resources/is/codion/swing/framework/ui/component/EntitySearchField.properties b/swing/framework-ui/src/main/resources/is/codion/swing/framework/ui/component/EntitySearchField.properties index 9598daa09f..e4c43b630a 100644 --- a/swing/framework-ui/src/main/resources/is/codion/swing/framework/ui/component/EntitySearchField.properties +++ b/swing/framework-ui/src/main/resources/is/codion/swing/framework/ui/component/EntitySearchField.properties @@ -6,3 +6,4 @@ prefix_wildcard=Auto-prefix wildcard select_entity=Select record searching=Searching result_limited=Result limited to {0, choice, 1#record|1<{0, number, integer} records} +result_limit=Result limit diff --git a/swing/framework-ui/src/main/resources/is/codion/swing/framework/ui/component/EntitySearchField_is_IS.properties b/swing/framework-ui/src/main/resources/is/codion/swing/framework/ui/component/EntitySearchField_is_IS.properties index 1548f80008..7bfc8848d8 100644 --- a/swing/framework-ui/src/main/resources/is/codion/swing/framework/ui/component/EntitySearchField_is_IS.properties +++ b/swing/framework-ui/src/main/resources/is/codion/swing/framework/ui/component/EntitySearchField_is_IS.properties @@ -6,3 +6,4 @@ prefix_wildcard=Sj\u00E1lfkrafa algildi fyrir framan select_entity=Veldu f\u00E6rslu searching=Leita result_limited=Ni\u00F0urst\u00F6\u00F0ur takmarka\u00F0ar vi\u00F0 {0, choice, 1#f\u00E6rslu|1<{0, number, integer} f\u00E6rslur} +result_limit=Fj\u00F6ldatakm\u00F6rkun