Add hyperlink to tac window

This commit is contained in:
Manfred Karrer 2016-03-20 14:58:19 +01:00
parent 565d82c564
commit 30c827fe3c
3 changed files with 44 additions and 14 deletions

View File

@ -72,9 +72,10 @@ public class DisplayAlertMessageWindow extends Overlay<DisplayAlertMessageWindow
headLine = "Important update information!";
headLineLabel.setStyle("-fx-text-fill: -fx-accent; -fx-font-weight: bold; -fx-font-size: 22;");
String url = "https://github.com/bitsquare/bitsquare/releases";
HyperlinkWithIcon download = addLabelHyperlinkWithIcon(gridPane, ++rowIndex, "Download:", url).second;
download.setMaxWidth(550);
download.setOnAction(e -> Utilities.openWebPage(url));
HyperlinkWithIcon hyperlinkWithIcon = addLabelHyperlinkWithIcon(gridPane, ++rowIndex,
"Download:", url).second;
hyperlinkWithIcon.setOnAction(e -> Utilities.openWebPage(url));
hyperlinkWithIcon.setMaxWidth(550);
} else {
headLine = "Important information!";
headLineLabel.setStyle("-fx-text-fill: -bs-error-red; -fx-font-weight: bold; -fx-font-size: 22;");

View File

@ -2,11 +2,15 @@ package io.bitsquare.gui.main.overlays.windows;
import com.google.inject.Inject;
import io.bitsquare.app.BitsquareApp;
import io.bitsquare.common.util.Utilities;
import io.bitsquare.gui.components.HyperlinkWithIcon;
import io.bitsquare.gui.main.overlays.Overlay;
import io.bitsquare.user.Preferences;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static io.bitsquare.gui.util.FormBuilder.addHyperlinkWithIcon;
public class TacWindow extends Overlay<TacWindow> {
private static final Logger log = LoggerFactory.getLogger(TacWindow.class);
private final Preferences preferences;
@ -35,7 +39,7 @@ public class TacWindow extends Overlay<TacWindow> {
" - You must reply within 48 hours to each arbitrator inquiry.\n" +
" - Failure to follow the above requirements may result in loss of your security deposit.\n\n" +
"For more details and a general overview please read the full documentation about the " +
"arbitration system and the dispute process at: https://bitsquare.io/arbitration_system.pdf";
"arbitration system and the dispute process at:";
message(text);
actionButtonText("I agree");
closeButtonText("I disagree and quit");
@ -45,6 +49,14 @@ public class TacWindow extends Overlay<TacWindow> {
}
}
@Override
protected void addMessage() {
super.addMessage();
String url = "https://bitsquare.io/arbitration_system.pdf";
HyperlinkWithIcon hyperlinkWithIcon = addHyperlinkWithIcon(gridPane, ++rowIndex, url, -8);
hyperlinkWithIcon.setOnAction(e -> Utilities.openWebPage(url));
}
@Override
protected void onShow() {
display();

View File

@ -158,6 +158,23 @@ public class FormBuilder {
return new Tuple2<>(label, textField);
}
///////////////////////////////////////////////////////////////////////////////////////////
// HyperlinkWithIcon
///////////////////////////////////////////////////////////////////////////////////////////
public static HyperlinkWithIcon addHyperlinkWithIcon(GridPane gridPane, int rowIndex, String url) {
return addHyperlinkWithIcon(gridPane, rowIndex, url, 0);
}
public static HyperlinkWithIcon addHyperlinkWithIcon(GridPane gridPane, int rowIndex, String url, double top) {
HyperlinkWithIcon hyperlinkWithIcon = new HyperlinkWithIcon(url, AwesomeIcon.EXTERNAL_LINK);
GridPane.setRowIndex(hyperlinkWithIcon, rowIndex);
GridPane.setColumnIndex(hyperlinkWithIcon, 0);
GridPane.setMargin(hyperlinkWithIcon, new Insets(top, 0, 0, -4));
gridPane.getChildren().add(hyperlinkWithIcon);
return hyperlinkWithIcon;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Label + HyperlinkWithIcon
@ -167,22 +184,22 @@ public class FormBuilder {
return addLabelHyperlinkWithIcon(gridPane, rowIndex, title, "", 0);
}
public static Tuple2<Label, HyperlinkWithIcon> addLabelHyperlinkWithIcon(GridPane gridPane, int rowIndex, String title, String value) {
return addLabelHyperlinkWithIcon(gridPane, rowIndex, title, value, 0);
public static Tuple2<Label, HyperlinkWithIcon> addLabelHyperlinkWithIcon(GridPane gridPane, int rowIndex, String title, String url) {
return addLabelHyperlinkWithIcon(gridPane, rowIndex, title, url, 0);
}
public static Tuple2<Label, HyperlinkWithIcon> addLabelHyperlinkWithIcon(GridPane gridPane, int rowIndex, String title, String value, double top) {
public static Tuple2<Label, HyperlinkWithIcon> addLabelHyperlinkWithIcon(GridPane gridPane, int rowIndex, String title, String url, double top) {
Label label = addLabel(gridPane, rowIndex, title, top);
HyperlinkWithIcon textField = new HyperlinkWithIcon(value, AwesomeIcon.EXTERNAL_LINK);
GridPane.setRowIndex(textField, rowIndex);
GridPane.setColumnIndex(textField, 1);
GridPane.setMargin(textField, new Insets(top, 0, 0, 0));
gridPane.getChildren().add(textField);
return new Tuple2<>(label, textField);
HyperlinkWithIcon hyperlinkWithIcon = new HyperlinkWithIcon(url, AwesomeIcon.EXTERNAL_LINK);
GridPane.setRowIndex(hyperlinkWithIcon, rowIndex);
GridPane.setColumnIndex(hyperlinkWithIcon, 1);
GridPane.setMargin(hyperlinkWithIcon, new Insets(top, 0, 0, -4));
gridPane.getChildren().add(hyperlinkWithIcon);
return new Tuple2<>(label, hyperlinkWithIcon);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Label + TextArea
///////////////////////////////////////////////////////////////////////////////////////////