Remove unused files

This commit is contained in:
Manfred Karrer 2015-03-04 10:45:22 +01:00
parent d2158b6d6c
commit 4f798839f2
5 changed files with 1 additions and 533 deletions

View File

@ -52,7 +52,7 @@ public class UpdateProcess {
private static final Logger log = LoggerFactory.getLogger(UpdateProcess.class);
// Edit version for updateFX
private static final int VERSION = 12;
private static final int VERSION = 1;
private static final List<ECPoint> UPDATE_SIGNING_KEYS = Crypto.decode("032D7B4073B0B94F0B0AAD72D4CC2B86FDDE7AAE334DE4BE448B0983D887975289");
private static final String UPDATES_BASE_URL = "http://localhost:8000/";

View File

@ -1,247 +0,0 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.components;
import io.bitsquare.locale.BSResources;
import javafx.application.Platform;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.beans.value.ChangeListener;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.VPos;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.text.*;
import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Convenience Component for info icon, info text and link display in a GridPane.
* Only the properties needed are supported.
* We need to extend from Parent so we can use it in FXML, but the InfoDisplay is not used as node,
* but add the children nodes to the gridPane.
*/
public class InfoDisplay2 extends Parent {
private static final Logger log = LoggerFactory.getLogger(InfoDisplay2.class);
private final StringProperty text = new SimpleStringProperty();
private final IntegerProperty rowIndex = new SimpleIntegerProperty(0);
private final IntegerProperty columnIndex = new SimpleIntegerProperty(0);
private final ObjectProperty<EventHandler<ActionEvent>> onAction = new SimpleObjectProperty<>();
private final ObjectProperty<GridPane> gridPane = new SimpleObjectProperty<>();
private final Label testLabel;
private boolean useReadMore;
private final Label icon = AwesomeDude.createIconLabel(AwesomeIcon.INFO_SIGN);
private final TextFlow textFlow;
private final Label label;
private final Hyperlink link;
private final ChangeListener<Number> listener;
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
public InfoDisplay2() {
icon.setId("non-clickable-icon");
icon.visibleProperty().bind(visibleProperty());
GridPane.setValignment(icon, VPos.TOP);
GridPane.setMargin(icon, new Insets(-2, 0, 0, 0));
GridPane.setRowSpan(icon, 2);
label = new Label();
label.textProperty().bind(text);
label.setTextOverrun(OverrunStyle.WORD_ELLIPSIS);
// width is set a frame later so we hide it first
label.setVisible(false);
link = new Hyperlink(BSResources.get("shared.readMore"));
link.setPadding(new Insets(0, 0, 0, -2));
// We need that to know if we have a wrapping or not.
// Did not find a way to get that from the API.
testLabel = new Label();
testLabel.textProperty().bind(text);
textFlow = new TextFlow();
textFlow.visibleProperty().bind(visibleProperty());
textFlow.getChildren().addAll(testLabel);
// update the width when the window gets resized
listener = (ov2, oldValue2, windowWidth) -> {
if (label.prefWidthProperty().isBound())
label.prefWidthProperty().unbind();
label.setPrefWidth((double) windowWidth - localToScene(0, 0).getX() - 35);
};
// when clicking "Read more..." we expand and change the link to the Help
link.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
if (useReadMore) {
label.setWrapText(true);
link.setText(BSResources.get("shared.openHelp"));
getScene().getWindow().widthProperty().removeListener(listener);
if (label.prefWidthProperty().isBound())
label.prefWidthProperty().unbind();
label.prefWidthProperty().bind(textFlow.widthProperty());
link.setVisited(false);
// focus border is a bit confusing here so we remove it
link.setStyle("-fx-focus-color: transparent;");
link.setOnAction(onAction.get());
}
else {
onAction.get().handle(actionEvent);
}
}
});
managedProperty().addListener((ov, oldValue, newValue) -> {
if (newValue)
layoutItems();
});
}
private void layoutItems() {
testLabel.widthProperty().addListener((ov, o, n) -> {
log.debug("#### testLabel.heightProperty " + testLabel.getHeight());
log.debug("#### testLabel.widthProperty " + testLabel.getText());
log.debug("#### testLabel.widthProperty " + n);
log.debug("#### textFlow.getWidth() " + textFlow.getWidth());
useReadMore = (double) n > textFlow.getWidth();
link.setText(BSResources.get(useReadMore ? "shared.readMore" : "shared.openHelp"));
Platform.runLater(() -> textFlow.getChildren().setAll(label, link));
});
sceneProperty().addListener((ov, oldValue, newValue) -> {
if (oldValue == null && newValue != null && newValue.getWindow() != null) {
newValue.getWindow().widthProperty().addListener(listener);
// localToScene does deliver 0 instead of the correct x position when scene property gets set,
// so we delay for 1 render cycle
Platform.runLater(() -> {
log.debug("#### label.setVisible() ");
label.setVisible(true);
label.prefWidthProperty().unbind();
label.setPrefWidth(newValue.getWindow().getWidth() - localToScene(0, 0).getX() - 35);
});
}
});
}
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
public void setText(String text) {
this.text.set(text);
layout();
}
public void setGridPane(GridPane gridPane) {
this.gridPane.set(gridPane);
gridPane.getChildren().addAll(icon, textFlow);
GridPane.setColumnIndex(icon, columnIndex.get());
GridPane.setColumnIndex(textFlow, columnIndex.get() + 1);
GridPane.setRowIndex(icon, rowIndex.get());
GridPane.setRowIndex(textFlow, rowIndex.get());
}
public void setRowIndex(int rowIndex) {
this.rowIndex.set(rowIndex);
GridPane.setRowIndex(icon, rowIndex);
GridPane.setRowIndex(textFlow, rowIndex);
}
public void setColumnIndex(int columnIndex) {
this.columnIndex.set(columnIndex);
GridPane.setColumnIndex(icon, columnIndex);
GridPane.setColumnIndex(textFlow, columnIndex + 1);
}
public final void setOnAction(EventHandler<ActionEvent> eventHandler) {
onAction.set(eventHandler);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
public String getText() {
return text.get();
}
public StringProperty textProperty() {
return text;
}
public int getColumnIndex() {
return columnIndex.get();
}
public IntegerProperty columnIndexProperty() {
return columnIndex;
}
public int getRowIndex() {
return rowIndex.get();
}
public IntegerProperty rowIndexProperty() {
return rowIndex;
}
public EventHandler<ActionEvent> getOnAction() {
return onAction.get();
}
public ObjectProperty<EventHandler<ActionEvent>> onActionProperty() {
return onAction;
}
public GridPane getGridPane() {
return gridPane.get();
}
public ObjectProperty<GridPane> gridPaneProperty() {
return gridPane;
}
}

View File

@ -1,105 +0,0 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.components.dialogs;
import io.bitsquare.gui.OverlayManager;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CustomPopups {
private static final Logger log = LoggerFactory.getLogger(CustomPopups.class);
private final Stage rootStage;
private final OverlayManager overlayManager;
private final Stage stage = new Stage();
private StackPane sceneRootPane;
public CustomPopups(Stage rootStage, OverlayManager overlayManager) {
this.rootStage = rootStage;
this.overlayManager = overlayManager;
setupStage();
}
public void showInfoPopup(String title, String message) {
BorderPane borderPane = new BorderPane();
borderPane.setMinWidth(400);
borderPane.setMinHeight(150);
borderPane.setMaxWidth(rootStage.getWidth() / 2);
borderPane.setMaxHeight(rootStage.getHeight() / 2);
borderPane.setPadding(new Insets(20, 20, 20, 20));
borderPane.setStyle("-fx-background-color: #ffffff;");
Label titleLabel = new Label(title);
titleLabel.setMouseTransparent(true);
BorderPane.setAlignment(titleLabel, Pos.TOP_CENTER);
borderPane.setTop(titleLabel);
titleLabel.setStyle("-fx-font-size: 16; -fx-font-weight: bold; -fx-text-fill: #333333;");
Label messageLabel = new Label(message);
messageLabel.setWrapText(true);
messageLabel.setMouseTransparent(true);
borderPane.setCenter(messageLabel);
messageLabel.setStyle("-fx-font-size: 12; -fx-text-fill: #000000;");
messageLabel.setPadding(new Insets(20, 0, 30, 0));
Button closeButton = getCloseButton();
BorderPane.setAlignment(closeButton, Pos.BOTTOM_RIGHT);
borderPane.setBottom(closeButton);
show(borderPane);
}
private void setupStage() {
stage.initModality(Modality.WINDOW_MODAL);
stage.initStyle(StageStyle.UNDECORATED);
stage.initOwner(rootStage);
sceneRootPane = new StackPane();
Scene scene = new Scene(sceneRootPane);
scene.getStylesheets().setAll(getClass().getResource("/io/bitsquare/gui/bitsquare.css").toExternalForm(),
getClass().getResource("/io/bitsquare/gui/images.css").toExternalForm());
stage.setScene(scene);
}
private void hide() {
stage.hide();
}
private void show(Pane pane) {
sceneRootPane.getChildren().setAll(pane);
stage.show();
}
private Button getCloseButton() {
Button closeButton = new Button("Close");
closeButton.setDefaultButton(true);
closeButton.setOnAction(e -> hide());
return closeButton;
}
}

