♻️ Minor changes and bug fixes

📝 Update wiki with info about new PseudoClasses

🐛 MFXTextField and all subclasses: fixed an issue with CSS and :focused PseudoClass. It was being ignored in some cases, probably because the inner TextField was stealing the focus to the actual control. To fix this we use a new PseudoClass ":focus-within" to specify that the inner field is focused, so the control should be considered focused as well
🐛 I18N: do not use URLClassLoader to load the ResourceBundles as using MaterialFX is other projects would lead to a MissingResourceException, instead change the bundle base name returned by getBundleBaseName() with the complete path to the bundles

Signed-off-by: palexdev <alessandro.parisi406@gmail.com>
This commit is contained in:
palexdev 2022-02-04 14:02:36 +01:00
parent 2a5b689c1d
commit ff8f531b59
23 changed files with 111 additions and 56 deletions

View File

@ -14,7 +14,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- New control MFXMagnifierPane
- ColorUtils: added some new methods to convert Colors to Strings
- FunctionalStringConverter: added two new convenience methods
@ -23,18 +22,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added resource bundles and API for internationalization
### Changed
- ColorUtils: changed some method to be null-safe
- MFXFilterPaneSkin: properly compute the minimum width
- MFXTableViewSkin: allow to drag the filter dialog
### Fixed
- MFXComboBoxSkin: ensure the caret position is at 0 if the combo box is not selectable
- MFXTableViewSkin: ensure the dialog is on foreground
- MFXTextField and all subclasses: fixed an issue with CSS and :focused PseudoClass. It was being ignored in some cases,
probably because the inner TextField was stealing the focus to the actual control. To fix this we use a new
PseudoClass ":focus-within" to specify that the inner field is focused, so the control should be considered focused as
well
- I18N: do not use URLClassLoader to load the ResourceBundles as using MaterialFX is other projects would lead to a
MissingResourceException, instead change the bundle base name returned by getBundleBaseName() with the complete path
to the bundles
## [11.13.0] - 22-01-2022
_This version won't follow the above scheme as the amount of changes and commits is simply too huge and there would be
no way to correctly show all the changes without making mistakes (duplicates, "overlapping" changes...), for this reason
I'll try to sum up only the major changes below._
@ -43,19 +46,25 @@ I'll try to sum up only the major changes below._
- Added new beans and properties
- Added new mechanisms for bindings
- Added new collections, in particular an ObservableList that combines the capabilities of JavaFX's FilteredList and
SortedList.
Also those two are read-only, but MaterialFX also offers a version that allows to directly make changes to the source list
- ReactFX, Flowless removed in favor of my own Virtual Flow implementation, VirtualizedFX. As a result all controls having lists have been reworked.
- The table view has been reworked as well to use a Virtual Flow (scrollable) so it's efficiency is now on a whole new level. There's also a paginated
version of the table (like before) but it still uses a Virtual Flow, which of course makes it efficient
- MFXLabels have been deprecated and removed as now MaterialFX follows Material Design's text fields. The new MFXTextFields are the best thing you're gonna see
on JavaFX. They have all the features defined by Material Design principles and also more. They now offer a floating label that can have 4 states: disabled, above, border, inline.
Oh, they can also be set to behave like Labels, no need to have duplicate controls (Label and TextFields), since they offer the same functionalities duh.
SortedList. Also those two are read-only, but MaterialFX also offers a version that allows to directly make changes to
the source list
- ReactFX, Flowless removed in favor of my own Virtual Flow implementation, VirtualizedFX. As a result all controls
having lists have been reworked.
- The table view has been reworked as well to use a Virtual Flow (scrollable) so it's efficiency is now on a whole new
level. There's also a paginated version of the table (like before) but it still uses a Virtual Flow, which of course
makes it efficient
- MFXLabels have been deprecated and removed as now MaterialFX follows Material Design's text fields. The new
MFXTextFields are the best thing you're gonna see on JavaFX. They have all the features defined by Material Design
principles and also more. They now offer a floating label that can have 4 states: disabled, above, border, inline. Oh,
they can also be set to behave like Labels, no need to have duplicate controls (Label and TextFields), since they
offer the same functionalities duh.
- Many controls (such as combo boxes, date pickers) now extends MFXTextField, so they inherit all its features.
- Almost all controls have been reviewed/remade to make them fully functional (there were a lot of issues with CSS not working properly).
- Almost all controls have been reviewed/remade to make them fully functional (there were a lot of issues with CSS not
working properly).
- The Filter API has been reviewed and now it's more powerful than ever with the new MFXFilterPane.
- The Validation API has been reviewed as well, it is as powerful as before thanks to JavaFX properties and observables, but it's much more flexible. It's up to the user now
to decide when and how to validate a control. Also an important design choice has been made here. Many validation frameworks for JavaFX also offer a way to decorate a control,
- The Validation API has been reviewed as well, it is as powerful as before thanks to JavaFX properties and observables,
but it's much more flexible. It's up to the user now to decide when and how to validate a control. Also an important
design choice has been made here. Many validation frameworks for JavaFX also offer a way to decorate a control,
but I decided to not to that as it would violate the Single Responsibility Principle! Validation has nothing to do with UI, plus depending on the fanciness of your App it's up to
you to decide how the validation controls will look like!
- Dialogs and Notifications have been reviewed as well. The dialogs have been simplified, and for notifications there are now two separate systems.

