Skip to content

Commit

Permalink
SecurityListWidget: use reporting period + enhanced formatting
Browse files Browse the repository at this point in the history
Plus: added translations

Issue: #4431
  • Loading branch information
buchen committed Jan 10, 2025
1 parent 5cff137 commit dd9b09a
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,8 @@ EditWizardQuoteFeedTitle = Historick\u00E9 kurzy

ErrorKeyAlreadyUsed = Kl\u00ED\u010D je ji\u017E pou\u017Eit.

EventListWidgetTitle = Cenn\u00E9 pap\u00EDry: Ud\u00E1losti

EventWizardDescription = P\u0159id\u00E1n\u00ED vlastn\u00ED ud\u00E1losti (datum, voln\u00FD text) k cenn\u00E9mu pap\u00EDru.\nP\u0159\u00EDklady: zadan\u00E1 objedn\u00E1vka/limit, sign\u00E1l grafu, zpr\u00E1vy o akci\u00EDch, koment\u00E1\u0159e

EventWizardLabelMessage = Ud\u00E1lost
Expand Down Expand Up @@ -2096,6 +2098,8 @@ MsgErrorTradeCollectionWithErrors = Chyba p\u0159i sb\u00EDr\u00E1n\u00ED obchod

MsgErrorUpdating = Chyba p\u0159i aktualizaci

MsgHintNoEvents = \u017D\u00E1dn\u00E9 ud\u00E1losti.

MsgHintUseOutboundDeliveryForZeroTotal = Pozn\u00E1mka: Prodeje s nulovou hodnotou nejsou podporov\u00E1ny. M\u00EDsto toho vytvo\u0159te transakci dod\u00E1n\u00ED.

MsgIncorrectConvertedSubTotal = P\u0159eveden\u00FD mezisou\u010Det je nespr\u00E1vn\u00FD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ EditWizardQuoteFeedTitle = Historiske kurser

ErrorKeyAlreadyUsed = N\u00F8gle er allerede brugt.

EventListWidgetTitle = V\u00E6rdipapirer: Begivenheder

EventWizardDescription = Tilf\u00F8j en tilpasset begivenhed (dato, fritekst) til et v\u00E6rdipapir.\nEksempler: afgivet ordre/gr\u00E6nse, diagramsignal, aktienyheder, kommentarer

EventWizardLabelMessage = Begivenhed
Expand Down Expand Up @@ -2099,6 +2101,8 @@ MsgErrorUpdating = Fejl ved opdatering

MsgHintNoAttributesConfigured = Ingen attributter af typen ''{0}'' er konfigureret.\n<a href=''settings''>Konfigurer nu</a>

MsgHintNoEvents = Ingen arrangementer.

MsgHintUseOutboundDeliveryForZeroTotal = Bem\u00E6rk: Salg med en v\u00E6rdi p\u00E5 nul underst\u00F8ttes ikke. Opret venligst en leveringstransaktion i stedet.

MsgIncorrectConvertedSubTotal = Konverteret sub-total er ikke korrekt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ EditWizardQuoteFeedTitle = Historische Kurse

ErrorKeyAlreadyUsed = Schl\u00FCssel schon vergeben.

EventListWidgetTitle = Wertpapiere: Ereignisse

EventWizardDescription = F\u00FCgt ein beliebiges Ereignis (Datum, Freitext) zu einem Wertpapier hinzu:\nBeispiele: Order/Limit platziert, Kurssignal, Aktien-News, Kommentare

EventWizardLabelMessage = Ereignis
Expand Down Expand Up @@ -2103,6 +2105,8 @@ MsgErrorUpdating = Fehler beim Aktualisieren

MsgHintNoAttributesConfigured = Keine Attribute vom Typ ''{0}'' konfiguriert.\n<a href=''settings''>Jetzt konfigurieren</a>

MsgHintNoEvents = Keine Ereignisse.

MsgHintUseOutboundDeliveryForZeroTotal = Hinweis: Verk\u00E4ufe mit einem Wert von null werden nicht unterst\u00FCtzt. Bitte erstelle stattdessen eine Buchung vom Typ Auslieferung.

MsgIncorrectConvertedSubTotal = Umgerechnete Zwischensumme ist fehlerhaft
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ EditWizardQuoteFeedTitle = Cotizaciones hist\u00F3ricas

ErrorKeyAlreadyUsed = La clave ya est\u00E1 en uso.

EventListWidgetTitle = Valores: Eventos

EventWizardDescription = A\u00F1ade un evento personalizado (fecha, texto) a un valor.\nEjemplos: comentarios, notas de \u00F3rdenes/l\u00EDmites, marcas del gr\u00E1fico, eventos y novedades, ...

EventWizardLabelMessage = Evento
Expand Down Expand Up @@ -2099,6 +2101,8 @@ MsgErrorUpdating = Error en la actualizaci\u00F3n

MsgHintNoAttributesConfigured = No se han configurado propiedades de tipo \u201B{0}\u2019.\n<a href=''settings''>Configurar ahora</a>

MsgHintNoEvents = No hay eventos.

MsgHintUseOutboundDeliveryForZeroTotal = Nota: No se admiten ventas con valor cero. En su lugar, crea una transacci\u00F3n de entrega.

MsgIncorrectConvertedSubTotal = Sub-total convertido es incorrecto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,8 @@ EditWizardQuoteFeedTitle = Cotations historiques

ErrorKeyAlreadyUsed = La cl\u00E9 est d\u00E9j\u00E0 utilis\u00E9e.

EventListWidgetTitle = Titres : \u00C9v\u00E9nements

EventWizardDescription = Ajouter un \u00E9v\u00E9nement personnalis\u00E9 (date, texte libre) \u00E0 un titre.\nExemples : ordre/limite plac\u00E9, signal graphique, nouvelles du titre, commentaires.

EventWizardLabelMessage = \u00C9v\u00E9nement
Expand Down Expand Up @@ -2100,6 +2102,8 @@ MsgErrorUpdating = Erreur pendant la mise \u00E0 jour

MsgHintNoAttributesConfigured = Aucun attribut de type ''{0}'' configur\u00E9.\n<a href=''settings''>Configurer maintenant</a>

MsgHintNoEvents = Aucun \u00E9v\u00E9nement.

MsgHintUseOutboundDeliveryForZeroTotal = Remarque : les ventes avec une valeur de z\u00E9ro ne sont pas support\u00E9es. Merci de cr\u00E9er une transaction de distribution sortante \u00E0 la place.

MsgIncorrectConvertedSubTotal = Le sous-total converti est incorrect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ EditWizardQuoteFeedTitle = Quotazioni storiche

ErrorKeyAlreadyUsed = La chiave \u00E8 gi\u00E0 utilizzata.

EventListWidgetTitle = Titoli: Eventi

EventWizardDescription = Aggiungi un evento personalizzato (data, testo libero) a un titolo.\nEsempi: ordine / limite piazzato, segnale grafico, notizie di borsa, commenti

EventWizardLabelMessage = Evento
Expand Down Expand Up @@ -2099,6 +2101,8 @@ MsgErrorUpdating = Errore durante l'aggiornamento

MsgHintNoAttributesConfigured = Nessun attributo di tipo ''{0}'' configurato.\n<a href=''settings''>Configura ora</a>

MsgHintNoEvents = Nessun evento.

MsgHintUseOutboundDeliveryForZeroTotal = Nota: le vendite con valore zero non sono supportate. Crea invece una "transazione alla consegna".

MsgIncorrectConvertedSubTotal = Il sub-totale convertito \u00E8 errato
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ EditWizardQuoteFeedTitle = Historische koersen

ErrorKeyAlreadyUsed = Sleutel is al in gebruik.

EventListWidgetTitle = Effecten: Evenementen

EventWizardDescription = Voeg een gebeurtenis (datum, vrije tekst) toe aan een effect.\nVoorbeelden van gebeurtenissen zijn: Geplaatste order, ingestelde limiet, koerssignaal, nieuws, commentaar.

EventWizardLabelMessage = Gebeurtenis
Expand Down Expand Up @@ -2099,6 +2101,8 @@ MsgErrorUpdating = Fout bij bijwerken
MsgHintNoAttributesConfigured = Geen kenmerken van het type ''{0}'' geconfigureerd.\n<a href=''settings''>Nu configureren</a>
MsgHintNoEvents = Geen evenementen.
MsgHintUseOutboundDeliveryForZeroTotal = Opmerking: Verkopen met een waarde van nul worden niet ondersteund. Maak in plaats daarvan een leveringstransactie.
MsgIncorrectConvertedSubTotal = Geconverteerd subtotaal is incorrect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ EditWizardQuoteFeedTitle = Historyczne notowania

