Use top lable with list

This commit is contained in:
Christoph Atteneder 2018-10-22 17:46:27 +02:00
parent e475147ebe
commit ba2277fcc5
No known key found for this signature in database
GPG Key ID: CD5DC1C529CDFD3B
4 changed files with 19 additions and 13 deletions

View File

@ -34,7 +34,7 @@ import bisq.core.locale.LanguageUtil;
import bisq.core.locale.Res;
import bisq.common.UserThread;
import bisq.common.util.Tuple2;
import bisq.common.util.Tuple3;
import com.google.inject.name.Named;
@ -156,7 +156,7 @@ public class ArbitratorRegistrationView extends ActivatableViewAndModel<VBox, Ar
pubKeyTextField.textProperty().bind(model.registrationPubKeyAsHex);
Tuple2<Label, ListView<String>> tuple = FormBuilder.addLabelListView(gridPane, ++gridRow, Res.get("shared.yourLanguage"));
Tuple3<Label, ListView<String>, VBox> tuple = FormBuilder.addTopLabelListView(gridPane, ++gridRow, Res.get("shared.yourLanguage"));
GridPane.setValignment(tuple.first, VPos.TOP);
languagesListView = tuple.second;
languagesListView.disableProperty().bind(model.registrationEditDisabled);

View File

@ -56,6 +56,7 @@ import javafx.scene.control.ListView;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import javafx.geometry.VPos;
@ -226,7 +227,7 @@ public class AltCoinAccountsView extends ActivatableViewAndModel<GridPane, AltCo
private void buildForm() {
addTitledGroupBg(root, gridRow, 1, Res.get("shared.manageAccounts"));
Tuple2<Label, ListView<PaymentAccount>> tuple = FormBuilder.addLabelListView(root, gridRow, Res.get("account.altcoin.yourAltcoinAccounts"), Layout.FIRST_ROW_DISTANCE);
Tuple3<Label, ListView<PaymentAccount>, VBox> tuple = FormBuilder.addTopLabelListView(root, gridRow, Res.get("account.altcoin.yourAltcoinAccounts"), Layout.FIRST_ROW_DISTANCE);
GridPane.setValignment(tuple.first, VPos.TOP);
paymentAccountsListView = tuple.second;
paymentAccountsListView.setPrefHeight(2 * Layout.LIST_ROW_HEIGHT + 14);

View File

@ -106,6 +106,7 @@ import javafx.scene.control.ListView;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextAlignment;
import javafx.geometry.VPos;
@ -339,7 +340,7 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
private void buildForm() {
addTitledGroupBg(root, gridRow, 1, Res.get("shared.manageAccounts"));
Tuple2<Label, ListView<PaymentAccount>> tuple = FormBuilder.addLabelListView(root, gridRow, Res.get("account.fiat.yourFiatAccounts"), Layout.FIRST_ROW_DISTANCE);
Tuple3<Label, ListView<PaymentAccount>, VBox> tuple = FormBuilder.addTopLabelListView(root, gridRow, Res.get("account.fiat.yourFiatAccounts"), Layout.FIRST_ROW_DISTANCE);
GridPane.setValignment(tuple.first, VPos.TOP);
tuple.first.setTextAlignment(TextAlignment.RIGHT);
paymentAccountsListView = tuple.second;

View File

@ -1324,20 +1324,24 @@ public class FormBuilder {
// Label + List
///////////////////////////////////////////////////////////////////////////////////////////
public static <T> Tuple2<Label, ListView<T>> addLabelListView(GridPane gridPane, int rowIndex, String title) {
return addLabelListView(gridPane, rowIndex, title, 0);
public static <T> Tuple3<Label, ListView<T>, VBox> addTopLabelListView(GridPane gridPane, int rowIndex, String title) {
return addTopLabelListView(gridPane, rowIndex, title, 0);
}
public static <T> Tuple2<Label, ListView<T>> addLabelListView(GridPane gridPane, int rowIndex, String title, double top) {
Label label = addLabel(gridPane, rowIndex, title, top);
public static <T> Tuple3<Label, ListView<T>, VBox> addTopLabelListView(GridPane gridPane, int rowIndex, String title, double top) {
Label label = getTopLabel(title);
VBox vBox = getTopLabelVBox(0);
ListView<T> listView = new ListView<>();
GridPane.setRowIndex(listView, rowIndex);
GridPane.setColumnIndex(listView, 1);
GridPane.setMargin(listView, new Insets(top, 0, 0, 0));
gridPane.getChildren().add(listView);
return new Tuple2<>(label, listView);
vBox.getChildren().addAll(label, listView);
GridPane.setRowIndex(vBox, rowIndex);
GridPane.setColumnIndex(vBox, 0);
GridPane.setMargin(vBox, new Insets(top, 0, 0, 0));
gridPane.getChildren().add(vBox);
return new Tuple3<>(label, listView, vBox);
}