From 99f644dd0e0dee64ddd4fcd3a85140c744eb1a1e Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Mon, 1 Sep 2014 19:00:05 +0200 Subject: [PATCH] add create offer ui mocks --- src/main/java/io/bitsquare/gui/bitsquare.css | 45 +- .../java/io/bitsquare/msg/MessageFacade.java | 6 +- src/main/resources/images/buy_black_62_54.png | Bin 0 -> 888 bytes src/main/resources/images/info_44.png | Bin 0 -> 1617 bytes .../uimock/CreateOfferControllerUIMock.java | 226 +++++++++ .../uimock/CreateOfferUIMockRunner.java | 87 ++++ .../uimock/CreateOfferViewUIMock.fxml | 427 ++++++++++++++++++ 7 files changed, 786 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/images/buy_black_62_54.png create mode 100644 src/main/resources/images/info_44.png create mode 100644 src/test/java/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferControllerUIMock.java create mode 100644 src/test/java/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferUIMockRunner.java create mode 100644 src/test/java/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferViewUIMock.fxml diff --git a/src/main/java/io/bitsquare/gui/bitsquare.css b/src/main/java/io/bitsquare/gui/bitsquare.css index d53968bf31..ae5d846f98 100644 --- a/src/main/java/io/bitsquare/gui/bitsquare.css +++ b/src/main/java/io/bitsquare/gui/bitsquare.css @@ -1,7 +1,30 @@ +/* Create offer screen */ +#input-description-label { + -fx-font-size: 11; + -fx-alignment: center; +} + +#create-offer-calc-label { + -fx-font-weight: bold; + -fx-font-size: 20; + -fx-padding: 15 5 0 5; +} + +#currency-info-label { + -fx-border-radius: 0 4 4 0; + -fx-padding: 4 4 4 4; + -fx-background-color: linear-gradient(to bottom, #eee, #ddd); + -fx-border-color: #aaa; + -fx-border-style: solid solid solid none; + -fx-border-insets: 0 0 0 -2; +} + +/* Splash screen */ #splash { -fx-background-color: #ffffff; } +/* Mmain UI screen */ #logo-sub-title-label { -fx-font-weight: bold; -fx-font-size: 24; @@ -174,14 +197,21 @@ -fx-font-size: 14; } -#form-group-label { +#form-group-title { -fx-font-weight: bold; -fx-font-size: 14; -fx-text-fill: #111; -fx-background-color: #f4f4f4; } -#form-group-border { +#form-group-title-active { + -fx-font-weight: bold; + -fx-font-size: 14; + -fx-text-fill: #0096c9; + -fx-background-color: #f4f4f4; +} + +#form-group-background { -fx-body-color: linear-gradient(to bottom, #f4f4f4, #F0F0F0); -fx-outer-border: linear-gradient(to bottom, #ddd, #ccc); -fx-background-color: -fx-shadow-highlight-color, @@ -191,6 +221,17 @@ -fx-background-insets: 0 0 -1 0, 0, 1, 2; -fx-background-radius: 3px, 3px, 2px, 1px; } +#form-group-background-active { + -fx-body-color: linear-gradient(to bottom, #f4f4f4, #F0F0F0); + -fx-outer-border: linear-gradient(to bottom, #9bbdc9, #57acc9); + -fx-background-color: -fx-shadow-highlight-color, + -fx-outer-border, + -fx-inner-border, + -fx-body-color; + -fx-background-insets: 0 0 -1 0, 0, 1.5, 2; + -fx-background-radius: 3px, 3px, 2px, 1px; +} + #form-title { -fx-font-weight: bold; diff --git a/src/main/java/io/bitsquare/msg/MessageFacade.java b/src/main/java/io/bitsquare/msg/MessageFacade.java index 7b771e29e0..ef9c9fa141 100644 --- a/src/main/java/io/bitsquare/msg/MessageFacade.java +++ b/src/main/java/io/bitsquare/msg/MessageFacade.java @@ -172,7 +172,7 @@ public class MessageFacade implements MessageBroker { Number160 locationKey = Number160.createHash(offer.getCurrency().getCurrencyCode()); try { final Data offerData = new Data(offer); - + // the offer is default 30 days valid int defaultOfferTTL = 30 * 24 * 60 * 60 * 1000; offerData.ttlSeconds(defaultOfferTTL); @@ -189,7 +189,7 @@ public class MessageFacade implements MessageBroker { // TODO will be removed when we don't use polling anymore setDirty(locationKey); - log.trace("Add offer to DHT was successful. Stored data: [locationKey: " + locationKey + + log.trace("Add offer to DHT was successful. Stored data: [locationKey: " + locationKey + ", " + "value: " + offerData + "]"); }); @@ -220,7 +220,7 @@ public class MessageFacade implements MessageBroker { } //TODO remove is failing, probably due Coin or Fiat class (was working before) - // objects are identical but returned object form network might have soem problem with serialisation? + // objects are identical but returned object form network might have some problem with serialisation? public void removeOffer(Offer offer) { Number160 locationKey = Number160.createHash(offer.getCurrency().getCurrencyCode()); try { diff --git a/src/main/resources/images/buy_black_62_54.png b/src/main/resources/images/buy_black_62_54.png new file mode 100644 index 0000000000000000000000000000000000000000..eb3f19e0e980ad283a2b824bae281e1db5190d9f GIT binary patch literal 888 zcmV-;1Bd*HP)1crsf44H(kdl{l27??j#5JDhdNTF9IYd?u6jzU zmD;}HU9ItEW_M?1?>f7Wzp!R^-_N{#^WMybMNt$K(ar@0wezMAV2s)JX&JNtx(KS^ zwa=ihp!cAk@xhrRmfvV1OLhtL7&PQAp}L@(pt=kHCk;LWYJ<*Vz$c*Vt|xAi;2ipO z44CT_Lp<;q{6K)_x|`RhIw|lq0{SGD%$$QyVmS*z4~gr~K)-!n$FG4_i0d8S3z${O z^>@C5UnZ`NK;L`^uSvkYuhr*^+N8`$iWzUfUl41xY~f!Z#(e>8yK;`1*4v8i>%fy?Use4bw_}{kM(>vO(SEs)(wId5uRdbu1mr_ zi5>{gY6x8%S1Z?AT>{PZi|DRe8K4h@=vl;Xo*KKI3pm(@#_40C*?5@(`dG;PA%?bW zJdc7kr{Gw1ohER8R{);{^%C4SBnq5+3GVyOBh3jo*b-=vV&-lL098e}j%ThxG&E-k z-`D5MqE&D#Fy5s6P6tGl)=+>niM4%@@|}D~r(zR)FJorjCl-<>G42U5?l9v!pIZS} zWaYM`{7hm`#aYVO*UR$FjuE(Ii)fsALxZZXg20Cu(pha?kuO#=fnzcnN*=srd0*Yc z_9Z^@M7o>`9B1UMB725Y1YTDp%p+N{lYzGt$>X+zlN6(pTa$cu6M=(mYL=+V6oRj4 z*82@5I95$R6c1=RIy*CNviLHlsqAVh@K=hPdFwed#o#r~tanLpo~bp3!H&bzQY&q> zP#>sQqu5P7P4h7OAAnb}HI{MoDDcRUK4O)X=D^{TD}V9?k1%&6wGS?R$@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cX!LgpjU^`HdSMV>)BP? z92Pj7V{mX#pnVeg`T4p`@-r)9#i3P3W|P9~?5voXnK|yy757>(~|>%vW`$q8e|wv z>b5;2Bja5w(q>v(n!LgXwQEHcNWjRR?UG^qvK8r=DVoWcj`fBXkebd_0uPR~%&zz$ zSZ-Ib9I{7y(>W?Q?vR-U*^n}3VkL*z5)u*waDE~837zRfvs=c+S?Gk<4@Y&jOc>?m z<)W~#P_oO+8Y|0O!|itehnM|ZqI9`jzX83>R%YbjbUJmj8|P!nE-fvUjVHQbQ?&%Y z@AY~=Xa3P>?L_-=->kljUX%wYEPD8PUtgaoFXppwpCL%@?ujN8H{XUd24nS0>XT^~ zO{`H3D-TZCDaTs;XvqREeOo(6K5_B`eckBn?7YJwB^D;M<0U#pXr?2h)G;+^CPqje zg7tUo)XVrYsC!feCVuey{nscDGu^G;4w!8SJRVP=uCDGPaI6>|RY_@}Yj_mimqja& z@XIV%X!ZaB`$;HRUBIkWumzU^x?S(6^t=bbq9HhFXlS?&{kFw&pzTB;J?QW6f8L5# zJzB7+r}rU)7OeMOOb6OWBMq9q8wdoNP!A-ko@ho&48(!tGKQUfA5!|>(37Lta=6Fq z0DTkSOSS(RS;;C2|E-FOiU&vz?}!Nh--sIUk##xIrhhp)I(h|mm8{|b+CO5rWAOfA z_-rfE`~9f0UaUa{Mjk_3)H*dabrne=S+laUY%nx{+2z2q|Aho@p(Op5J!;fx+N=xU zIUkt5gnG9*7!0}~n@eo-_2wg!D83f~?oSjkBdA;2P<{Qwayiy@{}*5Y=1H4awyyhs P00000NkvXXu0mjf3WxX< literal 0 HcmV?d00001 diff --git a/src/test/java/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferControllerUIMock.java b/src/test/java/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferControllerUIMock.java new file mode 100644 index 0000000000..359f93c939 --- /dev/null +++ b/src/test/java/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferControllerUIMock.java @@ -0,0 +1,226 @@ +/* + * This file is part of Bitsquare. + * + * Bitsquare is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bitsquare is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bitsquare. If not, see . + */ + +package io.bitsquare.gui.trade.createoffer.uimock; + +import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator; + +import java.net.URL; + +import java.util.ResourceBundle; + +import javax.inject.Inject; + +import javafx.fxml.FXML; +import javafx.scene.control.*; +import javafx.scene.image.*; +import javafx.scene.layout.*; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CreateOfferControllerUIMock { + private static final Logger log = LoggerFactory.getLogger(CreateOfferControllerUIMock.class); + + public VBox priceAmountMinAmountBox; + public HBox priceAmountHBox; + public VBox priceAmountBuyIconBox; + + + @FXML private GridPane gridPane; + @FXML private ImageView priceAmountInfoIcon, payFundsInfoIcon, paymentInfoIcon, showDetailsInfoIcon; + @FXML private Separator totalsSeparator; + + @FXML private Pane priceAmountPane, paymentInfoPane, payFundsPane, showDetailsPane; + @FXML private Label priceAmountInfoLabel, priceAmountTitleLabel, paymentInfoTitleLabel, addressLabel, + balanceLabel, paymentInfoLabel, + payFundsInfoLabel, payFundsTitleLabel, offerFeeLabel, networkFeeLabel, summaryBtcLabel, totalToPayLabel, + showDetailsTitleLabel, bankAccountTypeLabel, bankAccountCurrencyLabel, bankAccountCountyLabel, + acceptedCountriesLabel, acceptedLanguagesLabel, acceptedArbitratorsLabel, showDetailsInfoLabel; + @FXML private Button showPaymentInfoScreenButton, showPayFundsScreenButton, showDetailsButton; + @FXML private TextField offerFeeTextField, networkFeeTextField, acceptedArbitratorsTextField; + @FXML private TextField addressTextField; + @FXML private TextField balanceTextField; + + @FXML private Label buyLabel, confirmationLabel, txTitleLabel, collateralLabel; + @FXML private TextField amountTextField, minAmountTextField, priceTextField, volumeTextField; + @FXML private Button placeOfferButton, closeButton; + @FXML private TextField totalToPayTextField, collateralTextField, bankAccountTypeTextField, + bankAccountCurrencyTextField, bankAccountCountyTextField, acceptedCountriesTextField, + acceptedLanguagesTextField, + summaryBtcTextField, transactionIdTextField; + @FXML private ConfidenceProgressIndicator progressIndicator; + + + @Inject + private CreateOfferControllerUIMock() { + } + + + public void initialize(URL url, ResourceBundle rb) { + + paymentInfoPane.setVisible(false); + collateralLabel.setVisible(false); + collateralTextField.setVisible(false); + offerFeeLabel.setVisible(false); + offerFeeTextField.setVisible(false); + networkFeeLabel.setVisible(false); + networkFeeTextField.setVisible(false); + totalsSeparator.setVisible(false); + summaryBtcLabel.setVisible(false); + summaryBtcTextField.setVisible(false); + paymentInfoLabel.setVisible(false); + paymentInfoIcon.setVisible(false); + showPayFundsScreenButton.setVisible(false); + + payFundsPane.setVisible(false); + totalToPayLabel.setVisible(false); + totalToPayTextField.setVisible(false); + addressLabel.setVisible(false); + addressTextField.setVisible(false); + balanceLabel.setVisible(false); + balanceTextField.setVisible(false); + payFundsInfoIcon.setVisible(false); + payFundsInfoLabel.setVisible(false); + placeOfferButton.setVisible(false); + showDetailsButton.setVisible(false); + + showDetailsPane.setVisible(false); + showDetailsTitleLabel.setVisible(false); + acceptedCountriesLabel.setVisible(false); + acceptedCountriesTextField.setVisible(false); + acceptedLanguagesLabel.setVisible(false); + acceptedLanguagesTextField.setVisible(false); + acceptedArbitratorsLabel.setVisible(false); + acceptedArbitratorsTextField.setVisible(false); + bankAccountTypeLabel.setVisible(false); + bankAccountTypeTextField.setVisible(false); + bankAccountCurrencyLabel.setVisible(false); + bankAccountCurrencyTextField.setVisible(false); + bankAccountCountyLabel.setVisible(false); + bankAccountCountyTextField.setVisible(false); + showDetailsInfoIcon.setVisible(false); + showDetailsInfoLabel.setVisible(false); + } + + /* @FXML + private void collapsePriceAmountPane() { + for (int i = 1; i < 4; i++) { + gridPane.getRowConstraints().get(i).setMaxHeight(0); + } + + GridPane.setRowSpan(priceAmountPane, 1); + priceAmountBuyIconBox.setMaxHeight(0); + + // priceAmountPane.setVisible(false); + // priceAmountTitleLabel.setVisible(false); + priceAmountBuyIconBox.setVisible(false); + priceAmountHBox.setVisible(false); + priceAmountMinAmountBox.setVisible(false); + priceAmountInfoIcon.setVisible(false); + priceAmountInfoLabel.setVisible(false); + }*/ + + @FXML + private void showPaymentInfoScreen() { + + priceAmountPane.setId("form-group-background"); + priceAmountTitleLabel.setId("form-group-title"); + showPaymentInfoScreenButton.setVisible(false); + + paymentInfoPane.setVisible(true); + collateralLabel.setVisible(true); + collateralTextField.setVisible(true); + offerFeeLabel.setVisible(true); + offerFeeTextField.setVisible(true); + networkFeeLabel.setVisible(true); + networkFeeTextField.setVisible(true); + totalsSeparator.setVisible(true); + summaryBtcLabel.setVisible(true); + summaryBtcTextField.setVisible(true); + paymentInfoLabel.setVisible(true); + paymentInfoIcon.setVisible(true); + showPayFundsScreenButton.setVisible(true); + + showPayFundsScreen(); + } + + @FXML + private void showPayFundsScreen() { + paymentInfoPane.setId("form-group-background"); + paymentInfoTitleLabel.setId("form-group-title"); + + showPayFundsScreenButton.setVisible(false); + + payFundsPane.setVisible(true); + totalToPayLabel.setVisible(true); + totalToPayTextField.setVisible(true); + addressLabel.setVisible(true); + addressTextField.setVisible(true); + balanceLabel.setVisible(true); + balanceTextField.setVisible(true); + payFundsInfoIcon.setVisible(true); + payFundsInfoLabel.setVisible(true); + placeOfferButton.setVisible(true); + showDetailsButton.setVisible(true); + + } + + @FXML + private void showDetailsScreen() { + payFundsPane.setId("form-group-background"); + payFundsTitleLabel.setId("form-group-title"); + + showDetailsButton.setManaged(false); + showDetailsButton.setVisible(false); + + showDetailsPane.setVisible(true); + showDetailsTitleLabel.setVisible(true); + + acceptedCountriesLabel.setVisible(true); + acceptedCountriesTextField.setVisible(true); + acceptedLanguagesLabel.setVisible(true); + acceptedLanguagesTextField.setVisible(true); + acceptedArbitratorsLabel.setVisible(true); + acceptedArbitratorsTextField.setVisible(true); + + bankAccountTypeLabel.setVisible(true); + bankAccountTypeTextField.setVisible(true); + bankAccountCurrencyLabel.setVisible(true); + bankAccountCurrencyTextField.setVisible(true); + bankAccountCountyLabel.setVisible(true); + bankAccountCountyTextField.setVisible(true); + + showDetailsInfoIcon.setVisible(true); + showDetailsInfoLabel.setVisible(true); + + } + + @FXML + private void showAdvancedScreen() { + + } + + + @FXML + private void showSummaryScreen() { + + } + + +} + diff --git a/src/test/java/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferUIMockRunner.java b/src/test/java/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferUIMockRunner.java new file mode 100644 index 0000000000..0b36eedf16 --- /dev/null +++ b/src/test/java/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferUIMockRunner.java @@ -0,0 +1,87 @@ +package io.bitsquare.gui.trade.createoffer.uimock; + +import io.bitsquare.di.BitSquareModule; +import io.bitsquare.di.GuiceFXMLLoader; + +import com.google.inject.Guice; +import com.google.inject.Injector; + +import java.io.IOException; + +import java.net.MalformedURLException; +import java.net.URL; + +import javafx.application.Application; +import javafx.scene.*; +import javafx.scene.input.*; +import javafx.scene.layout.*; +import javafx.stage.Stage; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * For testing single isolated UI screens + */ +public class CreateOfferUIMockRunner extends Application { + private static final Logger log = LoggerFactory.getLogger(CreateOfferUIMockRunner.class); + private Scene scene; + private Parent view; + private Pane pane; + private boolean devTest = true; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws IOException { + Injector injector = Guice.createInjector(new BitSquareModule()); + GuiceFXMLLoader.setInjector(injector); + + pane = new StackPane(); + scene = new Scene(pane, 1000, 1200); + scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow); + loadMainWindow(); + primaryStage.setScene(scene); + primaryStage.show(); + } + + public void loadMainWindow() { + log.debug("re load"); + pane.getChildren().removeAll(); + GuiceFXMLLoader loader = new GuiceFXMLLoader( + getUrl("/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferViewUIMock.fxml"), false); + + try { + view = loader.load(); + } catch (IOException e) { + e.printStackTrace(); + } + + pane.getChildren().setAll(view); + refreshStylesheets(); + } + + private void refreshStylesheets() { + scene.getStylesheets().clear(); + scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm()); + } + + private URL getUrl(String subPath) { + if (devTest) { + try { + // load from file system location to make a reload possible. makes dev process easier with hot reload + return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/test/java" + subPath); + } catch (MalformedURLException e) { + e.printStackTrace(); + return null; + } + } + else { + return getClass().getResource(subPath); + } + } + + +} diff --git a/src/test/java/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferViewUIMock.fxml b/src/test/java/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferViewUIMock.fxml new file mode 100644 index 0000000000..76d0e10c23 --- /dev/null +++ b/src/test/java/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferViewUIMock.fxml @@ -0,0 +1,427 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +