Skip to content

Commit

Permalink
Merge pull request #2062 from ripcurlx/left-align-columns
Browse files Browse the repository at this point in the history
Left align columns, except last one
  • Loading branch information
ManfredKarrer authored Dec 5, 2018
2 parents 47a2aff + 9b7b0cf commit 806fcbe
Show file tree
Hide file tree
Showing 29 changed files with 237 additions and 188 deletions.
3 changes: 3 additions & 0 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ shared.all=All
shared.edit=Edit
shared.advancedOptions=Advanced options
shared.interval=Interval
shared.actions=Actions
shared.buyerUpperCase=Buyer
shared.sellerUpperCase=Seller

####################################################################
# UI views
Expand Down
71 changes: 45 additions & 26 deletions desktop/src/main/java/bisq/desktop/bisq.css
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ bg color of non edit textFields: fafafa
-fx-text-fill: -bs-dim-grey;
}

.jfx-text-field:readonly {
.jfx-text-field:readonly, .hyperlink-with-icon {
-fx-background-color: -bs-rd-grey-medium-light;
-fx-padding: 0.333333em 0.333333em 0.333333em 0.333333em;
}
Expand All @@ -425,14 +425,6 @@ bg color of non edit textFields: fafafa
-fx-border-width: 0;
}

/* hyperlink-with-icon has same style as jfx-text-field:readonly */

.hyperlink-with-icon {
-fx-background-color: -bs-rd-grey-medium-light;
-fx-padding: 0.333333em 0.333333em 0.333333em 0.333333em;
}


#info-field {
-fx-prompt-text-fill: -bs-rd-black;
}
Expand Down Expand Up @@ -968,12 +960,48 @@ textfield */
******************************************************************************/

.table-view .table-cell {
-fx-alignment: center-left;
-fx-padding: 2 0 2 0;
/*-fx-padding: 3 0 2 0;*/
}

.table-view .table-cell.last-column {
-fx-alignment: center-right;
-fx-padding: 2 10 2 0;
}

.table-view .table-cell.last-column.avatar-column {
-fx-alignment: center;
-fx-padding: 3 0 2 0;
-fx-padding: 2 0 2 0;
}

#addressColumn {
-fx-alignment: center-left;
.table-view .column-header.last-column {
-fx-padding: 0 10 0 0;
}

.table-view .column-header.last-column .label {
-fx-alignment: center-right;
}

.table-view .column-header.last-column.avatar-column {
-fx-padding: 0;
}

.table-view .column-header.last-column.avatar-column .label {
-fx-alignment: center;
}

.table-view .table-cell.first-column {
-fx-padding: 2 0 2 10;
}

.table-view .column-header.first-column {
-fx-padding: 0 0 0 10;
}

.number-column.table-cell {
-fx-font-size: 1em;
-fx-padding: 0 0 0 0;
}

.table-view .filler {
Expand All @@ -985,17 +1013,19 @@ textfield */
}

.table-view .column-header .label {
-fx-alignment: center;
-fx-alignment: center-left;
-fx-font-weight: normal;
-fx-font-size: 0.923em;
-fx-padding: 0;
}

.table-view .column-header {
-fx-background-color: -bs-rd-grey-very-light;
-fx-padding: 0;
}

.table-view .focus {
-fx-alignment: center;
-fx-alignment: center-left;
}

.table-view .text {
Expand Down Expand Up @@ -1097,17 +1127,6 @@ textfield */
-fx-cell-size: 47px;
}

.number-column.table-cell {

-fx-font-family: "IBM Plex Mono";
-fx-font-size: 1em;
-fx-padding: 0 0 0 0;
}

.address-column {
-fx-alignment: center !important;
}

/*******************************************************************************
* *
* Icons *
Expand Down Expand Up @@ -1680,7 +1699,7 @@ textfield */

