💥 Ditch the user agent stylesheet system in favor of Theme API

One of the biggest issues MaterialFX has ever had since it's beginning was the difficulty in customizing the controls through CSS. The root cause of this has always been the bad and shitty management of stylesheets priority by JavaFX. While in the past patches were implemented to fix the issue, in more than one occasion they were just mitigations that would work or not depending on...I don't know. Because you see, another problem of using such shitty system is that it was actually quite hard to debug, a theme/stylesheet could work for me but not for the user, a nightmare

With this commit, we definitely ditch the garbage user agent system in favor of a theming API that is discussed in more details on the project's README

Signed-off-by: Alessadro Parisi <alessandro.parisi406@gmail.com>
This commit is contained in:
Alessadro Parisi 2023-03-16 12:18:41 +01:00
parent b9cf071b9a
commit f16e5ffb6b
84 changed files with 297 additions and 818 deletions

View File

@ -13,7 +13,7 @@
<option value="run"/>
</list>
</option>
<option name="vmOptions" value=""/>
<option name="vmOptions" value="-Dglass.disableGrab=true"/>
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>

View File

@ -57,6 +57,7 @@ application {
} else {
setMainClassName("io.github.palexdev.materialfx.demo.Demo")
}
applicationDefaultJvmArgs = ["-Dglass.disableGrab=true"]
}
jlink {

View File

@ -19,6 +19,8 @@
package io.github.palexdev.materialfx.demo;
import fr.brouillard.oss.cssfx.CSSFX;
import io.github.palexdev.materialfx.css.themes.MFXThemeManager;
import io.github.palexdev.materialfx.css.themes.Themes;
import io.github.palexdev.materialfx.demo.controllers.DemoController;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
@ -38,10 +40,13 @@ public class Demo extends Application {
loader.setControllerFactory(c -> new DemoController(primaryStage));
Parent root = loader.load();
Scene scene = new Scene(root);
MFXThemeManager.addOn(scene, Themes.DEFAULT, Themes.LEGACY);
scene.setFill(Color.TRANSPARENT);
primaryStage.initStyle(StageStyle.TRANSPARENT);
primaryStage.setScene(scene);
primaryStage.setTitle("MaterialFX Demo");
primaryStage.show();
//ScenicView.show(scene);
}
}

View File

@ -3,6 +3,6 @@ import javafx.application.Application;
public class Launcher {
public static void main(String[] args) {
Application.launch(Playground.class, args);
Application.launch(Reproducer.class, args);
}
}

View File

