15
15
import com .panemu .tiwulfx .control .NumberField ;
16
16
17
17
import javafx .beans .property .DoubleProperty ;
18
+ import javafx .beans .property .SimpleObjectProperty ;
18
19
import javafx .collections .ListChangeListener ;
19
20
import javafx .geometry .Insets ;
20
21
import javafx .geometry .Pos ;
50
51
import ru .shemplo .tbs .entity .IPlanningBond ;
51
52
import ru .shemplo .tbs .entity .ITBSProfile ;
52
53
import ru .shemplo .tbs .gfx .table .TBSEditTableCell ;
54
+ import ru .tinkoff .invest .openapi .model .rest .Currency ;
53
55
54
56
55
57
public class TBBSPlannerTool extends HBox {
@@ -261,6 +263,7 @@ private TableView <IPlanningBond> makeTable () {
261
263
262
264
final var grThreshold = TBSStyles .<IPlanningBond , Number > threshold (0.0 , 1e-6 );
263
265
final var sameMonth = TBSStyles .<IPlanningBond > sameMonth (NOW );
266
+ final var linkIcon = TBSStyles .<IPlanningBond > linkIcon ();
264
267
265
268
table .getColumns ().add (TBSUIUtils .<IPlanningBond , Integer > buildTBSTableColumn ()
266
269
.name ("#" ).tooltip (null )
@@ -283,6 +286,15 @@ private TableView <IPlanningBond> makeTable () {
283
286
.propertyFetcher (bond -> bond .getRWProperty ("code" , () -> "" )).converter ((r , v ) -> v )
284
287
.highlighter (null )
285
288
.build ());
289
+ table .getColumns ().add (TBSUIUtils .<IPlanningBond , Currency > buildTBSTableColumn ()
290
+ .name ("Currency" ).tooltip (null )
291
+ .alignment (Pos .BASELINE_LEFT ).minWidth (80.0 ).sortable (false )
292
+ .propertyFetcher (bond -> new MappingROProperty <> (
293
+ bond .getRWProperty ("code" , () -> "" ),
294
+ TBSBondManager ::getBondCurrency
295
+ ))
296
+ .highlighter (null ).converter ((r , v ) -> String .valueOf (v ))
297
+ .build ());
286
298
table .getColumns ().add (TBSUIUtils .<IPlanningBond , Number > buildTBSTableColumn ()
287
299
.name ("👝" ).tooltip ("Number of lots in your portfolio (sum by all your accounts)" )
288
300
.alignment (Pos .BASELINE_LEFT ).minWidth (50.0 ).sortable (false )
@@ -335,6 +347,12 @@ bond.<Integer> getRWProperty ("customValue", () -> null),
335
347
.fieldSupplier (this ::makeCustomLotsValueField )
336
348
.converter (null ).highlighter (null )
337
349
.build ());
350
+ table .getColumns ().add (TBSUIUtils .<IPlanningBond , LinkedSymbolOrImage > buildTBSIconTableColumn ()
351
+ .name ("🗑" ).tooltip (null ).minWidth (30.0 ).sortable (false )
352
+ .propertyFetcher (b -> new SimpleObjectProperty <> (LinkedSymbolOrImage .symbol ("⌫" , b .getCode ())))
353
+ .onClick ((me , cell ) -> TBSPlanner .getInstance ().removeBond (cell .getItem ().getLink ()))
354
+ .highlighter (linkIcon )
355
+ .build ());
338
356
339
357
return table ;
340
358
}
0 commit comments