Add IRC link and info popup

This commit is contained in:
Manfred Karrer 2014-10-23 21:11:08 +02:00
parent 7ea5a92b78
commit 6272b360c0
4 changed files with 52 additions and 13 deletions

View file

@ -74,9 +74,9 @@ public class CachedViewCB<T extends PresentationModel> extends ViewCB<T> {
*/ */
public void activate() { public void activate() {
log.trace("Lifecycle: activate " + this.getClass().getSimpleName()); log.trace("Lifecycle: activate " + this.getClass().getSimpleName());
if (childController instanceof CachedViewCB) /* if (childController instanceof CachedViewCB)
((CachedViewCB) childController).activate(); ((CachedViewCB) childController).activate();
*/
if (presentationModel != null) if (presentationModel != null)
presentationModel.activate(); presentationModel.activate();
} }
@ -86,8 +86,8 @@ public class CachedViewCB<T extends PresentationModel> extends ViewCB<T> {
*/ */
public void deactivate() { public void deactivate() {
log.trace("Lifecycle: deactivate " + this.getClass().getSimpleName()); log.trace("Lifecycle: deactivate " + this.getClass().getSimpleName());
if (childController instanceof CachedViewCB) /* if (childController instanceof CachedViewCB)
((CachedViewCB) childController).deactivate(); ((CachedViewCB) childController).deactivate();*/
if (presentationModel != null) if (presentationModel != null)
presentationModel.deactivate(); presentationModel.deactivate();

View file

@ -156,6 +156,9 @@ public class AccountViewCB extends CachedViewCB<AccountPM> {
break; break;
} }
// for IRC demo we deactivate the arbitratorSettingsTab
arbitratorSettingsTab.setDisable(true);
tab.setContent(view); tab.setContent(view);
((TabPane) root).getSelectionModel().select(tab); ((TabPane) root).getSelectionModel().select(tab);
Initializable childController = loader.getController(); Initializable childController = loader.getController();

View file

@ -47,18 +47,22 @@
</GridPane.margin> </GridPane.margin>
</ComboBox> </ComboBox>
<Label text="IRC nick name:" GridPane.rowIndex="1"/> <Label text="Check if your nickname is available:" GridPane.rowIndex="1"/>
<InputTextField fx:id="ircNickNameTextField" GridPane.columnIndex="1" GridPane.rowIndex="1"/> <Hyperlink text="Open IRC @Freenode #bitsquare-trading in browser"
onAction="#onOpenIRC" GridPane.columnIndex="1" GridPane.rowIndex="1" minHeight="26"/>
<Label text="Currency:" GridPane.rowIndex="2"/> <Label text="Your IRC nick name:" GridPane.rowIndex="2"/>
<InputTextField fx:id="ircNickNameTextField" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
<Label text="Currency:" GridPane.rowIndex="3"/>
<ComboBox fx:id="currencyComboBox" promptText="Select currency" <ComboBox fx:id="currencyComboBox" promptText="Select currency"
onAction="#onSelectCurrency" GridPane.columnIndex="1" onAction="#onSelectCurrency" GridPane.columnIndex="1"
GridPane.rowIndex="2"/> GridPane.rowIndex="3"/>
<InfoDisplay gridPane="$root" onAction="#onOpenSetupHelp" rowIndex="3" <InfoDisplay gridPane="$root" onAction="#onOpenSetupHelp" rowIndex="4"
text="The payments account data will be saved in a encrypted form to the Bitcoin block chain and will be used in the trade process for account verification."/> text="The payments account data will be saved in a encrypted form to the Bitcoin block chain and will be used in the trade process for account verification."/>
<HBox fx:id="buttonsHBox" GridPane.columnIndex="1" GridPane.rowIndex="4" spacing="10"> <HBox fx:id="buttonsHBox" GridPane.columnIndex="1" GridPane.rowIndex="5" spacing="10">
<Button fx:id="saveButton" text="Save" onAction="#onSave" defaultButton="true" disable="true"/> <Button fx:id="saveButton" text="Save" onAction="#onSave" defaultButton="true" disable="true"/>
<GridPane.margin> <GridPane.margin>
<Insets top="15.0" bottom="5.0"/> <Insets top="15.0" bottom="5.0"/>
@ -67,7 +71,7 @@
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="200.0"/> <ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="250.0"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/> <ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
@ -77,6 +81,7 @@
<RowConstraints vgrow="NEVER"/> <RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/> <RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/> <RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/>
</rowConstraints> </rowConstraints>
</GridPane> </GridPane>

View file

@ -20,12 +20,18 @@ package io.bitsquare.gui.main.account.content.irc;
import io.bitsquare.bank.BankAccountType; import io.bitsquare.bank.BankAccountType;
import io.bitsquare.gui.CachedViewCB; import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.components.InputTextField; import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.main.account.MultiStepNavigation; import io.bitsquare.gui.main.account.MultiStepNavigation;
import io.bitsquare.gui.main.account.content.ContextAware; import io.bitsquare.gui.main.account.content.ContextAware;
import io.bitsquare.gui.main.help.Help; import io.bitsquare.gui.main.help.Help;
import io.bitsquare.gui.main.help.HelpId; import io.bitsquare.gui.main.help.HelpId;
import io.bitsquare.gui.util.validation.InputValidator; import io.bitsquare.gui.util.validation.InputValidator;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.net.URL; import java.net.URL;
import java.util.Currency; import java.util.Currency;
@ -33,7 +39,9 @@ import java.util.ResourceBundle;
import javax.inject.Inject; import javax.inject.Inject;
import javafx.application.Platform;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.layout.*; import javafx.scene.layout.*;
import javafx.util.Callback; import javafx.util.Callback;
@ -103,6 +111,8 @@ public class IrcAccountViewCB extends CachedViewCB<IrcAccountPm> implements Cont
} }
}); });
typesComboBox.getSelectionModel().select(0);
super.initialize(url, rb); super.initialize(url, rb);
} }
@ -112,6 +122,18 @@ public class IrcAccountViewCB extends CachedViewCB<IrcAccountPm> implements Cont
setupListeners(); setupListeners();
setupBindings(); setupBindings();
Platform.runLater(() -> {
Popups.openInfo("Demo setup for simulating the banking transfer",
"For demo purposes we use a special setup so that users can simulate the banking transfer when " +
"meeting in an IRC chat room.\n" +
"You need to define your IRC nickname and later in the trade process you can find your " +
"trading partner with his IRC nickname in the chat room and simulate the bank transfer " +
"activities, which are:\n\n" +
"1. Bitcoin buyer indicates that he has started the bank transfer.\n\n" +
"2. Bitcoin seller confirms that he has received the national currency from the " +
"bank transfer.");
});
} }
@SuppressWarnings("EmptyMethod") @SuppressWarnings("EmptyMethod")
@ -163,7 +185,14 @@ public class IrcAccountViewCB extends CachedViewCB<IrcAccountPm> implements Cont
Help.openWindow(HelpId.SETUP_FIAT_ACCOUNT); Help.openWindow(HelpId.SETUP_FIAT_ACCOUNT);
} }
@FXML
void onOpenIRC() {
try {
Desktop.getDesktop().browse(URI.create("https://webchat.freenode.net/?channels=bitsquare-trading"));
} catch (IOException e) {
log.error("Cannot open browser. " + e.getMessage());
}
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Private methods // Private methods
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -189,5 +218,7 @@ public class IrcAccountViewCB extends CachedViewCB<IrcAccountPm> implements Cont
ircNickNameTextField.textProperty().bindBidirectional(presentationModel.ircNickName); ircNickNameTextField.textProperty().bindBidirectional(presentationModel.ircNickName);
saveButton.disableProperty().bind(presentationModel.saveButtonDisable); saveButton.disableProperty().bind(presentationModel.saveButtonDisable);
} }
} }