Question

I need to have a DisclosurePanel with a FlexTable widget as the header and include the arrow icon with animation.

When adding a Widget to a DisclosurePanel, the arrow icon is disabled/replaced by the widget.

I've decided I need to either create a new class that extends FlexTable and has a cell with the arrow icon & the appropriate click handler to animate the icon, or create a wrapper class for DisclosurePanel (as it is a final class). Do either of these seem like a viable solution?

Was it helpful?

Solution

I would create a more generic Composite widget called HeaderWidgetWithArrow that contains

  1. The down arrow image
  2. Any arbitrary widget (such as a FlexTable)

The way if you want to include the arrow for a disclosure panel and say, a HorizontalPanel, you could just re-use the HeaderWidgetWithArrow for that.

Either way, I would not recommend extending FlexTable or DisclosurePanel. You should favor composition over inheritance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top