@ -0,0 +1,35 @@
import io.github.palexdev.materialfx.controls.legacy.MFXLegacyComboBox;
import io.github.palexdev.materialfx.css.themes.MFXThemeManager;
import io.github.palexdev.materialfx.css.themes.Themes;
import io.github.palexdev.materialfx.utils.FXCollectors;
import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import java.util.stream.IntStream;
public class Reproducer extends Application {
@Override
public void start(Stage stage) throws Exception {
VBox box = new VBox(20);
box.setAlignment(Pos.TOP_CENTER);
box.setPadding(new Insets(20));
MFXThemeManager.addOn(box, Themes.DEFAULT, Themes.LEGACY);
ObservableList<String> strings = IntStream.range(0, 50)
.mapToObj(i -> "String " + (i + 1))
.collect(FXCollectors.toList());
MFXLegacyComboBox<String> combo = new MFXLegacyComboBox<>(strings);
box.getChildren().add(combo);
Scene scene = new Scene(box, 400, 400);
stage.setScene(scene);
stage.show();
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.PositionBean;
import io.github.palexdev.materialfx.effects.DepthLevel;
import io.github.palexdev.materialfx.effects.ripple.MFXCircleRippleGenerator;
@ -48,7 +47,6 @@ public class MFXButton extends Button {
//================================================================================
private static final StyleablePropertyFactory<MFXButton> FACTORY = new StyleablePropertyFactory<>(Button.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-button";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXButton.css");
private final MFXCircleRippleGenerator rippleGenerator = new MFXCircleRippleGenerator(this);
//================================================================================
@ -355,9 +353,4 @@ public class MFXButton extends Button {
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return MFXButton.getControlCssMetaDataList();
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.base.AbstractMFXListView;
import io.github.palexdev.materialfx.controls.cell.MFXCheckListCell;
import io.github.palexdev.materialfx.skins.MFXListViewSkin;
@ -63,7 +62,6 @@ public class MFXCheckListView<T> extends AbstractMFXListView<T, MFXCheckListCell
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-check-list-view";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXCheckListView.css");
private final SimpleVirtualFlow<T, MFXCheckListCell<T>> virtualFlow;
private final ListChangeListener<? super T> itemsChanged = this::itemsChanged;
@ -243,9 +241,4 @@ public class MFXCheckListView<T> extends AbstractMFXListView<T, MFXCheckListCell
protected Skin<?> createDefaultSkin() {
return new MFXListViewSkin<>(this, virtualFlow);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.base.AbstractMFXTreeCell;
import io.github.palexdev.materialfx.controls.base.AbstractMFXTreeItem;
import io.github.palexdev.materialfx.controls.cell.MFXCheckTreeCell;
@ -48,7 +47,6 @@ public class MFXCheckTreeItem<T> extends MFXTreeItem<T> {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-check-tree-item";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXTreeItem.css");
private final BooleanProperty checked = new SimpleBooleanProperty(false);
private final BooleanProperty indeterminate = new SimpleBooleanProperty(false);
@ -139,11 +137,6 @@ public class MFXCheckTreeItem<T> extends MFXTreeItem<T> {
return new MFXCheckTreeItemSkin<>(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Events
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.base.MFXLabeled;
import io.github.palexdev.materialfx.skins.MFXCheckboxSkin;
import io.github.palexdev.materialfx.utils.StyleablePropertiesUtils;
@ -46,7 +45,6 @@ public class MFXCheckbox extends CheckBox implements MFXLabeled {
//================================================================================
private static final StyleablePropertyFactory<MFXCheckbox> FACTORY = new StyleablePropertyFactory<>(CheckBox.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-checkbox";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXCheckBox.css");
//================================================================================
// Constructors
@ -181,11 +179,6 @@ public class MFXCheckbox extends CheckBox implements MFXLabeled {
return new MFXCheckboxSkin(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return MFXCheckbox.getControlCssMetaDataList();

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.base.AbstractMFXToggleNode;
import io.github.palexdev.materialfx.enums.TextPosition;
import io.github.palexdev.materialfx.skins.MFXCircleToggleNodeSkin;
@ -42,7 +41,6 @@ public class MFXCircleToggleNode extends AbstractMFXToggleNode {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-circle-toggle-node";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXCircleToggleNode.css");
//================================================================================
// Constructors
@ -196,9 +194,4 @@ public class MFXCircleToggleNode extends AbstractMFXToggleNode {
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return getControlCssMetaDataList();
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.Alignment;
import io.github.palexdev.materialfx.beans.PositionBean;
import io.github.palexdev.materialfx.beans.properties.EventHandlerProperty;
@ -92,7 +91,6 @@ public class MFXComboBox<T> extends MFXTextField implements MFXCombo<T> {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-combo-box";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXComboBox.css");
private final ReadOnlyBooleanWrapper showing = new ReadOnlyBooleanWrapper(false);
private final ObjectProperty<Alignment> popupAlignment = new SimpleObjectProperty<>(Alignment.of(HPos.CENTER, VPos.BOTTOM));
@ -291,11 +289,6 @@ public class MFXComboBox<T> extends MFXTextField implements MFXCombo<T> {
return MFXComboBox.getClassCssMetaData();
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Delegate Methods
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.Alignment;
import io.github.palexdev.materialfx.beans.properties.functional.ConsumerProperty;
import io.github.palexdev.materialfx.beans.properties.functional.FunctionProperty;
@ -71,7 +70,6 @@ public class MFXContextMenu extends MFXPopup {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-context-menu";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXContextMenu.css");
private final ObservableList<Node> items = FXCollections.observableArrayList();
private Node owner;
@ -178,11 +176,6 @@ public class MFXContextMenu extends MFXPopup {
return new MFXContextMenuSkin(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.properties.EventHandlerProperty;
import io.github.palexdev.materialfx.beans.properties.functional.SupplierProperty;
import io.github.palexdev.materialfx.skins.MFXContextMenuItemSkin;
@ -58,7 +57,6 @@ public class MFXContextMenuItem extends Labeled {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-menu-item";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXContextMenuItem.css");
private final StringProperty accelerator = new SimpleStringProperty();
private final SupplierProperty<Tooltip> tooltipSupplier = new SupplierProperty<>();
@ -100,11 +98,6 @@ public class MFXContextMenuItem extends Labeled {
return new MFXContextMenuItemSkin(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.Alignment;
import io.github.palexdev.materialfx.beans.NumberRange;
import io.github.palexdev.materialfx.beans.PositionBean;
@ -90,7 +89,6 @@ public class MFXDatePicker extends MFXTextField {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-date-picker";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXDatePicker.css");
// Popup Properties
private final ReadOnlyBooleanWrapper showing = new ReadOnlyBooleanWrapper(false);
@ -288,11 +286,6 @@ public class MFXDatePicker extends MFXTextField {
return new MFXDatePickerSkin(this, boundField);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.properties.functional.FunctionProperty;
import io.github.palexdev.materialfx.collections.TransformableList;
import io.github.palexdev.materialfx.collections.TransformableListWrapper;
@ -43,12 +42,12 @@ import java.util.function.Predicate;
* In addition to the base class futures this adds:
* <p> - Uses a {@link TransformableListWrapper} to filter the items. You could even sort them by
* retrieving the list instance and setting a comparator, {@link TransformableList#comparatorProperty()}.
* Beware to this though, {@link TransformableList#setReversed(boolean)}, it's really important to specify that
* Beware of this though, {@link TransformableList#setReversed(boolean)}, it's really important to specify that
* the comparator is in reverse order otherwise indexes will be inconsistent.
* <p> - A function that takes the typed search text as an input and builds a {@link Predicate} as a result to
* filter the list. This means that the user can fully customize how the list is filtered.
* <p></p>
* Note: this combo box do not uses {@link MFXComboBoxCell} and while it does allow it it should never be used.
* Note: this combo box do not use {@link MFXComboBoxCell} and while it does allow it it should never be used.
* Use {@link MFXFilterComboBoxCell} instead for consistent selection behavior.
*/
public class MFXFilterComboBox<T> extends MFXComboBox<T> {
@ -56,7 +55,6 @@ public class MFXFilterComboBox<T> extends MFXComboBox<T> {
// Properties
//================================================================================
private final String STYLECLASS = "mfx-filter-combo-box";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXFilterComboBox.css");
private final StringProperty searchText = new SimpleStringProperty();
private final TransformableListWrapper<T> filterList = new TransformableListWrapper<>(FXCollections.observableArrayList());
@ -160,9 +158,4 @@ public class MFXFilterComboBox<T> extends MFXComboBox<T> {
protected Skin<?> createDefaultSkin() {
return new MFXFilterComboBoxSkin<>(this, boundField);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.FilterBean;
import io.github.palexdev.materialfx.enums.ChainMode;
import io.github.palexdev.materialfx.filter.base.AbstractFilter;
@ -140,7 +139,6 @@ public class MFXFilterPane<T> extends Control {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-filter-pane";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXFilterPane.css");
private final StringProperty headerText = new SimpleStringProperty(I18N.getOrDefault("filterPane.headerText"));
private final ObservableList<AbstractFilter<T, ?>> filters = FXCollections.observableArrayList();
private final ObservableList<FilterBean<T, ?>> activeFilters = FXCollections.observableArrayList();
@ -255,9 +253,4 @@ public class MFXFilterPane<T> extends Control {
protected Skin<?> createDefaultSkin() {
return new MFXFilterPaneSkin<>(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.base.AbstractMFXListView;
import io.github.palexdev.materialfx.controls.cell.MFXListCell;
import io.github.palexdev.materialfx.skins.MFXListViewSkin;
@ -63,7 +62,6 @@ public class MFXListView<T> extends AbstractMFXListView<T, MFXListCell<T>> {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-list-view";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXListView.css");
private final SimpleVirtualFlow<T, MFXListCell<T>> virtualFlow;
private final ListChangeListener<? super T> itemsChanged = this::itemsChanged;
@ -239,9 +237,4 @@ public class MFXListView<T> extends AbstractMFXListView<T, MFXListCell<T>> {
protected Skin<?> createDefaultSkin() {
return new MFXListViewSkin<>(this, virtualFlow);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.PositionBean;
import io.github.palexdev.materialfx.beans.properties.styleable.StyleableBooleanProperty;
import io.github.palexdev.materialfx.beans.properties.styleable.StyleableDoubleProperty;
@ -90,7 +89,6 @@ public class MFXMagnifierPane extends Control {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-magnifier";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXMagnifier.css");
private final ObjectProperty<Node> content = new SimpleObjectProperty<>();
private final ObjectProperty<PositionBean> position = new SimpleObjectProperty<>();
@ -148,11 +146,6 @@ public class MFXMagnifierPane extends Control {
return new MFXMagnifierPaneSkin(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Styleable Properties
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.collections.TransformableListWrapper;
import io.github.palexdev.materialfx.controls.base.MFXMenuControl;
import io.github.palexdev.materialfx.controls.cell.MFXNotificationCell;
@ -95,7 +94,6 @@ public class MFXNotificationCenter extends Control implements MFXMenuControl {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-notification-center";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXNotificationCenter.css");
private final TransformableListWrapper<INotification> notifications = new TransformableListWrapper<>(FXCollections.observableArrayList());
@ -138,12 +136,7 @@ public class MFXNotificationCenter extends Control implements MFXMenuControl {
notifications,
notification -> new MFXNotificationCell(this, notification),
Orientation.VERTICAL
) {
@Override
public String getUserAgentStylesheet() {
return MFXNotificationCenter.this.getUserAgentStylesheet();
}
};
);
unreadCountBinding = Bindings.createLongBinding(() ->
notifications.stream()
@ -168,7 +161,6 @@ public class MFXNotificationCenter extends Control implements MFXMenuControl {
//================================================================================
private void initialize() {
getStyleClass().add(STYLE_CLASS);
getStylesheets().add(STYLESHEET);
setPrefSize(400, 550);
defaultContextMenu();

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.properties.functional.FunctionProperty;
import io.github.palexdev.materialfx.beans.properties.functional.SupplierProperty;
import io.github.palexdev.materialfx.controls.cell.MFXPage;
@ -63,7 +62,6 @@ public class MFXPagination extends Control {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-pagination";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXPagination.css");
private final IntegerProperty currentPage = new SimpleIntegerProperty(1) {
@Override
@ -201,11 +199,6 @@ public class MFXPagination extends Control {
return new MFXPaginationSkin(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.properties.styleable.StyleableBooleanProperty;
import io.github.palexdev.materialfx.beans.properties.styleable.StyleableStringProperty;
import io.github.palexdev.materialfx.font.MFXFontIcon;
@ -57,7 +56,6 @@ public class MFXPasswordField extends MFXTextField {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-password-field";
private final String STYLE_SHEET = MFXResourcesLoader.load("css/MFXPasswordField.css");
public static final String BULLET = "\u25cf";
protected static final PseudoClass MASKED_PSEUDO_CLASS = PseudoClass.getPseudoClass("masked");
@ -268,11 +266,6 @@ public class MFXPasswordField extends MFXTextField {
boundField.selectAll();
}
@Override
public String getUserAgentStylesheet() {
return STYLE_SHEET;
}
//================================================================================
// Styleable Properties
//================================================================================

View File

@ -23,6 +23,7 @@ import io.github.palexdev.materialfx.beans.PopupPositionBean;
import io.github.palexdev.materialfx.beans.PositionBean;
import io.github.palexdev.materialfx.css.MFXCSSBridge;
import io.github.palexdev.materialfx.css.MFXStyleablePopup;
import io.github.palexdev.materialfx.css.themes.Themes;
import io.github.palexdev.materialfx.effects.Interpolators;
import io.github.palexdev.materialfx.skins.MFXPopupSkin;
import io.github.palexdev.materialfx.utils.AnimationUtils.KeyFrames;
@ -139,6 +140,7 @@ public class MFXPopup extends PopupControl implements MFXStyleablePopup {
setAutoFix(true);
setAutoHide(true);
setHideOnEscape(true);
getStyleSheets().addAll(Themes.DEFAULT.loadTheme(), Themes.LEGACY.loadTheme());
hover.addListener(invalidated -> pseudoClassStateChanged(HOVER_PSEUDO_CLASS, hover.get()));
}
@ -339,11 +341,6 @@ public class MFXPopup extends PopupControl implements MFXStyleablePopup {
return bridge.getStylesheets();
}
@Override
public String getUserAgentStylesheet() {
return null;
}
//================================================================================
// Static Methods
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.NumberRange;
import io.github.palexdev.materialfx.skins.MFXProgressBarSkin;
import io.github.palexdev.materialfx.utils.StyleablePropertiesUtils;
@ -51,7 +50,6 @@ public class MFXProgressBar extends ProgressBar {
//================================================================================
private static final StyleablePropertyFactory<MFXProgressBar> FACTORY = new StyleablePropertyFactory<>(ProgressBar.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-progress-bar";
private final String STYLESHEETS = MFXResourcesLoader.load("css/MFXProgressBar.css");
private final ObservableList<NumberRange<Double>> ranges1 = FXCollections.observableArrayList();
private final ObservableList<NumberRange<Double>> ranges2 = FXCollections.observableArrayList();
@ -193,9 +191,4 @@ public class MFXProgressBar extends ProgressBar {
protected List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return getClassCssMetaData();
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEETS;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.NumberRange;
import io.github.palexdev.materialfx.beans.properties.styleable.StyleableDoubleProperty;
import io.github.palexdev.materialfx.beans.properties.styleable.StyleableObjectProperty;
@ -57,7 +56,6 @@ public class MFXProgressSpinner extends ProgressIndicator {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-progress-spinner";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXProgressSpinner.css");
private final ObservableList<NumberRange<Double>> ranges1 = FXCollections.observableArrayList();
private final ObservableList<NumberRange<Double>> ranges2 = FXCollections.observableArrayList();
@ -340,11 +338,6 @@ public class MFXProgressSpinner extends ProgressIndicator {
return new MFXProgressSpinnerSkin(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
@Override
protected List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return MFXProgressSpinner.getControlCssMetaDataList();

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.base.MFXLabeled;
import io.github.palexdev.materialfx.skins.MFXRadioButtonSkin;
import io.github.palexdev.materialfx.utils.StyleablePropertiesUtils;
@ -48,7 +47,6 @@ public class MFXRadioButton extends RadioButton implements MFXLabeled {
//================================================================================
private static final StyleablePropertyFactory<MFXRadioButton> FACTORY = new StyleablePropertyFactory<>(RadioButton.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-radio-button";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXRadioButton.css");
//================================================================================
// Constructors
@ -247,11 +245,6 @@ public class MFXRadioButton extends RadioButton implements MFXLabeled {
return new MFXRadioButtonSkin(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return MFXRadioButton.getControlCssMetaDataList();

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.base.AbstractMFXToggleNode;
import io.github.palexdev.materialfx.effects.ripple.RippleClipType;
import io.github.palexdev.materialfx.factories.RippleClipTypeFactory;
@ -45,7 +44,6 @@ public class MFXRectangleToggleNode extends AbstractMFXToggleNode {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-rectangle-toggle-node";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXRectangleToggleNode.css");
private final ObjectProperty<RippleClipTypeFactory> rippleClipTypeFactory = new SimpleObjectProperty<>();
//================================================================================
@ -105,9 +103,4 @@ public class MFXRectangleToggleNode extends AbstractMFXToggleNode {
protected Skin<?> createDefaultSkin() {
return new MFXRectangleToggleNodeSkin(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.skins.MFXScrollPaneSkin;
import io.github.palexdev.materialfx.utils.ColorUtils;
import javafx.beans.property.ObjectProperty;
@ -39,7 +38,6 @@ public class MFXScrollPane extends ScrollPane {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-scroll-pane";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXScrollPane.css");
//================================================================================
// Constructors
@ -158,10 +156,4 @@ public class MFXScrollPane extends ScrollPane {
protected Skin<?> createDefaultSkin() {
return new MFXScrollPaneSkin(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.NumberRange;
import io.github.palexdev.materialfx.beans.PositionBean;
import io.github.palexdev.materialfx.beans.properties.functional.SupplierProperty;
@ -115,7 +114,6 @@ public class MFXSlider extends Control {
//================================================================================
private static final StyleablePropertyFactory<MFXSlider> FACTORY = new StyleablePropertyFactory<>(Control.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-slider";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXSlider.css");
private final DoubleProperty min = new SimpleDoubleProperty() {
@Override
@ -323,7 +321,6 @@ public class MFXSlider extends Control {
container.setId("popupContent");
container.setAlignment(Pos.TOP_CENTER);
container.setMinSize(45, 40);
container.getStylesheets().add(STYLESHEET);
caret.rotateProperty().bind(Bindings.createDoubleBinding(
() -> {
@ -890,9 +887,4 @@ public class MFXSlider extends Control {
protected List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return MFXSlider.getControlCssMetaDataList();
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.properties.functional.BiFunctionProperty;
import io.github.palexdev.materialfx.beans.properties.functional.ConsumerProperty;
import io.github.palexdev.materialfx.beans.properties.functional.SupplierProperty;
@ -63,7 +62,6 @@ public class MFXSpinner<T> extends Control {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-spinner";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXSpinner.css");
private final ReadOnlyObjectWrapper<T> value = new ReadOnlyObjectWrapper<>();
private final ObjectProperty<SpinnerModel<T>> spinnerModel = new SimpleObjectProperty<>();
@ -146,11 +144,6 @@ public class MFXSpinner<T> extends Control {
return new MFXSpinnerSkin<>(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.properties.EventHandlerProperty;
import io.github.palexdev.materialfx.controls.MFXStepperToggle.MFXStepperToggleEvent;
import io.github.palexdev.materialfx.enums.StepperToggleState;
@ -72,7 +71,6 @@ public class MFXStepper extends Control {
//================================================================================
private static final StyleablePropertyFactory<MFXStepper> FACTORY = new StyleablePropertyFactory<>(Control.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-stepper";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXStepper.css");
private final ObservableList<MFXStepperToggle> stepperToggles = FXCollections.observableArrayList();
private final DoubleProperty animationDuration = new SimpleDoubleProperty(700.0);
@ -684,11 +682,6 @@ public class MFXStepper extends Control {
return MFXStepper.getControlCssMetaDataList();
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Events
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.enums.StepperToggleState;
import io.github.palexdev.materialfx.enums.TextPosition;
import io.github.palexdev.materialfx.skins.MFXStepperSkin;
@ -64,7 +63,6 @@ public class MFXStepperToggle extends Control implements Validated {
//================================================================================
private static final StyleablePropertyFactory<MFXStepperToggle> FACTORY = new StyleablePropertyFactory<>(Control.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-stepper-toggle";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXStepperToggle.css");
private final MFXValidator validator = new MFXValidator();
private final BooleanProperty showErrorIcon = new SimpleBooleanProperty(true);
@ -389,11 +387,6 @@ public class MFXStepperToggle extends Control implements Validated {
return MFXStepperToggle.getControlCssMetaDataList();
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Events
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.properties.functional.ComparatorProperty;
import io.github.palexdev.materialfx.beans.properties.functional.FunctionProperty;
import io.github.palexdev.materialfx.controls.cell.MFXTableRowCell;
@ -71,7 +70,6 @@ public class MFXTableColumn<T> extends Labeled {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-table-column";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXTableView.css");
private final FunctionProperty<T, MFXTableRowCell<T, ?>> rowCellFactory = new FunctionProperty<>() {
@Override
@ -176,11 +174,6 @@ public class MFXTableColumn<T> extends Labeled {
return new MFXTableColumnSkin<>(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.PositionBean;
import io.github.palexdev.materialfx.controls.cell.MFXTableRowCell;
import io.github.palexdev.materialfx.effects.ripple.MFXCircleRippleGenerator;
@ -53,7 +52,6 @@ public class MFXTableRow<T> extends HBox implements Cell<T> {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-table-row";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXTableView.css");
private final MFXTableView<T> tableView;
private final ObservableList<MFXTableRowCell<T, ?>> cells = FXCollections.observableArrayList();
@ -229,11 +227,6 @@ public class MFXTableRow<T> extends HBox implements Cell<T> {
setIndex(tableView.getTransformableList().viewToSource(index));
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.properties.functional.FunctionProperty;
import io.github.palexdev.materialfx.collections.TransformableList;
import io.github.palexdev.materialfx.collections.TransformableListWrapper;
@ -59,7 +58,6 @@ public class MFXTableView<T> extends Control {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-table-view";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXTableView.css");
protected final SimpleVirtualFlow<T, MFXTableRow<T>> rowsFlow;
protected final ReadOnlyBooleanWrapper virtualFlowInitialized = new ReadOnlyBooleanWrapper();
@ -88,12 +86,7 @@ public class MFXTableView<T> extends Control {
transformableList,
getTableRowFactory(),
Orientation.VERTICAL
) {
@Override
public String getUserAgentStylesheet() {
return MFXTableView.this.getUserAgentStylesheet();
}
};
);
rowsFlow.cellFactoryProperty().bind(tableRowFactoryProperty());
VBox.setVgrow(rowsFlow, Priority.ALWAYS);
@ -296,11 +289,6 @@ public class MFXTableView<T> extends Control {
return new MFXTableViewSkin<>(this, rowsFlow);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
@Override
protected void layoutChildren() {
super.layoutChildren();

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.properties.styleable.StyleableBooleanProperty;
import io.github.palexdev.materialfx.beans.properties.styleable.StyleableDoubleProperty;
import io.github.palexdev.materialfx.beans.properties.styleable.StyleableIntegerProperty;
@ -123,7 +122,6 @@ public class MFXTextField extends TextField implements Validated, MFXMenuControl
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-text-field";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXTextField.css");
protected final BoundTextField boundField;
public static final Color DEFAULT_TEXT_COLOR = Color.rgb(0, 0, 0, 0.87);
@ -299,11 +297,6 @@ public class MFXTextField extends TextField implements Validated, MFXMenuControl
return MFXTextField.getClassCssMetaData();
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Workaround Methods
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.properties.EventHandlerProperty;
import io.github.palexdev.materialfx.controls.base.MFXLabeled;
import io.github.palexdev.materialfx.skins.MFXToggleButtonSkin;
@ -58,7 +57,6 @@ public class MFXToggleButton extends Labeled implements Toggle, MFXLabeled {
//================================================================================
private static final StyleablePropertyFactory<MFXToggleButton> FACTORY = new StyleablePropertyFactory<>(Labeled.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-toggle-button";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXToggleButton.css");
private final ObjectProperty<ToggleGroup> toggleGroup = new SimpleObjectProperty<>();
private final BooleanProperty selected = new SimpleBooleanProperty(false);
@ -376,11 +374,6 @@ public class MFXToggleButton extends Labeled implements Toggle, MFXLabeled {
return new MFXToggleButtonSkin(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return MFXToggleButton.getControlCssMetaDataList();

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.Alignment;
import io.github.palexdev.materialfx.beans.PositionBean;
import io.github.palexdev.materialfx.beans.properties.functional.ConsumerProperty;
@ -67,7 +66,6 @@ public class MFXTooltip extends MFXPopup {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-tooltip";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXTooltip.css");
private final ObjectProperty<Node> icon = new SimpleObjectProperty<>();
private final StringProperty text = new SimpleStringProperty();
@ -226,11 +224,6 @@ public class MFXTooltip extends MFXPopup {
return new MFXTooltipSkin(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.base.AbstractMFXTreeCell;
import io.github.palexdev.materialfx.controls.base.AbstractMFXTreeItem;
import io.github.palexdev.materialfx.controls.cell.MFXSimpleTreeCell;
@ -60,7 +59,6 @@ public class MFXTreeItem<T> extends AbstractMFXTreeItem<T> {
//================================================================================
private static final StyleablePropertyFactory<MFXTreeItem<?>> FACTORY = new StyleablePropertyFactory<>(MFXTreeItem.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-tree-item";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXTreeItem.css");
private final BooleanProperty expanded = new SimpleBooleanProperty(false);
private final ReadOnlyBooleanWrapper animationRunning = new ReadOnlyBooleanWrapper(false);
@ -292,11 +290,6 @@ public class MFXTreeItem<T> extends AbstractMFXTreeItem<T> {
return MFXTreeItem.getControlCssMetaDataList();
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
/**
* Simple layout strategy. Each item in the {@link #items} list has a left margin defined by {@link #childrenMarginProperty()}.
*/

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.base.AbstractMFXTreeItem;
import io.github.palexdev.materialfx.factories.InsetsFactory;
import io.github.palexdev.materialfx.selection.TreeSelectionModel;
@ -41,7 +40,6 @@ public class MFXTreeView<T> extends MFXScrollPane {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-tree-view";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXTreeView.css");
private final ObjectProperty<AbstractMFXTreeItem<T>> root = new SimpleObjectProperty<>(null);
private final ObjectProperty<ITreeSelectionModel<T>> selectionModel = new SimpleObjectProperty<>(null);
@ -155,10 +153,6 @@ public class MFXTreeView<T> extends MFXScrollPane {
//================================================================================
// Override Methods
//================================================================================
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
/**
* Events class for tree views.

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.cell;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.PositionBean;
import io.github.palexdev.materialfx.controls.MFXCheckListView;
import io.github.palexdev.materialfx.controls.MFXCheckbox;
@ -46,7 +45,6 @@ public class MFXCheckListCell<T> extends AbstractMFXListCell<T> {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-check-list-cell";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXCheckListCell.css");
protected final MFXCircleRippleGenerator rippleGenerator = new MFXCircleRippleGenerator(this);
private final MFXCheckListView<T> listView;
@ -60,7 +58,6 @@ public class MFXCheckListCell<T> extends AbstractMFXListCell<T> {
super(listView, data);
this.listView = listView;
checkbox = new MFXCheckbox("");
checkbox.getStylesheets().setAll(getUserAgentStylesheet());
if (!(data instanceof Node)) {
label = new Label();
@ -174,9 +171,4 @@ public class MFXCheckListCell<T> extends AbstractMFXListCell<T> {
public Node getNode() {
return this;
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.cell;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.MFXCheckTreeItem;
import io.github.palexdev.materialfx.controls.MFXCheckbox;
import javafx.beans.property.BooleanProperty;
@ -35,7 +34,6 @@ public class MFXCheckTreeCell<T> extends MFXSimpleTreeCell<T> {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-check-tree-cell";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXCheckTreeCell.css");
private final MFXCheckbox checkbox;
private static final PseudoClass CHECKED_PSEUDO_CLASS = PseudoClass.getPseudoClass("checked");
@ -93,9 +91,4 @@ public class MFXCheckTreeCell<T> extends MFXSimpleTreeCell<T> {
public MFXCheckbox getCheckbox() {
return checkbox;
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.cell;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.MFXComboBox;
import io.github.palexdev.materialfx.controls.base.MFXCombo;
import io.github.palexdev.virtualizedfx.cell.Cell;
@ -49,7 +48,6 @@ public class MFXComboBoxCell<T> extends HBox implements Cell<T> {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-combo-box-cell";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXComboBoxCell.css");
protected final ReadOnlyObjectWrapper<T> data = new ReadOnlyObjectWrapper<>();
protected final ReadOnlyIntegerWrapper index = new ReadOnlyIntegerWrapper();
@ -168,11 +166,6 @@ public class MFXComboBoxCell<T> extends HBox implements Cell<T> {
setData(item);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.cell;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.MFXDatePicker;
import io.github.palexdev.virtualizedfx.cell.Cell;
import javafx.beans.binding.Bindings;
@ -46,7 +45,6 @@ public class MFXDateCell extends Label implements Cell<LocalDate> {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-date-cell";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXDateCell.css");
private final MFXDatePicker datePicker;
private final ReadOnlyObjectWrapper<LocalDate> date = new ReadOnlyObjectWrapper<>();
@ -128,11 +126,6 @@ public class MFXDateCell extends Label implements Cell<LocalDate> {
setDate(date);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.cell;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.PositionBean;
import io.github.palexdev.materialfx.controls.MFXListView;
import io.github.palexdev.materialfx.controls.cell.base.AbstractMFXListCell;
@ -45,7 +44,6 @@ public class MFXListCell<T> extends AbstractMFXListCell<T> {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-list-cell";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXListCell.css");
protected final MFXCircleRippleGenerator rippleGenerator = new MFXCircleRippleGenerator(this);
private final Label label;
@ -138,11 +136,6 @@ public class MFXListCell<T> extends AbstractMFXListCell<T> {
return this;
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
@Override
public String toString() {
String className = getClass().getName();

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.cell;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.Alignment;
import io.github.palexdev.materialfx.beans.NumberRange;
import io.github.palexdev.materialfx.controls.MFXListView;
@ -55,7 +54,6 @@ public class MFXPage extends Label implements Cell<Integer> {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-page";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXPagination.css");
private final MFXPagination pagination;
private final ReadOnlyIntegerWrapper index = new ReadOnlyIntegerWrapper();
@ -147,11 +145,6 @@ public class MFXPage extends Label implements Cell<Integer> {
setIndex(index);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.cell;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.MFXIconWrapper;
import io.github.palexdev.materialfx.controls.MFXTreeItem;
import io.github.palexdev.materialfx.controls.base.AbstractMFXTreeCell;
@ -40,7 +39,6 @@ public class MFXSimpleTreeCell<T> extends AbstractMFXTreeCell<T> {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-tree-cell";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXTreeCell.css");
//================================================================================
// Constructors
@ -151,9 +149,4 @@ public class MFXSimpleTreeCell<T> extends AbstractMFXTreeCell<T> {
disclosureNode.setRotate(90);
}
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.cell;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.controls.MFXTableColumn;
import io.github.palexdev.materialfx.controls.MFXTableRow;
import io.github.palexdev.materialfx.controls.MFXTableView;
@ -64,7 +63,6 @@ public class MFXTableRowCell<T, E> extends Labeled {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-table-row-cell";
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXTableView.css");
private final Function<T, E> extractor;
private final StringConverter<E> converter;
@ -121,11 +119,6 @@ public class MFXTableRowCell<T, E> extends Labeled {
return new MFXTableRowCellSkin<>(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.legacy;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.MFXSnapshotWrapper;
import io.github.palexdev.materialfx.controls.MFXComboBox;
import io.github.palexdev.materialfx.skins.legacy.MFXLegacyComboBoxSkin;
@ -72,7 +71,6 @@ public class MFXLegacyComboBox<T> extends ComboBox<T> implements Validated {
//================================================================================
private static final StyleablePropertyFactory<MFXLegacyComboBox<?>> FACTORY = new StyleablePropertyFactory<>(ComboBox.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-legacy-combo-box";
private final String STYLESHEET = MFXResourcesLoader.load("css/legacy/MFXComboBox.css");
private final MFXValidator validator = new MFXValidator();
private final ObjectProperty<Paint> invalidLineColor = new SimpleObjectProperty<>(Color.web("#EF6E6B"));
@ -378,11 +376,6 @@ public class MFXLegacyComboBox<T> extends ComboBox<T> implements Validated {
return new MFXLegacyComboBoxSkin<>(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return MFXLegacyComboBox.getControlCssMetaDataList();

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.legacy;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.PositionBean;
import io.github.palexdev.materialfx.effects.ripple.MFXCircleRippleGenerator;
import io.github.palexdev.materialfx.factories.InsetsFactory;
@ -51,7 +50,6 @@ public class MFXLegacyListCell<T> extends ListCell<T> {
//================================================================================
private static final StyleablePropertyFactory<MFXLegacyListCell<?>> FACTORY = new StyleablePropertyFactory<>(ListCell.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-legacy-list-cell";
private final String STYLESHEET = MFXResourcesLoader.load("css/legacy/MFXLegacyListCell.css");
private final MFXCircleRippleGenerator rippleGenerator = new MFXCircleRippleGenerator(this);
//================================================================================
@ -275,11 +273,6 @@ public class MFXLegacyListCell<T> extends ListCell<T> {
//================================================================================
// Override Methods
//================================================================================
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return MFXLegacyListCell.getControlCssMetaDataList();

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.legacy;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.effects.DepthLevel;
import io.github.palexdev.materialfx.skins.legacy.MFXLegacyListViewSkin;
import io.github.palexdev.materialfx.utils.ColorUtils;
@ -48,7 +47,6 @@ public class MFXLegacyListView<T> extends ListView<T> {
//================================================================================
private static final StyleablePropertyFactory<MFXLegacyListView<?>> FACTORY = new StyleablePropertyFactory<>(ListView.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-legacy-list-view";
private final String STYLESHEET = MFXResourcesLoader.load("css/legacy/MFXLegacyListView.css");
//================================================================================
// Constructors
@ -267,11 +265,6 @@ public class MFXLegacyListView<T> extends ListView<T> {
return new MFXLegacyListViewSkin<>(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return MFXLegacyListView.getControlCssMetaDataList();

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.legacy;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.PositionBean;
import io.github.palexdev.materialfx.effects.ripple.MFXCircleRippleGenerator;
import io.github.palexdev.materialfx.utils.NodeUtils;
@ -47,7 +46,6 @@ public class MFXLegacyTableRow<T> extends TableRow<T> {
//================================================================================
private static final StyleablePropertyFactory<MFXLegacyTableRow<?>> FACTORY = new StyleablePropertyFactory<>(TableRow.getClassCssMetaData());
private final String STYLE_CLASS = "mfx-legacy-table-row";
private final String STYLESHEET = MFXResourcesLoader.load("css/legacy/MFXTableRow.css");
private final MFXCircleRippleGenerator rippleGenerator = new MFXCircleRippleGenerator(this);
//================================================================================
@ -193,11 +191,6 @@ public class MFXLegacyTableRow<T> extends TableRow<T> {
//================================================================================
// Override Methods
//================================================================================
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return getControlCssMetaDataList();

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.controls.legacy;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.skins.legacy.MFXLegacyTableViewSkin;
import javafx.collections.ObservableList;
import javafx.scene.control.Skin;
@ -35,7 +34,6 @@ public class MFXLegacyTableView<S> extends TableView<S> {
// Properties
//================================================================================
private final String STYLE_CLASS = "mfx-legacy-table-view";
private final String STYLESHEET = MFXResourcesLoader.load("css/legacy/MFXTableView.css");
//================================================================================
// Constructors
@ -65,9 +63,4 @@ public class MFXLegacyTableView<S> extends TableView<S> {
protected Skin<?> createDefaultSkin() {
return new MFXLegacyTableViewSkin<>(this);
}
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
}

View File

@ -19,11 +19,9 @@
package io.github.palexdev.materialfx.css;
import io.github.palexdev.materialfx.controls.MFXPopup;
import io.github.palexdev.materialfx.skins.MFXContextMenuSkin;
import javafx.collections.ObservableList;
import javafx.scene.Parent;
import javafx.scene.control.PopupControl;
import javafx.scene.layout.Region;
/**
* JavaFX offers a special type of Popup, the {@link PopupControl}, to allow styling
@ -59,12 +57,4 @@ public interface MFXStyleablePopup {
* @return the parsed stylesheets
*/
ObservableList<String> getStyleSheets();
/**
* This method works just like {@link Region#getUserAgentStylesheet()}.
* <p></p>
* Any {@link MFXStyleablePopup} should offer the possibility of setting a base stylesheet.
* It's up to the skin on how to use it though (an example can be found here {@link MFXContextMenuSkin}).
*/
String getUserAgentStylesheet();
}

View File

@ -0,0 +1,33 @@
package io.github.palexdev.materialfx.css.themes;
import javafx.scene.Parent;
import javafx.scene.Scene;
public class MFXThemeManager {
@SafeVarargs
public static <T extends Theme> void addOn(Parent parent, T... ts) {
for (T t : ts) {
parent.getStylesheets().add(t.loadTheme());
}
}
@SafeVarargs
public static <T extends Theme> void setOn(Parent parent, T... ts) {
parent.getStylesheets().clear();
addOn(parent, ts);
}
@SafeVarargs
public static <T extends Theme> void addOn(Scene scene, T... ts) {
for (T t : ts) {
scene.getStylesheets().add(t.loadTheme());
}
}
@SafeVarargs
public static <T extends Theme> void setOn(Scene scene, T... ts) {
scene.getStylesheets().clear();
addOn(scene, ts);
}
}

View File

@ -0,0 +1,62 @@
package io.github.palexdev.materialfx.css.themes;
import io.github.palexdev.materialfx.MFXResourcesLoader;
public enum Stylesheets implements Theme {
BUTTON("MFXButton.css"),
CHECKBOX("MFXCheckBox.css"),
CHECK_LIST_CELL("MFXCheckListCell.css"),
CHECK_LIST_VIEW("MFXCheckListView.css"),
CHECK_TREE_CELL("MFXCheckTreeCell.css"),
CIRCLE_TOGGLE_NODE("MFXCircleToggleNode.css"),
COMBO_BOX("MFXComboBox.css"),
COMBO_BOX_CELL("MFXComboBoxCell.css"),
CONTEXT_MENU("MFXContextMenu.css"),
CONTEXT_MENU_ITEM("MFXContextMenuItem.css"),
DATE_CELL("MFXDateCell.css"),
DATE_PICKER("MFXDatePicker.css"),
DIALOGS("MFXDialogs.css"),
FILTER_COMBO_BOX("MFXFilterComboBox.css"),
FILTER_DIALOG("MFXFilterDialog.css"),
FILTER_PANE("MFXFilterPane.css"),
LIST_CELL("MFXListCell.css"),
LIST_VIEW("MFXListView.css"),
MAGNIFIER("MFXMagnifier.css"),
NOTIFICATION_CENTER("MFXNotificationCenter.css"),
PAGINATION("MFXPagination.css"),
PASSWORD_FIELD("MFXPasswordField.css"),
PROGRESS_BAR("MFXProgressBar.css"),
PROGRESS_SPINNER("MFXProgressSpinner.css"),
RADIO_BUTTON("MFXRadioButton.css"),
RECTANGLE_TOGGLE_NODE("MFXRectangleToggleNode.css"),
SCROLL_PANE("MFXScrollPane.css"),
SLIDER("MFXSlider.css"),
SPINNER("MFXSpinner.css"),
STEPPER("MFXStepper.css"),
STEPPER_TOGGLE("MFXStepperToggle.css"),
TABLE_VIEW("MFXTableView.css"),
TEXT_FIELD("MFXTextField.css"),
TOGGLE_BUTTON("MFXToggleButton.css"),
TOOLTIP("MFXTooltip.css"),
TREE_CELL("MFXTreeCell.css"),
TREE_ITEM("MFXTreeItem.css"),
TREE_VIEW("MFXTreeView.css"),
;
private final String stylesheet;
Stylesheets(String stylesheet) {
this.stylesheet = stylesheet;
}
@Override
public String getTheme() {
return stylesheet;
}
@Override
public String loadTheme() {
if (Helper.isCached(this)) return Helper.getCachedTheme(this);
return Helper.cacheTheme(this, MFXResourcesLoader.load(baseDir() + getTheme()));
}
}

View File

@ -0,0 +1,32 @@
package io.github.palexdev.materialfx.css.themes;
import java.util.HashMap;
import java.util.Map;
public interface Theme {
String getTheme();
String loadTheme();
default String baseDir() {
return "css/";
}
class Helper {
private static final Map<Theme, String> CACHE = new HashMap<>();
protected static boolean isCached(Theme theme) {
return CACHE.containsKey(theme);
}
protected static String cacheTheme(Theme theme, String loaded) {
CACHE.put(theme, loaded);
return loaded;
}
protected static String getCachedTheme(Theme theme) {
return CACHE.get(theme);
}
}
}

View File

@ -0,0 +1,26 @@
package io.github.palexdev.materialfx.css.themes;
import io.github.palexdev.materialfx.MFXResourcesLoader;
public enum Themes implements Theme {
DEFAULT("DefaultTheme.css"),
LEGACY("legacy/LegacyControls.css"),
;
private final String theme;
Themes(String theme) {
this.theme = theme;
}
@Override
public String getTheme() {
return theme;
}
@Override
public String loadTheme() {
if (Helper.isCached(this)) return Helper.getCachedTheme(this);
return Helper.cacheTheme(this, MFXResourcesLoader.load(baseDir() + getTheme()));
}
}

View File

@ -18,6 +18,8 @@
package io.github.palexdev.materialfx.dialogs;
import io.github.palexdev.materialfx.css.themes.MFXThemeManager;
import io.github.palexdev.materialfx.css.themes.Themes;
import javafx.scene.layout.BorderPane;
/**
@ -41,6 +43,7 @@ public abstract class AbstractMFXDialog extends BorderPane {
//================================================================================
private void initialize() {
getStyleClass().add(STYLE_CLASS);
MFXThemeManager.addOn(this, Themes.DEFAULT, Themes.LEGACY);
setMinSize(400, 200);
}

View File

@ -18,7 +18,6 @@
package io.github.palexdev.materialfx.dialogs;
import io.github.palexdev.materialfx.MFXResourcesLoader;
import io.github.palexdev.materialfx.beans.properties.EventHandlerProperty;
import io.github.palexdev.materialfx.controls.MFXIconWrapper;
import io.github.palexdev.materialfx.controls.MFXScrollPane;
@ -64,8 +63,6 @@ public class MFXGenericDialog extends AbstractMFXDialog {
//================================================================================
// Properties
//================================================================================
private final String STYLESHEET = MFXResourcesLoader.load("css/MFXDialogs.css");
protected HBox header;
protected Label headerLabel;
protected MFXIconWrapper alwaysOnTopIcon;
@ -292,14 +289,6 @@ public class MFXGenericDialog extends AbstractMFXDialog {
actions.getChildren().clear();
}
//================================================================================
// Overridden Methods
//================================================================================
@Override
public String getUserAgentStylesheet() {
return STYLESHEET;
}
//================================================================================
// Getters/Setters
//================================================================================

View File

@ -101,7 +101,7 @@ public class MFXCheckboxSkin extends MFXLabeledSkinBase<MFXCheckbox> {
super.layoutChildren(contentX, contentY, contentWidth, contentHeight);
double boxSize = box.getSize();
Insets boxPadding = box.getPadding();
Insets boxPadding = rippleContainer.getPadding();
double boxClipRadius = boxPadding.getLeft() + boxSize / 2 + boxPadding.getRight();
rippleContainerClip.setRadius(boxClipRadius);
}

View File

@ -52,12 +52,7 @@ public class MFXCircleToggleNodeSkin extends SkinBase<MFXCircleToggleNode> {
circle.getStyleClass().add("circle");
circle.radiusProperty().bind(toggleNode.sizeProperty());
label = new MFXTextField() {
@Override
public String getUserAgentStylesheet() {
return toggleNode.getUserAgentStylesheet();
}
};
label = new MFXTextField();
label.alignmentProperty().bind(toggleNode.alignmentProperty());
label.fontProperty().bind(toggleNode.fontProperty());
label.graphicTextGapProperty().bind(toggleNode.graphicTextGapProperty());

View File

@ -227,12 +227,7 @@ public class MFXComboBoxSkin<T> extends MFXTextFieldSkin {
*/
protected MFXPopup createPopup() {
MFXComboBox<T> comboBox = getComboBox();
MFXPopup popup = new MFXPopup() {
@Override
public String getUserAgentStylesheet() {
return comboBox.getUserAgentStylesheet();
}
};
MFXPopup popup = new MFXPopup();
popup.getStyleClass().add("combo-popup");
popup.setPopupStyleableParent(comboBox);
popup.setAutoHide(true);
@ -255,12 +250,7 @@ public class MFXComboBoxSkin<T> extends MFXTextFieldSkin {
comboBox.itemsProperty(),
comboBox.getCellFactory(),
Orientation.VERTICAL
) {
@Override
public String getUserAgentStylesheet() {
return comboBox.getUserAgentStylesheet();
}
};
);
virtualFlow.cellFactoryProperty().bind(comboBox.cellFactoryProperty());
virtualFlow.prefWidthProperty().bind(comboBox.widthProperty());

View File

@ -88,12 +88,7 @@ public class MFXContextMenuSkin implements Skin<MFXContextMenu> {
};
Bindings.bindContent(container.getChildren(), contextMenu.getItems());
scrollPane = new MFXScrollPane(container) {
@Override
public String getUserAgentStylesheet() {
return contextMenu.getUserAgentStylesheet();
}
};
scrollPane = new MFXScrollPane(container);
scrollPane.setFitToWidth(true);
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.getTransforms().add(scale);

View File

@ -100,12 +100,7 @@ public class MFXDatePickerSkin extends MFXTextFieldSkin {
public MFXDatePickerSkin(MFXDatePicker datePicker, BoundTextField boundField) {
super(datePicker, boundField);
popup = new MFXPopup() {
@Override
public String getUserAgentStylesheet() {
return datePicker.getUserAgentStylesheet();
}
};
popup = new MFXPopup();
popup.getStyleClass().add("date-picker-popup");
popup.setPopupStyleableParent(datePicker);
popup.setAutoHide(true);
@ -294,12 +289,7 @@ public class MFXDatePickerSkin extends MFXTextFieldSkin {
protected Node createPopupContent() {
MFXDatePicker datePicker = getDatePicker();
MFXComboBox<Month> monthCombo = new MFXComboBox<>(FXCollections.observableArrayList(Month.values())) {
@Override
public String getUserAgentStylesheet() {
return datePicker.getUserAgentStylesheet();
}
};
MFXComboBox<Month> monthCombo = new MFXComboBox<>(FXCollections.observableArrayList(Month.values()));
monthCombo.getStyleClass().add("months-combo");
monthCombo.converterProperty().bind(Bindings.createObjectBinding(
() -> datePicker.getMonthConverterSupplier().get(),
@ -312,12 +302,7 @@ public class MFXDatePickerSkin extends MFXTextFieldSkin {
updateGrid();
});
MFXComboBox<Integer> yearCombo = new MFXComboBox<>(years) {
@Override
public String getUserAgentStylesheet() {
return datePicker.getUserAgentStylesheet();
}
};
MFXComboBox<Integer> yearCombo = new MFXComboBox<>(years);
yearCombo.getStyleClass().add("years-combo");
yearCombo.selectItem(currentYearMonth.getYear());
yearCombo.valueProperty().addListener((observable, oldValue, newValue) -> {

View File

@ -103,12 +103,7 @@ public class MFXFilterComboBoxSkin<T> extends MFXComboBoxSkin<T> {
MFXFilterComboBox<T> comboBox = getComboBox();
TransformableList<T> filterList = comboBox.getFilterList();
MFXTextField searchField = new MFXTextField("", I18N.getOrDefault("filterCombo.search")) {
@Override
public String getUserAgentStylesheet() {
return comboBox.getUserAgentStylesheet();
}
};
MFXTextField searchField = new MFXTextField("", I18N.getOrDefault("filterCombo.search"));
searchField.getStyleClass().add("search-field");
searchField.textProperty().bindBidirectional(comboBox.searchTextProperty());
searchField.setMaxWidth(Double.MAX_VALUE);

View File

@ -22,7 +22,10 @@ import io.github.palexdev.materialfx.beans.BiPredicateBean;
import io.github.palexdev.materialfx.beans.FilterBean;
import io.github.palexdev.materialfx.controls.*;
import io.github.palexdev.materialfx.controls.cell.MFXComboBoxCell;
import io.github.palexdev.materialfx.dialogs.*;
import io.github.palexdev.materialfx.dialogs.MFXDialogs;
import io.github.palexdev.materialfx.dialogs.MFXGenericDialog;
import io.github.palexdev.materialfx.dialogs.MFXGenericDialogBuilder;
import io.github.palexdev.materialfx.dialogs.MFXStageDialog;
import io.github.palexdev.materialfx.effects.ripple.RippleClipType;
import io.github.palexdev.materialfx.enums.ChainMode;
import io.github.palexdev.materialfx.enums.FloatMode;
@ -101,12 +104,7 @@ public class MFXFilterPaneSkin<T> extends SkinBase<MFXFilterPane<T>> {
filterBuilder = buildFilterBuilder();
activeFiltersPane = buildActiveFilters();
filtersContainer = new MFXScrollPane(activeFiltersPane) {
@Override
public String getUserAgentStylesheet() {
return filterPane.getUserAgentStylesheet();
}
};
filtersContainer = new MFXScrollPane(activeFiltersPane);
filtersContainer.setFitToWidth(true);
filtersContainer.maxWidthProperty().bind(filterPane.widthProperty());
@ -233,77 +231,31 @@ public class MFXFilterPaneSkin<T> extends SkinBase<MFXFilterPane<T>> {
ListProperty<BiPredicateBean<?, ?>> predicates = new SimpleListProperty<>(FXCollections.observableArrayList());
MFXTextField searchField = new MFXTextField() {
@Override
public String getUserAgentStylesheet() {
return filterPane.getUserAgentStylesheet();
}
};
MFXTextField searchField = new MFXTextField();
searchField.setFloatMode(FloatMode.DISABLED);
searchField.setPromptText(I18N.getOrDefault("filterPane.searchField"));
searchField.textProperty().bindBidirectional(query);
MFXComboBox<Object> enumsCombo = new MFXComboBox<>() {
@Override
public String getUserAgentStylesheet() {
return filterPane.getUserAgentStylesheet();
}
};
MFXComboBox<Object> enumsCombo = new MFXComboBox<>();
enumsCombo.setFloatMode(FloatMode.DISABLED);
enumsCombo.valueProperty().addListener((observable, oldValue, newValue) -> setQuery(newValue.toString()));
enumsCombo.setManaged(false);
enumsCombo.setVisible(false);
enumsCombo.setCellFactory((t) -> {
return new MFXComboBoxCell<>(enumsCombo, t) {
@Override
public String getUserAgentStylesheet() {
return filterPane.getUserAgentStylesheet();
}
};
});
enumsCombo.setCellFactory(t -> new MFXComboBoxCell<>(enumsCombo, t));
MFXComboBox<Boolean> booleansCombo = new MFXComboBox<>(FXCollections.observableArrayList(true, false)) {
@Override
public String getUserAgentStylesheet() {
return filterPane.getUserAgentStylesheet();
}
};
MFXComboBox<Boolean> booleansCombo = new MFXComboBox<>(FXCollections.observableArrayList(true, false));
booleansCombo.setFloatMode(FloatMode.DISABLED);
booleansCombo.valueProperty().addListener((observable, oldValue, newValue) -> setQuery(newValue.toString()));
booleansCombo.setManaged(false);
booleansCombo.setVisible(false);
booleansCombo.setCellFactory((t) -> {
return new MFXComboBoxCell<>(booleansCombo, t) {
@Override
public String getUserAgentStylesheet() {
return filterPane.getUserAgentStylesheet();
}
};
});
booleansCombo.setCellFactory(t -> new MFXComboBoxCell<>(booleansCombo, t));
MFXComboBox<BiPredicateBean<?, ?>> predicatesCombo = new MFXComboBox<>(predicates) {
@Override
public String getUserAgentStylesheet() {
return filterPane.getUserAgentStylesheet();
}
};
MFXComboBox<BiPredicateBean<?, ?>> predicatesCombo = new MFXComboBox<>(predicates);
predicatesCombo.setFloatMode(FloatMode.DISABLED);
predicatesCombo.getStyleClass().add("predicates-combo");
predicatesCombo.setCellFactory((p) -> {
return new MFXComboBoxCell<>(predicatesCombo, p) {
@Override
public String getUserAgentStylesheet() {
return filterPane.getUserAgentStylesheet();
}
};
});
predicatesCombo.setCellFactory(p -> new MFXComboBoxCell<>(predicatesCombo, p));
MFXComboBox<AbstractFilter<T, ?>> filterCombo = new MFXComboBox<>(filterPane.getFilters()) {
@Override
public String getUserAgentStylesheet() {
return filterPane.getUserAgentStylesheet();
}
};
MFXComboBox<AbstractFilter<T, ?>> filterCombo = new MFXComboBox<>(filterPane.getFilters());
filterCombo.setFloatMode(FloatMode.DISABLED);
filterCombo.getStyleClass().add("filter-combo");
filterCombo.valueProperty().addListener((observable, oldValue, newValue) -> {
@ -331,21 +283,9 @@ public class MFXFilterPaneSkin<T> extends SkinBase<MFXFilterPane<T>> {
}
});
filterCombo.selectFirst();
filterCombo.setCellFactory((t) -> {
return new MFXComboBoxCell<>(filterCombo, t) {
@Override
public String getUserAgentStylesheet() {
return filterPane.getUserAgentStylesheet();
}
};
});
filterCombo.setCellFactory(t -> new MFXComboBoxCell<>(filterCombo, t));
MFXButton addButton = new MFXButton(I18N.getOrDefault("filterPane.addFilter")) {
@Override
public String getUserAgentStylesheet() {
return filterPane.getUserAgentStylesheet();
}
};
MFXButton addButton = new MFXButton(I18N.getOrDefault("filterPane.addFilter"));
addButton.setOnAction(event -> {
if (filterCombo.getSelectedItem() != null
&& predicatesCombo.getSelectedItem() != null

View File

@ -51,7 +51,6 @@ public class MFXListViewSkin<T> extends SkinBase<AbstractMFXListView<T, ?>> {
super(listView);
hBar = virtualFlow.getHBar();
vBar = virtualFlow.getVBar();
virtualFlow.getStylesheets().setAll(listView.getUserAgentStylesheet());
hideBars = AnimationUtils.TimelineBuilder.build()
.add(

View File

@ -55,12 +55,7 @@ public class MFXPopupSkin implements Skin<MFXPopup> {
this.popup = popup;
scale = new Scale(0.1, 0.1, 0, 0);
container = new StackPane(popup.getContent()) {
@Override
public String getUserAgentStylesheet() {
return popup.getUserAgentStylesheet();
}
};
container = new StackPane(popup.getContent());
container.getTransforms().setAll(scale);
initHandler = event -> {

View File

@ -48,12 +48,7 @@ public class MFXRectangleToggleNodeSkin extends SkinBase<MFXRectangleToggleNode>
public MFXRectangleToggleNodeSkin(MFXRectangleToggleNode toggleNode) {
super(toggleNode);
label = new MFXTextField() {
@Override
public String getUserAgentStylesheet() {
return toggleNode.getUserAgentStylesheet();
}
};
label = new MFXTextField();
label.alignmentProperty().bind(toggleNode.alignmentProperty());
label.fontProperty().bind(toggleNode.fontProperty());
label.graphicTextGapProperty().bind(toggleNode.graphicTextGapProperty());

View File

@ -155,7 +155,6 @@ public class MFXSliderSkin extends SkinBase<MFXSlider> {
group = new Group(track, ticksGroup, bar, thumb, popup);
group.setManaged(false);
group.getStylesheets().add(slider.getUserAgentStylesheet());
getChildren().setAll(group);
releaseTimer.setDuration(Duration.millis(800));

View File

@ -79,12 +79,7 @@ public class MFXSpinnerSkin<T> extends SkinBase<MFXSpinner<T>> {
super(spinner);
// Text Field
field = new MFXTextField() {
@Override
public String getUserAgentStylesheet() {
return spinner.getUserAgentStylesheet();
}
};
field = new MFXTextField();
field.setFloatMode(FloatMode.DISABLED);
field.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
field.allowEditProperty().bind(spinner.editableProperty());

View File

@ -152,7 +152,6 @@ public class MFXStepperSkin extends SkinBase<MFXStepper> {
contentPane.getStyleClass().setAll("content-pane");
BorderPane container = new BorderPane();
container.getStylesheets().setAll(stepper.getUserAgentStylesheet());
container.setTop(stepperBar);
container.setCenter(contentPane);
container.setBottom(buttonsBox);

View File

@ -60,12 +60,7 @@ public class MFXTooltipSkin implements Skin<MFXTooltip> {
label.graphicProperty().bind(tooltip.iconProperty());
scale = new Scale(0.1, 0.1, 0, 0);
container = new StackPane(label) {
@Override
public String getUserAgentStylesheet() {
return tooltip.getUserAgentStylesheet();
}
};
container = new StackPane(label);
container.getStyleClass().add("container");
container.getTransforms().addAll(scale);
tooltip.setContent(container);

View File

@ -92,7 +92,6 @@ public class MFXLegacyComboBoxSkin<T> extends ComboBoxListViewSkin<T> {
validate = new Label();
validate.setGraphic(warnWrapper);
validate.getStyleClass().add("validate-label");
validate.getStylesheets().setAll(comboBox.getUserAgentStylesheet());
validate.setGraphicTextGap(padding);
validate.setVisible(false);
validate.setManaged(false);

View File

@ -79,6 +79,9 @@ module MaterialFX {
exports io.github.palexdev.materialfx.skins.base;
exports io.github.palexdev.materialfx.skins.legacy;
// Themes Package
exports io.github.palexdev.materialfx.css.themes;
// Utils Package
exports io.github.palexdev.materialfx.utils;
exports io.github.palexdev.materialfx.utils.others;

View File

@ -0,0 +1,38 @@
@import "MFXButton.css";
@import "MFXCheckBox.css";
@import "MFXCheckListCell.css";
@import "MFXCheckListView.css";
@import "MFXCheckTreeCell.css";
@import "MFXCircleToggleNode.css";
@import "MFXComboBox.css";
@import "MFXComboBoxCell.css";
@import "MFXContextMenu.css";
@import "MFXContextMenuItem.css";
@import "MFXDateCell.css";
@import "MFXDatePicker.css";
@import "MFXDialogs.css";
@import "MFXFilterComboBox.css";
@import "MFXFilterDialog.css";
@import "MFXFilterPane.css";
@import "MFXListCell.css";
@import "MFXListView.css";
@import "MFXMagnifier.css";
@import "MFXNotificationCenter.css";
@import "MFXPagination.css";
@import "MFXPasswordField.css";
@import "MFXProgressBar.css";
@import "MFXProgressSpinner.css";
@import "MFXRadioButton.css";
@import "MFXRectangleToggleNode.css";
@import "MFXScrollPane.css";
@import "MFXSlider.css";
@import "MFXSpinner.css";
@import "MFXStepper.css";
@import "MFXStepperToggle.css";
@import "MFXTableView.css";
@import "MFXTextField.css";
@import "MFXToggleButton.css";
@import "MFXTooltip.css";
@import "MFXTreeCell.css";
@import "MFXTreeItem.css";
@import "MFXTreeView.css";

View File

@ -35,7 +35,7 @@
-fx-border-radius: 2;
-fx-border-width: 1.5;
-fx-padding: 4;
-fx-padding: 2;
}
.mfx-checkbox .box .mark {
@ -45,6 +45,10 @@
-mfx-size: 12;
}
.mfx-checkbox .ripple-container {
-fx-padding: 4;
}
.mfx-checkbox .ripple-container .mfx-ripple-generator {
-mfx-animation-speed: 1.5;
-mfx-ripple-color: derive(-mfx-main, 110%);

View File

@ -22,15 +22,15 @@
-mfx-thumb-hover-color: rgb(89, 88, 91);
}
.virtual-flow .scroll-bar .track {
.mfx-check-list-view .virtual-flow .scroll-bar .track {
-fx-background-color: -mfx-track-color;
}
.virtual-flow .scroll-bar .thumb {
.mfx-check-list-view .virtual-flow .scroll-bar .thumb {
-fx-background-color: -mfx-thumb-color;
}
.virtual-flow .scroll-bar .thumb:pressed,
.virtual-flow .scroll-bar .thumb:hover {
.mfx-check-list-view .virtual-flow .scroll-bar .thumb:pressed,
.mfx-check-list-view .virtual-flow .scroll-bar .thumb:hover {
-fx-background-color: -mfx-thumb-hover-color;
}

View File

@ -41,110 +41,8 @@
-fx-background-radius: 5;
-fx-border-color: #ebebeb;
-fx-border-radius: 5;
-fx-max-height: 200;
}
.mfx-combo-box:disabled .caret .mfx-font-icon {
-mfx-color: #bcbcbc;
}
/**************************************************
* Virtual Flow Init
**************************************************/
.virtual-flow {
-fx-background-color: white;
}
/* Remove JavaFX crap */
.scroll-bar,
.scroll-bar .decrement-arrow,
.scroll-bar .increment-arrow {
-fx-pref-width: 0;
-fx-pref-height: 0;
}
.scroll-bar:horizontal .increment-button,
.scroll-bar:horizontal .decrement-button {
-fx-background-color: transparent;
-fx-background-radius: 0.0em;
-fx-padding: 0.0 0.0 10.0 0.0;
}
.scroll-bar:vertical .increment-button,
.scroll-bar:vertical .decrement-button {
-fx-background-color: transparent;
-fx-background-radius: 0.0em;
-fx-padding: 0.0 10.0 0.0 0.0;
}
.scroll-bar .increment-arrow,
.scroll-bar .decrement-arrow {
-fx-shape: " ";
-fx-padding: 0.15em 0.0;
}
.scroll-bar:horizontal .increment-arrow,
.scroll-bar:horizontal .decrement-arrow {
-fx-shape: " ";
-fx-padding: 0.0 0.05em;
}
.scroll-bar:vertical .increment-arrow,
.scroll-bar:vertical .decrement-arrow {
-fx-shape: " ";
-fx-padding: 0.0 0.05em;
}
/* Customize ScrollBars */
.scroll-bar:horizontal .track {
-fx-background-color: -mfx-track-color;
-fx-border-color: transparent;
-fx-background-radius: 2.0em;
-fx-border-radius: 2.0em;
-fx-background-insets: 3;
}
.scroll-bar:vertical .track {
-fx-background-color: -mfx-track-color;
-fx-border-color: transparent;
-fx-background-radius: 2.0em;
-fx-border-radius: 2.0em;
-fx-background-insets: 3;
}
.scroll-bar .decrement-arrow,
.scroll-bar .increment-arrow {
-fx-pref-width: 0;
-fx-pref-height: 0;
}
.scroll-bar:vertical {
-fx-background-color: transparent;
-fx-pref-width: 12;
-fx-pref-height: 12;
-fx-padding: 5 0.5 5 0.5;
}
.scroll-bar:horizontal {
-fx-background-color: transparent;
-fx-pref-width: 12;
-fx-pref-height: 12;
-fx-padding: 0.5 5 0.5 5;
}
.scroll-bar:horizontal .thumb,
.scroll-bar:vertical .thumb {
-fx-background-color: -mfx-thumb-color;
-fx-background-insets: 2.0, 0.0, 0.0;
-fx-background-radius: 2.0em;
}
.scroll-bar:horizontal .thumb:hover,
.scroll-bar:vertical .thumb:hover {
-fx-background-color: -mfx-thumb-hover-color;
-fx-background-insets: 1.5, 0.0, 0.0;
-fx-background-radius: 2.0em;
}

View File

@ -26,17 +26,17 @@
-mfx-font-family: "Open Sans SemiBold";
}
.mfx-filter-dialog .mfx-button {
.mfx-filter-dialog > .mfx-button {
-fx-border-color: -mfx-base-color;
-fx-border-radius: 5;
-fx-font-family: "Open Sans SemiBold";
}
.mfx-filter-dialog .mfx-button .text {
.mfx-filter-dialog > .mfx-button .text {
-fx-fill: -mfx-base-color;
}
.mfx-filter-dialog .mfx-button .mfx-ripple-generator {
.mfx-filter-dialog > .mfx-button .mfx-ripple-generator {
-mfx-ripple-color: derive(-mfx-base-color, 150%)
}

View File

@ -22,15 +22,15 @@
-mfx-thumb-hover-color: rgb(89, 88, 91);
}
.virtual-flow .scroll-bar .track {
.mfx-list-view .virtual-flow .scroll-bar .track {
-fx-background-color: -mfx-track-color;
}
.virtual-flow .scroll-bar .thumb {
.mfx-list-view .virtual-flow .scroll-bar .thumb {
-fx-background-color: -mfx-thumb-color;
}
.virtual-flow .scroll-bar .thumb:pressed,
.virtual-flow .scroll-bar .thumb:hover {
.mfx-list-view .virtual-flow .scroll-bar .thumb:pressed,
.mfx-list-view .virtual-flow .scroll-bar .thumb:hover {
-fx-background-color: -mfx-thumb-hover-color;
}

View File

@ -86,7 +86,7 @@ Header
/*************************
Virtual Flow
*************************/
.virtual-flow {
.mfx-notification-center .popup .notifications-container .virtual-flow {
-fx-background-color: transparent;
-track-color: rgb(230, 230, 230);
@ -94,100 +94,6 @@ Virtual Flow
-thumb-hover-color: rgb(89, 88, 91);
}
/* Remove JavaFX crap */
.scroll-bar,
.scroll-bar .decrement-arrow,
.scroll-bar .increment-arrow {
-fx-pref-width: 0;
-fx-pref-height: 0;
}
.scroll-bar:horizontal .increment-button,
.scroll-bar:horizontal .decrement-button {
-fx-background-color: transparent;
-fx-background-radius: 0.0em;
-fx-padding: 0.0 0.0 10.0 0.0;
}
.scroll-bar:vertical .increment-button,
.scroll-bar:vertical .decrement-button {
-fx-background-color: transparent;
-fx-background-radius: 0.0em;
-fx-padding: 0.0 10.0 0.0 0.0;
}
.scroll-bar .increment-arrow,
.scroll-bar .decrement-arrow {
-fx-shape: " ";
-fx-padding: 0.15em 0.0;
}
.scroll-bar:horizontal .increment-arrow,
.scroll-bar:horizontal .decrement-arrow {
-fx-shape: " ";
-fx-padding: 0.0 0.05em;
}
.scroll-bar:vertical .increment-arrow,
.scroll-bar:vertical .decrement-arrow {
-fx-shape: " ";
-fx-padding: 0.0 0.05em;
}
/* Customize ScrollBars */
.scroll-bar:horizontal .track {
-fx-background-color: -track-color;
-fx-border-color: transparent;
-fx-background-radius: 2.0em;
-fx-border-radius: 2.0em;
-fx-background-insets: 3;
}
.scroll-bar:vertical .track {
-fx-background-color: -track-color;
-fx-border-color: transparent;
-fx-background-radius: 2.0em;
-fx-border-radius: 2.0em;
-fx-background-insets: 3;
}
.scroll-bar .decrement-arrow,
.scroll-bar .increment-arrow {
-fx-pref-width: 0;
-fx-pref-height: 0;
}
.scroll-bar:vertical {
-fx-background-color: transparent;
-fx-pref-width: 12;
-fx-pref-height: 12;
-fx-padding: 5 0.5 5 0.5;
}
.scroll-bar:horizontal {
-fx-background-color: transparent;
-fx-pref-width: 12;
-fx-pref-height: 12;
-fx-padding: 0.5 5 0.5 5;
}
.scroll-bar:horizontal .thumb,
.scroll-bar:vertical .thumb {
-fx-background-color: -thumb-color;
-fx-background-insets: 2.0, 0.0, 0.0;
-fx-background-radius: 2.0em;
}
.scroll-bar:horizontal .thumb:hover,
.scroll-bar:vertical .thumb:hover {
-fx-background-color: -thumb-hover-color;
-fx-background-insets: 1.5, 0.0, 0.0;
-fx-background-radius: 2.0em;
}
.mfx-notification-center .popup .notifications-container .virtual-flow .mfx-notification-cell #check {
-mfx-checked-color: -mfx-purple;
-mfx-unchecked-color: -mfx-onyx;

View File

@ -86,104 +86,10 @@ Table Row Cells
/********************
Virtual Flow
********************/
.virtual-flow {
.mfx-table-view .virtual-flow {
-fx-background-color: transparent;
-track-color: rgb(230, 230, 230);
-thumb-color: rgb(137, 137, 137);
-thumb-hover-color: rgb(89, 88, 91);
}
/* Remove JavaFX crap */
.scroll-bar,
.scroll-bar .decrement-arrow,
.scroll-bar .increment-arrow {
-fx-pref-width: 0;
-fx-pref-height: 0;
}
.scroll-bar:horizontal .increment-button,
.scroll-bar:horizontal .decrement-button {
-fx-background-color: transparent;
-fx-background-radius: 0.0em;
-fx-padding: 0.0 0.0 10.0 0.0;
}
.scroll-bar:vertical .increment-button,
.scroll-bar:vertical .decrement-button {
-fx-background-color: transparent;
-fx-background-radius: 0.0em;
-fx-padding: 0.0 10.0 0.0 0.0;
}
.scroll-bar .increment-arrow,
.scroll-bar .decrement-arrow {
-fx-shape: " ";
-fx-padding: 0.15em 0.0;
}
.scroll-bar:horizontal .increment-arrow,
.scroll-bar:horizontal .decrement-arrow {
-fx-shape: " ";
-fx-padding: 0.0 0.05em;
}
.scroll-bar:vertical .increment-arrow,
.scroll-bar:vertical .decrement-arrow {
-fx-shape: " ";
-fx-padding: 0.0 0.05em;
}
/* Customize ScrollBars */
.scroll-bar:horizontal .track {
-fx-background-color: -track-color;
-fx-border-color: transparent;
-fx-background-radius: 2.0em;
-fx-border-radius: 2.0em;
-fx-background-insets: 3;
}
.scroll-bar:vertical .track {
-fx-background-color: -track-color;
-fx-border-color: transparent;
-fx-background-radius: 2.0em;
-fx-border-radius: 2.0em;
-fx-background-insets: 3;
}
.scroll-bar .decrement-arrow,
.scroll-bar .increment-arrow {
-fx-pref-width: 0;
-fx-pref-height: 0;
}
.scroll-bar:vertical {
-fx-background-color: transparent;
-fx-pref-width: 12;
-fx-pref-height: 12;
-fx-padding: 5 0.5 5 0.5;
}
.scroll-bar:horizontal {
-fx-background-color: transparent;
-fx-pref-width: 12;
-fx-pref-height: 12;
-fx-padding: 0.5 5 0.5 5;
}
.scroll-bar:horizontal .thumb,
.scroll-bar:vertical .thumb {
-fx-background-color: -thumb-color;
-fx-background-insets: 2.0, 0.0, 0.0;
-fx-background-radius: 2.0em;
}
.scroll-bar:horizontal .thumb:hover,
.scroll-bar:vertical .thumb:hover {
-fx-background-color: -thumb-hover-color;
-fx-background-insets: 1.5, 0.0, 0.0;
-fx-background-radius: 2.0em;
}

View File

@ -0,0 +1,5 @@
@import "MFXComboBox.css";
@import "MFXLegacyListView.css";
@import "MFXLegacyListCell.css";
@import "MFXTableView.css";
@import "MFXTableRow.css";