mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 02:12:00 +01:00
Rename classes
This commit is contained in:
parent
288f4a7d89
commit
f27a7461c8
@ -26,8 +26,8 @@ import bisq.desktop.common.view.View;
|
|||||||
import bisq.desktop.common.view.ViewLoader;
|
import bisq.desktop.common.view.ViewLoader;
|
||||||
import bisq.desktop.main.MainView;
|
import bisq.desktop.main.MainView;
|
||||||
import bisq.desktop.main.dao.bonding.BondingView;
|
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.proposal.ProposalView;
|
||||||
|
import bisq.desktop.main.dao.results.ResultsView;
|
||||||
import bisq.desktop.main.dao.voting.VotingView;
|
import bisq.desktop.main.dao.voting.VotingView;
|
||||||
import bisq.desktop.main.dao.wallet.BsqWalletView;
|
import bisq.desktop.main.dao.wallet.BsqWalletView;
|
||||||
import bisq.desktop.main.dao.wallet.dashboard.BsqDashboardView;
|
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);
|
navigation.navigateTo(MainView.class, DaoView.class, VotingView.class);
|
||||||
} else if (newValue == resultsTab) {
|
} else if (newValue == resultsTab) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
navigation.navigateTo(MainView.class, DaoView.class, CyclesView.class);
|
navigation.navigateTo(MainView.class, DaoView.class, ResultsView.class);
|
||||||
} else if (newValue == bondingTab) {
|
} else if (newValue == bondingTab) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
navigation.navigateTo(MainView.class, DaoView.class, BondingView.class);
|
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);
|
navigation.navigateTo(MainView.class, DaoView.class, VotingView.class);
|
||||||
else if (selectedItem == resultsTab)
|
else if (selectedItem == resultsTab)
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
navigation.navigateTo(MainView.class, DaoView.class, CyclesView.class);
|
navigation.navigateTo(MainView.class, DaoView.class, ResultsView.class);
|
||||||
else if (selectedItem == bondingTab)
|
else if (selectedItem == bondingTab)
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
navigation.navigateTo(MainView.class, DaoView.class, BondingView.class);
|
navigation.navigateTo(MainView.class, DaoView.class, BondingView.class);
|
||||||
@ -174,7 +174,7 @@ public class DaoView extends ActivatableViewAndModel<TabPane, Activatable> {
|
|||||||
selectedTab = proposalsTab;
|
selectedTab = proposalsTab;
|
||||||
} else if (view instanceof VotingView) {
|
} else if (view instanceof VotingView) {
|
||||||
selectedTab = votingTab;
|
selectedTab = votingTab;
|
||||||
} else if (view instanceof CyclesView) {
|
} else if (view instanceof ResultsView) {
|
||||||
selectedTab = resultsTab;
|
selectedTab = resultsTab;
|
||||||
} else if (view instanceof BondingView) {
|
} else if (view instanceof BondingView) {
|
||||||
selectedTab = bondingTab;
|
selectedTab = bondingTab;
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
* 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.dao.voting.proposal.compensation.CompensationProposal;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
@ -29,37 +29,37 @@ import java.util.Date;
|
|||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
public class CyclesListItem {
|
public class ResultsListItem {
|
||||||
private final BsqFormatter bsqFormatter;
|
private final BsqFormatter bsqFormatter;
|
||||||
@Getter
|
@Getter
|
||||||
private CycleResult cycleResult;
|
private ResultsOfCycle resultsOfCycle;
|
||||||
|
|
||||||
public CyclesListItem(CycleResult cycleResult,
|
public ResultsListItem(ResultsOfCycle resultsOfCycle,
|
||||||
BsqFormatter bsqFormatter) {
|
BsqFormatter bsqFormatter) {
|
||||||
this.cycleResult = cycleResult;
|
this.resultsOfCycle = resultsOfCycle;
|
||||||
this.bsqFormatter = bsqFormatter;
|
this.bsqFormatter = bsqFormatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCycle() {
|
public String getCycle() {
|
||||||
int displayIndex = cycleResult.getCycleIndex() + 1;
|
int displayIndex = resultsOfCycle.getCycleIndex() + 1;
|
||||||
String dateTime = bsqFormatter.formatDateTime(new Date(cycleResult.getCycleStartTime()));
|
String dateTime = bsqFormatter.formatDateTime(new Date(resultsOfCycle.getCycleStartTime()));
|
||||||
return Res.get("dao.results.results.table.item.cycle", displayIndex, dateTime);
|
return Res.get("dao.results.results.table.item.cycle", displayIndex, dateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNumProposals() {
|
public String getNumProposals() {
|
||||||
return String.valueOf(cycleResult.getEvaluatedProposals().size());
|
return String.valueOf(resultsOfCycle.getEvaluatedProposals().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNumVotesAsString() {
|
public String getNumVotesAsString() {
|
||||||
return String.valueOf(cycleResult.getNumVotes());
|
return String.valueOf(resultsOfCycle.getNumVotes());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStake() {
|
public String getStake() {
|
||||||
return bsqFormatter.formatCoinWithCode(Coin.valueOf(cycleResult.getTotalStake()));
|
return bsqFormatter.formatCoinWithCode(Coin.valueOf(resultsOfCycle.getTotalStake()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIssuance() {
|
public String getIssuance() {
|
||||||
long totalIssuance = cycleResult.getEvaluatedProposals().stream()
|
long totalIssuance = resultsOfCycle.getEvaluatedProposals().stream()
|
||||||
.filter(e -> e.getProposal() instanceof CompensationProposal)
|
.filter(e -> e.getProposal() instanceof CompensationProposal)
|
||||||
.map(e -> (CompensationProposal) e.getProposal())
|
.map(e -> (CompensationProposal) e.getProposal())
|
||||||
.mapToLong(e -> e.getRequestedBsq().value)
|
.mapToLong(e -> e.getRequestedBsq().value)
|
||||||
@ -68,6 +68,6 @@ public class CyclesListItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Long getCycleStartTime() {
|
public Long getCycleStartTime() {
|
||||||
return cycleResult.getCycleStartTime();
|
return resultsOfCycle.getCycleStartTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,7 +21,7 @@
|
|||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
<?import javafx.scene.layout.GridPane?>
|
<?import javafx.scene.layout.GridPane?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?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"
|
hgap="5.0" vgap="5.0"
|
||||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
|
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
|
||||||
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
@ -15,7 +15,7 @@
|
|||||||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
* 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;
|
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.AutoTooltipLabel;
|
||||||
import bisq.desktop.components.AutoTooltipTableColumn;
|
import bisq.desktop.components.AutoTooltipTableColumn;
|
||||||
import bisq.desktop.components.TableGroupHeadline;
|
import bisq.desktop.components.TableGroupHeadline;
|
||||||
import bisq.desktop.main.dao.cycles.cycle.CycleDisplay;
|
import bisq.desktop.main.dao.results.model.ResultsOfCycle;
|
||||||
import bisq.desktop.main.dao.cycles.model.CycleResult;
|
import bisq.desktop.main.dao.results.proposal.ProposalResultDisplay;
|
||||||
|
|
||||||
import bisq.core.btc.wallet.BsqWalletService;
|
import bisq.core.btc.wallet.BsqWalletService;
|
||||||
import bisq.core.dao.DaoFacade;
|
import bisq.core.dao.DaoFacade;
|
||||||
@ -68,7 +68,7 @@ import java.util.List;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@FxmlView
|
@FxmlView
|
||||||
public class CyclesView extends ActivatableViewAndModel<GridPane, Activatable> implements BsqStateListener {
|
public class ResultsView extends ActivatableViewAndModel<GridPane, Activatable> implements BsqStateListener {
|
||||||
private final DaoFacade daoFacade;
|
private final DaoFacade daoFacade;
|
||||||
// TODO use daoFacade once dev work completed
|
// TODO use daoFacade once dev work completed
|
||||||
private final BsqStateService bsqStateService;
|
private final BsqStateService bsqStateService;
|
||||||
@ -79,14 +79,14 @@ public class CyclesView extends ActivatableViewAndModel<GridPane, Activatable> i
|
|||||||
private final BsqFormatter bsqFormatter;
|
private final BsqFormatter bsqFormatter;
|
||||||
|
|
||||||
private int gridRow = 0;
|
private int gridRow = 0;
|
||||||
private TableView<CyclesListItem> tableView;
|
private TableView<ResultsListItem> tableView;
|
||||||
|
|
||||||
private final ObservableList<CyclesListItem> itemList = FXCollections.observableArrayList();
|
private final ObservableList<ResultsListItem> itemList = FXCollections.observableArrayList();
|
||||||
private final SortedList<CyclesListItem> sortedList = new SortedList<>(itemList);
|
private final SortedList<ResultsListItem> sortedList = new SortedList<>(itemList);
|
||||||
private ChangeListener<CyclesListItem> selectedItemListener;
|
private ChangeListener<ResultsListItem> selectedItemListener;
|
||||||
|
|
||||||
private GridPane resultGridPane;
|
private GridPane resultGridPane;
|
||||||
private CycleDisplay proposalsDisplay;
|
private ProposalResultDisplay proposalsDisplay;
|
||||||
private ScrollPane resultDisplayView;
|
private ScrollPane resultDisplayView;
|
||||||
private boolean resultDisplayInitialized;
|
private boolean resultDisplayInitialized;
|
||||||
|
|
||||||
@ -96,13 +96,13 @@ public class CyclesView extends ActivatableViewAndModel<GridPane, Activatable> i
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private CyclesView(DaoFacade daoFacade,
|
private ResultsView(DaoFacade daoFacade,
|
||||||
BsqStateService bsqStateService,
|
BsqStateService bsqStateService,
|
||||||
CycleService cycleService,
|
CycleService cycleService,
|
||||||
VoteResultService voteResultService,
|
VoteResultService voteResultService,
|
||||||
ProposalService proposalService,
|
ProposalService proposalService,
|
||||||
BsqWalletService bsqWalletService,
|
BsqWalletService bsqWalletService,
|
||||||
BsqFormatter bsqFormatter) {
|
BsqFormatter bsqFormatter) {
|
||||||
this.daoFacade = daoFacade;
|
this.daoFacade = daoFacade;
|
||||||
this.bsqStateService = bsqStateService;
|
this.bsqStateService = bsqStateService;
|
||||||
this.cycleService = cycleService;
|
this.cycleService = cycleService;
|
||||||
@ -161,7 +161,7 @@ public class CyclesView extends ActivatableViewAndModel<GridPane, Activatable> i
|
|||||||
// UI handlers
|
// UI handlers
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void onCycleListItemSelected(CyclesListItem item) {
|
private void onCycleListItemSelected(ResultsListItem item) {
|
||||||
if (item != null)
|
if (item != null)
|
||||||
createAllFieldsOnResultDisplay(item);
|
createAllFieldsOnResultDisplay(item);
|
||||||
else
|
else
|
||||||
@ -198,7 +198,7 @@ public class CyclesView extends ActivatableViewAndModel<GridPane, Activatable> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createResultDisplay() {
|
private void createResultDisplay() {
|
||||||
proposalsDisplay = new CycleDisplay(resultGridPane, bsqWalletService, daoFacade, bsqFormatter);
|
proposalsDisplay = new ProposalResultDisplay(resultGridPane, bsqWalletService, daoFacade, bsqFormatter);
|
||||||
resultDisplayView = proposalsDisplay.getView();
|
resultDisplayView = proposalsDisplay.getView();
|
||||||
GridPane.setMargin(resultDisplayView, new Insets(10, -10, 0, -10));
|
GridPane.setMargin(resultDisplayView, new Insets(10, -10, 0, -10));
|
||||||
GridPane.setRowIndex(resultDisplayView, ++gridRow);
|
GridPane.setRowIndex(resultDisplayView, ++gridRow);
|
||||||
@ -231,13 +231,13 @@ public class CyclesView extends ActivatableViewAndModel<GridPane, Activatable> i
|
|||||||
.map(e -> e.getTime() * 1000)
|
.map(e -> e.getTime() * 1000)
|
||||||
.orElse(0L);
|
.orElse(0L);
|
||||||
int cycleIndex = cycleService.getCycleIndex(cycle);
|
int cycleIndex = cycleService.getCycleIndex(cycle);
|
||||||
CycleResult cycleResult = new CycleResult(cycle,
|
ResultsOfCycle resultsOfCycle = new ResultsOfCycle(cycle,
|
||||||
cycleIndex,
|
cycleIndex,
|
||||||
cycleStartTime,
|
cycleStartTime,
|
||||||
proposalsForCycle,
|
proposalsForCycle,
|
||||||
evaluatedProposalsForCycle);
|
evaluatedProposalsForCycle);
|
||||||
CyclesListItem cyclesListItem = new CyclesListItem(cycleResult, bsqFormatter);
|
ResultsListItem resultsListItem = new ResultsListItem(resultsOfCycle, bsqFormatter);
|
||||||
itemList.add(cyclesListItem);
|
itemList.add(resultsListItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideResultDisplay() {
|
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.setVisible(true);
|
||||||
resultDisplayView.setManaged(true);
|
resultDisplayView.setManaged(true);
|
||||||
|
|
||||||
proposalsDisplay.createAllFields(0, cyclesListItem.getCycleResult());
|
proposalsDisplay.createAllFields(0, resultsListItem.getResultsOfCycle());
|
||||||
resultDisplayInitialized = true;
|
resultDisplayInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,19 +261,19 @@ public class CyclesView extends ActivatableViewAndModel<GridPane, Activatable> i
|
|||||||
// TableColumns
|
// TableColumns
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void createColumns(TableView<CyclesListItem> tableView) {
|
private void createColumns(TableView<ResultsListItem> tableView) {
|
||||||
TableColumn<CyclesListItem, CyclesListItem> cycleColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.cycle"));
|
TableColumn<ResultsListItem, ResultsListItem> cycleColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.results.table.header.cycle"));
|
||||||
cycleColumn.setMinWidth(160);
|
cycleColumn.setMinWidth(160);
|
||||||
cycleColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
cycleColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
cycleColumn.setCellFactory(
|
cycleColumn.setCellFactory(
|
||||||
new Callback<TableColumn<CyclesListItem, CyclesListItem>, TableCell<CyclesListItem,
|
new Callback<TableColumn<ResultsListItem, ResultsListItem>, TableCell<ResultsListItem,
|
||||||
CyclesListItem>>() {
|
ResultsListItem>>() {
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CyclesListItem, CyclesListItem> call(
|
public TableCell<ResultsListItem, ResultsListItem> call(
|
||||||
TableColumn<CyclesListItem, CyclesListItem> column) {
|
TableColumn<ResultsListItem, ResultsListItem> column) {
|
||||||
return new TableCell<CyclesListItem, CyclesListItem>() {
|
return new TableCell<ResultsListItem, ResultsListItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CyclesListItem item, boolean empty) {
|
public void updateItem(final ResultsListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
setText(item.getCycle());
|
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);
|
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.setMinWidth(90);
|
||||||
proposalsColumn.setMaxWidth(90);
|
proposalsColumn.setMaxWidth(90);
|
||||||
proposalsColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
proposalsColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
proposalsColumn.setCellFactory(
|
proposalsColumn.setCellFactory(
|
||||||
new Callback<TableColumn<CyclesListItem, CyclesListItem>, TableCell<CyclesListItem,
|
new Callback<TableColumn<ResultsListItem, ResultsListItem>, TableCell<ResultsListItem,
|
||||||
CyclesListItem>>() {
|
ResultsListItem>>() {
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CyclesListItem, CyclesListItem> call(
|
public TableCell<ResultsListItem, ResultsListItem> call(
|
||||||
TableColumn<CyclesListItem, CyclesListItem> column) {
|
TableColumn<ResultsListItem, ResultsListItem> column) {
|
||||||
return new TableCell<CyclesListItem, CyclesListItem>() {
|
return new TableCell<ResultsListItem, ResultsListItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CyclesListItem item, boolean empty) {
|
public void updateItem(final ResultsListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
setText(item.getNumProposals());
|
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);
|
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.setMinWidth(70);
|
||||||
votesColumn.setMaxWidth(70);
|
votesColumn.setMaxWidth(70);
|
||||||
votesColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
votesColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
votesColumn.setCellFactory(
|
votesColumn.setCellFactory(
|
||||||
new Callback<TableColumn<CyclesListItem, CyclesListItem>, TableCell<CyclesListItem,
|
new Callback<TableColumn<ResultsListItem, ResultsListItem>, TableCell<ResultsListItem,
|
||||||
CyclesListItem>>() {
|
ResultsListItem>>() {
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CyclesListItem, CyclesListItem> call(
|
public TableCell<ResultsListItem, ResultsListItem> call(
|
||||||
TableColumn<CyclesListItem, CyclesListItem> column) {
|
TableColumn<ResultsListItem, ResultsListItem> column) {
|
||||||
return new TableCell<CyclesListItem, CyclesListItem>() {
|
return new TableCell<ResultsListItem, ResultsListItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CyclesListItem item, boolean empty) {
|
public void updateItem(final ResultsListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
setText(item.getNumVotesAsString());
|
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);
|
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.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
stakeColumn.setCellFactory(
|
stakeColumn.setCellFactory(
|
||||||
new Callback<TableColumn<CyclesListItem, CyclesListItem>, TableCell<CyclesListItem,
|
new Callback<TableColumn<ResultsListItem, ResultsListItem>, TableCell<ResultsListItem,
|
||||||
CyclesListItem>>() {
|
ResultsListItem>>() {
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CyclesListItem, CyclesListItem> call(
|
public TableCell<ResultsListItem, ResultsListItem> call(
|
||||||
TableColumn<CyclesListItem, CyclesListItem> column) {
|
TableColumn<ResultsListItem, ResultsListItem> column) {
|
||||||
return new TableCell<CyclesListItem, CyclesListItem>() {
|
return new TableCell<ResultsListItem, ResultsListItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CyclesListItem item, boolean empty) {
|
public void updateItem(final ResultsListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
setText(item.getStake());
|
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);
|
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.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
issuanceColumn.setCellFactory(
|
issuanceColumn.setCellFactory(
|
||||||
new Callback<TableColumn<CyclesListItem, CyclesListItem>, TableCell<CyclesListItem,
|
new Callback<TableColumn<ResultsListItem, ResultsListItem>, TableCell<ResultsListItem,
|
||||||
CyclesListItem>>() {
|
ResultsListItem>>() {
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CyclesListItem, CyclesListItem> call(
|
public TableCell<ResultsListItem, ResultsListItem> call(
|
||||||
TableColumn<CyclesListItem, CyclesListItem> column) {
|
TableColumn<ResultsListItem, ResultsListItem> column) {
|
||||||
return new TableCell<CyclesListItem, CyclesListItem>() {
|
return new TableCell<ResultsListItem, ResultsListItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CyclesListItem item, boolean empty) {
|
public void updateItem(final ResultsListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
setText(item.getIssuance());
|
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);
|
tableView.getColumns().add(issuanceColumn);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,7 +15,7 @@
|
|||||||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
* 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.state.period.Cycle;
|
||||||
import bisq.core.dao.voting.proposal.Proposal;
|
import bisq.core.dao.voting.proposal.Proposal;
|
||||||
@ -27,7 +27,7 @@ import java.util.List;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CycleResult {
|
public class ResultsOfCycle {
|
||||||
private final Cycle cycle;
|
private final Cycle cycle;
|
||||||
private final int cycleIndex;
|
private final int cycleIndex;
|
||||||
private final int numVotes, numAcceptedVotes, numRejectedVotes;
|
private final int numVotes, numAcceptedVotes, numRejectedVotes;
|
||||||
@ -42,11 +42,11 @@ public class CycleResult {
|
|||||||
// Proposals which ended up in voting
|
// Proposals which ended up in voting
|
||||||
private final List<EvaluatedProposal> evaluatedProposals;
|
private final List<EvaluatedProposal> evaluatedProposals;
|
||||||
|
|
||||||
public CycleResult(Cycle cycle,
|
public ResultsOfCycle(Cycle cycle,
|
||||||
int cycleIndex,
|
int cycleIndex,
|
||||||
long cycleStartTime,
|
long cycleStartTime,
|
||||||
List<Proposal> proposals,
|
List<Proposal> proposals,
|
||||||
List<EvaluatedProposal> evaluatedProposals) {
|
List<EvaluatedProposal> evaluatedProposals) {
|
||||||
this.cycle = cycle;
|
this.cycle = cycle;
|
||||||
this.cycleIndex = cycleIndex;
|
this.cycleIndex = cycleIndex;
|
||||||
this.cycleStartTime = cycleStartTime;
|
this.cycleStartTime = cycleStartTime;
|
@ -15,7 +15,7 @@
|
|||||||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
* 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.main.overlays.Overlay;
|
||||||
import bisq.desktop.util.FormBuilder;
|
import bisq.desktop.util.FormBuilder;
|
||||||
@ -30,7 +30,7 @@ import javafx.geometry.Insets;
|
|||||||
|
|
||||||
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
|
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
|
||||||
|
|
||||||
class CycleDetailsWindow extends Overlay<CycleDetailsWindow> {
|
class ProposalResultDetailsWindow extends Overlay<ProposalResultDetailsWindow> {
|
||||||
|
|
||||||
private final BsqFormatter bsqFormatter;
|
private final BsqFormatter bsqFormatter;
|
||||||
private final EvaluatedProposal evaluatedProposal;
|
private final EvaluatedProposal evaluatedProposal;
|
||||||
@ -40,7 +40,7 @@ class CycleDetailsWindow extends Overlay<CycleDetailsWindow> {
|
|||||||
// Public API
|
// Public API
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public CycleDetailsWindow(BsqFormatter bsqFormatter, EvaluatedProposal evaluatedProposal) {
|
public ProposalResultDetailsWindow(BsqFormatter bsqFormatter, EvaluatedProposal evaluatedProposal) {
|
||||||
this.bsqFormatter = bsqFormatter;
|
this.bsqFormatter = bsqFormatter;
|
||||||
this.evaluatedProposal = evaluatedProposal;
|
this.evaluatedProposal = evaluatedProposal;
|
||||||
type = Type.Confirmation;
|
type = Type.Confirmation;
|
@ -15,13 +15,13 @@
|
|||||||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
* 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.AutoTooltipLabel;
|
||||||
import bisq.desktop.components.AutoTooltipTableColumn;
|
import bisq.desktop.components.AutoTooltipTableColumn;
|
||||||
import bisq.desktop.components.TableGroupHeadline;
|
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.proposal.ProposalDetailsWindow;
|
||||||
|
import bisq.desktop.main.dao.results.model.ResultsOfCycle;
|
||||||
import bisq.desktop.util.FormBuilder;
|
import bisq.desktop.util.FormBuilder;
|
||||||
import bisq.desktop.util.GUIUtil;
|
import bisq.desktop.util.GUIUtil;
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ import java.util.stream.Collectors;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class CycleDisplay {
|
public class ProposalResultDisplay {
|
||||||
private final GridPane gridPane;
|
private final GridPane gridPane;
|
||||||
private final BsqWalletService bsqWalletService;
|
private final BsqWalletService bsqWalletService;
|
||||||
private final DaoFacade daoFacade;
|
private final DaoFacade daoFacade;
|
||||||
@ -76,18 +76,18 @@ public class CycleDisplay {
|
|||||||
private int gridRowStartIndex;
|
private int gridRowStartIndex;
|
||||||
|
|
||||||
|
|
||||||
private final ObservableList<CycleListItem> itemList = FXCollections.observableArrayList();
|
private final ObservableList<ProposalResultListItem> itemList = FXCollections.observableArrayList();
|
||||||
private final SortedList<CycleListItem> sortedList = new SortedList<>(itemList);
|
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.gridPane = gridPane;
|
||||||
this.bsqWalletService = bsqWalletService;
|
this.bsqWalletService = bsqWalletService;
|
||||||
this.daoFacade = daoFacade;
|
this.daoFacade = daoFacade;
|
||||||
this.bsqFormatter = bsqFormatter;
|
this.bsqFormatter = bsqFormatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createAllFields(int gridRowStartIndex, CycleResult cycleResult) {
|
public void createAllFields(int gridRowStartIndex, ResultsOfCycle resultsOfCycle) {
|
||||||
removeAllFields();
|
removeAllFields();
|
||||||
|
|
||||||
this.gridRowStartIndex = gridRowStartIndex;
|
this.gridRowStartIndex = gridRowStartIndex;
|
||||||
@ -95,14 +95,14 @@ public class CycleDisplay {
|
|||||||
|
|
||||||
createTableView();
|
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<>();
|
Map<ProposalType, Long> requiredThresholdByType = new HashMap<>();
|
||||||
cycleResult.getEvaluatedProposals().forEach(e -> {
|
resultsOfCycle.getEvaluatedProposals().forEach(e -> {
|
||||||
requiredThresholdByType.putIfAbsent(e.getProposal().getType(), e.getRequiredThreshold());
|
requiredThresholdByType.putIfAbsent(e.getProposal().getType(), e.getRequiredThreshold());
|
||||||
});
|
});
|
||||||
Map<ProposalType, Long> requiredQuorumByType = new HashMap<>();
|
Map<ProposalType, Long> requiredQuorumByType = new HashMap<>();
|
||||||
cycleResult.getEvaluatedProposals().forEach(e -> {
|
resultsOfCycle.getEvaluatedProposals().forEach(e -> {
|
||||||
requiredQuorumByType.putIfAbsent(e.getProposal().getType(), e.getRequiredQuorum());
|
requiredQuorumByType.putIfAbsent(e.getProposal().getType(), e.getRequiredQuorum());
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ public class CycleDisplay {
|
|||||||
GridPane.setColumnSpan(headline, 2);
|
GridPane.setColumnSpan(headline, 2);
|
||||||
gridPane.getChildren().add(headline);
|
gridPane.getChildren().add(headline);
|
||||||
|
|
||||||
TableView<CycleListItem> tableView = new TableView<>();
|
TableView<ProposalResultListItem> tableView = new TableView<>();
|
||||||
tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
|
tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
|
||||||
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||||
tableView.setPrefHeight(200);
|
tableView.setPrefHeight(200);
|
||||||
@ -141,18 +141,18 @@ public class CycleDisplay {
|
|||||||
sortedList.comparatorProperty().bind(tableView.comparatorProperty());
|
sortedList.comparatorProperty().bind(tableView.comparatorProperty());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createColumns(TableView<CycleListItem> tableView) {
|
private void createColumns(TableView<ProposalResultListItem> tableView) {
|
||||||
TableColumn<CycleListItem, CycleListItem> proposalColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.proposalOwnerName"));
|
TableColumn<ProposalResultListItem, ProposalResultListItem> proposalColumn = new AutoTooltipTableColumn<>(Res.get("dao.results.result.table.header.proposalOwnerName"));
|
||||||
proposalColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
proposalColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
proposalColumn.setCellFactory(
|
proposalColumn.setCellFactory(
|
||||||
new Callback<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem,
|
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem,
|
||||||
CycleListItem>>() {
|
ProposalResultListItem>>() {
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CycleListItem, CycleListItem> call(
|
public TableCell<ProposalResultListItem, ProposalResultListItem> call(
|
||||||
TableColumn<CycleListItem, CycleListItem> column) {
|
TableColumn<ProposalResultListItem, ProposalResultListItem> column) {
|
||||||
return new TableCell<CycleListItem, CycleListItem>() {
|
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CycleListItem item, boolean empty) {
|
public void updateItem(final ProposalResultListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
setText(item.getProposalOwnerName());
|
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);
|
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.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
|
|
||||||
proposalIdColumn.setCellFactory(
|
proposalIdColumn.setCellFactory(
|
||||||
new Callback<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem, CycleListItem>>() {
|
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem, ProposalResultListItem>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CycleListItem, CycleListItem> call(TableColumn<CycleListItem,
|
public TableCell<ProposalResultListItem, ProposalResultListItem> call(TableColumn<ProposalResultListItem,
|
||||||
CycleListItem> column) {
|
ProposalResultListItem> column) {
|
||||||
return new TableCell<CycleListItem, CycleListItem>() {
|
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
|
||||||
private Hyperlink field;
|
private Hyperlink field;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CycleListItem item, boolean empty) {
|
public void updateItem(final ProposalResultListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
// cycleDetailsWindow.show(item.getEvaluatedProposal())
|
// 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);
|
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.setMinWidth(80);
|
||||||
acceptedColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
acceptedColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
acceptedColumn.setCellFactory(
|
acceptedColumn.setCellFactory(
|
||||||
new Callback<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem,
|
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem,
|
||||||
CycleListItem>>() {
|
ProposalResultListItem>>() {
|
||||||
private Hyperlink field;
|
private Hyperlink field;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CycleListItem, CycleListItem> call(
|
public TableCell<ProposalResultListItem, ProposalResultListItem> call(
|
||||||
TableColumn<CycleListItem, CycleListItem> column) {
|
TableColumn<ProposalResultListItem, ProposalResultListItem> column) {
|
||||||
return new TableCell<CycleListItem, CycleListItem>() {
|
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CycleListItem item, boolean empty) {
|
public void updateItem(final ProposalResultListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null && !empty) {
|
if (item != null && !empty) {
|
||||||
field = new Hyperlink(item.getAccepted());
|
field = new Hyperlink(item.getAccepted());
|
||||||
field.setStyle(item.getColorStyle());
|
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")));
|
field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
|
||||||
setGraphic(field);
|
setGraphic(field);
|
||||||
} else {
|
} else {
|
||||||
@ -240,28 +240,28 @@ public class CycleDisplay {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
acceptedColumn.setComparator(Comparator.comparing(CycleListItem::getAccepted));
|
acceptedColumn.setComparator(Comparator.comparing(ProposalResultListItem::getAccepted));
|
||||||
tableView.getColumns().add(acceptedColumn);
|
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.setMinWidth(80);
|
||||||
rejectedColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
rejectedColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
rejectedColumn.setCellFactory(
|
rejectedColumn.setCellFactory(
|
||||||
new Callback<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem,
|
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem,
|
||||||
CycleListItem>>() {
|
ProposalResultListItem>>() {
|
||||||
private Hyperlink field;
|
private Hyperlink field;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CycleListItem, CycleListItem> call(
|
public TableCell<ProposalResultListItem, ProposalResultListItem> call(
|
||||||
TableColumn<CycleListItem, CycleListItem> column) {
|
TableColumn<ProposalResultListItem, ProposalResultListItem> column) {
|
||||||
return new TableCell<CycleListItem, CycleListItem>() {
|
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CycleListItem item, boolean empty) {
|
public void updateItem(final ProposalResultListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null && !empty) {
|
if (item != null && !empty) {
|
||||||
field = new Hyperlink(item.getRejected());
|
field = new Hyperlink(item.getRejected());
|
||||||
field.setStyle(item.getColorStyle());
|
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")));
|
field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
|
||||||
setGraphic(field);
|
setGraphic(field);
|
||||||
} else {
|
} else {
|
||||||
@ -274,22 +274,22 @@ public class CycleDisplay {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
rejectedColumn.setComparator(Comparator.comparing(CycleListItem::getRejected));
|
rejectedColumn.setComparator(Comparator.comparing(ProposalResultListItem::getRejected));
|
||||||
tableView.getColumns().add(rejectedColumn);
|
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.setMinWidth(100);
|
||||||
thresholdColumn.setMaxWidth(100);
|
thresholdColumn.setMaxWidth(100);
|
||||||
thresholdColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
thresholdColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
thresholdColumn.setCellFactory(
|
thresholdColumn.setCellFactory(
|
||||||
new Callback<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem,
|
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem,
|
||||||
CycleListItem>>() {
|
ProposalResultListItem>>() {
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CycleListItem, CycleListItem> call(
|
public TableCell<ProposalResultListItem, ProposalResultListItem> call(
|
||||||
TableColumn<CycleListItem, CycleListItem> column) {
|
TableColumn<ProposalResultListItem, ProposalResultListItem> column) {
|
||||||
return new TableCell<CycleListItem, CycleListItem>() {
|
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CycleListItem item, boolean empty) {
|
public void updateItem(final ProposalResultListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
setText(item.getThreshold());
|
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);
|
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.setMinWidth(130);
|
||||||
quorumColumn.setMaxWidth(130);
|
quorumColumn.setMaxWidth(130);
|
||||||
quorumColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
quorumColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
quorumColumn.setCellFactory(
|
quorumColumn.setCellFactory(
|
||||||
new Callback<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem,
|
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem,
|
||||||
CycleListItem>>() {
|
ProposalResultListItem>>() {
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CycleListItem, CycleListItem> call(
|
public TableCell<ProposalResultListItem, ProposalResultListItem> call(
|
||||||
TableColumn<CycleListItem, CycleListItem> column) {
|
TableColumn<ProposalResultListItem, ProposalResultListItem> column) {
|
||||||
return new TableCell<CycleListItem, CycleListItem>() {
|
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CycleListItem item, boolean empty) {
|
public void updateItem(final ProposalResultListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
setText(item.getQuorum());
|
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);
|
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.setMinWidth(130);
|
||||||
issuanceColumn.setMaxWidth(130);
|
issuanceColumn.setMaxWidth(130);
|
||||||
issuanceColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
issuanceColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
issuanceColumn.setCellFactory(
|
issuanceColumn.setCellFactory(
|
||||||
new Callback<TableColumn<CycleListItem, CycleListItem>, TableCell<CycleListItem,
|
new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>, TableCell<ProposalResultListItem,
|
||||||
CycleListItem>>() {
|
ProposalResultListItem>>() {
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CycleListItem, CycleListItem> call(
|
public TableCell<ProposalResultListItem, ProposalResultListItem> call(
|
||||||
TableColumn<CycleListItem, CycleListItem> column) {
|
TableColumn<ProposalResultListItem, ProposalResultListItem> column) {
|
||||||
return new TableCell<CycleListItem, CycleListItem>() {
|
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CycleListItem item, boolean empty) {
|
public void updateItem(final ProposalResultListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
setText(item.getIssuance());
|
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);
|
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.setMinWidth(60);
|
||||||
resultColumn.setMaxWidth(60);
|
resultColumn.setMaxWidth(60);
|
||||||
resultColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
resultColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||||
resultColumn.setCellFactory(new Callback<TableColumn<CycleListItem, CycleListItem>,
|
resultColumn.setCellFactory(new Callback<TableColumn<ProposalResultListItem, ProposalResultListItem>,
|
||||||
TableCell<CycleListItem, CycleListItem>>() {
|
TableCell<ProposalResultListItem, ProposalResultListItem>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableCell<CycleListItem, CycleListItem> call(TableColumn<CycleListItem,
|
public TableCell<ProposalResultListItem, ProposalResultListItem> call(TableColumn<ProposalResultListItem,
|
||||||
CycleListItem> column) {
|
ProposalResultListItem> column) {
|
||||||
return new TableCell<CycleListItem, CycleListItem>() {
|
return new TableCell<ProposalResultListItem, ProposalResultListItem>() {
|
||||||
Label icon;
|
Label icon;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final CycleListItem item, boolean empty) {
|
public void updateItem(final ProposalResultListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
if (item != null && !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);
|
tableView.getColumns().add(resultColumn);
|
||||||
}
|
}
|
||||||
|
|
@ -15,7 +15,7 @@
|
|||||||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
* 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.proposal.compensation.CompensationProposal;
|
||||||
import bisq.core.dao.voting.voteresult.EvaluatedProposal;
|
import bisq.core.dao.voting.voteresult.EvaluatedProposal;
|
||||||
@ -29,13 +29,13 @@ import de.jensd.fx.fontawesome.AwesomeIcon;
|
|||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
public class CycleListItem {
|
public class ProposalResultListItem {
|
||||||
private final ProposalVoteResult proposalVoteResult;
|
private final ProposalVoteResult proposalVoteResult;
|
||||||
private final BsqFormatter bsqFormatter;
|
private final BsqFormatter bsqFormatter;
|
||||||
@Getter
|
@Getter
|
||||||
private EvaluatedProposal evaluatedProposal;
|
private EvaluatedProposal evaluatedProposal;
|
||||||
|
|
||||||
public CycleListItem(EvaluatedProposal evaluatedProposal, BsqFormatter bsqFormatter) {
|
public ProposalResultListItem(EvaluatedProposal evaluatedProposal, BsqFormatter bsqFormatter) {
|
||||||
this.evaluatedProposal = evaluatedProposal;
|
this.evaluatedProposal = evaluatedProposal;
|
||||||
proposalVoteResult = evaluatedProposal.getProposalVoteResult();
|
proposalVoteResult = evaluatedProposal.getProposalVoteResult();
|
||||||
this.bsqFormatter = bsqFormatter;
|
this.bsqFormatter = bsqFormatter;
|
Loading…
Reference in New Issue
Block a user