Ass styles for buy/sell at confirmation popups, add focus colors

This commit is contained in:
Manfred Karrer 2016-03-02 11:39:56 +01:00
parent 61eee8f445
commit 29aac699f8
5 changed files with 68 additions and 35 deletions

View file

@ -105,6 +105,7 @@ public class FileManager<T> {
if (savePending.getAndSet(true)) if (savePending.getAndSet(true))
return; // Already pending. return; // Already pending.
executor.schedule(saveFileTask, delayInMilli, TimeUnit.MILLISECONDS); executor.schedule(saveFileTask, delayInMilli, TimeUnit.MILLISECONDS);
} }

View file

@ -77,7 +77,7 @@ import static io.bitsquare.app.BitsquareEnvironment.APP_NAME_KEY;
public class BitsquareApp extends Application { public class BitsquareApp extends Application {
private static final Logger log = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(BitsquareApp.class); private static final Logger log = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(BitsquareApp.class);
public static final boolean DEV_MODE = true; public static final boolean DEV_MODE = false;
public static final boolean IS_RELEASE_VERSION = !DEV_MODE && true; public static final boolean IS_RELEASE_VERSION = !DEV_MODE && true;
private static Environment env; private static Environment env;

View file

@ -57,13 +57,18 @@ bg color of non edit textFields: fafafa
-bs-warning: -bs-orange; -bs-warning: -bs-orange;
-bs-buy: -bs-yellow; -bs-buy: -bs-yellow;
-bs-buy-dark: derive(-bs-buy, -10%); -bs-buy-focus: derive(-bs-buy, -50%);
-bs-buy-hover: derive(-bs-buy, -10%);
-bs-buy-transparent: derive(-bs-buy, 95%); -bs-buy-transparent: derive(-bs-buy, 95%);
-bs-sell: -bs-turquoise; -bs-sell: -bs-turquoise;
-bs-sell-dark: derive(-bs-sell, -10%); -bs-sell-focus: derive(-bs-sell, -50%);
-bs-sell-hover: derive(-bs-sell, -10%);
-bs-sell-transparent: derive(-bs-sell, 95%); -bs-sell-transparent: derive(-bs-sell, 95%);
-bs-cancel: -bs-light-grey;
-bs-cancel-focus: derive(-bs-cancel, -50%);
-bs-cancel-hover: derive(-bs-cancel, -10%);
-fx-default-button: derive(-fx-accent, 95%); -fx-default-button: derive(-fx-accent, 95%);
-fx-focus-color: -fx-accent; -fx-focus-color: -fx-accent;
@ -869,8 +874,26 @@ textfield */
-fx-background-radius: 5; -fx-background-radius: 5;
} }
#buy-button-big:focused {
-fx-background-color: -bs-buy-focus, -fx-inner-border, -fx-body-color, -fx-faint-focus-color, -fx-body-color;
}
#buy-button-big:hover { #buy-button-big:hover {
-fx-base: -bs-buy-dark; -fx-base: -bs-buy-hover;
}
#buy-button {
-fx-base: -bs-buy;
-fx-text-fill: white;
-fx-font-weight: bold;
}
#buy-button:focused {
-fx-background-color: -bs-buy-focus, -fx-inner-border, -fx-body-color, -fx-faint-focus-color, -fx-body-color;
}
#buy-button:hover {
-fx-base: -bs-buy-hover;
} }
#sell-button-big { #sell-button-big {
@ -881,18 +904,12 @@ textfield */
-fx-background-radius: 5; -fx-background-radius: 5;
} }
#sell-button-big:focused {
-fx-background-color: -bs-sell-focus, -fx-inner-border, -fx-body-color, -fx-faint-focus-color, -fx-body-color;
}
#sell-button-big:hover { #sell-button-big:hover {
-fx-base: -bs-sell-dark; -fx-base: -bs-sell-hover;
}
#buy-button {
-fx-base: -bs-buy;
-fx-text-fill: white;
-fx-font-weight: bold;
}
#buy-button:hover {
-fx-base: -bs-buy-dark;
} }
#sell-button { #sell-button {
@ -901,18 +918,26 @@ textfield */
-fx-font-weight: bold; -fx-font-weight: bold;
} }
#sell-button:focused {
-fx-background-color: -bs-sell-focus, -fx-inner-border, -fx-body-color, -fx-faint-focus-color, -fx-body-color;
}
#sell-button:hover { #sell-button:hover {
-fx-base: -bs-sell-dark; -fx-base: -bs-sell-hover;
} }
#cancel-button { #cancel-button {
-fx-base: -bs-light-grey; -fx-base: -bs-cancel;
-fx-text-fill: white; -fx-text-fill: white;
-fx-font-weight: bold; -fx-font-weight: bold;
} }
#cancel-button:hover { #cancel-button:hover {
-fx-base: derive(-bs-light-grey, -10%); -fx-base: -bs-cancel-hover;
}
#cancel-button:focused {
-fx-background-color: -bs-cancel-focus, -fx-inner-border, -fx-body-color, -fx-faint-focus-color, -fx-body-color;
} }
/******************************************************************************************************************** /********************************************************************************************************************

View file

@ -224,30 +224,33 @@ public class OfferDetailsPopup extends Popup {
addTitledGroupBg(gridPane, ++rowIndex, 1, "Commitment", Layout.GROUP_DISTANCE); addTitledGroupBg(gridPane, ++rowIndex, 1, "Commitment", Layout.GROUP_DISTANCE);
addLabelTextField(gridPane, rowIndex, "Please note:", Offer.TAC_OFFERER, Layout.FIRST_ROW_AND_GROUP_DISTANCE); addLabelTextField(gridPane, rowIndex, "Please note:", Offer.TAC_OFFERER, Layout.FIRST_ROW_AND_GROUP_DISTANCE);
Button cancelButton = addConfirmButton(true); addConfirmAndCancelButtons(true);
addCancelButton(cancelButton);
} else if (takeOfferHandlerOptional.isPresent()) { } else if (takeOfferHandlerOptional.isPresent()) {
addTitledGroupBg(gridPane, ++rowIndex, 1, "Contract", Layout.GROUP_DISTANCE); addTitledGroupBg(gridPane, ++rowIndex, 1, "Contract", Layout.GROUP_DISTANCE);
addLabelTextField(gridPane, rowIndex, "Terms and conditions:", Offer.TAC_TAKER, Layout.FIRST_ROW_AND_GROUP_DISTANCE); addLabelTextField(gridPane, rowIndex, "Terms and conditions:", Offer.TAC_TAKER, Layout.FIRST_ROW_AND_GROUP_DISTANCE);
Button cancelButton = addConfirmButton(false); addConfirmAndCancelButtons(false);
addCancelButton(cancelButton);
} else { } else {
Button cancelButton = addButtonAfterGroup(gridPane, ++rowIndex, "Close"); Button cancelButton = addButtonAfterGroup(gridPane, ++rowIndex, "Close");
cancelButton.setOnAction(e -> { cancelButton.setOnAction(e -> {
closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run()); closeHandlerOptional.ifPresent(Runnable::run);
hide(); hide();
}); });
} }
} }
@NotNull @NotNull
private Button addConfirmButton(boolean isPlaceOffer) { private void addConfirmAndCancelButtons(boolean isPlaceOffer) {
Tuple2<Button, Button> tuple = add2ButtonsAfterGroup(gridPane, Tuple2<Button, Button> tuple = add2ButtonsAfterGroup(gridPane,
++rowIndex, ++rowIndex,
isPlaceOffer ? "Confirm place offer" : "Confirm take offer", isPlaceOffer ? "Confirm place offer" : "Confirm take offer",
"Cancel"); "Cancel");
Button placeButton = tuple.first; Button placeButton = tuple.first;
boolean isBuyOffer = offer.getDirection() == Offer.Direction.BUY;
boolean isBuyStyle = isPlaceOffer ? isBuyOffer : !isBuyOffer;
placeButton.setId(isBuyStyle ? "buy-button" : "sell-button");
placeButton.setOnAction(e -> { placeButton.setOnAction(e -> {
if (user.getAcceptedArbitrators().size() > 0) { if (user.getAcceptedArbitrators().size() > 0) {
if (isPlaceOffer) if (isPlaceOffer)
@ -262,12 +265,11 @@ public class OfferDetailsPopup extends Popup {
} }
hide(); hide();
}); });
return tuple.second;
}
private void addCancelButton(Button cancelButton) { Button cancelButton = tuple.second;
cancelButton.setId("cancel-button");
cancelButton.setOnAction(e -> { cancelButton.setOnAction(e -> {
closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run()); closeHandlerOptional.ifPresent(Runnable::run);
hide(); hide();
}); });
} }

View file

@ -397,23 +397,28 @@ public class BSFormatter {
} }
public String getDirectionBothSides(Offer.Direction direction) { public String getDirectionBothSides(Offer.Direction direction) {
return direction == Offer.Direction.BUY ? "Offerer as bitcoin buyer / Taker as bitcoin seller" : "Offerer as bitcoin seller / Taker as bitcoin buyer"; return direction == Offer.Direction.BUY ? "Offerer as bitcoin buyer / Taker as bitcoin seller" :
"Offerer as bitcoin seller / Taker as bitcoin buyer";
} }
public String getDirectionForBuyer(boolean isMyOffer) { public String getDirectionForBuyer(boolean isMyOffer) {
return isMyOffer ? "You are buying bitcoin as offerer / Taker is selling bitcoin" : "You are buying bitcoin as taker / Offerer is selling bitcoin"; return isMyOffer ? "You are buying bitcoin as offerer / Taker is selling bitcoin" :
"You are buying bitcoin as taker / Offerer is selling bitcoin";
} }
public String getDirectionForSeller(boolean isMyOffer) { public String getDirectionForSeller(boolean isMyOffer) {
return isMyOffer ? "You are selling bitcoin as offerer / Taker is buying bitcoin" : "You are selling bitcoin as taker / Offerer is buying bitcoin"; return isMyOffer ? "You are selling bitcoin as offerer / Taker is buying bitcoin" :
"You are selling bitcoin as taker / Offerer is buying bitcoin";
} }
public String getDirectionForTaker(Offer.Direction direction) { public String getDirectionForTaker(Offer.Direction direction) {
return direction == Offer.Direction.BUY ? "You are selling bitcoin (take an offer for buying bitcoin)" : "You are buying bitcoin (take an offer for selling bitcoin)"; return direction == Offer.Direction.BUY ? "You are selling bitcoin (take an offer from someone who wants to buy bitcoin)" :
"You are buying bitcoin (take an offer from someone who wants to sell bitcoin)";
} }
public String getOfferDirection(Offer.Direction direction) { public String getOfferDirection(Offer.Direction direction) {
return direction == Offer.Direction.BUY ? "Offer for buying bitcoin" : "Offer for selling bitcoin"; return direction == Offer.Direction.BUY ? "Offer for buying bitcoin" :
"Offer for selling bitcoin";
} }
public String getRole(boolean isBuyerOffererAndSellerTaker, boolean isOfferer) { public String getRole(boolean isBuyerOffererAndSellerTaker, boolean isOfferer) {