sliderEl.addClassName(cls);
wrapper.appendChild(sliderEl);
final PanelPosition self = new PanelPosition();
self.node = node;
sliderEl.setOnmousedown(new EventListener() {
@Override
public void handleEvent(Event evt) {
evt.preventDefault();
final PanelNode siblingNode = first ? getPreviousSibling(node) : node.next;
final Element sibling;
if (siblingNode == null) {
sibling = null;
} else {
self.next = new PanelPosition();
sibling = siblingNode.el;
self.next.node = siblingNode;
}
PanelPosition affected = self.next;
MouseEvent e = (MouseEvent) evt;
if (vertical) {
self.mouseStart = e.getClientY();
// We parse from the css values set (which we set before this is called),
// so we don't have to do any measuring
// or compensate for weird offsets in the client elements.
self.posStart = CssUtils.parsePixels(wrapper.getStyle().getTop());
self.sizeStart = CssUtils.parsePixels(wrapper.getStyle().getHeight());
if (sibling != null) {
affected.posStart = CssUtils.parsePixels(sibling.getStyle().getTop());
affected.sizeStart = CssUtils.parsePixels(sibling.getStyle().getHeight());
}
} else {
self.mouseStart = e.getClientX();
self.posStart = CssUtils.parsePixels(wrapper.getStyle().getLeft());
self.sizeStart = CssUtils.parsePixels(wrapper.getStyle().getWidth());
if (sibling != null) {
affected.posStart = CssUtils.parsePixels(sibling.getStyle().getLeft());
affected.sizeStart = CssUtils.parsePixels(sibling.getStyle().getWidth());
}
}
final EventRemover[] remover = new EventRemover[2];
// TODO put these event listeners over an empty iframe, to cover up any iframes on page.
remover[0] = Browser.getWindow().addEventListener("mouseup", new EventListener() {
@Override
public void handleEvent(Event evt) {
if (remover[0] != null){
remover[0].remove();
remover[1].remove();
onResizeFinished(siblingNode, self);
remover[0] = null;
}
}
}, true);
remover[1] = Browser.getWindow().addEventListener("mousemove", new EventListener() {
@Override
public void handleEvent(Event evt) {
evt.preventDefault();
final MouseEvent e = (MouseEvent) evt;
final Element el = self.next == null ? null : self.next.node.el;