Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add derived data series in Statement of Assets Chart #4235

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class Messages extends NLS
public static String ChartSeriesBenchmarkSuffix;
public static String ChartSeriesCopySeriesFromOtherChart;
public static String ChartSeriesPickerAddBenchmark;
public static String ChartSeriesPickerAddDerivedData;
public static String ChartSeriesPickerAddItem;
public static String ChartSeriesPickerColor;
public static String ChartSeriesPickerDialogMsg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ ChartSeriesCopySeriesFromOtherChart = Copy from

ChartSeriesPickerAddBenchmark = Add benchmark...

ChartSeriesPickerAddDerivedData = Add derived data series ...

ChartSeriesPickerAddItem = Add data series...

ChartSeriesPickerColor = Color...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ ChartSeriesCopySeriesFromOtherChart = Kop\u00EDrovat z

ChartSeriesPickerAddBenchmark = P\u0159idat benchmark...

ChartSeriesPickerAddDerivedData = P\u0159id\u00E1n\u00ED odvozen\u00FDch datov\u00FDch \u0159ad ...

ChartSeriesPickerAddItem = P\u0159idat datovou \u0159adu...

ChartSeriesPickerColor = Barva...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ChartSeriesCopySeriesFromOtherChart = Kopier fra

ChartSeriesPickerAddBenchmark = Tilf\u00F8j ydeevne...

ChartSeriesPickerAddDerivedData = Tilf\u00F8j afledte dataserier ...

ChartSeriesPickerAddItem = Tilf\u00F8j dataserier...

ChartSeriesPickerColor = Farve...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ChartSeriesCopySeriesFromOtherChart = \u00DCbernehmen aus

ChartSeriesPickerAddBenchmark = Benchmark hinzuf\u00FCgen...

ChartSeriesPickerAddDerivedData = Abgeleitete Datenreihen hinzuf\u00FCgen ...

ChartSeriesPickerAddItem = Datenreihe hinzuf\u00FCgen...

ChartSeriesPickerColor = Farbe...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ChartSeriesCopySeriesFromOtherChart = Incorporar las series de

ChartSeriesPickerAddBenchmark = A\u00F1adir series de referencia...

ChartSeriesPickerAddDerivedData = A\u00F1adir series de datos derivados ...

ChartSeriesPickerAddItem = A\u00F1adir series de datos...

ChartSeriesPickerColor = Color...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ ChartSeriesCopySeriesFromOtherChart = Copier de

ChartSeriesPickerAddBenchmark = Ajouter une r\u00E9f\u00E9rence/benchmark...

ChartSeriesPickerAddDerivedData = Ajouter des s\u00E9ries de donn\u00E9es d\u00E9riv\u00E9es ...

ChartSeriesPickerAddItem = Ajouter des s\u00E9ries de donn\u00E9es...

ChartSeriesPickerColor = Couleur...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ChartSeriesCopySeriesFromOtherChart = Copia da

ChartSeriesPickerAddBenchmark = Aggiungi un benchmark

ChartSeriesPickerAddDerivedData = Aggiungere serie di dati derivati ...

ChartSeriesPickerAddItem = Aggiungi serie dati...

ChartSeriesPickerColor = Colore...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ChartSeriesCopySeriesFromOtherChart = Kopi\u00EBren van

ChartSeriesPickerAddBenchmark = Benchmark toevoegen...

ChartSeriesPickerAddDerivedData = Afgeleide gegevensreeksen toevoegen ...

ChartSeriesPickerAddItem = Gegevensreeks toevoegen...

ChartSeriesPickerColor = Kleur...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ChartSeriesCopySeriesFromOtherChart = Kopiuj z

ChartSeriesPickerAddBenchmark = Dodaj benchmark\u2026

ChartSeriesPickerAddDerivedData = Dodaj pochodne serie danych ...

ChartSeriesPickerAddItem = Dodaj serie danych ...

ChartSeriesPickerColor = Kolor...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ChartSeriesCopySeriesFromOtherChart = Copiar de

ChartSeriesPickerAddBenchmark = Adicionar refer\u00EAncia...

ChartSeriesPickerAddDerivedData = Adicionar s\u00E9ries de dados derivados ...

ChartSeriesPickerAddItem = Adicionar s\u00E9rie de dados...

ChartSeriesPickerColor = Cor...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ChartSeriesCopySeriesFromOtherChart = Copiar de

ChartSeriesPickerAddBenchmark = Adicionar Benchmark...

ChartSeriesPickerAddDerivedData = Adicionar s\u00E9ries de dados derivados ...

ChartSeriesPickerAddItem = Adicionar s\u00E9rie de dados...

ChartSeriesPickerColor = Cor...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ChartSeriesCopySeriesFromOtherChart = \u041A\u043E\u043F\u0438\u0440\u043E\u0432

ChartSeriesPickerAddBenchmark = \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0431\u0435\u043D\u0447\u043C\u0430\u0440\u043A...

ChartSeriesPickerAddDerivedData = \u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u043D\u044B\u0435 \u0441\u0435\u0440\u0438\u0438 \u0434\u0430\u043D\u043D\u044B\u0445 ...

