Example usage for com.google.gwt.user.client DOM asOld

List of usage examples for com.google.gwt.user.client DOM asOld

Introduction

In this page you can find the example usage for com.google.gwt.user.client DOM asOld.

Prototype

public static Element asOld(Element elem) 

Source Link

Document

Provided as a convenient way to upcast values statically typed as Element to Element .

Usage

From source file:com.example.test.client.VMultiSelectCalendarWidget.java

License:Apache License

@Override
public com.google.gwt.user.client.Element getSubPartElement(String subPart) {
    if (subPart.startsWith(SUBPART_DAY)) {
        // Zero or negative ids map to days in the preceding month,
        // past-the-end-of-month ids to days in the following month
        int dayOfMonth = Integer.parseInt(subPart.substring(SUBPART_DAY.length()));
        Date date = new Date(displayedMonth.getYear(), displayedMonth.getMonth(), dayOfMonth);
        Iterator<Widget> iter = daysTable.iterator();
        while (iter.hasNext()) {
            Widget w = iter.next();//from   ww  w. j av a2s. co  m
            if (w instanceof DayWidget) {
                DayWidget day = (DayWidget) w;
                if (day.getDate().equals(date)) {
                    return day.getElement();
                }
            }
        }
    }

    if (SUBPART_MONTH_YEAR_HEADER.equals(subPart)) {
        return DOM.asOld((Element) getCellFormatter().getElement(0, 2).getChild(0));
    }
    return null;
}

From source file:com.extjs.gxt.ui.client.widget.treepanel.TreePanel.java

License:sencha.com license

private void ensureFocusElement() {
    if (focusEl != null) {
        focusEl.removeFromParent();//from   ww  w  .j a  va  2s. co m
    }
    focusEl = new El(DOM.asOld(focusImpl.createFocusable()));
    focusEl.dom.getStyle().setProperty("outline", "none");
    getElement().appendChild(focusEl.dom);
    if (focusEl.dom.hasChildNodes()) {
        focusEl.dom.getFirstChildElement().getStyle().setProperty("outline", "none");
        com.google.gwt.dom.client.Style focusElStyle = focusEl.dom.getFirstChildElement().getStyle();
        focusElStyle.setProperty("borderWidth", "0px");
        focusElStyle.setProperty("fontSize", "1px");
        focusElStyle.setPropertyPx("lineHeight", 1);
    }
    focusEl.setLeft(0);
    focusEl.setTop(0);
    focusEl.makePositionable(true);
    focusEl.addEventsSunk(Event.FOCUSEVENTS);
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.jqueryfileupload.CubaFileUploadProgressWindow.java

License:Apache License

@Override
protected com.google.gwt.user.client.Element getContainerElement() {
    // in GWT 1.5 this method is used in PopupPanel constructor
    if (contents == null) {
        return super.getContainerElement();
    }/*  w  ww .  j  av  a  2 s  .  c o m*/
    return DOM.asOld(contents);
}

From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.tabsheet.VDDTabSheet.java

License:Apache License

/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 * /*from w ww.  j a  v  a2 s. com*/
 * @param event
 *            The drag event
 */
protected void updateDragDetails(VDragEvent event) {
    Element element = event.getElementOver();
    if (element == null)
        return;

    if (tabBar.getElement().isOrHasChild(element)) {
        Widget w = Util.findWidget(element, null);

        if (w == tabBar) {
            // Ove3r the spacer

            // Add index
            event.getDropDetails().put(Constants.DROP_DETAIL_TO, tabBar.getWidgetCount() - 1);

            // Add drop location
            event.getDropDetails().put(Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION,
                    HorizontalDropLocation.RIGHT);

        } else {

            // Add index
            event.getDropDetails().put(Constants.DROP_DETAIL_TO, getTabPosition(w));

            // Add drop location
            HorizontalDropLocation location = VDragDropUtil.getHorizontalDropLocation(DOM.asOld(element),
                    Util.getTouchOrMouseClientX(event.getCurrentGwtEvent()), tabLeftRightDropRatio);
            event.getDropDetails().put(Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION, location);
        }

        // Add mouse event details
        MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(),
                getElement());
        event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize());
    }
}

From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.tabsheet.VDDTabSheet.java

License:Apache License

/**
 * Emphasisizes a container element/*w  w w . j  a va 2s .c o m*/
 * 
 * @param element
 */
protected void emphasis(Element element, VDragEvent event) {

    boolean internalDrag = event.getTransferable().getDragSource() == this;

    if (tabBar.getElement().isOrHasChild(element)) {
        Widget w = Util.findWidget(element, null);

        if (w == tabBar && !internalDrag) {
            // Over spacer
            Element spacerContent = spacer.getChild(0).cast();
            spacerContent.appendChild(newTab);
            currentlyEmphasised = element;

        } else if (w instanceof VCaption) {

            // Over a tab
            HorizontalDropLocation location = VDragDropUtil.getHorizontalDropLocation(DOM.asOld(element),
                    Util.getTouchOrMouseClientX(event.getCurrentGwtEvent()), tabLeftRightDropRatio);

            if (location == HorizontalDropLocation.LEFT) {

                int index = getTabPosition(w);

                if (index == 0) {

                    currentlyEmphasised = tabBar.getWidget(0).getElement().getFirstChildElement().cast();
                    currentlyEmphasised.addClassName(CLASSNAME_NEW_TAB_LEFT);
                } else {
                    Widget prevTab = tabBar.getWidget(index - 1);
                    currentlyEmphasised = prevTab.getElement();
                    currentlyEmphasised.addClassName(CLASSNAME_NEW_TAB_RIGHT);
                }

            } else if (location == HorizontalDropLocation.RIGHT) {
                int index = getTabPosition(w);
                currentlyEmphasised = tabBar.getWidget(index).getElement();
                currentlyEmphasised.addClassName(CLASSNAME_NEW_TAB_RIGHT);
            } else {
                int index = getTabPosition(w);
                currentlyEmphasised = tabBar.getWidget(index).getElement();
                currentlyEmphasised.addClassName(CLASSNAME_NEW_TAB_CENTER);
            }

        }
    }
}

From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.VDDAbstractOrderedLayoutDropHandler.java

License:Apache License

protected Slot findSlotAtPosition(int clientX, int clientY, NativeEvent event) {
    com.google.gwt.dom.client.Element elementUnderMouse = WidgetUtil.getElementFromPoint(clientX, clientY);
    if (getLayout().getElement() != elementUnderMouse) {
        return getSlot(DOM.asOld(elementUnderMouse), event);
    }/*from w  ww. j  a  va  2s.  com*/
    return null;
}

From source file:com.haulmont.cuba.web.widgets.client.tabsheet.CubaTabSheetWidget.java

License:Apache License

protected void handleBadDD(NativeEvent event) {
    Element target = WidgetUtil.getElementUnderMouse(event);
    if (target == null) {
        VDragAndDropManager.get().interruptDrag();
        return;//from w  ww. j a v  a  2 s . co  m
    }

    Node targetParent = DOM.asOld(target).getParentNode();
    if (!getElement().isOrHasChild(targetParent)) {
        VDragAndDropManager.get().interruptDrag();
    }
}

From source file:com.ritchey.client.view.CellPanel.java

License:Apache License

protected com.google.gwt.user.client.Element getBody() {
    return DOM.asOld(body);
}

From source file:com.ritchey.client.view.CellPanel.java

License:Apache License

protected com.google.gwt.user.client.Element getTable() {
    return DOM.asOld(table);
}

From source file:com.ritchey.client.view.CellPanel.java

License:Apache License

@SuppressWarnings("deprecation")
protected void setCellHorizontalAlignment(Element td, HorizontalAlignmentConstant align) {
    setCellHorizontalAlignment(DOM.asOld(td), align);
}