-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Controls Package :bug: MFXTextField: fixed TextFormatter not working. It must be added on the BoundTextField, for this reason, added a delegate property (Fix for #174) CSS Package :recycle: MFXCSSBridge: do not take into account the Region's user agent stylesheet. If it's needed to specify the user agent the popup's getUserAgentStylesheet() method should be overridden inline, as well as for any other component that mey require it (see MFXComboBoxSkin as an example) (Fix for #173) Selection Package :recycle: Adds a method to retrieve the selection values as a List (rather than getSelection().values() which returns a generic Collection). Also make MultipleSelectionManager use LinkedHashSet and LinkedHashMap (TreeMap was used, oversight sorry) to keep insertion order for selection, this also ensures that building the values List returns the selected values in the same exact order as in the selection Map (Enhancement for #161) Skins Package :bug: MFXComboBoxSkin, MFXFilterComboBoxSkin: fixed an issue that prevented the combo box's popup from being fully customizable with CSS (Fix for #173) :bug: MFXDatePickerSkin: initialize the picker's text if the initial date is not null (Fix for #172) Signed-off-by: palexdev <alessandro.parisi406@gmail.com>
- Loading branch information
Showing
17 changed files
with
444 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
demo/src/test/java/selection/MultipleSelectionModelTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (C) 2022 Parisi Alessandro | ||
* This file is part of MaterialFX (https://github.com/palexdev/MaterialFX). | ||
* | ||
* MaterialFX is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* MaterialFX is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with MaterialFX. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package selection; | ||
|
||
import io.github.palexdev.materialfx.selection.MultipleSelectionModel; | ||
import io.github.palexdev.materialfx.utils.FXCollectors; | ||
import javafx.collections.ObservableList; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.stream.IntStream; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class MultipleSelectionModelTests { | ||
private final ObservableList<String> strings = IntStream.rangeClosed(0, 30) | ||
.mapToObj(i -> "String " + i) | ||
.collect(FXCollectors.toList()); | ||
private final MultipleSelectionModel<String> selectionModel = new MultipleSelectionModel<String>(strings); | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
selectionModel.clearSelection(); | ||
} | ||
|
||
@Test | ||
public void testOrder() { | ||
Integer[] toSelect = {0, 6, 3, 9, 6}; | ||
selectionModel.selectIndexes(List.of(toSelect)); | ||
|
||
assertEquals(4, selectionModel.getSelection().size()); | ||
|
||
// Indexes | ||
int i = 0; | ||
Set<Integer> indexes = selectionModel.getSelection().keySet(); | ||
for (int val : indexes) { | ||
assertEquals(toSelect[i], val); | ||
i++; | ||
} | ||
|
||
// Values | ||
i = 0; | ||
String[] expected = { | ||
"String 0", | ||
"String 6", | ||
"String 3", | ||
"String 9" | ||
}; | ||
List<String> values = selectionModel.getSelectedValues(); | ||
for (String value : values) { | ||
assertEquals(expected[i], value); | ||
i++; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (C) 2022 Parisi Alessandro | ||
* This file is part of MaterialFX (https://github.com/palexdev/MaterialFX). | ||
* | ||
* MaterialFX is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* MaterialFX is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with MaterialFX. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
.mfx-filter-combo-box { | ||
-fx-background-color: derive(#323232, 20%); | ||
-fx-border-color: transparent; | ||
-mfx-caret-visible: false; | ||
-mfx-float-mode: disabled; | ||
-fx-text-fill: white; | ||
} | ||
|
||
.mfx-filter-combo-box .caret .mfx-ripple-generator { | ||
-mfx-ripple-color: rgba(255, 255, 255, 0.2); | ||
} | ||
|
||
.mfx-filter-combo-box .caret .mfx-font-icon { | ||
-mfx-color: white | ||
} | ||
|
||
.mfx-filter-combo-box .combo-popup .search-container { | ||
-fx-background-color: derive(#323232, 20%); | ||
-fx-background-radius: 5; | ||
-fx-border-color: transparent; | ||
-fx-padding: 10 5 5 5; | ||
} | ||
|
||
.mfx-filter-combo-box .combo-popup .search-field { | ||
-fx-background-color: derive(#323232, 20%); | ||
-fx-text-fill: white; | ||
} | ||
|
||
.mfx-filter-combo-box .combo-popup .search-field .text-field { | ||
-fx-prompt-text-fill: #ebebeb; | ||
} | ||
|
||
.mfx-filter-combo-box .combo-popup .virtual-flow { | ||
-fx-background-color: transparent; | ||
} | ||
|
||
.mfx-filter-combo-box .combo-popup .virtual-flow .mfx-combo-box-cell .data-label { | ||
-fx-text-fill: white; | ||
} | ||
|
||
.mfx-filter-combo-box .combo-popup .virtual-flow .mfx-combo-box-cell:hover { | ||
-fx-background-color: white; | ||
} | ||
|
||
.mfx-filter-combo-box .combo-popup .virtual-flow .mfx-combo-box-cell:hover .data-label { | ||
-fx-text-fill: rgba(0, 0, 0, 0.87); | ||
} | ||
|
||
.mfx-filter-combo-box .combo-popup .virtual-flow .mfx-combo-box-cell:selected { | ||
-fx-background-color: white; | ||
} | ||
|
||
.mfx-filter-combo-box .combo-popup .virtual-flow .mfx-combo-box-cell:selected .data-label { | ||
-fx-text-fill: rgb(0, 0, 0, 0.87); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.