Hi guys I’m really stuck on that problem… Please look at the basic class below and the comments
public class PlanningWidget extends Composite {
private @UiField FooterPlanningLine footerPlanningLine;
private @UiField FooterLeft footerLeft;
public void paintBackground() {
footerPlanningLine.paintBackground();
}
}
public abstract class Composite extends Widget implements IsRenderable { … }
public class FooterPlanningLine extends Composite {
//constructor
public void paintBackground() {
//I want to call this method regardless from FooterLeft or PlanningWidget…
}
}
public class FooterLeft extends Composite {
private Canvas canvas;
//constructor
canvas.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// HERE I'D LIKE TO CALL THE FooterPlanningLine/PlanningWidget paintBackground() METHOD
}
}
These class are client-sided. I have tried to do :
NodeList<Element> nodeList = Document.get().getElementsByTagName("footerPanel");
// the line above gets the element of type FooterPlanningLine from the DOM
Element footerLp = nodeList.getItem(0);[i]
//The Element that I have to convert to Widget
[/i]
Anchor.wrap(footerLp);
Widget myWidget = new Widget();
[i]
// I WAS SUPPOSED TO DO THE THING BELOW BUT setElement is DEPRECATED ! Can’t use it anymore
[/i]
myWidget.setElement(footerLp);
((FooterPlanningLine) w).paintBackground();
/*
How can I call the FooterPlanningLine paintBackground() method OR PlanningWidget paintBackground() method from the FooterLeft click listener ???
I’m really stuck … Thank you for help. */
}