Run reformat and organize imports

This commit is contained in:
Manfred Karrer 2016-01-21 02:48:44 +01:00
parent f723bf5737
commit cb685d3b5c
73 changed files with 802 additions and 829 deletions

View file

@ -387,8 +387,7 @@ public class Notification {
if (stage.isShowing()) {
stage.toFront();
}
else {
} else {
stage.show();
}
@ -530,14 +529,11 @@ public class Notification {
final EventHandler<NotificationEvent> HANDLER;
if (NotificationEvent.NOTIFICATION_PRESSED == TYPE) {
HANDLER = getOnNotificationPressed();
}
else if (NotificationEvent.SHOW_NOTIFICATION == TYPE) {
} else if (NotificationEvent.SHOW_NOTIFICATION == TYPE) {
HANDLER = getOnShowNotification();
}
else if (NotificationEvent.HIDE_NOTIFICATION == TYPE) {
} else if (NotificationEvent.HIDE_NOTIFICATION == TYPE) {
HANDLER = getOnHideNotification();
}
else {
} else {
HANDLER = null;
}
if (null == HANDLER) return;

View file

@ -58,8 +58,7 @@ public class FxmlViewLoader implements ViewLoader {
if (fxmlView == null) {
convention = defaultConvention;
specifiedLocation = defaultLocation;
}
else {
} else {
convention = fxmlView.convention();
specifiedLocation = fxmlView.location();
}

View file

@ -18,8 +18,7 @@
package io.bitsquare.gui.common.view;
import javafx.fxml.FXML;
import javafx.scene.*;
import javafx.scene.Node;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -27,7 +26,9 @@ public abstract class AbstractView<R extends Node, M> implements View {
protected final Logger log = LoggerFactory.getLogger(this.getClass());
protected @FXML R root;
protected
@FXML
R root;
protected final M model;
public AbstractView(M model) {

View file

@ -17,7 +17,7 @@
package io.bitsquare.gui.common.view;
import javafx.scene.*;
import javafx.scene.Node;
public abstract class ActivatableView<R extends Node, M> extends InitializableView<R, M> {

View file

@ -17,9 +17,8 @@
package io.bitsquare.gui.common.view;
import java.util.HashMap;
import javax.inject.Inject;
import java.util.HashMap;
public class CachingViewLoader implements ViewLoader {

View file

@ -17,12 +17,11 @@
package io.bitsquare.gui.common.view;
import java.util.function.Function;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.function.Function;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)

View file

@ -17,12 +17,11 @@
package io.bitsquare.gui.common.view;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.Initializable;
import javafx.scene.*;
import javafx.scene.Node;
import java.net.URL;
import java.util.ResourceBundle;
public abstract class InitializableView<R extends Node, M> extends AbstractView<R, M> implements Initializable {

View file

@ -17,7 +17,7 @@
package io.bitsquare.gui.common.view;
import javafx.scene.*;
import javafx.scene.Node;
public interface View {
Node getRoot();

View file

@ -17,11 +17,9 @@
package io.bitsquare.gui.common.view.guice;
import io.bitsquare.gui.common.view.ViewFactory;
import com.google.common.base.Preconditions;
import com.google.inject.Injector;
import io.bitsquare.gui.common.view.ViewFactory;
public class InjectorViewFactory implements ViewFactory {

View file

@ -117,8 +117,7 @@ public class InfoDisplay extends Parent {
link.setStyle("-fx-focus-color: transparent;");
link.setOnAction(onAction.get());
getParent().layout();
}
else {
} else {
onAction.get().handle(actionEvent);
}
}

View file

@ -18,17 +18,18 @@
package io.bitsquare.gui.components;
import io.bitsquare.gui.util.validation.InputValidator;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.geometry.Insets;
import javafx.geometry.Point2D;
import javafx.scene.control.*;
import javafx.scene.effect.*;
import javafx.scene.layout.*;
import javafx.scene.paint.*;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.effect.BlurType;
import javafx.scene.effect.DropShadow;
import javafx.scene.effect.Effect;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import javafx.stage.Window;
import org.controlsfx.control.PopOver;
/**

View file

@ -19,8 +19,10 @@ package io.bitsquare.gui.components;
import javafx.animation.FadeTransition;
import javafx.animation.Interpolator;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.util.Duration;
// TODO replace with new notification component from lighthouse/bitcoinJ

View file

@ -25,12 +25,11 @@
package io.bitsquare.gui.components.confidence.behavior;
import com.sun.javafx.scene.control.behavior.BehaviorBase;
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
import java.util.Collections;
import com.sun.javafx.scene.control.behavior.BehaviorBase;
// TODO Copied form OpenJFX, check license issues and way how we integrated it
// We changed behaviour which was not exposed via APIs

View file

@ -17,24 +17,25 @@
package io.bitsquare.gui.components.processbar;
import com.sun.javafx.scene.control.behavior.BehaviorBase;
import com.sun.javafx.scene.control.behavior.KeyBinding;
import com.sun.javafx.scene.control.skin.BehaviorSkinBase;
import io.bitsquare.gui.util.Colors;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.Border;
import javafx.scene.layout.BorderStroke;
import javafx.scene.layout.BorderStrokeStyle;
import javafx.scene.layout.BorderWidths;
import javafx.scene.paint.Color;
import javafx.scene.shape.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import com.sun.javafx.scene.control.behavior.BehaviorBase;
import com.sun.javafx.scene.control.behavior.KeyBinding;
import com.sun.javafx.scene.control.skin.BehaviorSkinBase;
class ProcessStepBarSkin<T> extends BehaviorSkinBase<ProcessStepBar<T>, BehaviorBase<ProcessStepBar<T>>> {
private final ProcessStepBar<T> controller;

View file

@ -113,8 +113,7 @@ public class AccountView extends ActivatableView<TabPane, AccountViewModel> {
tab = arbitratorRegistrationTab;
arbitratorRegistrationView = (ArbitratorRegistrationView) view;
arbitratorRegistrationView.onTabSelection(true);
}
else {
} else {
throw new IllegalArgumentException("View not supported: " + view);
}

View file

@ -17,11 +17,10 @@
package io.bitsquare.gui.main.account;
import com.google.inject.Inject;
import io.bitsquare.gui.common.model.ViewModel;
import io.bitsquare.user.User;
import com.google.inject.Inject;
class AccountViewModel implements ViewModel {
private final User user;

View file

@ -22,19 +22,23 @@ import io.bitsquare.gui.common.view.InitializableView;
import io.bitsquare.gui.common.view.Wizard;
import io.bitsquare.gui.main.help.Help;
import io.bitsquare.gui.main.help.HelpId;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javax.inject.Inject;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.layout.*;
@FxmlView
public class ChangePasswordView extends InitializableView<GridPane, ChangePasswordViewModel> implements Wizard.Step {
@FXML HBox buttonsHBox;
@FXML Button saveButton, skipButton;
@FXML PasswordField oldPasswordField, passwordField, repeatedPasswordField;
@FXML
HBox buttonsHBox;
@FXML
Button saveButton, skipButton;
@FXML
PasswordField oldPasswordField, passwordField, repeatedPasswordField;
private Wizard wizard;

View file

@ -17,12 +17,10 @@
package io.bitsquare.gui.main.account.content.changepassword;
import com.google.inject.Inject;
import io.bitsquare.gui.common.model.ViewModel;
import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.gui.util.validation.PasswordValidator;
import com.google.inject.Inject;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
@ -74,12 +72,10 @@ class ChangePasswordViewModel implements ViewModel {
return true;
else
errorMessage = "The 2 passwords does not match.";
}
else {
} else {
errorMessage = result.errorMessage;
}
}
else {
} else {
errorMessage = result.errorMessage;
}
return false;

View file

@ -104,7 +104,7 @@ public class PasswordView extends ActivatableView<GridPane, Void> {
keyCrypterScrypt = (KeyCrypterScrypt) wallet.getKeyCrypter();
else
keyCrypterScrypt = ScryptUtil.getKeyCrypterScrypt();
ScryptUtil.deriveKeyWithScrypt(keyCrypterScrypt, passwordField.getText(), aesKey -> {
deriveStatusLabel.setText("");

View file

@ -38,8 +38,10 @@ import javax.inject.Inject;
@FxmlView
public class AccountSetupWizard extends ActivatableView implements Wizard {
@FXML VBox leftVBox;
@FXML AnchorPane content;
@FXML
VBox leftVBox;
@FXML
AnchorPane content;
private WizardItem seedWords, password, fiatAccount, restrictions;
private Navigation.Listener listener;
@ -63,8 +65,7 @@ public class AccountSetupWizard extends ActivatableView implements Wizard {
if (viewClass == SeedWordsView.class) {
seedWords.show();
}
else if (viewClass == PasswordView.class) {
} else if (viewClass == PasswordView.class) {
seedWords.onCompleted();
password.show();
} else if (viewClass == ArbitratorSelectionView.class) {
@ -107,8 +108,7 @@ public class AccountSetupWizard extends ActivatableView implements Wizard {
if (currentStep instanceof SeedWordsView) {
seedWords.onCompleted();
password.show();
}
else if (currentStep instanceof PasswordView) {
} else if (currentStep instanceof PasswordView) {
password.onCompleted();
restrictions.show();
} else if (currentStep instanceof ArbitratorSelectionView) {

View file

@ -38,7 +38,8 @@ import javax.inject.Inject;
@FxmlView
public class FundsView extends ActivatableViewAndModel<TabPane, Activatable> {
@FXML Tab reservedTab, withdrawalTab, transactionsTab;
@FXML
Tab reservedTab, withdrawalTab, transactionsTab;
private Navigation.Listener navigationListener;
private ChangeListener<Tab> tabChangeListener;

View file

@ -47,7 +47,8 @@ import java.util.stream.Stream;
@FxmlView
public class ReservedView extends ActivatableView<VBox, Void> {
@FXML TableView<ReservedListItem> table;
@FXML
TableView<ReservedListItem> table;
@FXML
TableColumn<ReservedListItem, ReservedListItem> labelColumn, addressColumn, balanceColumn, confidenceColumn;
@ -154,8 +155,7 @@ public class ReservedView extends ActivatableView<VBox, Void> {
});
}
setGraphic(hyperlink);
}
else {
} else {
setGraphic(null);
setId(null);
}
@ -233,8 +233,7 @@ public class ReservedView extends ActivatableView<VBox, Void> {
if (item != null && !empty) {
setGraphic(item.getProgressIndicator());
}
else {
} else {
setGraphic(null);
}
}

View file

@ -17,8 +17,8 @@
~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
-->
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.layout.AnchorPane?>
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.main.offer.BuyOfferView"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0"

View file

@ -17,8 +17,8 @@
~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
-->
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.layout.AnchorPane?>
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.main.offer.SellOfferView"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0"

View file

@ -274,7 +274,7 @@ class OfferBookViewModel extends ActivatableViewModel {
boolean directionResult = offer.getDirection() != direction;
boolean currencyResult = offer.getCurrencyCode().equals(tradeCurrency.getCode());
boolean paymentMethodResult = true;
if (!(paymentMethod instanceof AllPaymentMethodsEntry))
if (!(paymentMethod instanceof AllPaymentMethodsEntry))
paymentMethodResult = offer.getPaymentMethod().equals(paymentMethod);
return directionResult && currencyResult && paymentMethodResult;

View file

@ -277,7 +277,7 @@ class TakeOfferDataModel extends ActivatableDataModel {
boolean isMinAmountLessOrEqualAmount() {
//noinspection SimplifiableIfStatement
if (offer != null && offer.getMinAmount() != null && amountAsCoin.get() != null)
if (offer != null && offer.getMinAmount() != null && amountAsCoin.get() != null)
return !offer.getMinAmount().isGreaterThan(amountAsCoin.get());
return true;
}

View file

@ -38,7 +38,8 @@ import javax.inject.Inject;
@FxmlView
public class PortfolioView extends ActivatableViewAndModel<TabPane, Activatable> {
@FXML Tab openOffersTab, pendingTradesTab, closedTradesTab;
@FXML
Tab openOffersTab, pendingTradesTab, closedTradesTab;
private final Tab failedTradesTab = new Tab("Failed");
private Tab currentTab;
private Navigation.Listener navigationListener;

View file

@ -100,8 +100,7 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
offerDetailsPopup.show(tradable.getOffer());
});
setGraphic(hyperlink);
}
else {
} else {
setGraphic(null);
setId(null);
}

View file

@ -91,8 +91,7 @@ class ClosedTradesViewModel extends ActivatableWithDataModel<ClosedTradesDataMod
log.error("That must not happen. We got a pending state but we are in the closed trades list.");
return trade.getState().toString();
}
}
else if (item.getTradable() instanceof OpenOffer) {
} else if (item.getTradable() instanceof OpenOffer) {
OpenOffer.State state = ((OpenOffer) item.getTradable()).getState();
log.trace("OpenOffer state {}", state);
switch (state) {

View file

@ -32,8 +32,10 @@ import javax.inject.Inject;
@FxmlView
public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTradesViewModel> {
@FXML TableView<FailedTradesListItem> table;
@FXML TableColumn<FailedTradesListItem, FailedTradesListItem> priceColumn, amountColumn, volumeColumn,
@FXML
TableView<FailedTradesListItem> table;
@FXML
TableColumn<FailedTradesListItem, FailedTradesListItem> priceColumn, amountColumn, volumeColumn,
directionColumn, dateColumn, tradeIdColumn, stateColumn;
private final TradeDetailsPopup tradeDetailsPopup;
@ -86,8 +88,7 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
tradeDetailsPopup.show(trade);
});
setGraphic(hyperlink);
}
else {
} else {
setGraphic(null);
setId(null);
}

View file

@ -17,14 +17,13 @@
package io.bitsquare.gui.main.portfolio.pendingtrades.steps;
import io.bitsquare.gui.util.Colors;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.*;
import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import io.bitsquare.gui.util.Colors;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
public class TradeWizardItem extends Button {
public Class<? extends TradeStepDetailsView> getViewClass() {

View file

@ -65,7 +65,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
transactionFeeFocusedListener = (o, oldValue, newValue) -> {
model.onFocusOutTransactionFeeTextField(oldValue, newValue, transactionFeeInputTextField.getText());
};
addTitledGroupBg(root, ++gridRow, 5, "Display options", Layout.GROUP_DISTANCE);
useAnimationsCheckBox = addLabelCheckBox(root, gridRow, "Use animations:", "", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
useEffectsCheckBox = addLabelCheckBox(root, ++gridRow, "Use effects:", "").second;

View file

@ -364,7 +364,7 @@ public class FormBuilder {
public static Tuple2<Label, CheckBox> addLabelCheckBox(GridPane gridPane, int rowIndex, String title, String checkBoxTitle, double top) {
Label label = addLabel(gridPane, rowIndex, title, -3);
GridPane.setMargin(label, new Insets(top, 0, 0, 0));
CheckBox checkBox = new CheckBox(checkBoxTitle);
GridPane.setRowIndex(checkBox, rowIndex);
GridPane.setColumnIndex(checkBox, 1);

View file

@ -18,14 +18,12 @@
package io.bitsquare.gui.util;
import com.google.common.base.Stopwatch;
import java.util.concurrent.TimeUnit;
import javafx.animation.AnimationTimer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit;
public class Profiler {
private static final Logger log = LoggerFactory.getLogger(Profiler.class);

View file

@ -50,8 +50,7 @@ public class OptionalBtcValidator extends BtcValidator {
result = validateIfNotNegative(input)
.and(validateIfNotFractionalBtcValue(input))
.and(validateIfNotExceedsMaxBtcValue(input));
}
else {
} else {
// we accept zero input
return new ValidationResult(true);
}

View file

@ -48,8 +48,7 @@ public class OptionalFiatValidator extends FiatValidator {
result = validateIfNotNegative(input)
.and(validateIfNotExceedsMinFiatValue(input))
.and(validateIfNotExceedsMaxFiatValue(input));
}
else {
} else {
// we accept zero input
return new ValidationResult(true);
}

View file

@ -31,7 +31,7 @@ public final class PasswordValidator extends InputValidator {
if (externalValidationResult != null && !externalValidationResult.isValid)
return externalValidationResult;
return result;
}

View file

@ -18,7 +18,6 @@
package io.bitsquare.app;
import org.junit.Test;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertySource;
@ -26,7 +25,7 @@ import org.springframework.mock.env.MockPropertySource;
import static io.bitsquare.app.BitsquareEnvironment.*;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.*;
import static org.junit.Assert.assertThat;
import static org.springframework.core.env.PropertySource.named;
import static org.springframework.core.env.StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME;
import static org.springframework.core.env.StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME;

View file

@ -14,7 +14,7 @@
~ You should have received a copy of the GNU Affero General Public License
~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
-->
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane xmlns:fx="http://javafx.com/fxml">
</AnchorPane>

View file

@ -15,7 +15,7 @@
~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
-->
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane fx:id="root" fx:controller="io.bitsquare.common.fxml.FxmlViewLoaderTests$MissingFxmlViewAnnotation"
xmlns:fx="http://javafx.com/fxml">
</AnchorPane>

View file

@ -15,7 +15,7 @@
~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
-->
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane fx:id="root" fx:controller="io.bitsquare.common.fxml.FxmlViewLoaderTests$WellFormed"
xmlns:fx="http://javafx.com/fxml">
</AnchorPane>

View file

@ -19,24 +19,18 @@ package io.bitsquare.common.fxml;
import io.bitsquare.gui.common.ViewfxException;
import io.bitsquare.gui.common.fxml.FxmlViewLoader;
import io.bitsquare.gui.common.view.AbstractView;
import io.bitsquare.gui.common.view.FxmlView;
import io.bitsquare.gui.common.view.View;
import io.bitsquare.gui.common.view.ViewFactory;
import io.bitsquare.gui.common.view.ViewLoader;
import java.util.ResourceBundle;
import io.bitsquare.gui.common.view.*;
import javafx.fxml.LoadException;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.ResourceBundle;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.*;
import static org.junit.Assert.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;

View file

@ -20,11 +20,11 @@ package io.bitsquare.common.support;
import io.bitsquare.gui.common.view.AbstractView;
import io.bitsquare.gui.common.view.CachingViewLoader;
import io.bitsquare.gui.common.view.ViewLoader;
import org.junit.Test;
import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
public class CachingViewLoaderTests {