#charts .axis-label {
-fx-font-size: 0.769em;
-fx-alignment: left;
-fx-alignment: center-left;
}
/********************************************************************************************************************
* *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;

import javafx.geometry.Insets;
import javafx.geometry.Pos;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AddressWithIconAndDirection extends AnchorPane {
public class AddressWithIconAndDirection extends HBox {
private static final Logger log = LoggerFactory.getLogger(AddressWithIconAndDirection.class);
private final Hyperlink hyperlink;

Expand All @@ -48,28 +48,21 @@ public AddressWithIconAndDirection(String text, String address, AwesomeIcon awes
directionIcon.setRotate(180);
directionIcon.setMouseTransparent(true);

HBox hBox = new HBox();
hBox.setSpacing(-1);
setAlignment(Pos.CENTER_LEFT);
Label label = new AutoTooltipLabel(text);
label.setMouseTransparent(true);
HBox.setMargin(label, new Insets(3, 0, 0, 0));
HBox.setMargin(directionIcon, new Insets(0, 3, 0, 0));
HBox.setHgrow(label, Priority.ALWAYS);

hyperlink = new HyperlinkWithIcon(address, awesomeIcon);
HBox.setMargin(hyperlink, new Insets(0, 0, 0, 0));
HBox.setMargin(hyperlink, new Insets(0));
HBox.setHgrow(hyperlink, Priority.SOMETIMES);
// You need to set max width to Double.MAX_VALUE to make HBox.setHgrow working like expected!
// also pref width needs to be not default (-1)
hyperlink.setMaxWidth(Double.MAX_VALUE);
hyperlink.setPrefWidth(0);

hBox.getChildren().addAll(label, hyperlink);

AnchorPane.setLeftAnchor(directionIcon, 3.0);
AnchorPane.setTopAnchor(directionIcon, 4.0);
AnchorPane.setLeftAnchor(hBox, 22.0);
AnchorPane.setRightAnchor(hBox, 15.0);
getChildren().addAll(directionIcon, hBox);
getChildren().addAll(directionIcon, label, hyperlink);
}

public void setOnAction(EventHandler<ActionEvent> handler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void setTitleWithHelpText(String title, String help) {
});

final HBox hBox = new HBox(label, helpIcon);
hBox.setStyle("-fx-alignment: center");
hBox.setStyle("-fx-alignment: center-left");
hBox.setSpacing(4);
setGraphic(hBox);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ColoredDecimalPlacesWithZerosText(String number, int numberOfZerosToColor
Tuple2<Label, Label> numbers = getSplittedNumberNodes(number, numberOfZerosToColorize);
getChildren().addAll(numbers.first, numbers.second);
}
setAlignment(Pos.CENTER);
setAlignment(Pos.CENTER_LEFT);
}

private Tuple2<Label, Label> getSplittedNumberNodes(String number, int numberOfZeros) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public HyperlinkWithIcon(String text, AwesomeIcon awesomeIcon) {
icon.setMinWidth(20);
icon.setOpacity(0.7);
icon.getStyleClass().addAll("hyperlink", "no-underline");
setPadding(new Insets(0));
icon.setPadding(new Insets(0));

setGraphic(icon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ private void addColumns() {

column = new AutoTooltipTableColumn<>(Res.get("shared.amountWithCur", "BSQ"));
column.setMinWidth(80);
column.getStyleClass().add("first-column");
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setCellFactory(new Callback<>() {
@Override
Expand Down Expand Up @@ -268,6 +269,7 @@ public void updateItem(final BondListItem item, boolean empty) {
column = new AutoTooltipTableColumn<>(Res.get("dao.bond.table.column.lockupTxId"));
column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setMinWidth(60);
column.getStyleClass().add("last-column");
column.setCellFactory(
new Callback<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ private void createColumns() {
column = new AutoTooltipTableColumn<>(Res.get("shared.amountWithCur", "BSQ"));
column.setMinWidth(120);
column.setMaxWidth(column.getMinWidth());
column.getStyleClass().add("first-column");
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setCellFactory(new Callback<>() {
@Override
Expand Down Expand Up @@ -452,6 +453,7 @@ public void updateItem(final MyReputationListItem item, boolean empty) {
column = new TableColumn<>();
column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setMinWidth(60);
column.getStyleClass().add("last-column");
column.setCellFactory(
new Callback<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ private void createColumns() {
column = new AutoTooltipTableColumn<>(Res.get("dao.bond.table.column.name"));
column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setMinWidth(80);
column.getStyleClass().add("first-column");
column.setCellFactory(
new Callback<>() {
@Override
Expand Down Expand Up @@ -285,6 +286,7 @@ public void updateItem(final RolesListItem item, boolean empty) {
column = new TableColumn<>();
column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setMinWidth(80);
column.getStyleClass().add("last-column");
column.setCellFactory(
new Callback<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ private void createColumns() {

column = new AutoTooltipTableColumn<>(Res.get("dao.burnBsq.assets.nameAndCode"));
column.setMinWidth(120);
column.getStyleClass().add("first-column");
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setCellFactory(new Callback<>() {
@Override
Expand Down Expand Up @@ -406,6 +407,7 @@ public void updateItem(final AssetListItem item, boolean empty) {

column = new AutoTooltipTableColumn<>(Res.get("dao.burnBsq.assets.totalFee"));
column.setMinWidth(120);
column.getStyleClass().add("last-column");
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setCellFactory(new Callback<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ private void createColumnsForMyItems() {
column = new AutoTooltipTableColumn<>(Res.get("dao.proofOfBurn.amount"));
column.setMinWidth(80);
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.getStyleClass().add("first-column");
column.setCellFactory(new Callback<>() {
@Override
public TableCell<MyProofOfBurnListItem, MyProofOfBurnListItem> call(TableColumn<MyProofOfBurnListItem,
Expand Down Expand Up @@ -440,6 +441,7 @@ public void updateItem(final MyProofOfBurnListItem item, boolean empty) {
column = new AutoTooltipTableColumn<>("");
column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setMinWidth(60);
column.getStyleClass().add("last-column");
column.setCellFactory(
new Callback<>() {

Expand Down Expand Up @@ -478,6 +480,7 @@ private void createColumnsForAllTxs() {

column = new AutoTooltipTableColumn<>(Res.get("dao.proofOfBurn.amount"));
column.setMinWidth(80);
column.getStyleClass().add("first-column");
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setCellFactory(new Callback<>() {
@Override
Expand Down Expand Up @@ -603,6 +606,7 @@ public void updateItem(final ProofOfBurnListItem item, boolean empty) {
column = new AutoTooltipTableColumn<>("");
column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setMinWidth(80);
column.getStyleClass().add("last-column");
column.setCellFactory(
new Callback<>() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,14 +712,14 @@ private void createProposalColumns() {
column = new AutoTooltipTableColumn<>(Res.get("shared.dateTime"));
column.setMinWidth(190);
column.setMaxWidth(column.getMinWidth());
column.getStyleClass().add("first-column");
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setCellFactory(
new Callback<TableColumn<ProposalsListItem, ProposalsListItem>, TableCell<ProposalsListItem,
ProposalsListItem>>() {
new Callback<>() {
@Override
public TableCell<ProposalsListItem, ProposalsListItem> call(
TableColumn<ProposalsListItem, ProposalsListItem> column) {
return new TableCell<ProposalsListItem, ProposalsListItem>() {
return new TableCell<>() {
@Override
public void updateItem(final ProposalsListItem item, boolean empty) {
super.updateItem(item, empty);
Expand All @@ -741,12 +741,11 @@ public void updateItem(final ProposalsListItem item, boolean empty) {
column.setMinWidth(60);
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setCellFactory(
new Callback<TableColumn<ProposalsListItem, ProposalsListItem>, TableCell<ProposalsListItem,
ProposalsListItem>>() {
new Callback<>() {
@Override
public TableCell<ProposalsListItem, ProposalsListItem> call(
TableColumn<ProposalsListItem, ProposalsListItem> column) {
return new TableCell<ProposalsListItem, ProposalsListItem>() {
return new TableCell<>() {
@Override
public void updateItem(final ProposalsListItem item, boolean empty) {
super.updateItem(item, empty);
Expand All @@ -766,13 +765,12 @@ public void updateItem(final ProposalsListItem item, boolean empty) {
column.setMinWidth(80);
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setCellFactory(
new Callback<TableColumn<ProposalsListItem, ProposalsListItem>, TableCell<ProposalsListItem,
ProposalsListItem>>() {
new Callback<>() {

@Override
public TableCell<ProposalsListItem, ProposalsListItem> call(TableColumn<ProposalsListItem,
ProposalsListItem> column) {
return new TableCell<ProposalsListItem, ProposalsListItem>() {
return new TableCell<>() {
private HyperlinkWithIcon field;

@Override
Expand Down Expand Up @@ -801,12 +799,11 @@ public void updateItem(final ProposalsListItem item, boolean empty) {
column.setMinWidth(60);
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setCellFactory(
new Callback<TableColumn<ProposalsListItem, ProposalsListItem>, TableCell<ProposalsListItem,
ProposalsListItem>>() {
new Callback<>() {
@Override
public TableCell<ProposalsListItem, ProposalsListItem> call(
TableColumn<ProposalsListItem, ProposalsListItem> column) {
return new TableCell<ProposalsListItem, ProposalsListItem>() {
return new TableCell<>() {
@Override
public void updateItem(final ProposalsListItem item, boolean empty) {
super.updateItem(item, empty);
Expand All @@ -825,6 +822,7 @@ public void updateItem(final ProposalsListItem item, boolean empty) {
column = new TableColumn<>();
column.setMinWidth(50);
column.setMaxWidth(column.getMinWidth());
column.getStyleClass().add("last-column");
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setCellFactory(new Callback<>() {
@Override
Expand Down
Loading

0 comments on commit 806fcbe

Please sign in to comment.