diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/Messages.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/Messages.java index 4dabe25559..d8c82e387e 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/Messages.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/Messages.java @@ -512,6 +512,8 @@ public class Messages extends NLS public static String LabelAllSecurities; public static String LabelAllTrades; public static String LabelAllTransactions; + public static String LabelAllInbound; + public static String LabelAllOutbound; public static String LabelAssetChart; public static String LabelAvailableAttributes; public static String LabelAverageHoldingPeriod; @@ -522,6 +524,7 @@ public class Messages extends NLS public static String LabelBeforeTaxAndFees; public static String LabelBenchmarks; public static String LabelBiggerSize; + public static String LabelBuysOnly; public static String LabelEarningsByTaxonomy; public static String LabelCapitalGains; public static String LabelCategoryOtherMovements; @@ -760,6 +763,7 @@ public class Messages extends NLS public static String LabelSelectedTransactions; public static String LabelSelectYear; public static String LabelSelectYearSince; + public static String LabelSellsOnly; public static String LabelSemiVolatility; public static String LabelSettings; public static String LabelShowOnlyOneYear; @@ -830,6 +834,7 @@ public class Messages extends NLS public static String LabelTradesTurnoverRate; public static String LabelTradingActivityChart; public static String LabelTransactionCount; + public static String LabelTransactionFilter; public static String LabelTransactions; public static String LabelTransferals; public static String LabelTransfer; diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages.properties b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages.properties index f4951a2acd..ddfbe12443 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages.properties +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages.properties @@ -1036,6 +1036,10 @@ LabelAllTrades = All trades LabelAllTransactions = All transactions +LabelAllInbound = Inbound deliveries and buys + +LabelAllOutbound = Outbound deliveries and sells + LabelAssetChart = Statement of Assets - Chart LabelAvailableAttributes = Add new attribute @@ -1056,6 +1060,8 @@ LabelBenchmarks = Benchmarks LabelBiggerSize = Bigger +LabelBuysOnly = Buys only + LabelCapitalGains = Capital Gains LabelCategoryOtherMovements = Other Movements @@ -1596,6 +1602,8 @@ LabelSelectYearSince = Since LabelSelectedTransactions = Selected transactions +LabelSellsOnly = Sells only + LabelSemiVolatility = Semivariance LabelSettings = Settings @@ -1662,6 +1670,8 @@ LabelTradingActivityChart = Trading activity LabelTransactionCount = {0} transactions +LabelTransactionFilter = Transaction filter + LabelTransactions = Transactions LabelTransfer = Transfer diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages_de.properties b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages_de.properties index 05a8cd568a..d1e75bef6e 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages_de.properties +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages_de.properties @@ -1029,6 +1029,10 @@ LabelAllTrades = Alle Trades LabelAllTransactions = Alle Buchungen +LabelAllInbound = Einlieferungen und K\u00E4ufe + +LabelAllOutbound = Auslieferungen und Verk\u00E4ufe + LabelAssetChart = Verm\u00F6gensaufstellung - Diagramm LabelAvailableAttributes = Neues Attribut hinzuf\u00FCgen @@ -1049,6 +1053,8 @@ LabelBenchmarks = Benchmarks LabelBiggerSize = Gr\u00F6\u00DFer +LabelBuysOnly = Nur K\u00E4ufe + LabelCapitalGains = Kurserfolge LabelCategoryOtherMovements = Sonstige Bewegungen @@ -1589,6 +1595,8 @@ LabelSelectYearSince = Seit LabelSelectedTransactions = Ausgew\u00E4hlte Buchungen +LabelSellsOnly = Nur Verk\u00E4ufe + LabelSemiVolatility = Semivolatilit\u00E4t LabelSettings = Einstellungen @@ -1655,6 +1663,8 @@ LabelTradingActivityChart = Handelsaktivit\u00E4t LabelTransactionCount = {0} Buchungen +LabelTransactionFilter = Transaktionsfilter + LabelTransactions = Buchungen LabelTransfer = Umbuchung diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/dashboard/ActivityWidget.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/dashboard/ActivityWidget.java index 997ef3163e..03945bf5c6 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/dashboard/ActivityWidget.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/dashboard/ActivityWidget.java @@ -81,6 +81,38 @@ public ChartTypeConfig(WidgetDelegate delegate) } } + public enum TransactionFilter + { + + ALL_TRANSACTIONS(Messages.LabelAllTransactions), // + BUYS_ONLY(Messages.LabelBuysOnly), // + SELLS_ONLY(Messages.LabelSellsOnly), // + ALL_INBOUND(Messages.LabelAllInbound), // + ALL_OUTBOUND(Messages.LabelAllOutbound); + + private String label; + + private TransactionFilter(String label) + { + this.label = label; + } + + @Override + public String toString() + { + return label; + } + } + + static class TransactionFilterConfig extends EnumBasedConfig + { + public TransactionFilterConfig(WidgetDelegate delegate) + { + super(delegate, Messages.LabelTransactionFilter, TransactionFilter.class, Dashboard.Config.TRANSACTION_FILTER, + Policy.EXACTLY_ONE); + } + } + public static class TimeGridPaintListener implements ICustomPaintListener { private static final int INDENT = 5; @@ -178,6 +210,7 @@ public ActivityWidget(Widget widget, DashboardData data) addConfig(new ReportingPeriodConfig(this)); addConfig(new ClientFilterConfig(this)); addConfig(new ChartTypeConfig(this)); + addConfig(new TransactionFilterConfig(this)); addConfig(new ChartHeightConfig(this)); this.converter = data.getCurrencyConverter(); @@ -311,16 +344,43 @@ public void update(List> transactions) .collect(Collectors.toList()).toArray(new String[0])); } - createSeries(chartType, interval, transactions, PortfolioTransaction.Type.BUY, Colors.ICON_BLUE); + if (this.isAllTransactions()) + { + createSeries(chartType, interval, transactions, PortfolioTransaction.Type.BUY, Colors.ICON_BLUE); + + createSeries(chartType, interval, transactions, PortfolioTransaction.Type.DELIVERY_INBOUND, + Colors.brighter(Colors.ICON_BLUE)); + + createSeries(chartType, interval, transactions, PortfolioTransaction.Type.SELL, Colors.ICON_ORANGE); + + createSeries(chartType, interval, transactions, PortfolioTransaction.Type.DELIVERY_OUTBOUND, + Colors.brighter(Colors.ICON_ORANGE)); + } + + if (this.isAllInbound()) + { + createSeries(chartType, interval, transactions, PortfolioTransaction.Type.BUY, Colors.ICON_BLUE); - createSeries(chartType, interval, transactions, PortfolioTransaction.Type.DELIVERY_INBOUND, - Colors.brighter(Colors.ICON_BLUE)); + createSeries(chartType, interval, transactions, PortfolioTransaction.Type.DELIVERY_INBOUND, + Colors.brighter(Colors.ICON_BLUE)); + } - createSeries(chartType, interval, transactions, PortfolioTransaction.Type.SELL, Colors.ICON_ORANGE); + if (this.isAllOutbound()) + { + createSeries(chartType, interval, transactions, PortfolioTransaction.Type.SELL, Colors.ICON_ORANGE); - createSeries(chartType, interval, transactions, PortfolioTransaction.Type.DELIVERY_OUTBOUND, - Colors.brighter(Colors.ICON_ORANGE)); + createSeries(chartType, interval, transactions, PortfolioTransaction.Type.DELIVERY_OUTBOUND, + Colors.brighter(Colors.ICON_ORANGE)); + } + if (this.isBuysOnly()) + { + createSeries(chartType, interval, transactions, PortfolioTransaction.Type.BUY, Colors.ICON_BLUE); + } + if (this.isSellsOnly()) + { + createSeries(chartType, interval, transactions, PortfolioTransaction.Type.SELL, Colors.ICON_ORANGE); + } } finally { @@ -404,4 +464,39 @@ private boolean isAggregateByYear() return chartType == ChartType.SUM_BY_YEAR || chartType == ChartType.COUNT_BY_YEAR; } + + private boolean isAllTransactions() + { + TransactionFilter transactionFilter = get(TransactionFilterConfig.class).getValue(); + + return transactionFilter == transactionFilter.ALL_TRANSACTIONS; + } + + private boolean isBuysOnly() + { + TransactionFilter transactionFilter = get(TransactionFilterConfig.class).getValue(); + + return transactionFilter == transactionFilter.BUYS_ONLY; + } + + private boolean isAllInbound() + { + TransactionFilter transactionFilter = get(TransactionFilterConfig.class).getValue(); + + return transactionFilter == transactionFilter.ALL_INBOUND; + } + + private boolean isSellsOnly() + { + TransactionFilter transactionFilter = get(TransactionFilterConfig.class).getValue(); + + return transactionFilter == transactionFilter.SELLS_ONLY; + } + + private boolean isAllOutbound() + { + TransactionFilter transactionFilter = get(TransactionFilterConfig.class).getValue(); + + return transactionFilter == transactionFilter.ALL_OUTBOUND; + } } diff --git a/name.abuchen.portfolio/src/name/abuchen/portfolio/model/Dashboard.java b/name.abuchen.portfolio/src/name/abuchen/portfolio/model/Dashboard.java index 171266653c..45170c78b8 100644 --- a/name.abuchen.portfolio/src/name/abuchen/portfolio/model/Dashboard.java +++ b/name.abuchen.portfolio/src/name/abuchen/portfolio/model/Dashboard.java @@ -11,7 +11,7 @@ public enum Config { REPORTING_PERIOD, DATA_SERIES, SECONDARY_DATA_SERIES, CONFIG_UUID, AGGREGATION, EXCHANGE_RATE_SERIES, // COLOR_SCHEMA, LAYOUT, HEIGHT, EARNING_TYPE, NET_GROSS, CLIENT_FILTER, CALCULATION_METHOD, METRIC, // - ATTRIBUTE_UUID, URL, SHOW_Y_AXIS, TAXONOMY, FLAG_INCLUDE_UNASSIGNED, SORT_DIRECTION, START_YEAR; + ATTRIBUTE_UUID, URL, SHOW_Y_AXIS, TAXONOMY, FLAG_INCLUDE_UNASSIGNED, SORT_DIRECTION, START_YEAR, TRANSACTION_FILTER; } public static final class Column