fix open offers scrolling

This commit is contained in:
preland 2024-03-20 08:16:04 -05:00 committed by GitHub
parent a476181594
commit 379ac6d265
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 32 additions and 11 deletions

View File

@ -19,13 +19,15 @@
<?import haveno.desktop.components.list.FilterBox?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.VBox?>
<VBox fx:id="root" fx:controller="haveno.desktop.main.portfolio.pendingtrades.PendingTradesView"
spacing="20" xmlns:fx="http://javafx.com/fxml">
<padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0"/>
<Insets bottom="0.0" left="15.0" right="15.0" top="15.0"/>
</padding>
<FilterBox fx:id="filterBox" />
<TableView fx:id="tableView" VBox.vgrow="SOMETIMES">
@ -43,4 +45,8 @@
<TableColumn fx:id="moveTradeToFailedColumn" minWidth="80" maxWidth="80"/>
</columns>
</TableView>
<ScrollPane fx:id="scrollView" fitToWidth="true" hbarPolicy="NEVER"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/>
</VBox>

View File

@ -75,6 +75,7 @@ import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableRow;
@ -84,7 +85,6 @@ import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
@ -117,6 +117,8 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
@FXML
TableColumn<PendingTradesListItem, PendingTradesListItem> priceColumn, volumeColumn, amountColumn, avatarColumn,
marketColumn, roleColumn, paymentMethodColumn, tradeIdColumn, dateColumn, chatColumn, moveTradeToFailedColumn;
@FXML
ScrollPane scrollView;
private FilteredList<PendingTradesListItem> filteredList;
private SortedList<PendingTradesListItem> sortedList;
private TradeSubView selectedSubView;
@ -275,6 +277,8 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
sortedList = new SortedList<>(filteredList);
sortedList.comparatorProperty().bind(tableView.comparatorProperty());
tableView.setItems(sortedList);
tableView.setPrefHeight(100);
tableView.setMaxHeight(200);
filterBox.initialize(filteredList, tableView); // here because filteredList is instantiated here
filterBox.activate();
@ -295,13 +299,13 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
selectedSubView = model.dataModel.tradeManager.isBuyer(model.dataModel.getOffer()) ?
new BuyerSubView(model) : new SellerSubView(model);
selectedSubView.setMinHeight(460);
VBox.setVgrow(selectedSubView, Priority.ALWAYS);
//selectedSubView.setMinHeight(460);
//VBox.setVgrow(selectedSubView, Priority.SOMETIMES);
if (root.getChildren().size() == 2)
root.getChildren().add(selectedSubView);
root.getChildren().add(scrollView);
else if (root.getChildren().size() == 3)
root.getChildren().set(2, selectedSubView);
root.getChildren().set(2, scrollView);
scrollView.setContent(selectedSubView);
// create and register a callback so we can be notified when the subview
// wants to open the chat window
ChatCallback chatCallback = this::openChat;

View File

@ -61,7 +61,7 @@ public abstract class TradeSubView extends HBox {
public TradeSubView(PendingTradesViewModel model) {
this.model = model;
HBox.setHgrow(this, Priority.ALWAYS);
setSpacing(Layout.PADDING_WINDOW);
buildViews();
}

View File

@ -100,8 +100,10 @@ import haveno.desktop.main.overlays.popups.Popup;
import haveno.desktop.main.portfolio.pendingtrades.PendingTradesViewModel;
import haveno.desktop.main.portfolio.pendingtrades.steps.TradeStepView;
import haveno.desktop.util.Layout;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
@ -217,6 +219,7 @@ public class BuyerStep2View extends TradeStepView {
addTradeInfoBlock();
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
String paymentMethodId = paymentAccountPayload != null ? paymentAccountPayload.getPaymentMethodId() : "<missing payment account payload>";
TitledGroupBg accountTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 4,
@ -228,6 +231,14 @@ public class BuyerStep2View extends TradeStepView {
Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE).second;
field.setCopyWithoutCurrencyPostFix(true);
//preland: this fixes a textarea layout glitch
TextArea uiHack = new TextArea();
uiHack.setMaxHeight(1);
GridPane.setRowIndex(uiHack, 1);
GridPane.setMargin(uiHack, new Insets(0, 0, 0, 0));
uiHack.setVisible(false);
gridPane.getChildren().add(uiHack);
switch (paymentMethodId) {
case PaymentMethod.UPHOLD_ID:
gridRow = UpholdForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);

View File

@ -645,7 +645,7 @@ public class FormBuilder {
TextArea textArea = new HavenoTextArea();
textArea.setPromptText(prompt);
textArea.setWrapText(true);
textArea.setPrefHeight(100);
final Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, textArea, top);
GridPane.setColumnIndex(topLabelWithVBox.second, colIndex);