Skip to content

Commit

Permalink
Refactor Phase back to PeriodService
Browse files Browse the repository at this point in the history
  • Loading branch information
sqrrm committed Apr 7, 2018
1 parent 3a553b1 commit 405a074
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 23 deletions.
6 changes: 3 additions & 3 deletions src/main/java/bisq/desktop/components/SeparatedPhaseBars.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.desktop.components;

import bisq.core.dao.vote.Cycles;
import bisq.core.dao.vote.PeriodService;
import bisq.core.locale.Res;

import bisq.common.UserThread;
Expand Down Expand Up @@ -139,7 +139,7 @@ private void adjustWidth(double availableWidth) {

@Getter
public static class SeparatedPhaseBarsItem {
private final Cycles.Phase phase;
private final PeriodService.Phase phase;
private final boolean showBlocks;
private final IntegerProperty startValueProperty = new SimpleIntegerProperty();
private final IntegerProperty endValueProperty = new SimpleIntegerProperty();
Expand All @@ -150,7 +150,7 @@ public static class SeparatedPhaseBarsItem {
@Setter
private Label titleLabel;

public SeparatedPhaseBarsItem(Cycles.Phase phase, boolean showBlocks) {
public SeparatedPhaseBarsItem(PeriodService.Phase phase, boolean showBlocks) {
this.phase = phase;
this.showBlocks = showBlocks;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import bisq.core.dao.blockchain.BsqBlockChain;
import bisq.core.dao.blockchain.ReadableBsqBlockChain;
import bisq.core.dao.blockchain.vo.BsqBlock;
import bisq.core.dao.vote.Cycles;
import bisq.core.dao.vote.PeriodService;
import bisq.core.dao.vote.proposal.Proposal;
import bisq.core.dao.vote.proposal.ProposalPayload;
Expand Down Expand Up @@ -87,9 +86,9 @@ public abstract class BaseProposalView extends ActivatableView<GridPane, Void> i
protected GridPane detailsGridPane, gridPane;
protected ProposalListItem selectedProposalListItem;
protected ListChangeListener<Proposal> proposalListChangeListener;
protected ChangeListener<Cycles.Phase> phaseChangeListener;
protected ChangeListener<PeriodService.Phase> phaseChangeListener;
protected final PeriodService periodService;
protected Cycles.Phase currentPhase;
protected PeriodService.Phase currentPhase;
protected Subscription phaseSubscription;
private ScrollPane proposalDisplayView;

Expand Down Expand Up @@ -237,7 +236,7 @@ protected void onSelectProposal(ProposalListItem item) {
hideProposalDisplay();
}

protected void onPhaseChanged(Cycles.Phase phase) {
protected void onPhaseChanged(PeriodService.Phase phase) {
if (!phase.equals(this.currentPhase)) {
this.currentPhase = phase;
onSelectProposal(selectedProposalListItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import bisq.core.dao.blockchain.ReadableBsqBlockChain;
import bisq.core.dao.blockchain.vo.BsqBlock;
import bisq.core.dao.blockchain.vo.Tx;
import bisq.core.dao.vote.Cycles;
import bisq.core.dao.vote.PeriodService;
import bisq.core.dao.vote.proposal.Proposal;
import bisq.core.dao.vote.proposal.ProposalService;
Expand Down Expand Up @@ -73,7 +72,7 @@ public class ProposalListItem implements BsqBlockChain.Listener {
private TxConfidenceListener txConfidenceListener;
private Tooltip tooltip = new Tooltip(Res.get("confidence.unknown"));
private Transaction walletTransaction;
private ChangeListener<Cycles.Phase> phaseChangeListener;
private ChangeListener<PeriodService.Phase> phaseChangeListener;
private AutoTooltipButton actionButton;
private ImageView actionButtonIconView;
@Setter
Expand Down Expand Up @@ -123,7 +122,7 @@ public class ProposalListItem implements BsqBlockChain.Listener {
proposal.getVoteResultProperty().addListener(voteResultChangeListener);
}

public void applyState(Cycles.Phase newValue, VoteResult voteResult) {
public void applyState(PeriodService.Phase newValue, VoteResult voteResult) {
actionButton.setText("");
actionButton.setVisible(false);
actionButton.setOnAction(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.btc.wallet.InsufficientBsqException;
import bisq.core.dao.blockchain.ReadableBsqBlockChain;
import bisq.core.dao.vote.Cycles;
import bisq.core.dao.vote.PeriodService;
import bisq.core.dao.vote.blindvote.BlindVoteService;
import bisq.core.dao.vote.proposal.Proposal;
Expand Down Expand Up @@ -252,10 +251,10 @@ private void onCancelVote() {
}

@Override
protected void onPhaseChanged(Cycles.Phase phase) {
protected void onPhaseChanged(PeriodService.Phase phase) {
super.onPhaseChanged(phase);

changeVoteViewItemsVisibility(phase == Cycles.Phase.BLIND_VOTE);
changeVoteViewItemsVisibility(phase == PeriodService.Phase.BLIND_VOTE);

if (removeButton != null) {
removeButton.setManaged(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import bisq.desktop.util.Layout;

import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.dao.vote.Cycles;
import bisq.core.dao.vote.PeriodService;
import bisq.core.locale.Res;

Expand All @@ -50,7 +49,7 @@ public class ProposalDashboardView extends ActivatableView<GridPane, Void> {
private List<SeparatedPhaseBars.SeparatedPhaseBarsItem> phaseBarsItems;
private final BsqWalletService bsqWalletService;
private final PeriodService periodService;
private Cycles.Phase currentPhase;
private PeriodService.Phase currentPhase;
private Subscription phaseSubscription;
private GridPane gridPane;
private int gridRow = 0;
Expand Down Expand Up @@ -98,14 +97,14 @@ public void initialize() {

private SeparatedPhaseBars createSeparatedPhaseBars() {
phaseBarsItems = Arrays.asList(
new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.PROPOSAL, true),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BREAK1, false),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BLIND_VOTE, true),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BREAK2, false),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.VOTE_REVEAL, true),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BREAK3, false),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.ISSUANCE, false),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(Cycles.Phase.BREAK4, false));
new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.PROPOSAL, true),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BREAK1, false),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BLIND_VOTE, true),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BREAK2, false),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.VOTE_REVEAL, true),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BREAK3, false),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.ISSUANCE, false),
new SeparatedPhaseBars.SeparatedPhaseBarsItem(PeriodService.Phase.BREAK4, false));
return new SeparatedPhaseBars(phaseBarsItems);
}

Expand Down

0 comments on commit 405a074

Please sign in to comment.