make table views rounded (wip)

This commit is contained in:
woodser 2025-05-01 19:01:42 -04:00
parent 4ebb9be253
commit 3725209273
No known key found for this signature in database
GPG key ID: 55A10DD48ADEE5EF
17 changed files with 53 additions and 17 deletions

View file

@ -1088,11 +1088,23 @@ textfield */
}
.table-view .filler {
-fx-background-color: -bs-color-gray-0;
-fx-background-color: transparent;
}
.table-view {
-fx-control-inner-background-alt: -fx-control-inner-background;
-fx-background-color: transparent;
-fx-border-color: transparent;
-fx-background-radius: 10;
-fx-border-radius: 10;
-fx-padding: 0;
}
.table-view .column-header-background {
-fx-background-color: transparent;
-fx-border-color: transparent;
-fx-background-radius: 10;
-fx-border-radius: 10;
}
.table-view .column-header .label {
@ -1103,12 +1115,11 @@ textfield */
}
.table-view .column-header {
-fx-background-color: -bs-color-gray-0;
-fx-background-color: transparent;
-fx-border-color: transparent;
-fx-padding: 0;
}
.table-view .focus {
-fx-alignment: center-left;
-fx-background-radius: 10 10 0 0;
-fx-border-radius: 10 10 0 0;
}
.table-view .text {
@ -1120,17 +1131,6 @@ textfield */
-fx-opacity: 0;
}
.table-view:focused {
-fx-background-color: -fx-box-border, -fx-control-inner-background;
-fx-background-insets: 0, 1;
-fx-padding: 1;
}
.table-view:focused .table-row-cell:focused {
-fx-background-color: -fx-table-cell-border-color, -fx-background;
-fx-background-insets: 0, 0 0 1 0;
}
.offer-table .table-row-cell {
-fx-border-color: -bs-background-color;
-fx-table-cell-border-color: -bs-background-color;

View file

@ -26,6 +26,7 @@ import haveno.desktop.components.AutoTooltipButton;
import haveno.desktop.components.AutoTooltipLabel;
import haveno.desktop.components.AutoTooltipTableColumn;
import haveno.desktop.main.overlays.Overlay;
import haveno.desktop.util.GUIUtil;
import haveno.desktop.util.ImageUtil;
import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.collections.FXCollections;
@ -73,6 +74,7 @@ public class ManageMarketAlertsWindow extends Overlay<ManageMarketAlertsWindow>
private void addContent() {
TableView<MarketAlertFilter> tableView = new TableView<>();
GUIUtil.applyRoundedArc(tableView);
GridPane.setRowIndex(tableView, ++rowIndex);
GridPane.setColumnSpan(tableView, 2);
GridPane.setMargin(tableView, new Insets(10, 0, 0, 0));

View file

@ -144,6 +144,7 @@ public class DepositView extends ActivatableView<VBox, Void> {
@Override
public void initialize() {
GUIUtil.applyRoundedArc(tableView);
paymentLabelString = Res.get("funds.deposit.fundHavenoWallet");
addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));

View file

@ -127,6 +127,8 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
@Override
public void initialize() {
GUIUtil.applyRoundedArc(tableView);
dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime")));
detailsColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.details")));
addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));

View file

@ -427,6 +427,7 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
private Tuple4<TableView<OfferListItem>, VBox, Button, Label> getOfferTable(OfferDirection direction) {
TableView<OfferListItem> tableView = new TableView<>();
GUIUtil.applyRoundedArc(tableView);
tableView.setMinHeight(initialOfferTableViewHeight);
tableView.setPrefHeight(initialOfferTableViewHeight);
tableView.setMinWidth(480);

View file

@ -65,6 +65,7 @@ public class SpreadView extends ActivatableViewAndModel<GridPane, SpreadViewMode
@Override
public void initialize() {
tableView = new TableView<>();
GUIUtil.applyRoundedArc(tableView);
int gridRow = 0;
GridPane.setRowIndex(tableView, gridRow);

View file

@ -730,6 +730,7 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
private void createTable() {
tableView = new TableView<>();
GUIUtil.applyRoundedArc(tableView);
VBox.setVgrow(tableView, Priority.ALWAYS);
// date

View file

@ -228,6 +228,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
root.getChildren().add(offerToolsBox);
tableView = new TableView<>();
GUIUtil.applyRoundedArc(tableView);
GridPane.setRowIndex(tableView, ++gridRow);
GridPane.setColumnIndex(tableView, 0);

View file

@ -156,6 +156,8 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
@Override
public void initialize() {
GUIUtil.applyRoundedArc(tableView);
widthListener = (observable, oldValue, newValue) -> onWidthChange((double) newValue);
tradeFeeColumn.setGraphic(new AutoTooltipLabel(ColumnNames.TRADE_FEE.toString().replace(" BTC", "")));
buyerSecurityDepositColumn.setGraphic(new AutoTooltipLabel(ColumnNames.BUYER_SEC.toString()));

View file

@ -115,6 +115,8 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
@Override
public void initialize() {
GUIUtil.applyRoundedArc(tableView);
priceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.price")));
amountColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())));
volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amount")));

View file

@ -156,6 +156,8 @@ public class OpenOffersView extends ActivatableViewAndModel<VBox, OpenOffersView
@Override
public void initialize() {
GUIUtil.applyRoundedArc(tableView);
widthListener = (observable, oldValue, newValue) -> onWidthChange((double) newValue);
groupIdColumn.setGraphic(new AutoTooltipLabel(ColumnNames.GROUP_ID.toString()));
paymentMethodColumn.setGraphic(new AutoTooltipLabel(ColumnNames.PAYMENT_METHOD.toString()));

View file

@ -55,6 +55,7 @@ import haveno.desktop.main.shared.ChatView;
import haveno.desktop.util.CssTheme;
import haveno.desktop.util.DisplayUtils;
import haveno.desktop.util.FormBuilder;
import haveno.desktop.util.GUIUtil;
import haveno.network.p2p.NodeAddress;
import java.util.Comparator;
import java.util.HashMap;
@ -171,6 +172,8 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
@Override
public void initialize() {
GUIUtil.applyRoundedArc(tableView);
priceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.price")));
amountColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())));
volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amount")));

View file

@ -149,6 +149,9 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
@Override
public void initialize() {
GUIUtil.applyRoundedArc(p2pPeersTableView);
GUIUtil.applyRoundedArc(moneroConnectionsTableView);
btcHeader.setText(Res.get("settings.net.xmrHeader"));
p2pHeader.setText(Res.get("settings.net.p2pHeader"));
onionAddress.setPromptText(Res.get("settings.net.onionAddressLabel"));

View file

@ -311,6 +311,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> implements
VBox.setVgrow(filterBox, Priority.NEVER);
tableView = new TableView<>();
GUIUtil.applyRoundedArc(tableView);
VBox.setVgrow(tableView, Priority.SOMETIMES);
tableView.setMinHeight(150);

View file

@ -2448,6 +2448,7 @@ public class FormBuilder {
if (groupStyle != null) titledGroupBg.getStyleClass().add(groupStyle);
TableView<T> tableView = new TableView<>();
GUIUtil.applyRoundedArc(tableView);
GridPane.setRowIndex(tableView, rowIndex);
GridPane.setMargin(tableView, new Insets(top + 30, -10, 5, -10));
gridPane.getChildren().add(tableView);

View file

@ -84,6 +84,7 @@ import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.shape.Rectangle;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Modality;
@ -1033,4 +1034,15 @@ public class GUIUtil {
columnConstraints2.setHgrow(Priority.ALWAYS);
gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
}
public static void applyRoundedArc(TableView<?> tableView) {
Rectangle clip = new Rectangle();
clip.setArcWidth(Layout.ROUNDED_ARC);
clip.setArcHeight(Layout.ROUNDED_ARC);
tableView.setClip(clip);
tableView.layoutBoundsProperty().addListener((obs, oldVal, newVal) -> {
clip.setWidth(newVal.getWidth());
clip.setHeight(newVal.getHeight());
});
}
}

View file

@ -40,4 +40,5 @@ public class Layout {
public static final double SPACING_V_BOX = 5d;
public static final double GRID_GAP = 5d;
public static final double LIST_ROW_HEIGHT = 34;
public static final double ROUNDED_ARC = 10;
}