View File

@ -1,131 +0,0 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.components.dialogs;
import io.bitsquare.locale.BSResources;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.geometry.Insets;
import javafx.scene.control.*;
import javafx.scene.image.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import org.controlsfx.control.ButtonBar;
import org.controlsfx.control.action.AbstractAction;
import org.controlsfx.control.action.Action;
import org.controlsfx.dialog.Dialog;
import org.controlsfx.dialog.DialogStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// TODO under construction
public class InfoDialog {
private static final Logger log = LoggerFactory.getLogger(InfoDialog.class);
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public InfoDialog(Stage stage) {
final TextField username = new TextField();
final PasswordField password = new PasswordField();
final Action actionLogin = new AbstractAction("Login") {
// This method is called when the login button is clicked ...
public void handle(ActionEvent ae) {
Dialog d = (Dialog) ae.getSource();
// Do the login here.
d.hide();
}
};
// Create the custom dialog.
Dialog dlg = new Dialog(stage, "Login Dialog");
dlg.setIconifiable(false);
dlg.setClosable(false);
dlg.setResizable(false);
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(0, 10, 0, 10));
username.setPromptText("Username");
password.setPromptText("Password");
grid.add(new Label("Username:"), 0, 0);
grid.add(username, 1, 0);
grid.add(new Label("Password:"), 0, 1);
grid.add(password, 1, 1);
ButtonBar.setType(actionLogin, ButtonBar.ButtonType.OK_DONE);
actionLogin.disabledProperty().set(true);
// Do some validation (using the Java 8 lambda syntax).
username.textProperty().addListener((observable, oldValue, newValue) -> actionLogin.disabledProperty().set(newValue.trim().isEmpty()));
dlg.setMasthead("Look, a Custom Login Dialog");
dlg.setContent(grid);
dlg.getActions().addAll(actionLogin, Dialog.Actions.CANCEL);
// Request focus on the username field by default.
Platform.runLater(username::requestFocus);
dlg.show();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Public methods
///////////////////////////////////////////////////////////////////////////////////////////
public void show(Object owner, String title, String masthead, String message) {
Dialog dlg = new Dialog(owner, title, false, DialogStyle.CROSS_PLATFORM_DARK);
dlg.setResizable(false);
dlg.setIconifiable(false);
dlg.setClosable(false);
Image image = new Image(InfoDialog.class.getResource
("/impl/org/controlsfx/dialog/resources/oxygen/48/dialog-information.png").toString());
if (image != null) {
dlg.setGraphic(new ImageView(image));
}
dlg.setMasthead(masthead);
List<Action> actions = new ArrayList<>();
actions.add(new AbstractAction(BSResources.get("shared.close")) {
@Override
public void handle(ActionEvent actionEvent) {
getProperties().put("type", "CLOSE");
Dialog.Actions.CLOSE.handle(actionEvent);
// overlayManager.removeBlurContent();
}
});
dlg.getActions().addAll(actions);
// dlg.setBackgroundEffect(backgroundEffect);
}
}

View File

@ -1,49 +0,0 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.network;
import io.bitsquare.BitsquareModule;
import io.bitsquare.msg.MessageService;
import com.google.inject.Injector;
import org.springframework.core.env.Environment;
public abstract class NetworkModule extends BitsquareModule {
protected NetworkModule(Environment env) {
super(env);
}
@Override
protected final void configure() {
bind(MessageService.class).to(messageService()).asEagerSingleton();
doConfigure();
}
protected void doConfigure() {
}
protected abstract Class<? extends MessageService> messageService();
@Override
protected void doClose(Injector injector) {
injector.getInstance(MessageService.class).shutDown();
}
}