mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 02:12:00 +01:00
Rename View => BasicView and extract View interface
This commit is contained in:
parent
55036b04c6
commit
961ec9b317
44
src/main/java/io/bitsquare/gui/BasicView.java
Normal file
44
src/main/java/io/bitsquare/gui/BasicView.java
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public abstract class BasicView<M> implements View {
|
||||
|
||||
protected final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
protected final M model;
|
||||
protected @FXML Parent root;
|
||||
|
||||
public BasicView(M model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public BasicView() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
protected View loadView(Navigation.Item navigationItem) {
|
||||
throw new UnsupportedOperationException("loadView not implemented");
|
||||
}
|
||||
}
|
@ -17,6 +17,6 @@
|
||||
|
||||
package io.bitsquare.gui;
|
||||
|
||||
public interface ChildOf<Parent> {
|
||||
public interface ChildOf<Parent extends View> extends View {
|
||||
void setParent(Parent parent);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ import java.util.ResourceBundle;
|
||||
|
||||
import javafx.fxml.Initializable;
|
||||
|
||||
public class InitializableView<M> extends View<M> implements Initializable {
|
||||
public class InitializableView<M> extends BasicView<M> implements Initializable {
|
||||
|
||||
public InitializableView(M model) {
|
||||
super(model);
|
||||
|
@ -17,28 +17,5 @@
|
||||
|
||||
package io.bitsquare.gui;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class View<M> {
|
||||
|
||||
protected final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
protected final M model;
|
||||
protected @FXML Parent root;
|
||||
|
||||
public View(M model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public View() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
protected View loadView(Navigation.Item navigationItem) {
|
||||
throw new UnsupportedOperationException("loadView not implemented");
|
||||
}
|
||||
public interface View {
|
||||
}
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
package io.bitsquare.gui;
|
||||
|
||||
public interface Wizard {
|
||||
void nextStep(View current);
|
||||
public interface Wizard extends View {
|
||||
void nextStep(Step currentStep);
|
||||
|
||||
public interface Step extends ChildOf<Wizard> {
|
||||
void hideWizardNavigation();
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package io.bitsquare.gui.main.account.arbitrator;
|
||||
|
||||
import io.bitsquare.gui.BasicView;
|
||||
import io.bitsquare.gui.Navigation;
|
||||
import io.bitsquare.gui.View;
|
||||
import io.bitsquare.gui.ViewLoader;
|
||||
@ -30,7 +31,7 @@ import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
// TODO Arbitration is very basic yet
|
||||
public class ArbitratorSettingsView extends View {
|
||||
public class ArbitratorSettingsView extends BasicView {
|
||||
|
||||
private final ViewLoader viewLoader;
|
||||
private final Navigation navigation;
|
||||
|
@ -18,7 +18,7 @@
|
||||
package io.bitsquare.gui.main.account.arbitrator.profile;
|
||||
|
||||
import io.bitsquare.arbitrator.Arbitrator;
|
||||
import io.bitsquare.gui.View;
|
||||
import io.bitsquare.gui.BasicView;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.persistence.Persistence;
|
||||
import io.bitsquare.settings.Preferences;
|
||||
@ -29,7 +29,7 @@ import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
|
||||
// TODO Arbitration is very basic yet
|
||||
public class ArbitratorProfileView extends View {
|
||||
public class ArbitratorProfileView extends BasicView {
|
||||
|
||||
private final Preferences preferences;
|
||||
|
||||
|
@ -142,29 +142,25 @@ public class AccountSetupWizard extends ActivatableView implements Wizard {
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// MultiStepNavigation implementation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void nextStep(View childView) {
|
||||
if (childView instanceof SeedWordsView) {
|
||||
public void nextStep(Step currentStep) {
|
||||
if (currentStep instanceof SeedWordsView) {
|
||||
seedWords.onCompleted();
|
||||
password.show();
|
||||
}
|
||||
else if (childView instanceof PasswordView) {
|
||||
else if (currentStep instanceof PasswordView) {
|
||||
password.onCompleted();
|
||||
restrictions.show();
|
||||
}
|
||||
else if (childView instanceof RestrictionsView) {
|
||||
else if (currentStep instanceof RestrictionsView) {
|
||||
restrictions.onCompleted();
|
||||
fiatAccount.show();
|
||||
}
|
||||
else if (childView instanceof IrcAccountView) {
|
||||
else if (currentStep instanceof IrcAccountView) {
|
||||
fiatAccount.onCompleted();
|
||||
registration.show();
|
||||
}
|
||||
else if (childView instanceof RegistrationView) {
|
||||
else if (currentStep instanceof RegistrationView) {
|
||||
registration.onCompleted();
|
||||
|
||||
if (navigation.getItemsForReturning() != null)
|
||||
|
@ -17,9 +17,9 @@
|
||||
|
||||
package io.bitsquare.gui.main.home;
|
||||
|
||||
import io.bitsquare.gui.View;
|
||||
import io.bitsquare.gui.BasicView;
|
||||
|
||||
// home is just hosting the arbiters buttons yet, but that's just for dev, not clear yet what will be in home,
|
||||
// probably overview, event history, news, charts,... -> low prio
|
||||
public class HomeView extends View {
|
||||
public class HomeView extends BasicView {
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
package io.bitsquare.gui.main.msg;
|
||||
|
||||
import io.bitsquare.gui.View;
|
||||
import io.bitsquare.gui.BasicView;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
|
||||
// will be probably only used for arbitration communication, will be renamed and the icon changed
|
||||
|
||||
|
||||
public class MsgView extends View {
|
||||
public class MsgView extends BasicView {
|
||||
private static final Logger log = LoggerFactory.getLogger(MsgView.class);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user