Skip to content

Commit

Permalink
AttributeColumn: For "days left" column, show actual date as tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
pfalcon authored and buchen committed Jan 3, 2025
1 parent c1959a9 commit 4e68479
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import name.abuchen.portfolio.model.LimitPriceSettings;
import name.abuchen.portfolio.model.Security;
import name.abuchen.portfolio.model.SecurityPrice;
import name.abuchen.portfolio.money.Values;
import name.abuchen.portfolio.ui.Images;
import name.abuchen.portfolio.ui.Messages;
import name.abuchen.portfolio.ui.util.Colors;
Expand Down Expand Up @@ -446,6 +447,17 @@ public String getText(Object element)
LocalDate value = (LocalDate) attributable.getAttributes().get(attribute);
return value == null ? null : String.valueOf(ChronoUnit.DAYS.between(value, LocalDate.now()));
}

@Override
public String getToolTipText(Object element)
{
Attributable attributable = Adaptor.adapt(Attributable.class, element);
if (attributable == null)
return null;

LocalDate value = (LocalDate) attributable.getAttributes().get(attribute);
return value == null ? null : Values.Date.format(value);
}
});

column.setVisible(false);
Expand Down

0 comments on commit 4e68479

Please sign in to comment.