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 0000000000..eb3f19e0e9 Binary files /dev/null and b/src/main/resources/images/buy_black_62_54.png differ diff --git a/src/main/resources/images/info_44.png b/src/main/resources/images/info_44.png new file mode 100644 index 0000000000..0273cd564b Binary files /dev/null and b/src/main/resources/images/info_44.png differ 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +