private void fixIE8FocusCaptureIssue() { Element e = DOM.createInputText(); Style elemStyle = e.getStyle(); elemStyle.setPosition(Position.ABSOLUTE); elemStyle.setTop(-10, Unit.PX); elemStyle.setWidth(0, Unit.PX); elemStyle.setHeight(0, Unit.PX); contentPanel.getElement().appendChild(e); e.focus(); contentPanel.getElement().removeChild(e); }
public VWindow() { super(false, false, true); // no autohide, not modal, shadow // Different style of shadow for windows setShadowStyle("window"); Roles.getDialogRole().set(getElement()); Roles.getDialogRole().setAriaRelevantProperty(getElement(), RelevantValue.ADDITIONS); constructDOM(); contentPanel.addScrollHandler(this); contentPanel.addKeyDownHandler(this); contentPanel.addKeyUpHandler(this); contentPanel.addFocusHandler(this); contentPanel.addBlurHandler(this); }
@Override public void onBrowserEvent(final Event event) { boolean bubble = true; final int type = event.getTypeInt(); final Element target = DOM.eventGetTarget(event); if (resizing || resizeBox == target) { onResizeEvent(event); bubble = false; } else if (isClosable() && target == closeBox) { if (type == Event.ONCLICK) { onCloseClick(); } bubble = false; } else if (target == maximizeRestoreBox) { // handled in connector if (type != Event.ONCLICK) { bubble = false; } } else if (header.isOrHasChild(target) && !dragging) { // dblclick handled in connector if (type != Event.ONDBLCLICK && draggable) { if (type == Event.ONMOUSEDOWN) { headerDragPending = event; } else if (type == Event.ONMOUSEMOVE && headerDragPending != null) { // ie won't work unless this is set here dragging = true; onDragEvent(headerDragPending); onDragEvent(event); headerDragPending = null; } else { headerDragPending = null; } bubble = false; } } else if (dragging || !contents.isOrHasChild(target)) { onDragEvent(event); bubble = false; } else if (type == Event.ONCLICK) { // clicked inside window, ensure to be on top if (!isActive()) { bringToFront(); } } /* * If clicking on other than the content, move focus to the window. * After that this windows e.g. gets all keyboard shortcuts. */ if (type == Event.ONMOUSEDOWN && !contentPanel.getElement().isOrHasChild(target) && target != closeBox && target != maximizeRestoreBox) { contentPanel.focus(); } if (!bubble) { event.stopPropagation(); } else { // Super.onBrowserEvent takes care of Handlers added by the // ClickEventHandler super.onBrowserEvent(event); } }
private int getDecorationWidth() { LayoutManager layoutManager = getLayoutManager(); return layoutManager.getOuterWidth(getElement()) - contentPanel.getElement().getOffsetWidth(); }
@Override public void focus() { contentPanel.focus(); }
@Override public void onScroll(ScrollEvent event) { client.updateVariable(id, "scrollTop", contentPanel.getScrollPosition(), false); client.updateVariable(id, "scrollLeft", contentPanel.getHorizontalScrollPosition(), false); }