ErrorKeyAlreadyUsed = Klucz jest ju\u017C u\u017Cywany.

EventListWidgetTitle = Wolory: Wydarzenia

EventWizardDescription = Dodaj w\u0142asne zdarzenie (data, dowolny tekst) dla waloru.\nPrzyk\u0142ady: za\u0142o\u017Cone zlecenie sell/limit, sygna\u0142 techniczny, wiadomo\u015Bci z rynku, komentarze

EventWizardLabelMessage = Zdarzenie
Expand Down Expand Up @@ -2099,6 +2101,8 @@ MsgErrorUpdating = B\u0142\u0105d podczas aktualizacji
MsgHintNoAttributesConfigured = Nie skonfigurowano atrybut\u00F3w typu ''{0}''.\n<a href="settings">Skonfiguruj teraz</a>
MsgHintNoEvents = Brak wydarze\u0144.
MsgHintUseOutboundDeliveryForZeroTotal = Uwaga: Sprzeda\u017C z warto\u015Bci\u0105 zero nie jest obs\u0142ugiwana. Zamiast tego utw\u00F3rz transakcj\u0119 dostawy.
MsgIncorrectConvertedSubTotal = Przekonwertowana suma cz\u0119\u015Bciowa jest nieprawid\u0142owa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ EditWizardQuoteFeedTitle = Cota\u00E7\u00F5es Hist\u00F3ricas

ErrorKeyAlreadyUsed = A chave j\u00E1 est\u00E1 sendo usada.

EventListWidgetTitle = T\u00EDtulos: Eventos

EventWizardDescription = Adicionar um evento personalizado (data, texto) a uma a\u00E7\u00E3o.\nExemplos: ordens/limites colocados, sinais no gr\u00E1ficos, not\u00EDcias sobre a\u00E7\u00E3o, coment\u00E1rios

EventWizardLabelMessage = Evento
Expand Down Expand Up @@ -2097,6 +2099,8 @@ MsgErrorUpdating = Erro ao atualizar

MsgHintNoAttributesConfigured = Nenhum atributo do tipo ''{0}'' configurado.\n<a href=''settings''>Configure agora</a>

MsgHintNoEvents = N\u00E3o h\u00E1 eventos.

MsgHintUseOutboundDeliveryForZeroTotal = Nota: As vendas com um valor de zero n\u00E3o s\u00E3o suportadas. Em vez disso, cria uma transa\u00E7\u00E3o de entrega.

MsgIncorrectConvertedSubTotal = Subtotal convertido est\u00E1 incorreto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ EditWizardQuoteFeedTitle = Cota\u00E7\u00F5es Hist\u00F3ricas

ErrorKeyAlreadyUsed = A chave j\u00E1 est\u00E1 sendo usada.

EventListWidgetTitle = T\u00EDtulos: Eventos

EventWizardDescription = Adicionar um evento personalizado (data, texto) a uma a\u00E7\u00E3o.\nExemplos: ordens/limites colocados, sinais no gr\u00E1ficos, not\u00EDcias sobre a\u00E7\u00E3o, coment\u00E1rios

EventWizardLabelMessage = Evento
Expand Down Expand Up @@ -2099,6 +2101,8 @@ MsgErrorUpdating = Erro ao atualizar

MsgHintNoAttributesConfigured = Nenhum atributo do tipo ''{0}'' configurado.\n<a href=''settings''>Configure agora</a>

MsgHintNoEvents = Nenhum evento.

MsgHintUseOutboundDeliveryForZeroTotal = Observa\u00E7\u00E3o: N\u00E3o h\u00E1 suporte para vendas com valor zero. Em vez disso, crie uma transa\u00E7\u00E3o de entrega.

MsgIncorrectConvertedSubTotal = Subtotal convertido est\u00E1 incorreto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ EditWizardQuoteFeedTitle = \u0418\u0441\u0442\u043E\u0440\u0438\u0447\u0435\u044

ErrorKeyAlreadyUsed = \u041A\u043B\u044E\u0447 \u0443\u0436\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F.

EventListWidgetTitle = \u0410\u043A\u0442\u0438\u0432\u044B: \u0421\u043E\u0431\u044B\u0442\u0438\u044F

