♻️ Minor additions and fixes

🏗️ Finally publish new module-info.java, project should be buildable and usable at this point

🐛 MFXRectangleToggleNodeSkin, add some more width to the minWidth computation to take into account the caret width and be sure that the text node won't wobble around
♻️ MFXTextFieldSkin, use prefWidth as minWidth computation
 Added some new resources

Signed-off-by: palexdev <alessandro.parisi406@gmail.com>
This commit is contained in:
palexdev 2022-01-14 15:15:41 +01:00
parent 745f580bc2
commit c9f2e96f32
6 changed files with 197 additions and 139 deletions

View File

@ -10,7 +10,8 @@
</option>
<option name="taskNames">
<list>
<option value="clean build"/>
<option value="clean"/>
<option value="build"/>
</list>
</option>
<option name="vmOptions" value=""/>

View File

@ -19,7 +19,7 @@
package io.github.palexdev.materialfx.font;
/**
* Enumerator class for MaterialFX font resources. (Count: 114)
* Enumerator class for MaterialFX font resources. (Count: 132)
*/
public enum FontResources {
ANGLE_DOWN("mfx-angle-down", '\uE900'),
@ -38,104 +38,122 @@ public enum FontResources {
CALENDAR_DARK("mfx-calendar-dark", '\uE90D'),
CALENDAR_LIGHT("mfx-calendar-light", '\uE90E'),
CALENDAR_SEMI_DARK("mfx-calendar-semi-dark", '\uE90F'),
CARET_DOWN("mfx-caret-down", '\uE910'),
CARET_LEFT("mfx-caret-left", '\uE911'),
CARET_RIGHT("mfx-caret-right", '\uE912'),
CARET_UP("mfx-caret-up", '\uE913'),
CASPIAN_MARK("mfx-caspian-mark", '\uE914'),
CHART_PIE("mfx-chart-pie", '\uE915'),
CHECK_CIRCLE("mfx-check-circle", '\uE916'),
CHECK_CIRCLE_EMPTY("mfx-check-circle-empty", '\uE917'),
CHEVRON_DOWN("mfx-chevron-down", '\uE918'),
CHEVRON_LEFT("mfx-chevron-left", '\uE919'),
CHEVRON_RIGHT("mfx-chevron-right", '\uE91A'),
CHEVRON_UP("mfx-chevron-up", '\uE91B'),
CIRCLE("mfx-circle", '\uE91C'),
CIRCLE_EMPTY("mfx-circle-empty", '\uE91D'),
CONTENT_COPY("mfx-content-copy", '\uE91E'),
CONTENT_CUT("mfx-content-cut", '\uE91F'),
CONTENT_PASTE("mfx-content-paste", '\uE920'),
DASHBOARD("mfx-dashboard", '\uE921'),
DEBUG("mfx-debug", '\uE922'),
DELETE("mfx-delete", '\uE923'),
DELETE_ALT("mfx-delete-alt", '\uE924'),
DO_NOT_ENTER_CIRCLE("mfx-do-not-enter-circle", '\uE925'),
ELLIPSIS_VERTICAL("mfx-ellipsis-vertical", '\uE926'),
EXCLAMATION_CIRCLE("mfx-exclamation-circle", '\uE927'),
EXCLAMATION_CIRCLE_FILLED("mfx-exclamation-circle-filled", '\uE928'),
EXCLAMATION_TRIANGLE("mfx-exclamation-triangle", '\uE929'),
EXPAND("mfx-expand", '\uE92A'),
EYE("mfx-eye", '\uE92B'),
EYE_SLASH("mfx-eye-slash", '\uE92C'),
FILE("mfx-file", '\uE92D'),
FILTER("mfx-filter", '\uE92E'),
FILTER_ALT("mfx-filter-alt", '\uE92F'),
FILTER_ALT_CLEAR("mfx-filter-alt-clear", '\uE930'),
FIRST_PAGE("mfx-first-page", '\uE931'),
FIT("mfx-fit", '\uE932'),
FOLDER("mfx-folder", '\uE933'),
GEAR("mfx-gear", '\uE934'),
GOOGLE("mfx-google", '\uE935'),
GOOGLE_DRAWING("mfx-google-drawing", '\uE936'),
GOOGLE_DRIVE("mfx-google-drive", '\uE937'),
GOOGLE_FORMS("mfx-google-forms", '\uE938'),
GOOGLE_FUSION_TABLES("mfx-google-fusion-tables", '\uE939'),
GOOGLE_PRESENTATION("mfx-google-presentation", '\uE93A'),
GOOGLE_SCRIPT("mfx-google-script", '\uE93B'),
GOOGLE_SITES("mfx-google-sites", '\uE93C'),
HOME("mfx-home", '\uE93D'),
HYPHEN("mfx-hyphen", '\uE93E'),
IMAGE("mfx-image", '\uE93F'),
INFO("mfx-info", '\uE940'),
INFO_CIRCLE("mfx-info-circle", '\uE941'),
INFO_CIRCLE_FILLED("mfx-info-circle-filled", '\uE942'),
LAST_PAGE("mfx-last-page", '\uE943'),
LEVEL_UP("mfx-level-up", '\uE944'),
LOCK("mfx-lock", '\uE945'),
LOCK_OPEN("mfx-lock-open", '\uE946'),
LOGO("mfx-logo", '\uE947'),
LOGO_ALT("mfx-logo-alt", '\uE948'),
MAP("mfx-map", '\uE949'),
MINUS("mfx-minus", '\uE94A'),
MINUS_CIRCLE("mfx-minus-circle", '\uE94B'),
MODENA_MARK("mfx-modena-mark", '\uE94C'),
MUSIC("mfx-music", '\uE94D'),
NEXT("mfx-next", '\uE94E'),
REDO("mfx-redo", '\uE94F'),
RESTORE("mfx-restore", '\uE950'),
SEARCH("mfx-search", '\uE951'),
SEARCH_PLUS("mfx-search-plus", '\uE952'),
SELECT_ALL("mfx-select-all", '\uE953'),
SHORTCUT("mfx-shortcut", '\uE954'),
SIDEBAR_CLOSE("mfx-sidebar-close", '\uE955'),
SIDEBAR_OPEN("mfx-sidebar-open", '\uE956'),
SLIDERS("mfx-sliders", '\uE957'),
SPREADSHEET("mfx-spreadsheet", '\uE958'),
STEP_BACKWARD("mfx-step-backward", '\uE959'),
STEP_FORWARD("mfx-step-forward", '\uE95A'),
SYNC("mfx-sync", '\uE95B'),
SYNC_LIGHT("mfx-sync-light", '\uE95C'),
UNDO("mfx-undo", '\uE95D'),
USER("mfx-user", '\uE95E'),
USERS("mfx-users", '\uE95F'),
VARIANT10_MARK("mfx-variant10-mark", '\uE960'),
VARIANT11_MARK("mfx-variant11-mark", '\uE961'),
VARIANT12_MARK("mfx-variant12-mark", '\uE962'),
VARIANT13_MARK("mfx-variant13-mark", '\uE963'),
VARIANT14_MARK("mfx-variant14-mark", '\uE964'),
VARIANT3_MARK("mfx-variant3-mark", '\uE965'),
VARIANT4_MARK("mfx-variant4-mark", '\uE966'),
VARIANT5_MARK("mfx-variant5-mark", '\uE967'),
VARIANT6_MARK("mfx-variant6-mark", '\uE968'),
VARIANT7_MARK("mfx-variant7-mark", '\uE969'),
VARIANT8_MARK("mfx-variant8-mark", '\uE96A'),
VARIANT9_MARK("mfx-variant9-mark", '\uE96B'),
VIDEO("mfx-video", '\uE96C'),
X("mfx-x", '\uE96D'),
X_ALT("mfx-x-alt", '\uE96E'),
X_CIRCLE("mfx-x-circle", '\uE96F'),
X_CIRCLE_LIGHT("mfx-x-circle-light", '\uE970'),
X_LIGHT("mfx-x-light", '\uE971');
CALENDARS("mfx-calendars", '\uE910'),
CALENDARS_SEMI_DARK("mfx-calendars-semi-dark", '\uE911'),
CARET_DOWN("mfx-caret-down", '\uE912'),
CARET_LEFT("mfx-caret-left", '\uE913'),
CARET_RIGHT("mfx-caret-right", '\uE914'),
CARET_UP("mfx-caret-up", '\uE915'),
CASPIAN_MARK("mfx-caspian-mark", '\uE916'),
CHART_PIE("mfx-chart-pie", '\uE917'),
CHECK_CIRCLE("mfx-check-circle", '\uE918'),
CHECK_CIRCLE_EMPTY("mfx-check-circle-empty", '\uE919'),
CHEVRON_DOWN("mfx-chevron-down", '\uE91A'),
CHEVRON_LEFT("mfx-chevron-left", '\uE91B'),
CHEVRON_RIGHT("mfx-chevron-right", '\uE91C'),
CHEVRON_UP("mfx-chevron-up", '\uE91D'),
CIRCLE("mfx-circle", '\uE91E'),
CIRCLE_DOT("mfx-circle-dot", '\uE91F'),
CIRCLE_EMPTY("mfx-circle-empty", '\uE920'),
CONTENT_COPY("mfx-content-copy", '\uE921'),
CONTENT_CUT("mfx-content-cut", '\uE922'),
CONTENT_PASTE("mfx-content-paste", '\uE923'),
DASHBOARD("mfx-dashboard", '\uE924'),
DEBUG("mfx-debug", '\uE925'),
DELETE("mfx-delete", '\uE926'),
DELETE_ALT("mfx-delete-alt", '\uE927'),
DO_NOT_ENTER_CIRCLE("mfx-do-not-enter-circle", '\uE928'),
ELLIPSIS_VERTICAL("mfx-ellipsis-vertical", '\uE929'),
EXCLAMATION_CIRCLE("mfx-exclamation-circle", '\uE92A'),
EXCLAMATION_CIRCLE_FILLED("mfx-exclamation-circle-filled", '\uE92B'),
EXCLAMATION_TRIANGLE("mfx-exclamation-triangle", '\uE92C'),
EXPAND("mfx-expand", '\uE92D'),
EYE("mfx-eye", '\uE92E'),
EYE_SLASH("mfx-eye-slash", '\uE92F'),
FILE("mfx-file", '\uE930'),
FILTER("mfx-filter", '\uE931'),
FILTER_ALT("mfx-filter-alt", '\uE932'),
FILTER_ALT_CLEAR("mfx-filter-alt-clear", '\uE933'),
FIRST_PAGE("mfx-first-page", '\uE934'),
FIT("mfx-fit", '\uE935'),
FOLDER("mfx-folder", '\uE936'),
FONTICONS("mfx-fonticons", '\uE937'),
GEAR("mfx-gear", '\uE938'),
GOOGLE("mfx-google", '\uE939'),
GOOGLE_DRAWING("mfx-google-drawing", '\uE93A'),
GOOGLE_DRIVE("mfx-google-drive", '\uE93B'),
GOOGLE_FORMS("mfx-google-forms", '\uE93C'),
GOOGLE_FUSION_TABLES("mfx-google-fusion-tables", '\uE93D'),
GOOGLE_PRESENTATION("mfx-google-presentation", '\uE93E'),
GOOGLE_SCRIPT("mfx-google-script", '\uE93F'),
GOOGLE_SITES("mfx-google-sites", '\uE940'),
HOME("mfx-home", '\uE941'),
HYPHEN("mfx-hyphen", '\uE942'),
IMAGE("mfx-image", '\uE943'),
INFO("mfx-info", '\uE944'),
INFO_CIRCLE("mfx-info-circle", '\uE945'),
INFO_CIRCLE_FILLED("mfx-info-circle-filled", '\uE946'),
INPUT_PIPE("mfx-input-pipe", '\uE947'),
INPUT_PIPE_ALT("mfx-input-pipe-alt", '\uE948'),
LAST_PAGE("mfx-last-page", '\uE949'),
LEVEL_UP("mfx-level-up", '\uE94A'),
LIST_DROPDOWN("mfx-list-dropdown", '\uE94B'),
LOCK("mfx-lock", '\uE94C'),
LOCK_OPEN("mfx-lock-open", '\uE94D'),
LOGO("mfx-logo", '\uE94E'),
LOGO_ALT("mfx-logo-alt", '\uE94F'),
MAP("mfx-map", '\uE950'),
MESSAGE("mfx-message", '\uE951'),
MESSAGES("mfx-messages", '\uE952'),
MINUS("mfx-minus", '\uE953'),
MINUS_CIRCLE("mfx-minus-circle", '\uE954'),
MODENA_MARK("mfx-modena-mark", '\uE955'),
MUSIC("mfx-music", '\uE956'),
NEXT("mfx-next", '\uE957'),
PROGRESS_BARS("mfx-progress-bars", '\uE958'),
PROGRESS_BARS_ALT("mfx-progress-bars-alt", '\uE959'),
REDO("mfx-redo", '\uE95A'),
RESTORE("mfx-restore", '\uE95B'),
SCROLL_BAR("mfx-scroll-bar", '\uE95C'),
SEARCH("mfx-search", '\uE961'),
SEARCH_PLUS("mfx-search-plus", '\uE962'),
SELECT_ALL("mfx-select-all", '\uE963'),
SHORTCUT("mfx-shortcut", '\uE964'),
SIDEBAR_CLOSE("mfx-sidebar-close", '\uE965'),
SIDEBAR_OPEN("mfx-sidebar-open", '\uE966'),
SLIDERS("mfx-sliders", '\uE967'),
SPREADSHEET("mfx-spreadsheet", '\uE968'),
SQUARE_LIST("mfx-square-list", '\uE969'),
STEP_BACKWARD("mfx-step-backward", '\uE96A'),
STEP_FORWARD("mfx-step-forward", '\uE96B'),
STEPPER("mfx-stepper", '\uE96C'),
SYNC("mfx-sync", '\uE970'),
SYNC_LIGHT("mfx-sync-light", '\uE971'),
TABLE("mfx-table", '\uE972'),
TABLE_ALT("mfx-table-alt", '\uE973'),
TOGGLE_OFF("mfx-toggle-off", '\uE974'),
TOGGLE_ON("mfx-toggle-on", '\uE975'),
UNDO("mfx-undo", '\uE976'),
USER("mfx-user", '\uE977'),
USERS("mfx-users", '\uE978'),
VARIANT10_MARK("mfx-variant10-mark", '\uE979'),
VARIANT11_MARK("mfx-variant11-mark", '\uE97A'),
VARIANT12_MARK("mfx-variant12-mark", '\uE97B'),
VARIANT13_MARK("mfx-variant13-mark", '\uE97C'),
VARIANT14_MARK("mfx-variant14-mark", '\uE97D'),
VARIANT3_MARK("mfx-variant3-mark", '\uE97E'),
VARIANT4_MARK("mfx-variant4-mark", '\uE97F'),
VARIANT5_MARK("mfx-variant5-mark", '\uE980'),
VARIANT6_MARK("mfx-variant6-mark", '\uE981'),
VARIANT7_MARK("mfx-variant7-mark", '\uE982'),
VARIANT8_MARK("mfx-variant8-mark", '\uE983'),
VARIANT9_MARK("mfx-variant9-mark", '\uE984'),
VIDEO("mfx-video", '\uE985'),
X("mfx-x", '\uE986'),
X_ALT("mfx-x-alt", '\uE987'),
X_CIRCLE("mfx-x-circle", '\uE988'),
X_CIRCLE_LIGHT("mfx-x-circle-light", '\uE989'),
X_LIGHT("mfx-x-light", '\uE98A');
public static FontResources findByDescription(String description) {
for (FontResources font : values()) {

View File

@ -199,7 +199,7 @@ public class MFXRectangleToggleNodeSkin extends SkinBase<MFXRectangleToggleNode>
Node leading = toggleNode.getLabelLeadingIcon();
Node trailing = toggleNode.getLabelTrailingIcon();
double textWidth = LabelUtils.computeTextWidth(toggleNode.getFont(), toggleNode.getText())
+ label.snappedLeftInset() + label.snappedRightInset();
+ label.snappedLeftInset() + label.snappedRightInset() + 10; // Take into account the caret width and some more space to be sure text won't wobble around
return leftInset +
(leading != null ? leading.prefWidth(-1) + gap : 0) +
textWidth +

View File

@ -218,6 +218,11 @@ public class MFXTextFieldSkin extends SkinBase<MFXTextField> {
//================================================================================
// Overridden Methods
//================================================================================
@Override
protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
return computePrefWidth(height, topInset, rightInset, bottomInset, leftInset);
}
@Override
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
MFXTextField textField = getSkinnable();

View File

@ -1,42 +1,76 @@
module MaterialFX {
requires transitive javafx.controls;
requires transitive javafx.fxml;
requires transitive javafx.graphics;
requires transitive java.desktop;
requires transitive javafx.controls;
requires transitive javafx.fxml;
requires transitive javafx.graphics;
requires transitive java.desktop;
requires virtualizedfx;
requires virtualizedfx;
exports io.github.palexdev.materialfx;
exports io.github.palexdev.materialfx.beans;
exports io.github.palexdev.materialfx.beans.properties.base;
exports io.github.palexdev.materialfx.beans.properties.functional;
exports io.github.palexdev.materialfx.beans.properties.resettable;
exports io.github.palexdev.materialfx.beans.properties.styleable;
exports io.github.palexdev.materialfx.beans.properties.synced;
exports io.github.palexdev.materialfx.bindings;
exports io.github.palexdev.materialfx.collections;
exports io.github.palexdev.materialfx.controls;
exports io.github.palexdev.materialfx.controls.base;
exports io.github.palexdev.materialfx.controls.cell;
exports io.github.palexdev.materialfx.controls.legacy;
exports io.github.palexdev.materialfx.css;
exports io.github.palexdev.materialfx.effects;
exports io.github.palexdev.materialfx.effects.ripple;
exports io.github.palexdev.materialfx.effects.ripple.base;
exports io.github.palexdev.materialfx.enums;
exports io.github.palexdev.materialfx.factories;
exports io.github.palexdev.materialfx.filter;
exports io.github.palexdev.materialfx.filter.base;
exports io.github.palexdev.materialfx.font;
exports io.github.palexdev.materialfx.notifications;
exports io.github.palexdev.materialfx.notifications.base;
exports io.github.palexdev.materialfx.selection;
exports io.github.palexdev.materialfx.selection.base;
exports io.github.palexdev.materialfx.skins;
exports io.github.palexdev.materialfx.skins.base;
exports io.github.palexdev.materialfx.skins.legacy;
exports io.github.palexdev.materialfx.utils;
exports io.github.palexdev.materialfx.utils.others;
exports io.github.palexdev.materialfx.validation;
exports io.github.palexdev.materialfx.validation.base;
exports io.github.palexdev.materialfx;
// Beans Package
exports io.github.palexdev.materialfx.beans;
exports io.github.palexdev.materialfx.beans.properties;
exports io.github.palexdev.materialfx.beans.properties.base;
exports io.github.palexdev.materialfx.beans.properties.functional;
exports io.github.palexdev.materialfx.beans.properties.resettable;
exports io.github.palexdev.materialfx.beans.properties.styleable;
exports io.github.palexdev.materialfx.beans.properties.synced;
// Bindings Package
exports io.github.palexdev.materialfx.bindings;
exports io.github.palexdev.materialfx.bindings.base;
// Collections Package
exports io.github.palexdev.materialfx.collections;
// Controls Package
exports io.github.palexdev.materialfx.controls;
exports io.github.palexdev.materialfx.controls.base;
exports io.github.palexdev.materialfx.controls.cell;
exports io.github.palexdev.materialfx.controls.legacy;
// CSS Package
exports io.github.palexdev.materialfx.css;
// Dialogs Package
exports io.github.palexdev.materialfx.dialogs;
// Effects Package
exports io.github.palexdev.materialfx.effects;
exports io.github.palexdev.materialfx.effects.ripple;
exports io.github.palexdev.materialfx.effects.ripple.base;
// Enums Package
exports io.github.palexdev.materialfx.enums;
// Factories Package
exports io.github.palexdev.materialfx.factories;
// Filter Package
exports io.github.palexdev.materialfx.filter;
exports io.github.palexdev.materialfx.filter.base;
// Font Package
exports io.github.palexdev.materialfx.font;
// Notifications Package
exports io.github.palexdev.materialfx.notifications;
exports io.github.palexdev.materialfx.notifications.base;
// Selection Package
exports io.github.palexdev.materialfx.selection;
exports io.github.palexdev.materialfx.selection.base;
// Skins Package
exports io.github.palexdev.materialfx.skins;
exports io.github.palexdev.materialfx.skins.base;
exports io.github.palexdev.materialfx.skins.legacy;
// Utils Package
exports io.github.palexdev.materialfx.utils;
exports io.github.palexdev.materialfx.utils.others;
// Validation Package
exports io.github.palexdev.materialfx.validation;
}