Hello!
I use a little modified class from the
ComponentTree Add-on
It built with com.vaadin.ui.CssLayout and worked correctly in other web browsers up to Vaadin ver. 6.5.7.
Starting from Vaadin ver. 6.6.0 I must to switch on Compatibility-View in IE 9, otherwise blocks of tree do not throw open. But in Google Chrome it go on to work correctly.
import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.themes.BaseTheme;
public class ComponentTree extends CssLayout {
/**
*
*/
private static final long serialVersionUID = 1L;
private final ThemeResource ICON_COLLAPSED = new ThemeResource("img/componenttree-node-collapsed.png");
private final ThemeResource ICON_EXPANDED = new ThemeResource("img/componenttree-node-expanded.png");
public ComponentTree() {
super();
}
public ComponentTreeItem addChild(Component c) {
ComponentTreeItem i = new ComponentTreeItem(c);
addComponent(i);
return i;
}
public class ComponentTreeItem extends CssLayout implements ClickListener {
private static final long serialVersionUID = -1436990419814629056L;
private Button expander;
private boolean expanded = false;
private CssLayout children;
private ComponentTreeItem blockParent;
private Action onZoomIn;
private ClickListener headerClickListener;
public ComponentTreeItem(Component c) {
super();
this.expander = new Button();
this.expander.setIcon(ICON_COLLAPSED);
this.expander.addStyleName(BaseTheme.BUTTON_LINK);
this.expander.addStyleName("componenttree-expander");
this.expander.addListener(this);
this.expander.setVisible(false);
this.headerClickListener = this;
this.children = new CssLayout();
this.children.setVisible(false);
this.children.setStyleName("componenttree-children");
this.setStyleName("componenttree-child");
this.addComponent(this.expander);
this.addComponent(c);
this.addComponent(this.children);
}
public ComponentTreeItem addChild(Component c) {
ComponentTreeItem i = new ComponentTreeItem(c);
i.setBlockParent(this);
this.expander.setVisible(true);
this.children.addComponent(i);
this.setStyleName("componenttree-parent");
return i;
}
public ComponentTreeItem getBlockParent() {
return blockParent;
}
private void setBlockParent(ComponentTreeItem blockParent) {
this.blockParent = blockParent;
}
public void removeChild(ComponentTreeItem c) {
this.children.removeComponent(c);
}
public void buttonClick(ClickEvent event) {
this.expanded = !this.expanded;
this.expander.setIcon(this.expanded ? ICON_EXPANDED : ICON_COLLAPSED);
this.children.setVisible(this.expanded);
if (this.expanded) {
onZoomIn.invoke();
}
}
public void setOnZoomIn(Action onZoomIn) {
this.onZoomIn = onZoomIn;
}
public void zoomIn() {
this.expanded = true;
this.expander.setIcon(this.expanded ? ICON_EXPANDED : ICON_COLLAPSED);
this.children.setVisible(this.expanded);
}
public ClickListener getHeaderClickListener() {
return headerClickListener;
}
}
}
Is this a bug?
Thanks for the answer
Best regards