EventWizardDescription = \u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043D\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043C\u043E\u0435 \u0441\u043E\u0431\u044B\u0442\u0438\u0435 (\u0434\u0430\u0442\u0443, \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u043B\u044C\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442) \u043A \u0446\u0435\u043D\u043D\u043E\u0439 \u0431\u0443\u043C\u0430\u0433\u0435.\n\u041F\u0440\u0438\u043C\u0435\u0440\u044B: \u0440\u0430\u0437\u043C\u0435\u0449\u0435\u043D\u043D\u044B\u0439 \u043E\u0440\u0434\u0435\u0440 / \u043B\u0438\u043C\u0438\u0442, \u0441\u0438\u0433\u043D\u0430\u043B \u0433\u0440\u0430\u0444\u0438\u043A\u0430, \u0431\u0438\u0440\u0436\u0435\u0432\u044B\u0435 \u043D\u043E\u0432\u043E\u0441\u0442\u0438, \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438.

EventWizardLabelMessage = \u0421\u043E\u0431\u044B\u0442\u0438\u0435
Expand Down Expand Up @@ -2097,6 +2099,8 @@ MsgErrorUpdating = \u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0440\u0438 \u043

MsgHintNoAttributesConfigured = \u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044B \u0442\u0438\u043F\u0430 "{0}" \u043D\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043D\u044B.\n<a href=''settings''>\u041D\u0430\u0441\u0442\u0440\u043E\u0438\u0442\u044C \u0441\u0435\u0439\u0447\u0430\u0441</a>

MsgHintNoEvents = \u041D\u0438\u043A\u0430\u043A\u0438\u0445 \u0441\u043E\u0431\u044B\u0442\u0438\u0439.

MsgHintUseOutboundDeliveryForZeroTotal = \u041F\u0440\u0438\u043C\u0435\u0447\u0430\u043D\u0438\u0435: \u041F\u0440\u043E\u0434\u0430\u0436\u0438 \u0441 \u043D\u0443\u043B\u0435\u0432\u044B\u043C \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\u043C \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F. \u0412\u043C\u0435\u0441\u0442\u043E \u044D\u0442\u043E\u0433\u043E \u0441\u043E\u0437\u0434\u0430\u0439 \u0442\u0440\u0430\u043D\u0437\u0430\u043A\u0446\u0438\u044E \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438.

MsgIncorrectConvertedSubTotal = \u041A\u043E\u043D\u0432\u0435\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u043F\u0440\u043E\u043C\u0435\u0436\u0443\u0442\u043E\u0447\u043D\u044B\u0439 \u0438\u0442\u043E\u0433 \u043D\u0435\u0432\u0435\u0440\u0435\u043D
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ EditWizardQuoteFeedTitle = Historick\u00E9 kurzy
ErrorKeyAlreadyUsed = K\u013E\u00FA\u010D je u\u017E pou\u017Eit\u00FD.
EventListWidgetTitle = Cenn\u00E9 papiere: Udalosti
EventWizardDescription = Pridanie vlastnej udalosti (d\u00E1tum, vo\u013En\u00FD text) do cenn\u00E9ho papiera. \nPr\u00EDklady: zadan\u00E1 objedn\u00E1vka/limit, sign\u00E1l grafu, spr\u00E1vy o akci\u00E1ch, koment\u00E1re
EventWizardLabelMessage = Udalos\u0165
Expand Down Expand Up @@ -2099,6 +2101,8 @@ MsgErrorUpdating = Chyba pri aktualiz\u00E1cii
MsgHintNoAttributesConfigured = Nie s\u00FA nakonfigurovan\u00E9 \u017Eiadne atrib\u00FAty typu ''{0}''. \n<a href=''settings''>Konfigurova\u0165 teraz</a>
MsgHintNoEvents = \u017Diadne podujatia.
MsgHintUseOutboundDeliveryForZeroTotal = Pozn\u00E1mka: Predaje s nulovou hodnotou nie s\u00FA podporovan\u00E9. Namiesto toho vytvorte transakciu dodania.
MsgIncorrectConvertedSubTotal = Prepo\u010D\u00EDtan\u00FD medzis\u00FA\u010Det je nespr\u00E1vny
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ EditWizardQuoteFeedTitle = \u5386\u53F2\u62A5\u4EF7

ErrorKeyAlreadyUsed = \u952E\u5DF2\u5360\u7528\u3002