ChartSeriesPickerAddItem = \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0435\u0440\u0438\u044E \u0434\u0430\u043D\u043D\u044B\u0445...

ChartSeriesPickerColor = \u0426\u0432\u0435\u0442...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ChartSeriesCopySeriesFromOtherChart = Kop\u00EDrova\u0165 z

ChartSeriesPickerAddBenchmark = Prida\u0165 Benchmark...

ChartSeriesPickerAddDerivedData = Pridanie odvoden\u00FDch radov \u00FAdajov ...

ChartSeriesPickerAddItem = Prida\u0165 d\u00E1tov\u00FA radu...

ChartSeriesPickerColor = Farba...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ChartSeriesCopySeriesFromOtherChart = \u590D\u5236\u81EA

ChartSeriesPickerAddBenchmark = \u6DFB\u52A0\u57FA\u51C6...

ChartSeriesPickerAddDerivedData = \u6DFB\u52A0\u6D3E\u751F\u6570\u636E\u7CFB\u5217 ...

ChartSeriesPickerAddItem = \u6DFB\u52A0\u6570\u636E\u7CFB\u5217...

ChartSeriesPickerColor = \u989C\u8272...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ChartSeriesCopySeriesFromOtherChart = \u8907\u88FD\u81EA

ChartSeriesPickerAddBenchmark = \u65B0\u589E\u6307\u6A19...

ChartSeriesPickerAddDerivedData = \u65B0\u589E\u884D\u751F\u8CC7\u6599\u7CFB\u5217 ...

ChartSeriesPickerAddItem = \u65B0\u589E\u6578\u5217...

ChartSeriesPickerColor = \u984F\u8272...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ public void configMenuAboutToShow(IMenuManager manager)

if (dataSeriesSet.getUseCase() != DataSeries.UseCase.STATEMENT_OF_ASSETS)
manager.add(new SimpleAction(Messages.ChartSeriesPickerAddBenchmark, a -> doAddSeries(true)));
else
manager.add(new SimpleAction(Messages.ChartSeriesPickerAddDerivedData, a -> doAddDerivedSeries()));

addCopyFromOtherChartsMenu(manager);
}
Expand Down Expand Up @@ -136,6 +138,33 @@ private void doAddSeries(boolean showOnlyBenchmark)
fireUpdate();
}

private void doAddDerivedSeries()
{
List<DataSeries> list = new ArrayList<>(dataSeriesSet.getAvailableDerivedSeries());

// remove already selected items
for (DataSeries s : selectedSeries)
list.remove(s);

DataSeriesSelectionDialog dialog = new DataSeriesSelectionDialog(Display.getDefault().getActiveShell(), client);
dialog.setElementsDerivedData(list);
dialog.setExpandTree(false);

if (dialog.open() != DataSeriesSelectionDialog.OK)
return;

List<DataSeries> result = dialog.getResult();
if (result.isEmpty())
return;

result.forEach(series -> {
series.setVisible(true);
selectedSeries.add(series);
});

fireUpdate();
}

