Search in sources :

Example 96 with Element

use of com.google.gwt.dom.client.Element in project cuba by cuba-platform.

the class CubaTabSheetWidget method handleBadDD.

protected void handleBadDD(NativeEvent event) {
    Element target = WidgetUtil.getElementUnderMouse(event);
    if (target == null) {
        VDragAndDropManager.get().interruptDrag();
        return;
    }
    Node targetParent = DOM.asOld(target).getParentNode();
    if (!getElement().isOrHasChild(targetParent)) {
        VDragAndDropManager.get().interruptDrag();
    }
}
Also used : Element(com.google.gwt.dom.client.Element) Node(com.google.gwt.dom.client.Node)

Example 97 with Element

use of com.google.gwt.dom.client.Element in project cuba by cuba-platform.

the class CubaTreeTableConnector method init.

@Override
protected void init() {
    super.init();
    getWidget()._delegate.cellClickListener = new TableCellClickListener() {

        @Override
        public void onClick(String columnKey, int rowKey) {
            getRpcProxy(CubaTableServerRpc.class).onClick(columnKey, String.valueOf(rowKey));
        }
    };
    tooltipHandlerRegistration = Event.addNativePreviewHandler(new Event.NativePreviewHandler() {

        @Override
        public void onPreviewNativeEvent(Event.NativePreviewEvent event) {
            if (event.getTypeInt() != Event.ONMOUSEMOVE || !Element.is(event.getNativeEvent().getEventTarget())) {
                return;
            }
            Element element = Element.as(event.getNativeEvent().getEventTarget());
            if ("div".equalsIgnoreCase(element.getTagName())) {
                String className = element.getClassName();
                if (className != null && (className.contains("v-table-caption-container") || className.contains("v-table-footer-container"))) {
                    DomEvent.fireNativeEvent(event.getNativeEvent(), getWidget());
                }
            }
        }
    });
}
Also used : TableCellClickListener(com.haulmont.cuba.web.toolkit.ui.client.tableshared.TableCellClickListener) Element(com.google.gwt.dom.client.Element)

Example 98 with Element

use of com.google.gwt.dom.client.Element in project cuba by cuba-platform.

the class CubaTreeTableConnector method getTooltipInfo.

@Override
public TooltipInfo getTooltipInfo(Element element) {
    if (getState().columnDescriptions != null) {
        Element targetHeaderElement = findCurrentOrParentTd(element);
        if (targetHeaderElement != null) {
            // if column has description
            int childIndex = DOM.getChildIndex(targetHeaderElement.getParentElement(), targetHeaderElement);
            String columnKey = getWidget().tHead.getHeaderCell(childIndex).getColKey();
            if (columnKey != null) {
                String columnDescription = getState().columnDescriptions.get(columnKey);
                if (columnDescription != null && !columnDescription.isEmpty()) {
                    return new TooltipInfo(columnDescription);
                }
            }
        }
    }
    if (getState().aggregationDescriptions != null) {
        Element targetAggregatedElement = findCurrentOrParentTd(element);
        if (targetAggregatedElement != null && (targetAggregatedElement.hasClassName("v-table-aggregation-cell") || targetAggregatedElement.hasClassName("v-table-footer-container"))) {
            int childIndex = DOM.getChildIndex(targetAggregatedElement.getParentElement(), targetAggregatedElement);
            String columnKey = getWidget().tHead.getHeaderCell(childIndex).getColKey();
            if (columnKey != null) {
                String columnTooltip = getState().aggregationDescriptions.get(columnKey);
                if (columnTooltip != null && !columnTooltip.isEmpty()) {
                    return new TooltipInfo(columnTooltip);
                }
            }
        }
    }
    if (element != getWidget().getElement()) {
        Object node = WidgetUtil.findWidget(element, CubaTreeTableWidget.CubaTreeTableBody.CubaTreeTableRow.class);
        if (node != null) {
            CubaTreeTableWidget.CubaTreeTableBody.CubaTreeTableRow row = (CubaTreeTableWidget.CubaTreeTableBody.CubaTreeTableRow) node;
            return row.getTooltip(element);
        }
    }
    return super.getTooltipInfo(element);
}
Also used : Element(com.google.gwt.dom.client.Element)

Example 99 with Element

use of com.google.gwt.dom.client.Element in project pentaho-platform by pentaho.

the class SolutionBrowserPanel method adjustHeight.

private void adjustHeight() {
    Element pucHeader = DOM.getElementById("pucHeader");
    if (pucHeader != null) {
        final boolean isIE = RootPanel.getBodyElement().getClassName().contains("IE8") || RootPanel.getBodyElement().getClassName().contains("IE9") || RootPanel.getBodyElement().getClassName().contains("IE10");
        final int offset = pucHeader.getOffsetHeight();
        setElementHeightOffset(navigatorAndContentSplit.getElement(), -1 * offset);
        setElementHeightOffset(contentTabPanel.getElement(), isIE ? -1 * (offset + 36) : -1 * offset);
        Timer t = new Timer() {

            public void run() {
                setElementHeightOffset(navigatorAndContentSplit.getElement(), -1 * offset);
                setElementHeightOffset(contentTabPanel.getElement(), isIE ? -1 * (offset + 36) : -1 * offset);
            }
        };
        t.schedule(100);
    }
}
Also used : Timer(com.google.gwt.user.client.Timer) Element(com.google.gwt.dom.client.Element)

Example 100 with Element

use of com.google.gwt.dom.client.Element in project activityinfo by bedatadriven.

the class OfflineMenu method updatePendingCountIcon.

private void updatePendingCountIcon(int count) {
    Element countElement = Document.get().getElementById("pending-count");
    countElement.setInnerText(Integer.toString(count));
    pendingChangesItem.setText(I18N.MESSAGES.pendingChanges(count));
}
Also used : Element(com.google.gwt.dom.client.Element)

Aggregations

Element (com.google.gwt.dom.client.Element)340 DivElement (com.google.gwt.dom.client.DivElement)19 TableRowElement (com.google.gwt.dom.client.TableRowElement)19 NativeEvent (com.google.gwt.dom.client.NativeEvent)16 Test (org.junit.Test)14 EventTarget (com.google.gwt.dom.client.EventTarget)11 SVGSVGElement (elemental.svg.SVGSVGElement)11 InputElement (com.google.gwt.dom.client.InputElement)10 Node (com.google.gwt.dom.client.Node)9 TableCellElement (com.google.gwt.dom.client.TableCellElement)9 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)8 AnchorElement (com.google.gwt.dom.client.AnchorElement)8 ImageElement (com.google.gwt.dom.client.ImageElement)8 LabelElement (com.google.gwt.dom.client.LabelElement)8 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)8 Image (com.google.gwt.user.client.ui.Image)8 SpanElement (com.google.gwt.dom.client.SpanElement)7 Style (com.google.gwt.dom.client.Style)7 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)7 Widget (com.google.gwt.user.client.ui.Widget)7