EventListWidgetTitle = \u8BC1\u5238\uFF1A\u4E8B\u4EF6

EventWizardDescription = \u4E3A\u8BC1\u5238\u6DFB\u52A0\u81EA\u5B9A\u4E49\u4E8B\u4EF6 (\u65E5\u671F\uFF0C\u4EFB\u610F\u6587\u672C)\u3002\n\u4F8B\u5982\uFF1A\u4E0B\u5355/\u9650\u4EF7\uFF0C\u56FE\u8868\u4FE1\u53F7\uFF0C\u80A1\u7968\u65B0\u95FB\uFF0C\u8BC4\u8BBA

EventWizardLabelMessage = \u4E8B\u4EF6
Expand Down Expand Up @@ -2099,6 +2101,8 @@ MsgErrorUpdating = \u66F4\u65B0\u65F6\u51FA\u9519

MsgHintNoAttributesConfigured = \u672A\u8BBE\u7F6E\u5C5E\u6027 \u201C{0}\u201D\u3002\n<a href=''settings''>\u8BF7\u8BBE\u7F6E</a>

MsgHintNoEvents = \u6CA1\u6709\u6D3B\u52A8\u3002

MsgHintUseOutboundDeliveryForZeroTotal = \u6CE8\u610F\uFF1A\u4E0D\u652F\u6301\u96F6\u503C\u5356\u51FA\u3002\u8BF7\u6539\u4E3A\u8BC1\u5238\u8F6C\u51FA\u3002

MsgIncorrectConvertedSubTotal = \u8F6C\u6362\u540E\u7684\u5C0F\u8BA1\u9519\u8BEF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ EditWizardQuoteFeedTitle = \u6B77\u53F2\u5831\u50F9

ErrorKeyAlreadyUsed = \u8A72\u5BC6\u9470\u5DF2\u4F7F\u7528\u3002

EventListWidgetTitle = \u8B49\u5238\uFF1A\u6D3B\u52D5

EventWizardDescription = \u5411\u8B49\u5238\u6DFB\u52A0\u81EA\u5B9A\u7FA9\u4E8B\u4EF6\uFF08\u65E5\u671F\u3001\u81EA\u7531\u6587\u672C\uFF09\u3002\n\u5982\uFF1A\u4E0B\u8A02\u55AE/\u9650\u5236\u3001\u5716\u8868\u4FE1\u865F\u3001\u80A1\u7968\u65B0\u805E\u3001\u8A55\u8AD6\u3002

EventWizardLabelMessage = \u4E8B\u4EF6
Expand Down Expand Up @@ -2099,6 +2101,8 @@ MsgErrorUpdating = \u66F4\u65B0\u932F\u8AA4
MsgHintNoAttributesConfigured = \u672A\u8A2D\u5B9A\u4EFB\u4F55\u300C{0}\u300D\u985E\u578B\u7684\u5C6C\u6027\u3002\n<a href=''settings''>\u7ACB\u5373\u8A2D\u5B9A</a>
MsgHintNoEvents = \u6C92\u6709\u6D3B\u52D5\u3002
MsgHintUseOutboundDeliveryForZeroTotal = \u6CE8\u610F\uFF1A\u4E0D\u652F\u63F4\u503C\u70BA\u96F6\u7684\u92B7\u552E\u3002\u8ACB\u5EFA\u7ACB\u4EA4\u8CA8\u4EA4\u6613\u3002
MsgIncorrectConvertedSubTotal = \u8F49\u63DB\u5F8C\u7684\u5C0F\u8A08\u4E0D\u6B63\u78BA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Predicate;
import java.util.function.Supplier;

import org.eclipse.swt.SWT;
Expand All @@ -13,19 +12,19 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;

import name.abuchen.portfolio.model.Dashboard;
import name.abuchen.portfolio.model.Dashboard.Widget;
import name.abuchen.portfolio.model.Security;
import name.abuchen.portfolio.model.SecurityEvent;
import name.abuchen.portfolio.money.Values;
import name.abuchen.portfolio.ui.Messages;
import name.abuchen.portfolio.ui.UIConstants;
import name.abuchen.portfolio.ui.util.FormDataFactory;
import name.abuchen.portfolio.ui.util.LogoManager;
import name.abuchen.portfolio.ui.util.swt.StyledLabel;
import name.abuchen.portfolio.ui.views.dashboard.ChartHeightConfig;
import name.abuchen.portfolio.ui.views.dashboard.DashboardData;
import name.abuchen.portfolio.ui.views.dashboard.EnumBasedConfig;
import name.abuchen.portfolio.ui.views.dashboard.WidgetDelegate;
import name.abuchen.portfolio.ui.views.dashboard.ReportingPeriodConfig;
import name.abuchen.portfolio.util.TextUtil;

