From f27a7461c83c5f09fc7845d4703b7d64f15767eb Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Wed, 18 Jul 2018 23:19:53 +0200 Subject: [PATCH] Rename classes --- .../java/bisq/desktop/main/dao/DaoView.java | 8 +- .../ResultsListItem.java} | 28 ++-- .../ResultsView.fxml} | 2 +- .../ResultsView.java} | 128 +++++++-------- .../model/ResultsOfCycle.java} | 14 +- .../ProposalResultDetailsWindow.java} | 6 +- .../proposal/ProposalResultDisplay.java} | 154 +++++++++--------- .../proposal/ProposalResultListItem.java} | 6 +- 8 files changed, 173 insertions(+), 173 deletions(-) rename src/main/java/bisq/desktop/main/dao/{cycles/CyclesListItem.java => results/ResultsListItem.java} (65%) rename src/main/java/bisq/desktop/main/dao/{cycles/CyclesView.fxml => results/ResultsView.fxml} (94%) rename src/main/java/bisq/desktop/main/dao/{cycles/CyclesView.java => results/ResultsView.java} (69%) rename src/main/java/bisq/desktop/main/dao/{cycles/model/CycleResult.java => results/model/ResultsOfCycle.java} (88%) rename src/main/java/bisq/desktop/main/dao/{cycles/cycle/CycleDetailsWindow.java => results/proposal/ProposalResultDetailsWindow.java} (91%) rename src/main/java/bisq/desktop/main/dao/{cycles/cycle/CycleDisplay.java => results/proposal/ProposalResultDisplay.java} (64%) rename src/main/java/bisq/desktop/main/dao/{cycles/cycle/CycleListItem.java => results/proposal/ProposalResultListItem.java} (94%) diff --git a/src/main/java/bisq/desktop/main/dao/DaoView.java b/src/main/java/bisq/desktop/main/dao/DaoView.java index ae9683c956..be9261217b 100644 --- a/src/main/java/bisq/desktop/main/dao/DaoView.java +++ b/src/main/java/bisq/desktop/main/dao/DaoView.java @@ -26,8 +26,8 @@ import bisq.desktop.common.view.View; import bisq.desktop.common.view.ViewLoader; import bisq.desktop.main.MainView; import bisq.desktop.main.dao.bonding.BondingView; -import bisq.desktop.main.dao.cycles.CyclesView; import bisq.desktop.main.dao.proposal.ProposalView; +import bisq.desktop.main.dao.results.ResultsView; import bisq.desktop.main.dao.voting.VotingView; import bisq.desktop.main.dao.wallet.BsqWalletView; import bisq.desktop.main.dao.wallet.dashboard.BsqDashboardView; @@ -126,7 +126,7 @@ public class DaoView extends ActivatableViewAndModel { navigation.navigateTo(MainView.class, DaoView.class, VotingView.class); } else if (newValue == resultsTab) { //noinspection unchecked - navigation.navigateTo(MainView.class, DaoView.class, CyclesView.class); + navigation.navigateTo(MainView.class, DaoView.class, ResultsView.class); } else if (newValue == bondingTab) { //noinspection unchecked navigation.navigateTo(MainView.class, DaoView.class, BondingView.class); @@ -152,7 +152,7 @@ public class DaoView extends ActivatableViewAndModel { navigation.navigateTo(MainView.class, DaoView.class, VotingView.class); else if (selectedItem == resultsTab) //noinspection unchecked - navigation.navigateTo(MainView.class, DaoView.class, CyclesView.class); + navigation.navigateTo(MainView.class, DaoView.class, ResultsView.class); else if (selectedItem == bondingTab) //noinspection unchecked navigation.navigateTo(MainView.class, DaoView.class, BondingView.class); @@ -174,7 +174,7 @@ public class DaoView extends ActivatableViewAndModel { selectedTab = proposalsTab; } else if (view instanceof VotingView) { selectedTab = votingTab; - } else if (view instanceof CyclesView) { + } else if (view instanceof ResultsView) { selectedTab = resultsTab; } else if (view instanceof BondingView) { selectedTab = bondingTab; diff --git a/src/main/java/bisq/desktop/main/dao/cycles/CyclesListItem.java b/src/main/java/bisq/desktop/main/dao/results/ResultsListItem.java similarity index 65% rename from src/main/java/bisq/desktop/main/dao/cycles/CyclesListItem.java rename to src/main/java/bisq/desktop/main/dao/results/ResultsListItem.java index e16bbad440..0d0e3e6220 100644 --- a/src/main/java/bisq/desktop/main/dao/cycles/CyclesListItem.java +++ b/src/main/java/bisq/desktop/main/dao/results/ResultsListItem.java @@ -15,9 +15,9 @@ * along with Bisq. If not, see . */ -package bisq.desktop.main.dao.cycles; +package bisq.desktop.main.dao.results; -import bisq.desktop.main.dao.cycles.model.CycleResult; +import bisq.desktop.main.dao.results.model.ResultsOfCycle; import bisq.core.dao.voting.proposal.compensation.CompensationProposal; import bisq.core.locale.Res; @@ -29,37 +29,37 @@ import java.util.Date; import lombok.Getter; -public class CyclesListItem { +public class ResultsListItem { private final BsqFormatter bsqFormatter; @Getter - private CycleResult cycleResult; + private ResultsOfCycle resultsOfCycle; - public CyclesListItem(CycleResult cycleResult, - BsqFormatter bsqFormatter) { - this.cycleResult = cycleResult; + public ResultsListItem(ResultsOfCycle resultsOfCycle, + BsqFormatter bsqFormatter) { + this.resultsOfCycle = resultsOfCycle; this.bsqFormatter = bsqFormatter; } public String getCycle() { - int displayIndex = cycleResult.getCycleIndex() + 1; - String dateTime = bsqFormatter.formatDateTime(new Date(cycleResult.getCycleStartTime())); + int displayIndex = resultsOfCycle.getCycleIndex() + 1; + String dateTime = bsqFormatter.formatDateTime(new Date(resultsOfCycle.getCycleStartTime())); return Res.get("dao.results.results.table.item.cycle", displayIndex, dateTime); } public String getNumProposals() { - return String.valueOf(cycleResult.getEvaluatedProposals().size()); + return String.valueOf(resultsOfCycle.getEvaluatedProposals().size()); } public String getNumVotesAsString() { - return String.valueOf(cycleResult.getNumVotes()); + return String.valueOf(resultsOfCycle.getNumVotes()); } public String getStake() { - return bsqFormatter.formatCoinWithCode(Coin.valueOf(cycleResult.getTotalStake())); + return bsqFormatter.formatCoinWithCode(Coin.valueOf(resultsOfCycle.getTotalStake())); } public String getIssuance() { - long totalIssuance = cycleResult.getEvaluatedProposals().stream() + long totalIssuance = resultsOfCycle.getEvaluatedProposals().stream() .filter(e -> e.getProposal() instanceof CompensationProposal) .map(e -> (CompensationProposal) e.getProposal()) .mapToLong(e -> e.getRequestedBsq().value) @@ -68,6 +68,6 @@ public class CyclesListItem { } public Long getCycleStartTime() { - return cycleResult.getCycleStartTime(); + return resultsOfCycle.getCycleStartTime(); } } diff --git a/src/main/java/bisq/desktop/main/dao/cycles/CyclesView.fxml b/src/main/java/bisq/desktop/main/dao/results/ResultsView.fxml similarity index 94% rename from src/main/java/bisq/desktop/main/dao/cycles/CyclesView.fxml rename to src/main/java/bisq/desktop/main/dao/results/ResultsView.fxml index ef067e5f4f..4b19a62a64 100644 --- a/src/main/java/bisq/desktop/main/dao/cycles/CyclesView.fxml +++ b/src/main/java/bisq/desktop/main/dao/results/ResultsView.fxml @@ -21,7 +21,7 @@ -. */ -package bisq.desktop.main.dao.cycles; +package bisq.desktop.main.dao.results; import bisq.desktop.common.model.Activatable; @@ -24,8 +24,8 @@ import bisq.desktop.common.view.FxmlView; import bisq.desktop.components.AutoTooltipLabel; import bisq.desktop.components.AutoTooltipTableColumn; import bisq.desktop.components.TableGroupHeadline; -import bisq.desktop.main.dao.cycles.cycle.CycleDisplay; -import bisq.desktop.main.dao.cycles.model.CycleResult; +import bisq.desktop.main.dao.results.model.ResultsOfCycle; +import bisq.desktop.main.dao.results.proposal.ProposalResultDisplay; import bisq.core.btc.wallet.BsqWalletService; import bisq.core.dao.DaoFacade; @@ -68,7 +68,7 @@ import java.util.List; import java.util.stream.Collectors; @FxmlView -public class CyclesView extends ActivatableViewAndModel implements BsqStateListener { +public class ResultsView extends ActivatableViewAndModel implements BsqStateListener { private final DaoFacade daoFacade; // TODO use daoFacade once dev work completed private final BsqStateService bsqStateService; @@ -79,14 +79,14 @@ public class CyclesView extends ActivatableViewAndModel i private final BsqFormatter bsqFormatter; private int gridRow = 0; - private TableView tableView; + private TableView tableView; - private final ObservableList itemList = FXCollections.observableArrayList(); - private final SortedList sortedList = new SortedList<>(itemList); - private ChangeListener selectedItemListener; + private final ObservableList itemList = FXCollections.observableArrayList(); + private final SortedList sortedList = new SortedList<>(itemList); + private ChangeListener selectedItemListener; private GridPane resultGridPane; - private CycleDisplay proposalsDisplay; + private ProposalResultDisplay proposalsDisplay; private ScrollPane resultDisplayView; private boolean resultDisplayInitialized; @@ -96,13 +96,13 @@ public class CyclesView extends ActivatableViewAndModel i /////////////////////////////////////////////////////////////////////////////////////////// @Inject - private CyclesView(DaoFacade daoFacade, - BsqStateService bsqStateService, - CycleService cycleService, - VoteResultService voteResultService, - ProposalService proposalService, - BsqWalletService bsqWalletService, - BsqFormatter bsqFormatter) { + private ResultsView(DaoFacade daoFacade, + BsqStateService bsqStateService, + CycleService cycleService, + VoteResultService voteResultService, + ProposalService proposalService, + BsqWalletService bsqWalletService, + BsqFormatter bsqFormatter) { this.daoFacade = daoFacade; this.bsqStateService = bsqStateService; this.cycleService = cycleService; @@ -161,7 +161,7 @@ public class CyclesView extends ActivatableViewAndModel i // UI handlers /////////////////////////////////////////////////////////////////////////////////////////// - private void onCycleListItemSelected(CyclesListItem item) { + private void onCycleListItemSelected(ResultsListItem item) { if (item != null) createAllFieldsOnResultDisplay(item); else @@ -198,7 +198,7 @@ public class CyclesView extends ActivatableViewAndModel i } private void createResultDisplay() { - proposalsDisplay = new CycleDisplay(resultGridPane, bsqWalletService, daoFacade, bsqFormatter); + proposalsDisplay = new ProposalResultDisplay(resultGridPane, bsqWalletService, daoFacade, bsqFormatter); resultDisplayView = proposalsDisplay.getView(); GridPane.setMargin(resultDisplayView, new Insets(10, -10, 0, -10)); GridPane.setRowIndex(resultDisplayView, ++gridRow); @@ -231,13 +231,13 @@ public class CyclesView extends ActivatableViewAndModel i .map(e -> e.getTime() * 1000) .orElse(0L); int cycleIndex = cycleService.getCycleIndex(cycle); - CycleResult cycleResult = new CycleResult(cycle, + ResultsOfCycle resultsOfCycle = new ResultsOfCycle(cycle, cycleIndex, cycleStartTime, proposalsForCycle, evaluatedProposalsForCycle); - CyclesListItem cyclesListItem = new CyclesListItem(cycleResult, bsqFormatter); - itemList.add(cyclesListItem); + ResultsListItem resultsListItem = new ResultsListItem(resultsOfCycle, bsqFormatter); + itemList.add(resultsListItem); } private void hideResultDisplay() { @@ -248,11 +248,11 @@ public class CyclesView extends ActivatableViewAndModel i } } - private void createAllFieldsOnResultDisplay(CyclesListItem cyclesListItem) { + private void createAllFieldsOnResultDisplay(ResultsListItem resultsListItem) { resultDisplayView.setVisible(true); resultDisplayView.setManaged(true); - proposalsDisplay.createAllFields(0, cyclesListItem.getCycleResult()); + proposalsDisplay.createAllFields(0, resultsListItem.getResultsOfCycle()); resultDisplayInitialized = true; } @@ -261,19 +261,19 @@ public class CyclesView extends ActivatableViewAndModel i // TableColumns /////////////////////////////////////////////////////////////////////////////////////////// - private void createColumns(TableView tableView) { - TableColumn cycleColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.cycle")); + private void createColumns(TableView tableView) { + TableColumn cycleColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.cycle")); cycleColumn.setMinWidth(160); cycleColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); cycleColumn.setCellFactory( - new Callback, TableCell>() { + new Callback, TableCell>() { @Override - public TableCell call( - TableColumn column) { - return new TableCell() { + public TableCell call( + TableColumn column) { + return new TableCell() { @Override - public void updateItem(final CyclesListItem item, boolean empty) { + public void updateItem(final ResultsListItem item, boolean empty) { super.updateItem(item, empty); if (item != null) setText(item.getCycle()); @@ -283,22 +283,22 @@ public class CyclesView extends ActivatableViewAndModel i }; } }); - cycleColumn.setComparator(Comparator.comparing(CyclesListItem::getCycleStartTime)); + cycleColumn.setComparator(Comparator.comparing(ResultsListItem::getCycleStartTime)); tableView.getColumns().add(cycleColumn); - TableColumn proposalsColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.numProposals")); + TableColumn proposalsColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.numProposals")); proposalsColumn.setMinWidth(90); proposalsColumn.setMaxWidth(90); proposalsColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); proposalsColumn.setCellFactory( - new Callback, TableCell>() { + new Callback, TableCell>() { @Override - public TableCell call( - TableColumn column) { - return new TableCell() { + public TableCell call( + TableColumn column) { + return new TableCell() { @Override - public void updateItem(final CyclesListItem item, boolean empty) { + public void updateItem(final ResultsListItem item, boolean empty) { super.updateItem(item, empty); if (item != null) setText(item.getNumProposals()); @@ -308,22 +308,22 @@ public class CyclesView extends ActivatableViewAndModel i }; } }); - proposalsColumn.setComparator(Comparator.comparing(CyclesListItem::getNumProposals)); + proposalsColumn.setComparator(Comparator.comparing(ResultsListItem::getNumProposals)); tableView.getColumns().add(proposalsColumn); - TableColumn votesColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.numVotes")); + TableColumn votesColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.numVotes")); votesColumn.setMinWidth(70); votesColumn.setMaxWidth(70); votesColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); votesColumn.setCellFactory( - new Callback, TableCell>() { + new Callback, TableCell>() { @Override - public TableCell call( - TableColumn column) { - return new TableCell() { + public TableCell call( + TableColumn column) { + return new TableCell() { @Override - public void updateItem(final CyclesListItem item, boolean empty) { + public void updateItem(final ResultsListItem item, boolean empty) { super.updateItem(item, empty); if (item != null) setText(item.getNumVotesAsString()); @@ -333,20 +333,20 @@ public class CyclesView extends ActivatableViewAndModel i }; } }); - votesColumn.setComparator(Comparator.comparing(CyclesListItem::getNumProposals)); + votesColumn.setComparator(Comparator.comparing(ResultsListItem::getNumProposals)); tableView.getColumns().add(votesColumn); - TableColumn stakeColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.stake")); + TableColumn stakeColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.stake")); stakeColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); stakeColumn.setCellFactory( - new Callback, TableCell>() { + new Callback, TableCell>() { @Override - public TableCell call( - TableColumn column) { - return new TableCell() { + public TableCell call( + TableColumn column) { + return new TableCell() { @Override - public void updateItem(final CyclesListItem item, boolean empty) { + public void updateItem(final ResultsListItem item, boolean empty) { super.updateItem(item, empty); if (item != null) setText(item.getStake()); @@ -356,20 +356,20 @@ public class CyclesView extends ActivatableViewAndModel i }; } }); - stakeColumn.setComparator(Comparator.comparing(CyclesListItem::getNumProposals)); + stakeColumn.setComparator(Comparator.comparing(ResultsListItem::getNumProposals)); tableView.getColumns().add(stakeColumn); - TableColumn issuanceColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.issuance")); + TableColumn issuanceColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.issuance")); issuanceColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); issuanceColumn.setCellFactory( - new Callback, TableCell>() { + new Callback, TableCell>() { @Override - public TableCell call( - TableColumn column) { - return new TableCell() { + public TableCell call( + TableColumn column) { + return new TableCell() { @Override - public void updateItem(final CyclesListItem item, boolean empty) { + public void updateItem(final ResultsListItem item, boolean empty) { super.updateItem(item, empty); if (item != null) setText(item.getIssuance()); @@ -379,7 +379,7 @@ public class CyclesView extends ActivatableViewAndModel i }; } }); - issuanceColumn.setComparator(Comparator.comparing(CyclesListItem::getNumProposals)); + issuanceColumn.setComparator(Comparator.comparing(ResultsListItem::getNumProposals)); tableView.getColumns().add(issuanceColumn); } } diff --git a/src/main/java/bisq/desktop/main/dao/cycles/model/CycleResult.java b/src/main/java/bisq/desktop/main/dao/results/model/ResultsOfCycle.java similarity index 88% rename from src/main/java/bisq/desktop/main/dao/cycles/model/CycleResult.java rename to src/main/java/bisq/desktop/main/dao/results/model/ResultsOfCycle.java index 4da420c231..5c67cdef68 100644 --- a/src/main/java/bisq/desktop/main/dao/cycles/model/CycleResult.java +++ b/src/main/java/bisq/desktop/main/dao/results/model/ResultsOfCycle.java @@ -15,7 +15,7 @@ * along with Bisq. If not, see . */ -package bisq.desktop.main.dao.cycles.model; +package bisq.desktop.main.dao.results.model; import bisq.core.dao.state.period.Cycle; import bisq.core.dao.voting.proposal.Proposal; @@ -27,7 +27,7 @@ import java.util.List; import lombok.Data; @Data -public class CycleResult { +public class ResultsOfCycle { private final Cycle cycle; private final int cycleIndex; private final int numVotes, numAcceptedVotes, numRejectedVotes; @@ -42,11 +42,11 @@ public class CycleResult { // Proposals which ended up in voting private final List evaluatedProposals; - public CycleResult(Cycle cycle, - int cycleIndex, - long cycleStartTime, - List proposals, - List evaluatedProposals) { + public ResultsOfCycle(Cycle cycle, + int cycleIndex, + long cycleStartTime, + List proposals, + List evaluatedProposals) { this.cycle = cycle; this.cycleIndex = cycleIndex; this.cycleStartTime = cycleStartTime; diff --git a/src/main/java/bisq/desktop/main/dao/cycles/cycle/CycleDetailsWindow.java b/src/main/java/bisq/desktop/main/dao/results/proposal/ProposalResultDetailsWindow.java similarity index 91% rename from src/main/java/bisq/desktop/main/dao/cycles/cycle/CycleDetailsWindow.java rename to src/main/java/bisq/desktop/main/dao/results/proposal/ProposalResultDetailsWindow.java index 1d05be18e8..f50078b104 100644 --- a/src/main/java/bisq/desktop/main/dao/cycles/cycle/CycleDetailsWindow.java +++ b/src/main/java/bisq/desktop/main/dao/results/proposal/ProposalResultDetailsWindow.java @@ -15,7 +15,7 @@ * along with Bisq. If not, see . */ -package bisq.desktop.main.dao.cycles.cycle; +package bisq.desktop.main.dao.results.proposal; import bisq.desktop.main.overlays.Overlay; import bisq.desktop.util.FormBuilder; @@ -30,7 +30,7 @@ import javafx.geometry.Insets; import static bisq.desktop.util.FormBuilder.addTitledGroupBg; -class CycleDetailsWindow extends Overlay { +class ProposalResultDetailsWindow extends Overlay { private final BsqFormatter bsqFormatter; private final EvaluatedProposal evaluatedProposal; @@ -40,7 +40,7 @@ class CycleDetailsWindow extends Overlay { // Public API /////////////////////////////////////////////////////////////////////////////////////////// - public CycleDetailsWindow(BsqFormatter bsqFormatter, EvaluatedProposal evaluatedProposal) { + public ProposalResultDetailsWindow(BsqFormatter bsqFormatter, EvaluatedProposal evaluatedProposal) { this.bsqFormatter = bsqFormatter; this.evaluatedProposal = evaluatedProposal; type = Type.Confirmation; diff --git a/src/main/java/bisq/desktop/main/dao/cycles/cycle/CycleDisplay.java b/src/main/java/bisq/desktop/main/dao/results/proposal/ProposalResultDisplay.java similarity index 64% rename from src/main/java/bisq/desktop/main/dao/cycles/cycle/CycleDisplay.java rename to src/main/java/bisq/desktop/main/dao/results/proposal/ProposalResultDisplay.java index 6587762bae..dd8e7b9647 100644 --- a/src/main/java/bisq/desktop/main/dao/cycles/cycle/CycleDisplay.java +++ b/src/main/java/bisq/desktop/main/dao/results/proposal/ProposalResultDisplay.java @@ -15,13 +15,13 @@ * along with Bisq. If not, see . */ -package bisq.desktop.main.dao.cycles.cycle; +package bisq.desktop.main.dao.results.proposal; import bisq.desktop.components.AutoTooltipLabel; import bisq.desktop.components.AutoTooltipTableColumn; import bisq.desktop.components.TableGroupHeadline; -import bisq.desktop.main.dao.cycles.model.CycleResult; import bisq.desktop.main.dao.proposal.ProposalDetailsWindow; +import bisq.desktop.main.dao.results.model.ResultsOfCycle; import bisq.desktop.util.FormBuilder; import bisq.desktop.util.GUIUtil; @@ -66,7 +66,7 @@ import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; @Slf4j -public class CycleDisplay { +public class ProposalResultDisplay { private final GridPane gridPane; private final BsqWalletService bsqWalletService; private final DaoFacade daoFacade; @@ -76,18 +76,18 @@ public class CycleDisplay { private int gridRowStartIndex; - private final ObservableList itemList = FXCollections.observableArrayList(); - private final SortedList sortedList = new SortedList<>(itemList); + private final ObservableList itemList = FXCollections.observableArrayList(); + private final SortedList sortedList = new SortedList<>(itemList); - public CycleDisplay(GridPane gridPane, BsqWalletService bsqWalletService, DaoFacade daoFacade, BsqFormatter bsqFormatter) { + public ProposalResultDisplay(GridPane gridPane, BsqWalletService bsqWalletService, DaoFacade daoFacade, BsqFormatter bsqFormatter) { this.gridPane = gridPane; this.bsqWalletService = bsqWalletService; this.daoFacade = daoFacade; this.bsqFormatter = bsqFormatter; } - public void createAllFields(int gridRowStartIndex, CycleResult cycleResult) { + public void createAllFields(int gridRowStartIndex, ResultsOfCycle resultsOfCycle) { removeAllFields(); this.gridRowStartIndex = gridRowStartIndex; @@ -95,14 +95,14 @@ public class CycleDisplay { createTableView(); - itemList.setAll(cycleResult.getEvaluatedProposals().stream().map(e -> new CycleListItem(e, bsqFormatter)).collect(Collectors.toList())); + itemList.setAll(resultsOfCycle.getEvaluatedProposals().stream().map(e -> new ProposalResultListItem(e, bsqFormatter)).collect(Collectors.toList())); Map requiredThresholdByType = new HashMap<>(); - cycleResult.getEvaluatedProposals().forEach(e -> { + resultsOfCycle.getEvaluatedProposals().forEach(e -> { requiredThresholdByType.putIfAbsent(e.getProposal().getType(), e.getRequiredThreshold()); }); Map requiredQuorumByType = new HashMap<>(); - cycleResult.getEvaluatedProposals().forEach(e -> { + resultsOfCycle.getEvaluatedProposals().forEach(e -> { requiredQuorumByType.putIfAbsent(e.getProposal().getType(), e.getRequiredQuorum()); }); @@ -125,7 +125,7 @@ public class CycleDisplay { GridPane.setColumnSpan(headline, 2); gridPane.getChildren().add(headline); - TableView tableView = new TableView<>(); + TableView tableView = new TableView<>(); tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData"))); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); tableView.setPrefHeight(200); @@ -141,18 +141,18 @@ public class CycleDisplay { sortedList.comparatorProperty().bind(tableView.comparatorProperty()); } - private void createColumns(TableView tableView) { - TableColumn proposalColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.proposalOwnerName")); + private void createColumns(TableView tableView) { + TableColumn proposalColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.proposalOwnerName")); proposalColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); proposalColumn.setCellFactory( - new Callback, TableCell>() { + new Callback, TableCell>() { @Override - public TableCell call( - TableColumn column) { - return new TableCell() { + public TableCell call( + TableColumn column) { + return new TableCell() { @Override - public void updateItem(final CycleListItem item, boolean empty) { + public void updateItem(final ProposalResultListItem item, boolean empty) { super.updateItem(item, empty); if (item != null) setText(item.getProposalOwnerName()); @@ -162,23 +162,23 @@ public class CycleDisplay { }; } }); - proposalColumn.setComparator(Comparator.comparing(CycleListItem::getProposalOwnerName)); + proposalColumn.setComparator(Comparator.comparing(ProposalResultListItem::getProposalOwnerName)); tableView.getColumns().add(proposalColumn); - TableColumn proposalIdColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.proposalId")); + TableColumn proposalIdColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.proposalId")); proposalIdColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); proposalIdColumn.setCellFactory( - new Callback, TableCell>() { + new Callback, TableCell>() { @Override - public TableCell call(TableColumn column) { - return new TableCell() { + public TableCell call(TableColumn column) { + return new TableCell() { private Hyperlink field; @Override - public void updateItem(final CycleListItem item, boolean empty) { + public void updateItem(final ProposalResultListItem item, boolean empty) { super.updateItem(item, empty); // cycleDetailsWindow.show(item.getEvaluatedProposal()) @@ -205,28 +205,28 @@ public class CycleDisplay { }; } }); - proposalIdColumn.setComparator(Comparator.comparing(CycleListItem::getProposalOwnerName)); + proposalIdColumn.setComparator(Comparator.comparing(ProposalResultListItem::getProposalOwnerName)); tableView.getColumns().add(proposalIdColumn); - TableColumn acceptedColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.accepted")); + TableColumn acceptedColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.accepted")); acceptedColumn.setMinWidth(80); acceptedColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); acceptedColumn.setCellFactory( - new Callback, TableCell>() { + new Callback, TableCell>() { private Hyperlink field; @Override - public TableCell call( - TableColumn column) { - return new TableCell() { + public TableCell call( + TableColumn column) { + return new TableCell() { @Override - public void updateItem(final CycleListItem item, boolean empty) { + public void updateItem(final ProposalResultListItem item, boolean empty) { super.updateItem(item, empty); if (item != null && !empty) { field = new Hyperlink(item.getAccepted()); field.setStyle(item.getColorStyle()); - field.setOnAction(event -> new CycleDetailsWindow(bsqFormatter, item.getEvaluatedProposal()).show()); + field.setOnAction(event -> new ProposalResultDetailsWindow(bsqFormatter, item.getEvaluatedProposal()).show()); field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails"))); setGraphic(field); } else { @@ -240,28 +240,28 @@ public class CycleDisplay { }; } }); - acceptedColumn.setComparator(Comparator.comparing(CycleListItem::getAccepted)); + acceptedColumn.setComparator(Comparator.comparing(ProposalResultListItem::getAccepted)); tableView.getColumns().add(acceptedColumn); - TableColumn rejectedColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.rejected")); + TableColumn rejectedColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.rejected")); rejectedColumn.setMinWidth(80); rejectedColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); rejectedColumn.setCellFactory( - new Callback, TableCell>() { + new Callback, TableCell>() { private Hyperlink field; @Override - public TableCell call( - TableColumn column) { - return new TableCell() { + public TableCell call( + TableColumn column) { + return new TableCell() { @Override - public void updateItem(final CycleListItem item, boolean empty) { + public void updateItem(final ProposalResultListItem item, boolean empty) { super.updateItem(item, empty); if (item != null && !empty) { field = new Hyperlink(item.getRejected()); field.setStyle(item.getColorStyle()); - field.setOnAction(event -> new CycleDetailsWindow(bsqFormatter, item.getEvaluatedProposal()).show()); + field.setOnAction(event -> new ProposalResultDetailsWindow(bsqFormatter, item.getEvaluatedProposal()).show()); field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails"))); setGraphic(field); } else { @@ -274,22 +274,22 @@ public class CycleDisplay { }; } }); - rejectedColumn.setComparator(Comparator.comparing(CycleListItem::getRejected)); + rejectedColumn.setComparator(Comparator.comparing(ProposalResultListItem::getRejected)); tableView.getColumns().add(rejectedColumn); - TableColumn thresholdColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.threshold")); + TableColumn thresholdColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.threshold")); thresholdColumn.setMinWidth(100); thresholdColumn.setMaxWidth(100); thresholdColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); thresholdColumn.setCellFactory( - new Callback, TableCell>() { + new Callback, TableCell>() { @Override - public TableCell call( - TableColumn column) { - return new TableCell() { + public TableCell call( + TableColumn column) { + return new TableCell() { @Override - public void updateItem(final CycleListItem item, boolean empty) { + public void updateItem(final ProposalResultListItem item, boolean empty) { super.updateItem(item, empty); if (item != null) setText(item.getThreshold()); @@ -299,22 +299,22 @@ public class CycleDisplay { }; } }); - thresholdColumn.setComparator(Comparator.comparing(CycleListItem::getThreshold)); + thresholdColumn.setComparator(Comparator.comparing(ProposalResultListItem::getThreshold)); tableView.getColumns().add(thresholdColumn); - TableColumn quorumColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.quorum")); + TableColumn quorumColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.quorum")); quorumColumn.setMinWidth(130); quorumColumn.setMaxWidth(130); quorumColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); quorumColumn.setCellFactory( - new Callback, TableCell>() { + new Callback, TableCell>() { @Override - public TableCell call( - TableColumn column) { - return new TableCell() { + public TableCell call( + TableColumn column) { + return new TableCell() { @Override - public void updateItem(final CycleListItem item, boolean empty) { + public void updateItem(final ProposalResultListItem item, boolean empty) { super.updateItem(item, empty); if (item != null) setText(item.getQuorum()); @@ -324,22 +324,22 @@ public class CycleDisplay { }; } }); - quorumColumn.setComparator(Comparator.comparing(CycleListItem::getThreshold)); + quorumColumn.setComparator(Comparator.comparing(ProposalResultListItem::getThreshold)); tableView.getColumns().add(quorumColumn); - TableColumn issuanceColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.issuance")); + TableColumn issuanceColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.issuance")); issuanceColumn.setMinWidth(130); issuanceColumn.setMaxWidth(130); issuanceColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); issuanceColumn.setCellFactory( - new Callback, TableCell>() { + new Callback, TableCell>() { @Override - public TableCell call( - TableColumn column) { - return new TableCell() { + public TableCell call( + TableColumn column) { + return new TableCell() { @Override - public void updateItem(final CycleListItem item, boolean empty) { + public void updateItem(final ProposalResultListItem item, boolean empty) { super.updateItem(item, empty); if (item != null) setText(item.getIssuance()); @@ -349,25 +349,25 @@ public class CycleDisplay { }; } }); - issuanceColumn.setComparator(Comparator.comparing(CycleListItem::getThreshold)); + issuanceColumn.setComparator(Comparator.comparing(ProposalResultListItem::getThreshold)); tableView.getColumns().add(issuanceColumn); - TableColumn resultColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.result")); + TableColumn resultColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.result")); resultColumn.setMinWidth(60); resultColumn.setMaxWidth(60); resultColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); - resultColumn.setCellFactory(new Callback, - TableCell>() { + resultColumn.setCellFactory(new Callback, + TableCell>() { @Override - public TableCell call(TableColumn column) { - return new TableCell() { + public TableCell call(TableColumn column) { + return new TableCell() { Label icon; @Override - public void updateItem(final CycleListItem item, boolean empty) { + public void updateItem(final ProposalResultListItem item, boolean empty) { super.updateItem(item, empty); if (item != null && !empty) { @@ -386,7 +386,7 @@ public class CycleDisplay { }); - resultColumn.setComparator(Comparator.comparing(CycleListItem::getThreshold)); + resultColumn.setComparator(Comparator.comparing(ProposalResultListItem::getThreshold)); tableView.getColumns().add(resultColumn); } diff --git a/src/main/java/bisq/desktop/main/dao/cycles/cycle/CycleListItem.java b/src/main/java/bisq/desktop/main/dao/results/proposal/ProposalResultListItem.java similarity index 94% rename from src/main/java/bisq/desktop/main/dao/cycles/cycle/CycleListItem.java rename to src/main/java/bisq/desktop/main/dao/results/proposal/ProposalResultListItem.java index de87fed8e5..f176f44bdb 100644 --- a/src/main/java/bisq/desktop/main/dao/cycles/cycle/CycleListItem.java +++ b/src/main/java/bisq/desktop/main/dao/results/proposal/ProposalResultListItem.java @@ -15,7 +15,7 @@ * along with Bisq. If not, see . */ -package bisq.desktop.main.dao.cycles.cycle; +package bisq.desktop.main.dao.results.proposal; import bisq.core.dao.voting.proposal.compensation.CompensationProposal; import bisq.core.dao.voting.voteresult.EvaluatedProposal; @@ -29,13 +29,13 @@ import de.jensd.fx.fontawesome.AwesomeIcon; import lombok.Getter; -public class CycleListItem { +public class ProposalResultListItem { private final ProposalVoteResult proposalVoteResult; private final BsqFormatter bsqFormatter; @Getter private EvaluatedProposal evaluatedProposal; - public CycleListItem(EvaluatedProposal evaluatedProposal, BsqFormatter bsqFormatter) { + public ProposalResultListItem(EvaluatedProposal evaluatedProposal, BsqFormatter bsqFormatter) { this.evaluatedProposal = evaluatedProposal; proposalVoteResult = evaluatedProposal.getProposalVoteResult(); this.bsqFormatter = bsqFormatter;