private void addCopyFromOtherChartsMenu(IMenuManager manager)
{
String[] charts = new String[] { //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,73 @@ public enum ClientDataSeries
EARNINGS, EARNINGS_ACCUMULATED, FEES, FEES_ACCUMULATED;
}

/**
* Data series available for the Type_Parent type.
*/
public enum ClientDataSeriesType
{
TRANSFERALS(ClientDataSeries.TRANSFERALS, Messages.LabelTransferals, false), //
TRANSFERALS_ACCUMULATED(ClientDataSeries.TRANSFERALS_ACCUMULATED, Messages.LabelAccumulatedTransferals, true,
true), //
INVESTED_CAPITAL(ClientDataSeries.INVESTED_CAPITAL, Messages.LabelInvestedCapital, true, true), //
ABSOLUTE_INVESTED_CAPITAL(ClientDataSeries.ABSOLUTE_INVESTED_CAPITAL, Messages.LabelAbsoluteInvestedCapital,
true, true), //
ABSOLUTE_DELTA(ClientDataSeries.ABSOLUTE_DELTA, Messages.LabelDelta, true), //
ABSOLUTE_DELTA_ALL_RECORDS(ClientDataSeries.ABSOLUTE_DELTA_ALL_RECORDS, Messages.LabelAbsoluteDelta, true), //
DIVIDENDS(ClientDataSeries.DIVIDENDS, Messages.LabelDividends, false), //
DIVIDENDS_ACCUMULATED(ClientDataSeries.DIVIDENDS_ACCUMULATED, Messages.LabelAccumulatedDividends, true), //
INTEREST(ClientDataSeries.INTEREST, Messages.LabelInterest, false), //
INTEREST_ACCUMULATED(ClientDataSeries.INTEREST_ACCUMULATED, Messages.LabelAccumulatedInterest, true), //
INTEREST_CHARGE(ClientDataSeries.INTEREST_CHARGE, Messages.LabelInterestCharge, false), //
INTEREST_CHARGE_ACCUMULATED(ClientDataSeries.INTEREST_CHARGE_ACCUMULATED,
Messages.LabelAccumulatedInterestCharge, true), //
EARNINGS(ClientDataSeries.EARNINGS, Messages.LabelEarnings, false), //
EARNINGS_ACCUMULATED(ClientDataSeries.EARNINGS_ACCUMULATED, Messages.LabelAccumulatedEarnings, true), //
FEES(ClientDataSeries.FEES, Messages.LabelFees, false), //
FEES_ACCUMULATED(ClientDataSeries.FEES_ACCUMULATED, Messages.LabelFeesAccumulated, true), //
TAXES(ClientDataSeries.TAXES, Messages.ColumnTaxes, false), //
TAXES_ACCUMULATED(ClientDataSeries.TAXES_ACCUMULATED, Messages.LabelAccumulatedTaxes, true); //

private String label;
private boolean isLine;
private boolean isArea;
private ClientDataSeries clientDataSeries;

private ClientDataSeriesType(ClientDataSeries clientDataSeries, String label, boolean isLine)
{
this(clientDataSeries, label, isLine, false);
}

private ClientDataSeriesType(ClientDataSeries clientDataSeries, String label, boolean isLine, boolean isArea)
{
this.label = label;
this.isLine = isLine;
this.isArea = isArea;
this.clientDataSeries = clientDataSeries;
}

public boolean isLineSerie()
{
return isLine;
}

public boolean isAreaSerie()
{
return isArea;
}

public ClientDataSeries getClientDataSeries()
{
return clientDataSeries;
}

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

/**
* Type of objects for which the PerformanceIndex is calculated.
*/
Expand All @@ -52,6 +119,7 @@ public enum Type
ACCOUNT("Account", i -> ((Account) i).getUUID()), //$NON-NLS-1$
ACCOUNT_PRETAX("Account-PreTax", i -> ((Account) i).getUUID()), //$NON-NLS-1$
PORTFOLIO("Portfolio", i -> ((Portfolio) i).getUUID()), //$NON-NLS-1$
TYPE_PARENT("Type-Parent-", i -> ((GroupedDataSeries) i).getId()), //$NON-NLS-1$
PORTFOLIO_PRETAX("Portfolio-PreTax", i -> ((Portfolio) i).getUUID()), //$NON-NLS-1$
PORTFOLIO_PLUS_ACCOUNT("[+]Portfolio", i -> ((Portfolio) i).getUUID()), //$NON-NLS-1$
PORTFOLIO_PLUS_ACCOUNT_PRETAX("[+]Portfolio-PreTax", i -> ((Portfolio) i).getUUID()), //$NON-NLS-1$
Expand Down Expand Up @@ -124,6 +192,9 @@ public Object getInstance()

public String getLabel()
{
if (instance instanceof GroupedDataSeries groupedDataSeries)
return groupedDataSeries.getClientDataSeriesLabel() + " (" + label + ")"; //$NON-NLS-1$ //$NON-NLS-2$

return isBenchmark() ? label + " " + Messages.ChartSeriesBenchmarkSuffix : label; //$NON-NLS-1$
}

Expand All @@ -146,6 +217,15 @@ public String getSearchLabel()
buf.append(" (").append(parent.getPathName(false)).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
}

if (instance instanceof GroupedDataSeries
&& ((GroupedDataSeries) instance).getParentObject() instanceof Classification classification)
{
Classification parent = classification.getParent();

if (parent.getParent() != null)
buf.append(" (").append(parent.getPathName(false)).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
}

if (isBenchmark())
buf.append(" ").append(Messages.ChartSeriesBenchmarkSuffix); //$NON-NLS-1$

Expand Down Expand Up @@ -214,7 +294,8 @@ public void setLineWidth(int lineWidth)

public Image getImage()
{
switch (type)
switch (instance instanceof GroupedDataSeries groupedDataSeries ? groupedDataSeries.getParentObjectType()
: type)
{
case SECURITY:
case SECURITY_BENCHMARK:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ private PerformanceIndex calculate(DataSeries series, Interval reportingPeriod)
new WithoutTaxesFilter().filter(pretax.getFilter().filter(client)), converter,
reportingPeriod, warnings);

case TYPE_PARENT:
var instance = ((GroupedDataSeries) series.getInstance());
return instance.getPerformanceIndexMethod(client, converter, reportingPeriod, warnings);

default:
throw new IllegalArgumentException(series.getType().name());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ private PaintItem(Composite parent, DataSeries series)
setToolTipText(TextUtil.wordwrap(security.toInfoString()));
else if (series.getInstance() instanceof Classification classification)
setToolTipText(classification.getPathName(true));
else if (series.getInstance() instanceof GroupedDataSeries groupedDataSeries
&& ((GroupedDataSeries) series.getInstance())
.getParentObject() instanceof Classification classification)
setToolTipText(groupedDataSeries.getClientDataSeriesLabel() + " (" + classification.getPathName(true) //$NON-NLS-1$
+ ")"); //$NON-NLS-1$
else
setToolTipText(series.getLabel());
}
Expand Down
Loading