public class EventListWidget extends AbstractSecurityListWidget<EventListWidget.EventItem>
{
Expand All @@ -40,46 +39,11 @@ public EventItem(Security security, SecurityEvent event)
}
}

public enum DateCheck
{
PAST(Messages.OptionDateIsInThePast, date -> !LocalDate.now().isBefore(date)), //
FUTURE(Messages.OptionDateIsInTheFuture, date -> !date.isBefore(LocalDate.now()));

private String label;
private Predicate<LocalDate> predicate;

private DateCheck(String label, Predicate<LocalDate> predicate)
{
this.label = label;
this.predicate = predicate;
}

public boolean include(LocalDate date)
{
return predicate.test(date);
}

@Override
public String toString()
{
return label;
}
}

static class DateDateConfig extends EnumBasedConfig<DateCheck>
{
public DateDateConfig(WidgetDelegate<?> delegate)
{
super(delegate, Messages.ColumnDate, DateCheck.class, Dashboard.Config.REPORTING_PERIOD,
Policy.EXACTLY_ONE);
}
}

public EventListWidget(Widget widget, DashboardData data)
{
super(widget, data);

addConfig(new DateDateConfig(this));
addConfig(new ReportingPeriodConfig(this));
addConfig(new SortingConfig(this));
addConfig(new ChartHeightConfig(this));
}
Expand All @@ -89,14 +53,14 @@ public Supplier<List<EventItem>> getUpdateTask()
{
return () -> {

DateCheck dateType = get(DateDateConfig.class).getValue();
var interval = get(ReportingPeriodConfig.class).getReportingPeriod().toInterval(LocalDate.now());

List<EventItem> items = new ArrayList<>();
for (Security security : getClient().getSecurities())
{
for (var event : security.getEvents())
{
if (dateType.include(event.getDate()))
if (interval.contains(event.getDate()))
{
items.add(new EventItem(security, event));
}
Expand All @@ -116,18 +80,45 @@ protected Composite createItemControl(Composite parent, EventItem item)
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FormLayout());

String type = item.event.getType().toString();
String details = null;

switch (item.event.getType())
{
case NOTE:
details = item.event.getDetails();
break;
case STOCK_SPLIT:
type += " " + item.event.getDetails(); //$NON-NLS-1$
break;
case DIVIDEND_PAYMENT:
details = Values.Money.format(item.event instanceof SecurityEvent.DividendEvent dividendPayment
? dividendPayment.getAmount()
: null);
break;
default:
}

Label logo = createLabel(composite,
LogoManager.instance().getDefaultColumnImage(item.getSecurity(), getClient().getSettings()));

Label lblType = createLabel(composite, Values.Date.format(item.event.getDate()) + ": " + type); //$NON-NLS-1$
lblType.setData(UIConstants.CSS.CLASS_NAME, UIConstants.CSS.HEADING2);
Label name = createLabel(composite, item.getSecurity().getName());

Label date = createLabel(composite, Values.Date.format(item.event.getDate()) + ": " + item.event.getDetails()); //$NON-NLS-1$

composite.addMouseListener(mouseUpAdapter);
name.addMouseListener(mouseUpAdapter);
date.addMouseListener(mouseUpAdapter);
lblType.addMouseListener(mouseUpAdapter);

FormDataFactory.startingWith(logo).thenRight(name).right(new FormAttachment(100)).thenBelow(date);
FormDataFactory.startingWith(lblType).thenBelow(logo).thenRight(name);

if (details != null)
{
Label lblDetails = new Label(composite, SWT.WRAP);
lblDetails.setText(TextUtil.tooltip(details));
lblDetails.addMouseListener(mouseUpAdapter);
FormDataFactory.startingWith(name).thenBelow(lblDetails).width(200).right(new FormAttachment(100));
}

return composite;
}
Expand Down

0 comments on commit dd9b09a

Please sign in to comment.