Rename *PM => *ViewModel

This commit is contained in:
Chris Beams 2014-11-22 17:00:39 +01:00
parent a7fe05de00
commit 608f515b89
No known key found for this signature in database
GPG key ID: 3D214F8F5BC5ED73
32 changed files with 73 additions and 73 deletions

View file

@ -29,7 +29,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Non caching version for code behind classes using the PM pattern
* Non caching version for code behind classes using the ViewModel pattern
*/
public abstract class View<M> implements Initializable {

View file

@ -45,7 +45,7 @@ public class AccountView extends ActivatableView {
@FXML Tab accountSettingsTab, arbitratorSettingsTab;
private final AccountPM model;
private final AccountViewModel model;
private final ViewLoader viewLoader;
private final Navigation navigation;
@ -55,7 +55,7 @@ public class AccountView extends ActivatableView {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private AccountView(AccountPM model, ViewLoader viewLoader, Navigation navigation) {
private AccountView(AccountViewModel model, ViewLoader viewLoader, Navigation navigation) {
this.model = model;
this.viewLoader = viewLoader;
this.navigation = navigation;

View file

@ -22,12 +22,12 @@ import io.bitsquare.user.User;
import com.google.inject.Inject;
class AccountPM implements ViewModel {
class AccountViewModel implements ViewModel {
private final User user;
@Inject
public AccountPM(User user) {
public AccountViewModel(User user) {
this.user = user;
}

View file

@ -36,7 +36,7 @@ import javafx.scene.layout.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ChangePasswordView extends View<ChangePasswordPM> implements ContextAware {
public class ChangePasswordView extends View<ChangePasswordViewModel> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(ChangePasswordView.class);
@ -50,7 +50,7 @@ public class ChangePasswordView extends View<ChangePasswordPM> implements Contex
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private ChangePasswordView(ChangePasswordPM model) {
private ChangePasswordView(ChangePasswordViewModel model) {
super(model);
}

View file

@ -28,7 +28,7 @@ import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
class ChangePasswordPM implements ViewModel {
class ChangePasswordViewModel implements ViewModel {
private final PasswordValidator passwordValidator;
@ -40,7 +40,7 @@ class ChangePasswordPM implements ViewModel {
@Inject
public ChangePasswordPM(PasswordValidator passwordValidator) {
public ChangePasswordViewModel(PasswordValidator passwordValidator) {
this.passwordValidator = passwordValidator;
passwordField.addListener((ov) -> saveButtonDisabled.set(!validate()));

View file

@ -41,7 +41,7 @@ import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.util.StringConverter;
class FiatAccountPM extends ActivatableWithDelegate<FiatAccountModel> implements ViewModel {
class FiatAccountViewModel extends ActivatableWithDelegate<FiatAccountModel> implements ViewModel {
private final BankAccountNumberValidator bankAccountNumberValidator;
@ -60,7 +60,7 @@ class FiatAccountPM extends ActivatableWithDelegate<FiatAccountModel> implements
@Inject
public FiatAccountPM(FiatAccountModel model, BankAccountNumberValidator bankAccountNumberValidator) {
public FiatAccountViewModel(FiatAccountModel model, BankAccountNumberValidator bankAccountNumberValidator) {
super(model);
this.bankAccountNumberValidator = bankAccountNumberValidator;

View file

@ -56,7 +56,7 @@ import org.slf4j.LoggerFactory;
import static javafx.beans.binding.Bindings.createBooleanBinding;
public class FiatAccountView extends ActivatableView<FiatAccountPM> implements ContextAware {
public class FiatAccountView extends ActivatableView<FiatAccountViewModel> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(FiatAccountView.class);
@ -76,7 +76,7 @@ public class FiatAccountView extends ActivatableView<FiatAccountPM> implements C
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
FiatAccountView(FiatAccountPM model, OverlayManager overlayManager) {
FiatAccountView(FiatAccountViewModel model, OverlayManager overlayManager) {
super(model);
this.overlayManager = overlayManager;

View file

@ -38,7 +38,7 @@ import javafx.beans.property.StringProperty;
import javafx.collections.ObservableList;
import javafx.util.StringConverter;
class IrcAccountPM extends ActivatableWithDelegate<IrcAccountModel> implements ViewModel {
class IrcAccountViewModel extends ActivatableWithDelegate<IrcAccountModel> implements ViewModel {
private final InputValidator nickNameValidator;
@ -49,7 +49,7 @@ class IrcAccountPM extends ActivatableWithDelegate<IrcAccountModel> implements V
@Inject
public IrcAccountPM(IrcAccountModel model, BankAccountNumberValidator nickNameValidator) {
public IrcAccountViewModel(IrcAccountModel model, BankAccountNumberValidator nickNameValidator) {
super(model);
this.nickNameValidator = nickNameValidator;

View file

@ -47,7 +47,7 @@ import org.slf4j.LoggerFactory;
/*
Just temporary for giving the user a possibility to test the app via simulating the bank transfer in a IRC chat.
*/
public class IrcAccountView extends ActivatableView<IrcAccountPM> implements ContextAware {
public class IrcAccountView extends ActivatableView<IrcAccountViewModel> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(IrcAccountView.class);
@ -63,7 +63,7 @@ public class IrcAccountView extends ActivatableView<IrcAccountPM> implements Con
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
IrcAccountView(IrcAccountPM model) {
IrcAccountView(IrcAccountViewModel model) {
super(model);
}

View file

@ -36,7 +36,7 @@ import javafx.scene.layout.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PasswordView extends View<PasswordPM> implements ContextAware {
public class PasswordView extends View<PasswordViewModel> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(PasswordView.class);
@ -50,7 +50,7 @@ public class PasswordView extends View<PasswordPM> implements ContextAware {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private PasswordView(PasswordPM model) {
private PasswordView(PasswordViewModel model) {
super(model);
}

View file

@ -28,7 +28,7 @@ import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
class PasswordPM implements ViewModel {
class PasswordViewModel implements ViewModel {
private final PasswordValidator passwordValidator;
@ -40,7 +40,7 @@ class PasswordPM implements ViewModel {
@Inject
public PasswordPM(PasswordValidator passwordValidator) {
public PasswordViewModel(PasswordValidator passwordValidator) {
this.passwordValidator = passwordValidator;
passwordField.addListener((ov) -> saveButtonDisabled.set(!validate()));

View file

@ -48,7 +48,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RegistrationView extends View<RegistrationPM> implements ContextAware {
public class RegistrationView extends View<RegistrationViewModel> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(RegistrationView.class);
@ -67,7 +67,7 @@ public class RegistrationView extends View<RegistrationPM> implements ContextAwa
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private RegistrationView(RegistrationPM model, OverlayManager overlayManager) {
private RegistrationView(RegistrationViewModel model, OverlayManager overlayManager) {
super(model);
this.overlayManager = overlayManager;
}

View file

@ -36,7 +36,7 @@ import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
class RegistrationPM extends WithDelegate<RegistrationModel> implements ViewModel {
class RegistrationViewModel extends WithDelegate<RegistrationModel> implements ViewModel {
final BooleanProperty isPayButtonDisabled = new SimpleBooleanProperty(true);
final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty();
@ -49,7 +49,7 @@ class RegistrationPM extends WithDelegate<RegistrationModel> implements ViewMode
@Inject
public RegistrationPM(RegistrationModel delegate, BSFormatter formatter) {
public RegistrationViewModel(RegistrationModel delegate, BSFormatter formatter) {
super(delegate);
this.formatter = formatter;

View file

@ -50,7 +50,7 @@ import javafx.util.StringConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RestrictionsView extends ActivatableView<RestrictionsPM> implements ContextAware {
public class RestrictionsView extends ActivatableView<RestrictionsViewModel> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(RestrictionsView.class);
@ -71,7 +71,7 @@ public class RestrictionsView extends ActivatableView<RestrictionsPM> implements
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private RestrictionsView(RestrictionsPM model, ViewLoader viewLoader, Stage primaryStage) {
private RestrictionsView(RestrictionsViewModel model, ViewLoader viewLoader, Stage primaryStage) {
super(model);
this.viewLoader = viewLoader;
this.primaryStage = primaryStage;

View file

@ -31,13 +31,13 @@ import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.ObservableList;
class RestrictionsPM extends ActivatableWithDelegate<RestrictionsModel> implements ViewModel {
class RestrictionsViewModel extends ActivatableWithDelegate<RestrictionsModel> implements ViewModel {
final BooleanProperty doneButtonDisable = new SimpleBooleanProperty(true);
@Inject
public RestrictionsPM(RestrictionsModel model) {
public RestrictionsViewModel(RestrictionsModel model) {
super(model);
}

View file

@ -36,7 +36,7 @@ import javafx.scene.layout.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SeedWordsView extends View<SeedWordsPM> implements ContextAware {
public class SeedWordsView extends View<SeedWordsViewModel> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(SeedWordsView.class);
@ -49,7 +49,7 @@ public class SeedWordsView extends View<SeedWordsPM> implements ContextAware {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private SeedWordsView(SeedWordsPM model) {
private SeedWordsView(SeedWordsViewModel model) {
super(model);
}

View file

@ -28,12 +28,12 @@ import java.util.List;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
class SeedWordsPM implements ViewModel {
class SeedWordsViewModel implements ViewModel {
final StringProperty seedWords = new SimpleStringProperty();
@Inject
public SeedWordsPM(WalletService walletService, BSFormatter formatter) {
public SeedWordsViewModel(WalletService walletService, BSFormatter formatter) {
if (walletService.getWallet() != null) {
List<String> mnemonicCode = walletService.getWallet().getKeyChainSeed().getMnemonicCode();
if (mnemonicCode != null) {

View file

@ -34,7 +34,7 @@ import javafx.util.Callback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ClosedTradesView extends ActivatableView<ClosedTradesPM> {
public class ClosedTradesView extends ActivatableView<ClosedTradesViewModel> {
private static final Logger log = LoggerFactory.getLogger(ClosedTradesView.class);
@FXML TableColumn<ClosedTradesListItem, ClosedTradesListItem> priceColumn, amountColumn, volumeColumn,
@ -47,7 +47,7 @@ public class ClosedTradesView extends ActivatableView<ClosedTradesPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private ClosedTradesView(ClosedTradesPM model) {
private ClosedTradesView(ClosedTradesViewModel model) {
super(model);
}

View file

@ -25,13 +25,13 @@ import com.google.inject.Inject;
import javafx.collections.ObservableList;
class ClosedTradesPM extends ActivatableWithDelegate<ClosedTradesModel> implements ViewModel {
class ClosedTradesViewModel extends ActivatableWithDelegate<ClosedTradesModel> implements ViewModel {
private final BSFormatter formatter;
@Inject
public ClosedTradesPM(ClosedTradesModel model, BSFormatter formatter) {
public ClosedTradesViewModel(ClosedTradesModel model, BSFormatter formatter) {
super(model);
this.formatter = formatter;

View file

@ -36,7 +36,7 @@ import javafx.util.Callback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class OffersView extends ActivatableView<OffersPM> {
public class OffersView extends ActivatableView<OffersViewModel> {
private static final Logger log = LoggerFactory.getLogger(OffersView.class);
@FXML TableColumn<OfferListItem, OfferListItem> priceColumn, amountColumn, volumeColumn,
@ -49,7 +49,7 @@ public class OffersView extends ActivatableView<OffersPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private OffersView(OffersPM model) {
private OffersView(OffersViewModel model) {
super(model);
}

View file

@ -25,13 +25,13 @@ import com.google.inject.Inject;
import javafx.collections.ObservableList;
class OffersPM extends ActivatableWithDelegate<OffersModel> implements ViewModel {
class OffersViewModel extends ActivatableWithDelegate<OffersModel> implements ViewModel {
private final BSFormatter formatter;
@Inject
public OffersPM(OffersModel model, BSFormatter formatter) {
public OffersViewModel(OffersModel model, BSFormatter formatter) {
super(model);
this.formatter = formatter;

View file

@ -58,15 +58,15 @@ import javafx.util.StringConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PendingTradesView extends ActivatableView<PendingTradesPM> {
public class PendingTradesView extends ActivatableView<PendingTradesViewModel> {
private static final Logger log = LoggerFactory.getLogger(PendingTradesView.class);
private ChangeListener<PendingTradesListItem> selectedItemChangeListener;
private ListChangeListener<PendingTradesListItem> listChangeListener;
private ChangeListener<String> txIdChangeListener;
private ChangeListener<PendingTradesPM.State> offererStateChangeListener;
private ChangeListener<PendingTradesPM.State> takerStateChangeListener;
private ChangeListener<PendingTradesViewModel.State> offererStateChangeListener;
private ChangeListener<PendingTradesViewModel.State> takerStateChangeListener;
private ChangeListener<Throwable> faultChangeListener;
private final Navigation navigation;
@ -99,7 +99,7 @@ public class PendingTradesView extends ActivatableView<PendingTradesPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
PendingTradesView(PendingTradesPM model, Navigation navigation) {
PendingTradesView(PendingTradesViewModel model, Navigation navigation) {
super(model);
this.navigation = navigation;
@ -290,7 +290,7 @@ public class PendingTradesView extends ActivatableView<PendingTradesPM> {
applyTakerState(model.state.get());
}
private void applyOffererState(PendingTradesPM.State state) {
private void applyOffererState(PendingTradesViewModel.State state) {
setPaymentsControlsVisible(false);
setSummaryControlsVisible(false);
@ -364,7 +364,7 @@ public class PendingTradesView extends ActivatableView<PendingTradesPM> {
}
private void applyTakerState(PendingTradesPM.State state) {
private void applyTakerState(PendingTradesViewModel.State state) {
confirmPaymentReceiptButton.setVisible(false);
confirmPaymentReceiptButton.setManaged(false);

View file

@ -44,8 +44,8 @@ import javafx.collections.ObservableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
class PendingTradesPM extends ActivatableWithDelegate<PendingTradesModel> implements ViewModel {
private static final Logger log = LoggerFactory.getLogger(PendingTradesPM.class);
class PendingTradesViewModel extends ActivatableWithDelegate<PendingTradesModel> implements ViewModel {
private static final Logger log = LoggerFactory.getLogger(PendingTradesViewModel.class);
enum State {
TAKER_SELLER_WAIT_TX_CONF,
@ -70,7 +70,7 @@ class PendingTradesPM extends ActivatableWithDelegate<PendingTradesModel> implem
@Inject
public PendingTradesPM(PendingTradesModel delegate, BSFormatter formatter,
public PendingTradesViewModel(PendingTradesModel delegate, BSFormatter formatter,
BtcAddressValidator btcAddressValidator) {
super(delegate);

View file

@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
/**
* This UI is not cached as it is normally only needed once.
*/
public class PreferencesView extends ActivatableView<PreferencesPM> {
public class PreferencesView extends ActivatableView<PreferencesViewModel> {
private static final Logger log = LoggerFactory.getLogger(PreferencesView.class);
@ -47,7 +47,7 @@ public class PreferencesView extends ActivatableView<PreferencesPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private PreferencesView(PreferencesPM model) {
private PreferencesView(PreferencesViewModel model) {
super(model);
}

View file

@ -26,10 +26,10 @@ import javafx.beans.property.BooleanProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.ObservableList;
class PreferencesPM extends ActivatableWithDelegate<PreferencesModel> implements ViewModel {
class PreferencesViewModel extends ActivatableWithDelegate<PreferencesModel> implements ViewModel {
@Inject
public PreferencesPM(PreferencesModel model) {
public PreferencesViewModel(PreferencesModel model) {
super(model);
}

View file

@ -73,7 +73,7 @@ import static javafx.beans.binding.Bindings.createStringBinding;
// TODO Implement other positioning method in InoutTextField to display it over the field instead of right side
// priceAmountHBox is too large after redesign as to be used as layoutReference.
public class CreateOfferView extends ActivatableView<CreateOfferPM> {
public class CreateOfferView extends ActivatableView<CreateOfferViewModel> {
private static final Logger log = LoggerFactory.getLogger(CreateOfferView.class);
@ -117,7 +117,7 @@ public class CreateOfferView extends ActivatableView<CreateOfferPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private CreateOfferView(CreateOfferPM model, Navigation navigation,
private CreateOfferView(CreateOfferViewModel model, Navigation navigation,
OverlayManager overlayManager) {
super(model);
this.navigation = navigation;

View file

@ -44,7 +44,7 @@ import javafx.beans.property.StringProperty;
import static javafx.beans.binding.Bindings.createStringBinding;
class CreateOfferPM extends ActivatableWithDelegate<CreateOfferModel> implements ViewModel {
class CreateOfferViewModel extends ActivatableWithDelegate<CreateOfferModel> implements ViewModel {
private final BtcValidator btcValidator;
private final BSFormatter formatter;
@ -93,7 +93,7 @@ class CreateOfferPM extends ActivatableWithDelegate<CreateOfferModel> implements
@Inject
public CreateOfferPM(CreateOfferModel model, FiatValidator fiatValidator, BtcValidator btcValidator,
public CreateOfferViewModel(CreateOfferModel model, FiatValidator fiatValidator, BtcValidator btcValidator,
BSFormatter formatter) {
super(model);

View file

@ -62,7 +62,7 @@ import static javafx.beans.binding.Bindings.createStringBinding;
* TODO: The advanced filters are not impl. yet
* The restrictions handling is open from the concept and is only implemented for countries yet.
*/
public class OfferBookView extends ActivatableView<OfferBookPM> {
public class OfferBookView extends ActivatableView<OfferBookViewModel> {
private static final Logger log = LoggerFactory.getLogger(OfferBookView.class);
private final Navigation navigation;
@ -90,7 +90,7 @@ public class OfferBookView extends ActivatableView<OfferBookPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
OfferBookView(OfferBookPM model,
OfferBookView(OfferBookViewModel model,
Navigation navigation,
OverlayManager overlayManager,
OptionalBtcValidator optionalBtcValidator,

View file

@ -36,7 +36,7 @@ import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.transformation.SortedList;
class OfferBookPM extends ActivatableWithDelegate<OfferBookModel> implements ViewModel {
class OfferBookViewModel extends ActivatableWithDelegate<OfferBookModel> implements ViewModel {
private final OptionalBtcValidator optionalBtcValidator;
private final BSFormatter formatter;
@ -51,7 +51,7 @@ class OfferBookPM extends ActivatableWithDelegate<OfferBookModel> implements Vie
@Inject
public OfferBookPM(OfferBookModel delegate, OptionalFiatValidator optionalFiatValidator,
public OfferBookViewModel(OfferBookModel delegate, OptionalFiatValidator optionalFiatValidator,
OptionalBtcValidator optionalBtcValidator, BSFormatter formatter) {
super(delegate);

View file

@ -69,7 +69,7 @@ import org.controlsfx.dialog.Dialog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TakeOfferView extends ActivatableView<TakeOfferPM> {
public class TakeOfferView extends ActivatableView<TakeOfferViewModel> {
private static final Logger log = LoggerFactory.getLogger(TakeOfferView.class);
private final Navigation navigation;
@ -112,7 +112,7 @@ public class TakeOfferView extends ActivatableView<TakeOfferPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private TakeOfferView(TakeOfferPM model, Navigation navigation,
private TakeOfferView(TakeOfferViewModel model, Navigation navigation,
OverlayManager overlayManager) {
super(model);

View file

@ -41,7 +41,7 @@ import javafx.beans.property.StringProperty;
import static javafx.beans.binding.Bindings.createStringBinding;
class TakeOfferPM extends ActivatableWithDelegate<TakeOfferModel> implements ViewModel {
class TakeOfferViewModel extends ActivatableWithDelegate<TakeOfferModel> implements ViewModel {
private String fiatCode;
private String amountRange;
@ -87,7 +87,7 @@ class TakeOfferPM extends ActivatableWithDelegate<TakeOfferModel> implements Vie
@Inject
public TakeOfferPM(TakeOfferModel model, BtcValidator btcValidator, BSFormatter formatter) {
public TakeOfferViewModel(TakeOfferModel model, BtcValidator btcValidator, BSFormatter formatter) {
super(model);
this.btcValidator = btcValidator;

View file

@ -37,11 +37,11 @@ import org.slf4j.LoggerFactory;
import static org.junit.Assert.*;
public class CreateOfferPMTest {
private static final Logger log = LoggerFactory.getLogger(CreateOfferPMTest.class);
public class CreateOfferViewModelTest {
private static final Logger log = LoggerFactory.getLogger(CreateOfferViewModelTest.class);
private CreateOfferModel model;
private CreateOfferPM presenter;
private CreateOfferViewModel presenter;
@Before
public void setup() {
@ -50,7 +50,7 @@ public class CreateOfferPMTest {
formatter.setFiatCurrencyCode("USD");
model = new CreateOfferModel(null, null, null, null, null, null, formatter);
presenter = new CreateOfferPM(model, new FiatValidator(null), new BtcValidator(), formatter);
presenter = new CreateOfferViewModel(model, new FiatValidator(null), new BtcValidator(), formatter);
}
@Test