Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,18 @@

public abstract class MDListCell<T> extends ListCell<T> {
private static final PseudoClass SELECTED = PseudoClass.getPseudoClass("selected");
protected static final PseudoClass WARNING = PseudoClass.getPseudoClass("warning");

private final StackPane container = new StackPane();
private final StackPane root = new StackPane();

public MDListCell(JFXListView<T> listView) {
getStyleClass().add("md-list-cell");

setText(null);
setGraphic(null);

root.getStyleClass().add("md-list-cell");
root.getStyleClass().add("root-container");
RipplerContainer ripplerContainer = new RipplerContainer(container);
root.getChildren().setAll(ripplerContainer);

Expand Down Expand Up @@ -73,9 +75,7 @@ protected StackPane getContainer() {
}

protected void setSelectable() {
FXUtils.onChangeAndOperate(selectedProperty(), selected -> {
root.pseudoClassStateChanged(SELECTED, selected);
});
FXUtils.onChangeAndOperate(selectedProperty(), selected -> pseudoClassStateChanged(SELECTED, selected));
}

protected abstract void updateControl(T item, boolean empty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.ListChangeListener;
import javafx.css.PseudoClass;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
Expand Down Expand Up @@ -543,7 +542,6 @@ final class ModInfoDialog extends JFXDialogLayout {
private static final Lazy<JFXPopup> popup = new Lazy<>(() -> new JFXPopup(menu.get()));

final class ModInfoListCell extends MDListCell<ModInfoObject> {
private static final PseudoClass WARNING = PseudoClass.getPseudoClass("warning");

JFXCheckBox checkBox = new JFXCheckBox();
ImageContainer imageContainer = new ImageContainer(32);
Expand All @@ -558,8 +556,6 @@ final class ModInfoListCell extends MDListCell<ModInfoObject> {
ModInfoListCell(JFXListView<ModInfoObject> listView) {
super(listView);

this.getStyleClass().add("mod-info-list-cell");

HBox container = new HBox(8);
container.setPickOnBounds(false);
container.setAlignment(Pos.CENTER_LEFT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import javafx.beans.binding.Bindings;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.css.PseudoClass;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
Expand Down Expand Up @@ -493,7 +492,6 @@ Image getIcon() {
}

private static final class ResourcePackListCell extends MDListCell<ResourcePackInfoObject> {
private static final PseudoClass WARNING = PseudoClass.getPseudoClass("warning");

private final ResourcePackListPage page;

Expand All @@ -511,8 +509,6 @@ public ResourcePackListCell(JFXListView<ResourcePackInfoObject> listView, Resour
super(listView);
this.page = page;

getStyleClass().add("resource-pack-list-cell");

HBox root = new HBox(8);
root.setPickOnBounds(false);
root.setAlignment(Pos.CENTER_LEFT);
Expand Down
10 changes: 3 additions & 7 deletions HMCL/src/main/resources/assets/css/root.css
Original file line number Diff line number Diff line change
Expand Up @@ -1096,20 +1096,16 @@
-fx-spacing: 10;
}

.md-list-cell {
.md-list-cell .root-container {
-fx-border-color: -monet-outline-variant;
-fx-border-width: 0 0 1 0;
}

.md-list-cell:selected {
.md-list-cell:selected .root-container {
-fx-background-color: -monet-secondary-container;
}

.mod-info-list-cell:warning {
-fx-background-color: -monet-error-container;
}

.resource-pack-list-cell:warning {
.md-list-cell:warning .root-container {
-fx-background-color: -monet-error-container;
}

Expand Down