View File

@ -69,11 +69,11 @@
-fx-padding: 3 -3 0 3;
}
#customNCombo2:focused {
#customNCombo2:focus-within {
-fx-border-color: transparent transparent -common-gradient transparent;
}
#customNCombo2:focused .caret .mfx-font-icon {
#customNCombo2:focus-within .caret .mfx-font-icon {
-mfx-color: #ff5d53;
}

View File

@ -71,13 +71,13 @@
-fx-font-family: "Visby Round CF Medium";
}
#custDatePicker .date-picker-popup .months-combo:focused,
#custDatePicker .date-picker-popup .years-combo:focused {
#custDatePicker .date-picker-popup .months-combo:focus-within,
#custDatePicker .date-picker-popup .years-combo:focus-within {
-fx-text-fill: #007BF6;
}
#custDatePicker .date-picker-popup .months-combo:focused .caret .mfx-font-icon,
#custDatePicker .date-picker-popup .years-combo:focused .caret .mfx-font-icon {
#custDatePicker .date-picker-popup .months-combo:focus-within .caret .mfx-font-icon,
#custDatePicker .date-picker-popup .years-combo:focus-within .caret .mfx-font-icon {
-mfx-color: #007BF6;
}

View File

@ -110,6 +110,10 @@ import java.util.List;
* Considering that the other option would have been re-implementing a TextField completely from scratch (really hard task)
* this is the best option as of now. Even just a custom skin would not work (yep I tried) since black magic is involved
* in the default one, better not mess with that or something will break for sure, yay for spaghetti coding JavaFX devs :D
* <p></p>
* <b>Note 3: </b>Since MFXTextFields (and all subclasses) are basically a wrapper for a TextField, and considered how focus
* works for them. To make focus behavior consistent in CSS, MFXTextField introduces a new PseudoClass "focus-within" which will
* be activated every time the inner TextField is focused and deactivated when it loses focus
*/
public class MFXTextField extends TextField implements Validated, MFXMenuControl {
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.i18n;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.StringBinding;
@ -26,8 +25,6 @@ import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.stage.Stage;
import java.net.URL;
import java.net.URLClassLoader;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
@ -43,16 +40,12 @@ public class I18N {
//================================================================================
// Properties
//================================================================================
private static final URLClassLoader loader;
private static final ObjectProperty<Locale> locale = new SimpleObjectProperty<>();
//================================================================================
// Static Block
//================================================================================
static {
URL[] urls = new URL[]{MFXResourcesLoader.loadURL("i18n")};
loader = new URLClassLoader(urls);
setLanguage(Language.defaultLanguage());
locale.addListener(invalidated -> Locale.setDefault(getLocale()));
}
@ -158,11 +151,10 @@ public class I18N {
}
/**
* Responsible for loading a {@link ResourceBundle} for the given Locale.
* Uses {@link URLClassLoader} to load the resource.
* Responsible for loading a {@link ResourceBundle} for the given Locale
*/
private static ResourceBundle getBundle(Locale locale) {
return ResourceBundle.getBundle(getBundleBaseName(), locale, loader);
return ResourceBundle.getBundle(getBundleBaseName(), locale);
}
//================================================================================
@ -200,6 +192,6 @@ public class I18N {
* @return the {@link ResourceBundle}'s base name
*/
public static String getBundleBaseName() {
return "mfxlang";
return "io.github.palexdev.materialfx.i18n.mfxlang";
}
}

View File

@ -29,7 +29,7 @@
-mfx-ripple-radius: 14;
}
.mfx-combo-box:focused .caret .mfx-font-icon {
.mfx-combo-box:focus-within .caret .mfx-font-icon {
-mfx-color: -mfx-main;
}

View File

@ -32,7 +32,7 @@ Date Picker
-mfx-ripple-color: #F3F1F6;
}
.mfx-date-picker:focused .icon {
.mfx-date-picker:focus-within .icon {
-mfx-color: -mfx-purple;
}
@ -73,8 +73,8 @@ Popup
-fx-font-family: "Open Sans SemiBold";
}
.mfx-date-picker .date-picker-popup .months-combo:focused,
.mfx-date-picker .date-picker-popup .years-combo:focused {
.mfx-date-picker .date-picker-popup .months-combo:focus-within,
.mfx-date-picker .date-picker-popup .years-combo:focus-within {
-fx-background-color: #f8f7fa;
-fx-text-fill: -mfx-purple;
}

View File

@ -50,7 +50,7 @@
}
.mfx-filter-combo-box .combo-popup .search-field,
.mfx-filter-combo-box .combo-popup .search-field:focused {
.mfx-filter-combo-box .combo-popup .search-field:focus-within {
-fx-border-width: 1;
-fx-background-insets: 0;
-fx-border-color: lightgray;

View File

@ -132,7 +132,7 @@ Filter Builder
-fx-text-fill: -mfx-main;
}
.mfx-filter-pane .mfx-combo-box:focused {
.mfx-filter-pane .mfx-combo-box:focus-within {
-fx-background-color: -mfx-main;
-fx-background-insets: 0;
-fx-border-color: transparent;
@ -146,7 +146,7 @@ Filter Builder
-mfx-ripple-color: #C68EF8;
}
.mfx-filter-pane .mfx-combo-box:focused .caret .mfx-font-icon {
.mfx-filter-pane .mfx-combo-box:focus-within .caret .mfx-font-icon {
-mfx-color: white;
}
@ -161,7 +161,7 @@ Filter Builder
-fx-font-family: "Open Sans SemiBold";
}
.mfx-filter-pane .mfx-text-field:focused {
.mfx-filter-pane .mfx-text-field:focus-within {
-fx-background-insets: 0;
-fx-border-width: 1;
-fx-border-insets: 0;

View File

@ -45,7 +45,7 @@
-fx-font-smoothing-type: lcd;
}
.mfx-text-field:focused {
.mfx-text-field:focus-within {
-fx-background-insets: 2;
-fx-border-color: -mfx-main;
-fx-border-width: 1.5;
@ -61,7 +61,7 @@
-fx-background-color: white;
}
.mfx-text-field:focused .floating-text {
.mfx-text-field:focus-within .floating-text {
-fx-text-fill: -mfx-main;
}

View File

@ -2,7 +2,7 @@
## Preview
<img src="https://imgur.com/ArUhH58.gif" alt="Checkboxes" border="0">
<img src="https://imgur.com/ArUhH58.gif" alt="Checkboxes">
## MFXCheckBoxes

View File

@ -2,7 +2,7 @@
## Preview
<img src="https://imgur.com/BO0twpA.gif" alt="Comboboxes" border="0">
<img src="https://imgur.com/BO0twpA.gif" alt="Comboboxes">
## MFXComboBoxes
@ -52,9 +52,17 @@
- .mfx-combo-box .combo-popup .virtual-flow .mfx-combo-box-cell
- .mfx-combo-box .combo-popup .virtual-flow .data-label (the cell's text)
*There are other selectors, but they are the same as MFXTextField, refer to its wiki*
### PseudoClasses
| PseudoClass | Description |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| :popup | Activated when the popup is shown and deactivated when the popup is hidden.<br/>Allows to customize the combo box when the popup is showing |
*Also inherits all new PseudoClasses from MFXTextField since it extends it*
## MFXFilterComboBoxes
- Style Class: mfx-filter-combo-box
@ -82,4 +90,9 @@
### CSS Selectors
*This combo box has the same CSS selectors as MFXComboBox, the only difference is that the base style class is .mfx-filter-combo-box*
*This combo box has the same CSS selectors as MFXComboBox, the only difference is that the base style class is
.mfx-filter-combo-box*
### PseudoClasses
*This combo box has the same new PseudoClasses as MFXComboBox*

View File

@ -2,7 +2,7 @@
## Preview
<img src="https://imgur.com/J3v3i9w.gif" alt="Pickers" border="0">
<img src="https://imgur.com/J3v3i9w.gif" alt="Pickers">
## MFXDatePickers

31
wiki/Home.md Normal file
View File

@ -0,0 +1,31 @@
<br />
<p align="center">
<a href="https://github.com/palexdev/MaterialFX">
<img src=https://imgur.com/7NdnoFl.png" alt="Logo">
</a>
</p>
***
### Welcome to the MaterialFX wiki!
</div>
### Components
* [Buttons](https://github.com/palexdev/MaterialFX/wiki/Buttons)
* [Check Boxes](https://github.com/palexdev/MaterialFX/wiki/Check%20Boxes.md)
* [Combo Boxes](https://github.com/palexdev/MaterialFX/wiki/Combo%20Boxes.md)
* [Date Pickers](https://github.com/palexdev/MaterialFX/wiki/Date%20Pickers.md)
* [Filter Panes](https://github.com/palexdev/MaterialFX/wiki/Filter%20Pane.md)
* [Lists](https://github.com/palexdev/MaterialFX/wiki/Lists.md)
* [Paginations](https://github.com/palexdev/MaterialFX/wiki/Pagination.md)
* [Progress](https://github.com/palexdev/MaterialFX/wiki/Progress.md)
* [Radio Buttons](https://github.com/palexdev/MaterialFX/wiki/Radio%20Button.md)
* [Ripple Generators](https://github.com/palexdev/MaterialFX/wiki/Ripple%20Generator.md)
* [Sliders](https://github.com/palexdev/MaterialFX/wiki/Slider.md)
* [Steppers](https://github.com/palexdev/MaterialFX/wiki/Stepper.md)
* [Tables](https://github.com/palexdev/MaterialFX/wiki/Table%20Views.md)
* [Text Fields](https://github.com/palexdev/MaterialFX/wiki/Text%20Fields.md)
* [Toggles](https://github.com/palexdev/MaterialFX/wiki/Toggles)
* [Tooltips](https://github.com/palexdev/MaterialFX/wiki/Tooltip.md)

View File

@ -2,7 +2,7 @@
## Preview
<img src="https://imgur.com/4Ckdn5z.gif" alt="Listviews" border="0">
<img src="https://imgur.com/4Ckdn5z.gif" alt="Listviews">
## MFXListViews

View File

@ -2,7 +2,7 @@
## Preview
<img src="https://imgur.com/nj6xhUT.gif" alt="Tableviews" border="0">
<img src="https://imgur.com/nj6xhUT.gif" alt="Tableviews">
## MFXPaginations

View File

@ -2,7 +2,7 @@
## Preview
<img src="https://imgur.com/2E6X3uJ.gif" alt="Progress" border="0">
<img src="https://imgur.com/2E6X3uJ.gif" alt="Progress">
## MFXProgressBars

View File

@ -2,7 +2,7 @@
## Preview
<img src="https://imgur.com/ArUhH58.gif" alt="Checkboxes" border="0">
<img src="https://imgur.com/ArUhH58.gif" alt="Checkboxes">
## MFXRadioButtons

View File

@ -2,7 +2,7 @@
## Preview
<img src="https://imgur.com/nOrsa1n.gif" alt="Sliders" border="0">
<img src="https://imgur.com/nOrsa1n.gif" alt="Sliders">
## MFXSliders

View File

@ -2,7 +2,7 @@
## Preview
<img src="https://imgur.com/nEgV9F1.gif" alt="Stepper" border="0">
<img src="https://imgur.com/nEgV9F1.gif" alt="Stepper">
## MFXSteppers

View File

@ -2,7 +2,7 @@
## Preview
<img src="https://imgur.com/nj6xhUT.gif" alt="Tableviews" border="0">
<img src="https://imgur.com/nj6xhUT.gif" alt="Tableviews">
## MFXTableViews

View File

@ -2,7 +2,7 @@
## Preview
<img src="https://imgur.com/XT2iVU7.gif" alt="Fields" border="0">
<img src="https://imgur.com/XT2iVU7.gif" alt="Fields">
## MFXTextFields

View File

@ -2,7 +2,7 @@
## Preview
<img src="https://imgur.com/ArUhH58.gif" alt="Checkboxes" border="0">
<img src="https://imgur.com/ArUhH58.gif" alt="Checkboxes">
## MFXToggleButtons
@ -42,6 +42,12 @@
- .mfx-toggle-button .circle (the toggle's circle)
### PseudoClasses
| PseudoClass | Description |
| ----------- | ------------------------------------------------- |
| ":selected" | Allows to customize the toggle when it's selected |
## MFXCircleToggleNodes
- Style Class: mfx-circle-toggle-node