Rename classes

This commit is contained in:
Manfred Karrer 2018-07-18 23:19:53 +02:00
parent 288f4a7d89
commit f27a7461c8
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46
8 changed files with 173 additions and 173 deletions

View File

@ -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<TabPane, Activatable> {
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<TabPane, Activatable> {
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<TabPane, Activatable> {
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;

View File

@ -15,9 +15,9 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
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();
}
}

View File

@ -21,7 +21,7 @@
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.geometry.Insets?>
<GridPane fx:id="root" fx:controller="bisq.desktop.main.dao.cycles.CyclesView"
<GridPane fx:id="root" fx:controller="bisq.desktop.main.dao.results.ResultsView"
hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"

View File

@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
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<GridPane, Activatable> implements BsqStateListener {
public class ResultsView extends ActivatableViewAndModel<GridPane, Activatable> 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<GridPane, Activatable> i
private final BsqFormatter bsqFormatter;
private int gridRow = 0;
private TableView<CyclesListItem> tableView;
private TableView<ResultsListItem> tableView;
private final ObservableList<CyclesListItem> itemList = FXCollections.observableArrayList();
private final SortedList<CyclesListItem> sortedList = new SortedList<>(itemList);
private ChangeListener<CyclesListItem> selectedItemListener;
private final ObservableList<ResultsListItem> itemList = FXCollections.observableArrayList();
private final SortedList<ResultsListItem> sortedList = new SortedList<>(itemList);
private ChangeListener<ResultsListItem> 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<GridPane, Activatable> 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<GridPane, Activatable> 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<GridPane, Activatable> 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<GridPane, Activatable> 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<GridPane, Activatable> 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<GridPane, Activatable> i
// TableColumns
///////////////////////////////////////////////////////////////////////////////////////////
private void createColumns(TableView<CyclesListItem> tableView) {
TableColumn<CyclesListItem, CyclesListItem> cycleColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.cycle"));
private void createColumns(TableView<ResultsListItem> tableView) {
TableColumn<ResultsListItem, ResultsListItem> 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<TableColumn<CyclesListItem, CyclesListItem>, TableCell<CyclesListItem,
CyclesListItem>>() {
new Callback<TableColumn<ResultsListItem, ResultsListItem>, TableCell<ResultsListItem,
ResultsListItem>>() {
@Override
public TableCell<CyclesListItem, CyclesListItem> call(
TableColumn<CyclesListItem, CyclesListItem> column) {
return new TableCell<CyclesListItem, CyclesListItem>() {
public TableCell<ResultsListItem, ResultsListItem> call(
TableColumn<ResultsListItem, ResultsListItem> column) {
return new TableCell<ResultsListItem, ResultsListItem>() {
@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<GridPane, Activatable> i
};
}
});
cycleColumn.setComparator(Comparator.comparing(CyclesListItem::getCycleStartTime));
cycleColumn.setComparator(Comparator.comparing(ResultsListItem::getCycleStartTime));
tableView.getColumns().add(cycleColumn);
TableColumn<CyclesListItem, CyclesListItem> proposalsColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.numProposals"));
TableColumn<ResultsListItem, ResultsListItem> 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<TableColumn<CyclesListItem, CyclesListItem>, TableCell<CyclesListItem,
CyclesListItem>>() {
new Callback<TableColumn<ResultsListItem, ResultsListItem>, TableCell<ResultsListItem,
ResultsListItem>>() {
@Override
public TableCell<CyclesListItem, CyclesListItem> call(
TableColumn<CyclesListItem, CyclesListItem> column) {
return new TableCell<CyclesListItem, CyclesListItem>() {
public TableCell<ResultsListItem, ResultsListItem> call(
TableColumn<ResultsListItem, ResultsListItem> column) {
return new TableCell<ResultsListItem, ResultsListItem>() {
@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<GridPane, Activatable> i
};
}
});
proposalsColumn.setComparator(Comparator.comparing(CyclesListItem::getNumProposals));
proposalsColumn.setComparator(Comparator.comparing(ResultsListItem::getNumProposals));
tableView.getColumns().add(proposalsColumn);
TableColumn<CyclesListItem, CyclesListItem> votesColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.numVotes"));
TableColumn<ResultsListItem, ResultsListItem> 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<TableColumn<CyclesListItem, CyclesListItem>, TableCell<CyclesListItem,
CyclesListItem>>() {
new Callback<TableColumn<ResultsListItem, ResultsListItem>, TableCell<ResultsListItem,
ResultsListItem>>() {
@Override
public TableCell<CyclesListItem, CyclesListItem> call(
TableColumn<CyclesListItem, CyclesListItem> column) {
return new TableCell<CyclesListItem, CyclesListItem>() {
public TableCell<ResultsListItem, ResultsListItem> call(
TableColumn<ResultsListItem, ResultsListItem> column) {
return new TableCell<ResultsListItem, ResultsListItem>() {
@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<GridPane, Activatable> i
};
}
});
votesColumn.setComparator(Comparator.comparing(CyclesListItem::getNumProposals));
votesColumn.setComparator(Comparator.comparing(ResultsListItem::getNumProposals));
tableView.getColumns().add(votesColumn);
TableColumn<CyclesListItem, CyclesListItem> stakeColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.stake"));
TableColumn<ResultsListItem, ResultsListItem> stakeColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.stake"));
stakeColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
stakeColumn.setCellFactory(
new Callback<TableColumn<CyclesListItem, CyclesListItem>, TableCell<CyclesListItem,
CyclesListItem>>() {
new Callback<TableColumn<ResultsListItem, ResultsListItem>, TableCell<ResultsListItem,
ResultsListItem>>() {
@Override
public TableCell<CyclesListItem, CyclesListItem> call(
TableColumn<CyclesListItem, CyclesListItem> column) {
return new TableCell<CyclesListItem, CyclesListItem>() {
public TableCell<ResultsListItem, ResultsListItem> call(
TableColumn<ResultsListItem, ResultsListItem> column) {
return new TableCell<ResultsListItem, ResultsListItem>() {
@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<GridPane, Activatable> i
};
}
});
stakeColumn.setComparator(Comparator.comparing(CyclesListItem::getNumProposals));
stakeColumn.setComparator(Comparator.comparing(ResultsListItem::getNumProposals));
tableView.getColumns().add(stakeColumn);
TableColumn<CyclesListItem, CyclesListItem> issuanceColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.issuance"));
TableColumn<ResultsListItem, ResultsListItem> issuanceColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.issuance"));
issuanceColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
issuanceColumn.setCellFactory(
new Callback<TableColumn<CyclesListItem, CyclesListItem>, TableCell<CyclesListItem,
CyclesListItem>>() {
new Callback<TableColumn<ResultsListItem, ResultsListItem>, TableCell<ResultsListItem,
ResultsListItem>>() {
@Override
public TableCell<CyclesListItem, CyclesListItem> call(
TableColumn<CyclesListItem, CyclesListItem> column) {
return new TableCell<CyclesListItem, CyclesListItem>() {
public TableCell<ResultsListItem, ResultsListItem> call(
TableColumn<ResultsListItem, ResultsListItem> column) {
return new TableCell<ResultsListItem, ResultsListItem>() {
@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<GridPane, Activatable> i
};
}
});
issuanceColumn.setComparator(Comparator.comparing(CyclesListItem::getNumProposals));
issuanceColumn.setComparator(Comparator.comparing(ResultsListItem::getNumProposals));
tableView.getColumns().add(issuanceColumn);
}
}

View File

@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
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<EvaluatedProposal> evaluatedProposals;
public CycleResult(Cycle cycle,
int cycleIndex,
long cycleStartTime,
List<Proposal> proposals,
List<EvaluatedProposal> evaluatedProposals) {
public ResultsOfCycle(Cycle cycle,
int cycleIndex,
long cycleStartTime,
List<Proposal> proposals,
List<EvaluatedProposal> evaluatedProposals) {
this.cycle = cycle;
this.cycleIndex = cycleIndex;
this.cycleStartTime = cycleStartTime;

View File

@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
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<CycleDetailsWindow> {
class ProposalResultDetailsWindow extends Overlay<ProposalResultDetailsWindow> {
private final BsqFormatter bsqFormatter;
private final EvaluatedProposal evaluatedProposal;
@ -40,7 +40,7 @@ class CycleDetailsWindow extends Overlay<CycleDetailsWindow> {
// Public API
///////////////////////////////////////////////////////////////////////////////////////////
public CycleDetailsWindow(BsqFormatter bsqFormatter, EvaluatedProposal evaluatedProposal) {
public ProposalResultDetailsWindow(BsqFormatter bsqFormatter, EvaluatedProposal evaluatedProposal) {
this.bsqFormatter = bsqFormatter;
this.evaluatedProposal = evaluatedProposal;
type = Type.Confirmation;

View File

@ -15,13 +15,13 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
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<CycleListItem> itemList = FXCollections.observableArrayList();
private final SortedList<CycleListItem> sortedList = new SortedList<>(itemList);
private final ObservableList<ProposalResultListItem> itemList = FXCollections.observableArrayList();
private final SortedList<ProposalResultListItem> 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<ProposalType, Long> requiredThresholdByType = new HashMap<>();
cycleResult.getEvaluatedProposals().forEach(e -> {
resultsOfCycle.getEvaluatedProposals().forEach(e -> {
requiredThresholdByType.putIfAbsent(e.getProposal().getType(), e.getRequiredThreshold());
});
Map<ProposalType, Long> 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<CycleListItem> tableView = new TableView<>();
TableView<ProposalResultListItem> 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<CycleListItem> tableView) {
TableColumn<CycleListItem, CycleListItem> proposalColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.proposalOwnerName"));
private void createColumns(TableView<ProposalResultListItem> tableView) {
TableColumn<ProposalResultListItem, ProposalResultListItem> proposalColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.proposalOwnerName"));
proposalColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
proposalColumn.setCellFactory(
new Callback<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem,
CycleListItem>>() {
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem,
ProposalResultListItem>>() {
@Override
public TableCell<CycleListItem, CycleListItem> call(
TableColumn<CycleListItem, CycleListItem> column) {
return new TableCell<CycleListItem, CycleListItem>() {
public TableCell<ProposalResultListItem, ProposalResultListItem> call(
TableColumn<ProposalResultListItem, ProposalResultListItem> column) {
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
@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<CycleListItem, CycleListItem> proposalIdColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.proposalId"));
TableColumn<ProposalResultListItem, ProposalResultListItem> proposalIdColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.proposalId"));
proposalIdColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
proposalIdColumn.setCellFactory(
new Callback<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem, CycleListItem>>() {
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem, ProposalResultListItem>>() {
@Override
public TableCell<CycleListItem, CycleListItem> call(TableColumn<CycleListItem,
CycleListItem> column) {
return new TableCell<CycleListItem, CycleListItem>() {
public TableCell<ProposalResultListItem, ProposalResultListItem> call(TableColumn<ProposalResultListItem,
ProposalResultListItem> column) {
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
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<CycleListItem, CycleListItem> acceptedColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.accepted"));
TableColumn<ProposalResultListItem, ProposalResultListItem> 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<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem,
CycleListItem>>() {
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem,
ProposalResultListItem>>() {
private Hyperlink field;
@Override
public TableCell<CycleListItem, CycleListItem> call(
TableColumn<CycleListItem, CycleListItem> column) {
return new TableCell<CycleListItem, CycleListItem>() {
public TableCell<ProposalResultListItem, ProposalResultListItem> call(
TableColumn<ProposalResultListItem, ProposalResultListItem> column) {
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
@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<CycleListItem, CycleListItem> rejectedColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.rejected"));
TableColumn<ProposalResultListItem, ProposalResultListItem> 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<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem,
CycleListItem>>() {
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem,
ProposalResultListItem>>() {
private Hyperlink field;
@Override
public TableCell<CycleListItem, CycleListItem> call(
TableColumn<CycleListItem, CycleListItem> column) {
return new TableCell<CycleListItem, CycleListItem>() {
public TableCell<ProposalResultListItem, ProposalResultListItem> call(
TableColumn<ProposalResultListItem, ProposalResultListItem> column) {
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
@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<CycleListItem, CycleListItem> thresholdColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.threshold"));
TableColumn<ProposalResultListItem, ProposalResultListItem> 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<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem,
CycleListItem>>() {
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem,
ProposalResultListItem>>() {
@Override
public TableCell<CycleListItem, CycleListItem> call(
TableColumn<CycleListItem, CycleListItem> column) {
return new TableCell<CycleListItem, CycleListItem>() {
public TableCell<ProposalResultListItem, ProposalResultListItem> call(
TableColumn<ProposalResultListItem, ProposalResultListItem> column) {
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
@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<CycleListItem, CycleListItem> quorumColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.quorum"));
TableColumn<ProposalResultListItem, ProposalResultListItem> 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<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem,
CycleListItem>>() {
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem,
ProposalResultListItem>>() {
@Override
public TableCell<CycleListItem, CycleListItem> call(
TableColumn<CycleListItem, CycleListItem> column) {
return new TableCell<CycleListItem, CycleListItem>() {
public TableCell<ProposalResultListItem, ProposalResultListItem> call(
TableColumn<ProposalResultListItem, ProposalResultListItem> column) {
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
@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<CycleListItem, CycleListItem> issuanceColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.issuance"));
TableColumn<ProposalResultListItem, ProposalResultListItem> 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<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem,
CycleListItem>>() {
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem,
ProposalResultListItem>>() {
@Override
public TableCell<CycleListItem, CycleListItem> call(
TableColumn<CycleListItem, CycleListItem> column) {
return new TableCell<CycleListItem, CycleListItem>() {
public TableCell<ProposalResultListItem, ProposalResultListItem> call(
TableColumn<ProposalResultListItem, ProposalResultListItem> column) {
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
@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<CycleListItem, CycleListItem> resultColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.result"));
TableColumn<ProposalResultListItem, ProposalResultListItem> 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<TableColumn<CycleListItem, CycleListItem>,
TableCell<CycleListItem, CycleListItem>>() {
resultColumn.setCellFactory(new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>,
TableCell<ProposalResultListItem, ProposalResultListItem>>() {
@Override
public TableCell<CycleListItem, CycleListItem> call(TableColumn<CycleListItem,
CycleListItem> column) {
return new TableCell<CycleListItem, CycleListItem>() {
public TableCell<ProposalResultListItem, ProposalResultListItem> call(TableColumn<ProposalResultListItem,
ProposalResultListItem> column) {
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
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);
}

View File

@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
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;