private void setStyle() { if (isOpen) { images.disclosurePanelOpen().applyTo(iconImage); } else { images.disclosurePanelClosed().applyTo(iconImage); } }
private DefaultHeader(final DisclosurePanelImages images, final String text) { super(DOM.createAnchor()); this.images = images; final Element elem = getElement(); DOM.setElementProperty(elem, "href", "javascript:void(0);"); // Avoids layout problems from having blocks in inlines. DOM.setStyleAttribute(elem, "display", "block"); sinkEvents(Event.ONCLICK); setStyleName(STYLENAME_HEADER); iconImage = isOpen ? images.disclosurePanelOpen().createImage() : images.disclosurePanelClosed().createImage(); // I do not need any Widgets here, just a DOM structure. final Element root = DOM.createTable(); final Element tbody = DOM.createTBody(); final Element tr = DOM.createTR(); final Element imageTD = DOM.createTD(); labelTD = DOM.createTD(); setElement(root); DOM.appendChild(root, tbody); DOM.appendChild(tbody, tr); DOM.appendChild(tr, imageTD); DOM.appendChild(tr, labelTD); // set image TD to be same width as image. DOM.setElementProperty(imageTD, "align", "center"); DOM.setElementProperty(imageTD, "valign", "middle"); DOM.setStyleAttribute(imageTD, "width", iconImage.getWidth() + "px"); DOM.appendChild(imageTD, iconImage.getElement()); setText(text); addEventHandler(this); setStyle(); }