@@ -0,0 +1,1880 @@
+package to.etc.domui.component.layout;%0A%0Aimport com.google.common.base.Objects;%0Aimport to.etc.domui.component.buttons.LinkButton;%0Aimport to.etc.domui.component.misc.Icon;%0Aimport to.etc.domui.dom.html.Div;%0Aimport to.etc.domui.dom.html.NodeBase;%0Aimport to.etc.domui.dom.html.Span;%0Aimport to.etc.domui.dom.html.TextNode;%0A%0A/**%0A * A panel with a title bar whose content can be expanded and collapsed.%0A *%0A * @author %3Ca href=%22mailto:jal@etc.to%22%3EFrits Jalvingh%3C/a%3E%0A * Created on 04-06-20.%0A */%0Apublic class ExpandCollapsePanel extends Span %7B%0A%09private NodeBase m_label;%0A%0A%09private NodeBase m_content;%0A%0A%09private final Div m_contentDiv = new Div();%0A%0A%09public ExpandCollapsePanel() %7B%0A%09%7D%0A%0A%09public ExpandCollapsePanel(String label) %7B%0A%09%09setLabel(label);%0A%09%7D%0A%09public ExpandCollapsePanel(String label, String content) %7B%0A%09%09setLabel(label);%0A%09%09setContent(content);%0A%09%7D%0A%0A%09@Override%0A%09final public void createContent() throws Exception %7B%0A%09%09LinkButton lb = new LinkButton(%22%22, Icon.faPlus, a -%3E toggle(a));%0A%09%09add(lb);%0A%09%09add(%22%5Cu00a0%22);%0A%09%09add(m_label);%0A%09%7D%0A%0A%09private void toggle(LinkButton lb) %7B%0A%09%09if(m_contentDiv.isAttached()) %7B%0A%09%09%09m_contentDiv.remove();%0A%09%09%09lb.setImage(Icon.faPlus);%0A%09%09%7D else %7B%0A%09%09%09lb.setImage(Icon.faMinus);%0A%09%09%09m_contentDiv.removeAllChildren();%0A%09%09%09appendAfterMe(m_contentDiv);%0A%09%09%09expandContent(m_contentDiv);%0A%09%09%7D%0A%09%7D%0A%0A%09protected void expandContent(Div contentDiv) %7B%0A%09%09m_contentDiv.add(m_content);%0A%09%7D%0A%0A%09public NodeBase getLabel() %7B%0A%09%09return m_label;%0A%09%7D%0A%0A%09public void setLabel(NodeBase label) %7B%0A%09%09if(label == m_label)%0A%09%09%09return;%0A%09%09m_label = label;%0A%09%09forceRebuild();%0A%09%7D%0A%0A%09public NodeBase getContent() %7B%0A%09%09return m_content;%0A%09%7D%0A%0A%09public void setContent(NodeBase content) %7B%0A%09%09if(Objects.equal(m_content, content))%0A%09%09%09return;%0A%09%09m_content = content;%0A%09%7D%0A%0A%09public void setLabel(String name) %7B%0A%09%09setLabel(new TextNode(name));%0A%09%7D%0A%0A%09public void setContent(String name) %7B%0A%09%09setContent(new TextNode(name));%0A%09%7D%0A%7D%0A

Add ExpandCollapsePanel