@@ -287,8 +287,14 @@ public Object getValueAt(Object node, int column) {
287287
288288 if (transactionSummary .getChildCount () <= 0 ) return null ;
289289
290- final boolean shouldConvertPenceToPound = org . yccheok . jstock . portfolio . Utils . shouldConvertPenceToPound ( portfolioRealTimeInfo , (( Transaction )transactionSummary .getChildAt (0 )).getStock ().code ) ;
290+ final Code code = (( Transaction )transactionSummary .getChildAt (0 )).getStock ().code ;
291291
292+ final boolean shouldConvertPenceToPound = org .yccheok .jstock .portfolio .Utils .shouldConvertPenceToPound (portfolioRealTimeInfo , code );
293+
294+ final boolean shouldDisplayCurrencyInfoForValue = this .portfolioManagementJPanel .shouldDisplayCurrencyInfoForValue ();
295+
296+ final Currency stockCurrency = shouldDisplayCurrencyInfoForValue ? org .yccheok .jstock .portfolio .Utils .getStockCurrency (portfolioRealTimeInfo , code ) : null ;
297+
292298 switch (column ) {
293299 case 0 :
294300 return ((Transaction )transactionSummary .getChildAt (0 )).getStock ().symbol ;
@@ -313,45 +319,45 @@ public Object getValueAt(Object node, int column) {
313319 case 5 :
314320 if (shouldConvertPenceToPound == false ) {
315321 if (isFeeCalculationEnabled ) {
316- return transactionSummary .getNetTotal ();
322+ return DoubleWithCurrency . create ( transactionSummary .getNetTotal (), stockCurrency );
317323 } else {
318- return transactionSummary .getTotal ();
324+ return DoubleWithCurrency . create ( transactionSummary .getTotal (), stockCurrency );
319325 }
320326 } else {
321327 if (isFeeCalculationEnabled ) {
322- return transactionSummary .getNetTotal () / 100.0 ;
328+ return DoubleWithCurrency . create ( transactionSummary .getNetTotal () / 100.0 , stockCurrency ) ;
323329 } else {
324- return transactionSummary .getTotal () / 100.0 ;
330+ return DoubleWithCurrency . create ( transactionSummary .getTotal () / 100.0 , stockCurrency ) ;
325331 }
326332 }
327333
328334 case 6 :
329335 if (shouldConvertPenceToPound == false ) {
330336 if (isFeeCalculationEnabled ) {
331- return transactionSummary .getNetReferenceTotal ();
337+ return DoubleWithCurrency . create ( transactionSummary .getNetReferenceTotal (), stockCurrency );
332338 } else {
333- return transactionSummary .getReferenceTotal ();
339+ return DoubleWithCurrency . create ( transactionSummary .getReferenceTotal (), stockCurrency );
334340 }
335341 } else {
336342 if (isFeeCalculationEnabled ) {
337- return transactionSummary .getNetReferenceTotal () / 100.0 ;
343+ return DoubleWithCurrency . create ( transactionSummary .getNetReferenceTotal () / 100.0 , stockCurrency ) ;
338344 } else {
339- return transactionSummary .getReferenceTotal () / 100.0 ;
345+ return DoubleWithCurrency . create ( transactionSummary .getReferenceTotal () / 100.0 , stockCurrency ) ;
340346 }
341347 }
342348
343349 case 7 :
344350 if (shouldConvertPenceToPound == false ) {
345351 if (isFeeCalculationEnabled ) {
346- return getNetGainLossValue (transactionSummary );
352+ return DoubleWithCurrency . create ( getNetGainLossValue (transactionSummary ), stockCurrency );
347353 } else {
348- return getGainLossValue (transactionSummary );
354+ return DoubleWithCurrency . create ( getGainLossValue (transactionSummary ), stockCurrency );
349355 }
350356 } else {
351357 if (isFeeCalculationEnabled ) {
352- return getNetGainLossValue (transactionSummary ) / 100.0 ;
358+ return DoubleWithCurrency . create ( getNetGainLossValue (transactionSummary ) / 100.0 , stockCurrency ) ;
353359 } else {
354- return getGainLossValue (transactionSummary ) / 100.0 ;
360+ return DoubleWithCurrency . create ( getGainLossValue (transactionSummary ) / 100.0 , stockCurrency ) ;
355361 }
356362 }
357363
@@ -379,8 +385,14 @@ public Object getValueAt(Object node, int column) {
379385 if (node instanceof Transaction ) {
380386 final Transaction transaction = (Transaction )node ;
381387
382- final boolean shouldConvertPenceToPound = org . yccheok . jstock . portfolio . Utils . shouldConvertPenceToPound ( portfolioRealTimeInfo , transaction .getStock ().code ) ;
388+ final Code code = transaction .getStock ().code ;
383389
390+ final boolean shouldConvertPenceToPound = org .yccheok .jstock .portfolio .Utils .shouldConvertPenceToPound (portfolioRealTimeInfo , code );
391+
392+ final boolean shouldDisplayCurrencyInfoForValue = this .portfolioManagementJPanel .shouldDisplayCurrencyInfoForValue ();
393+
394+ final Currency stockCurrency = shouldDisplayCurrencyInfoForValue ? org .yccheok .jstock .portfolio .Utils .getStockCurrency (portfolioRealTimeInfo , code ) : null ;
395+
384396 switch (column ) {
385397 case 0 :
386398 return (transaction ).getStock ().symbol ;
@@ -400,45 +412,45 @@ public Object getValueAt(Object node, int column) {
400412 case 5 :
401413 if (shouldConvertPenceToPound == false ) {
402414 if (isFeeCalculationEnabled ) {
403- return transaction .getNetTotal ();
415+ return DoubleWithCurrency . create ( transaction .getNetTotal (), stockCurrency );
404416 } else {
405- return transaction .getTotal ();
417+ return DoubleWithCurrency . create ( transaction .getTotal (), stockCurrency );
406418 }
407419 } else {
408420 if (isFeeCalculationEnabled ) {
409- return transaction .getNetTotal () / 100.0 ;
421+ return DoubleWithCurrency . create ( transaction .getNetTotal () / 100.0 , stockCurrency ) ;
410422 } else {
411- return transaction .getTotal () / 100.0 ;
423+ return DoubleWithCurrency . create ( transaction .getTotal () / 100.0 , stockCurrency ) ;
412424 }
413425 }
414426
415427 case 6 :
416428 if (shouldConvertPenceToPound == false ) {
417429 if (isFeeCalculationEnabled ) {
418- return transaction .getNetReferenceTotal ();
430+ return DoubleWithCurrency . create ( transaction .getNetReferenceTotal (), stockCurrency );
419431 } else {
420- return transaction .getReferenceTotal ();
432+ return DoubleWithCurrency . create ( transaction .getReferenceTotal (), stockCurrency );
421433 }
422434 } else {
423435 if (isFeeCalculationEnabled ) {
424- return transaction .getNetReferenceTotal () / 100.0 ;
436+ return DoubleWithCurrency . create ( transaction .getNetReferenceTotal () / 100.0 , stockCurrency ) ;
425437 } else {
426- return transaction .getReferenceTotal () / 100.0 ;
438+ return DoubleWithCurrency . create ( transaction .getReferenceTotal () / 100.0 , stockCurrency ) ;
427439 }
428440 }
429441
430442 case 7 :
431443 if (shouldConvertPenceToPound == false ) {
432444 if (isFeeCalculationEnabled ) {
433- return getNetGainLossValue (transaction );
445+ return DoubleWithCurrency . create ( getNetGainLossValue (transaction ), stockCurrency );
434446 } else {
435- return getGainLossValue (transaction );
447+ return DoubleWithCurrency . create ( getGainLossValue (transaction ), stockCurrency );
436448 }
437449 } else {
438450 if (isFeeCalculationEnabled ) {
439- return getNetGainLossValue (transaction ) / 100.0 ;
451+ return DoubleWithCurrency . create ( getNetGainLossValue (transaction ) / 100.0 , stockCurrency ) ;
440452 } else {
441- return getGainLossValue (transaction ) / 100.0 ;
453+ return DoubleWithCurrency . create ( getGainLossValue (transaction ) / 100.0 , stockCurrency ) ;
442454 }
443455 }
444456
0 commit comments