• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Util类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vaadin.client.Util的典型用法代码示例。如果您正苦于以下问题:Java Util类的具体用法?Java Util怎么用?Java Util使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Util类属于com.vaadin.client包,在下文中一共展示了Util类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setInternalWidths

import com.vaadin.client.Util; //导入依赖的package包/类
void setInternalWidths() {
    DOM.setStyleAttribute(getElement(), "position", "relative");
    int bordersAndPaddings = Util.measureHorizontalPaddingAndBorder(
            buttons.getElement(), 0)
            + Util.measureHorizontalPaddingAndBorder(
                    moveButtons.getElement(), 0);
    int buttonWidth = Util.getRequiredWidth(buttons);
    int moveButtonWidth = Util.getRequiredWidth(moveButtons);
    int totalWidth = getOffsetWidth();

    int spaceForSelect = (totalWidth - buttonWidth - moveButtonWidth - bordersAndPaddings) / 2;

    options.setWidth(spaceForSelect + "px");
    if (optionsCaption != null) {
        optionsCaption.setWidth(spaceForSelect + "px");
    }

    selections.setWidth(spaceForSelect + "px");
    if (selectionsCaption != null) {
        selectionsCaption.setWidth(spaceForSelect + "px");
    }
    int captionWidth = totalWidth - moveButtonWidth;
    captionWrapper.setWidth(captionWidth + "px");
}
 
开发者ID:tepi,项目名称:ListBuilder,代码行数:25,代码来源:VListBuilder.java


示例2: onDragStart

import com.vaadin.client.Util; //导入依赖的package包/类
protected void onDragStart(NativeEvent event) {
    if (dragStartY >= 0) {
        // VConsole.log("Ignore onDragStart");
        return;
    }

    Element element = Element.as(event.getEventTarget());
    if (!overlayElement.isOrHasChild(element)) {
        // VConsole.log("onDragStart not at overlay");
        return;
    }

    // VConsole.log("onDragStart");

    dragStartY = Util.getTouchOrMouseClientY(event);
    dragStartIndex = GwtPicker.this.currentValue;
    setTransitionMode(TransitionMode.DRAGGING);
    event.stopPropagation();

}
 
开发者ID:alump,项目名称:Picker,代码行数:21,代码来源:GwtPicker.java


示例3: onDragMove

import com.vaadin.client.Util; //导入依赖的package包/类
protected void onDragMove(NativeEvent event) {
    if (dragStartY < 0) {
        return;
    }

    int dragDist = Math.round(dragStartY
            - Util.getTouchOrMouseClientY(event));

    if (!dragged) {
        if (Math.abs(dragDist) < DRAG_TRESSHOLD_Y) {
            dragged = true;
            Event.setCapture(captureElement);
            event.preventDefault();
            event.stopPropagation();
        }
    } else {
        int top = GwtPicker.this.scrollTopValue - dragDist;
        setScrollTop(top, false);
        GwtPicker.this.setValueAtMiddle(false, false);
        event.preventDefault();
        event.stopPropagation();
    }

}
 
开发者ID:alump,项目名称:Picker,代码行数:25,代码来源:GwtPicker.java


示例4: createResponseHandler

import com.vaadin.client.Util; //导入依赖的package包/类
@Override
protected XhrResponseHandler createResponseHandler() {
    return new XhrResponseHandler() {
        protected int serverTimeOnClient;

        @Override
        public void onResponseReceived(Request request, Response response) {
            int statusCode = response.getStatusCode();
            if (statusCode == 200) {
                serverTimeOnClient = (int) Util.round(Profiler.getRelativeTimeMillis() - requestStartTime, 0);
            }
            super.onResponseReceived(request, response);
        }

        @Override
        protected void beforeHandlingMessage(ValueMap json) {
            super.beforeHandlingMessage(json);
            ScreenClientProfiler profiler = ScreenClientProfiler.getInstance();
            String profilerMarker = ScreenClientProfiler.getProfilerMarkerFromJson(json);
            if (profilerMarker != null) {
                int serverTimeOnServer = ScreenClientProfiler.getServerTimeFromJson(json);
                if (serverTimeOnServer > 0) {
                    profiler.registerServerTime(profilerMarker, serverTimeOnServer);
                    profiler.registerNetworkTime(profilerMarker, serverTimeOnClient - serverTimeOnServer);
                } else {
                    profiler.registerServerTime(profilerMarker, serverTimeOnClient);
                }
                profiler.registerEventTs(profilerMarker, ScreenClientProfiler.getEventTsFromJson(json));
            }
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:33,代码来源:CubaXhrConnection.java


示例5: onBrowserEvent

import com.vaadin.client.Util; //导入依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
    if (DOM.eventGetType(event) == Event.ONCLICK) {
        Element target = Element.as(event.getEventTarget());
        ComponentConnector componentConnector = Util.findConnectorFor(getWidget());
        if (target == contextHelpIndicatorElement
                && componentConnector instanceof HasContextHelpConnector) {
            HasContextHelpConnector connector = (HasContextHelpConnector) componentConnector;
            if (hasContextHelpIconListeners(componentConnector.getState())) {
                connector.contextHelpIconClick(event);
            }
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:15,代码来源:CubaFieldGroupLayoutComponentSlot.java


示例6: onClick

import com.vaadin.client.Util; //导入依赖的package包/类
@Override
public void onClick(ClickEvent event) {
    Element target = Element.as(event.getNativeEvent().getEventTarget());
    ComponentConnector componentConnector = Util.findConnectorFor(getWidget());

    if (target == contextHelpIcon
            && componentConnector instanceof HasContextHelpConnector) {
        HasContextHelpConnector connector = (HasContextHelpConnector) componentConnector;
        if (hasContextHelpIconListeners(componentConnector.getState())) {
            connector.contextHelpIconClick(event);
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:14,代码来源:CubaOrderedLayoutSlot.java


示例7: detectExtraSizes

import com.vaadin.client.Util; //导入依赖的package包/类
/**
 * Detects space used by components paddings and borders.
 */
private void detectExtraSizes() {
   Element clone = Util.cloneNode(getElement(), false);
   DOM.setElementAttribute(clone, "id", "");
   DOM.setStyleAttribute(clone, "visibility", "hidden");
   DOM.setStyleAttribute(clone, "position", "absolute");
   // due FF3 bug set size to 10px and later subtract it from extra pixels
   DOM.setStyleAttribute(clone, "width", "10px");
   DOM.setStyleAttribute(clone, "height", "10px");
   DOM.appendChild(DOM.getParent(getElement()), clone);
   extraHorizontalPixels = DOM.getElementPropertyInt(clone, "offsetWidth") - 10;
   extraVerticalPixels = DOM.getElementPropertyInt(clone, "offsetHeight") - 10;

   DOM.removeChild(DOM.getParent(getElement()), clone);
}
 
开发者ID:vkazhdan,项目名称:vaadin-crichtextarea,代码行数:18,代码来源:CVRichTextArea.java


示例8: setInternalHeights

import com.vaadin.client.Util; //导入依赖的package包/类
void setInternalHeights() {
    int captionHeight = 0;
    int totalHeight = getOffsetHeight();

    if (optionsCaption != null) {
        captionHeight = Util.getRequiredHeight(optionsCaption);
    } else if (selectionsCaption != null) {
        captionHeight = Util.getRequiredHeight(selectionsCaption);
    }
    String selectHeight = (totalHeight - captionHeight) + "px";

    selections.setHeight(selectHeight);
    options.setHeight(selectHeight);
}
 
开发者ID:tepi,项目名称:ListBuilder,代码行数:15,代码来源:VListBuilder.java


示例9: clearInternalWidths

import com.vaadin.client.Util; //导入依赖的package包/类
void clearInternalWidths() {
    int cols = -1;
    if (getColumns() > 0) {
        cols = getColumns();
    } else if (!widthSet) {
        cols = DEFAULT_COLUMN_COUNT;
    }

    if (cols >= 0) {
        String colWidth = cols + "em";
        String containerWidth = (2 * cols + 2 * buttonWidthEm + 0.5) + "em";
        // Caption wrapper width == optionsSelect + buttons +
        // selectionsSelect
        String captionWrapperWidth = (2 * cols + 2 * buttonWidthEm) + "em";

        options.setWidth(colWidth);
        if (optionsCaption != null) {
            optionsCaption.setWidth(Util.getRequiredWidth(options) + "px");
        }
        selections.setWidth(colWidth);
        if (selectionsCaption != null) {
            selectionsCaption.setWidth(Util.getRequiredWidth(selections)
                    + "px");
        }
        buttons.setWidth(String.valueOf(buttonWidthEm) + "em");
        moveButtons.setWidth(String.valueOf(buttonWidthEm) + "em");
        container.setWidth(containerWidth);
        captionWrapper.setWidth(captionWrapperWidth);
    }
}
 
开发者ID:tepi,项目名称:ListBuilder,代码行数:31,代码来源:VListBuilder.java


示例10: onClick

import com.vaadin.client.Util; //导入依赖的package包/类
@Override
public void onClick(ClickEvent event) {

    Element element = Element.as(event.getNativeEvent()
            .getEventTarget());

    if (upButtonElement.isOrHasChild(element)) {
        event.preventDefault();
        event.stopPropagation();
        setPrevValue();
    } else if (downButtonElement.isOrHasChild(element)) {
        event.preventDefault();
        event.stopPropagation();
        setNextValue();
    } else if (overlayElement != null
            && overlayElement.isOrHasChild(element)) {
        if (new Date().getTime() - dragEnded < IGNORE_CLICK_AFTER_DRAG_MS) {
            return;
        }
        // VConsole.log("onClick");
        GwtPicker.this.setValueAtPosition(
                Util.getTouchOrMouseClientX(event.getNativeEvent()),
                Util.getTouchOrMouseClientY(event.getNativeEvent()),
                true, null);
    }

    Event.releaseCapture(captureElement);
}
 
开发者ID:alump,项目名称:Picker,代码行数:29,代码来源:GwtPicker.java


示例11: dragStart

import com.vaadin.client.Util; //导入依赖的package包/类
protected void dragStart(HumanInputEvent event) {
    NativeEvent ne = event.getNativeEvent();
    VConsole.log("Drag start" + ne.getType());
    if (!dragging && np != null && isEnabled()) {
        dragging = true;
        touchDrag = Event.as(ne).getTypeInt() == Event.ONTOUCHSTART;
        dragstartX = Util.getTouchOrMouseClientX(ne);
        dragstartY = Util.getTouchOrMouseClientY(ne);
        if (!BrowserInfo.get().isTouchDevice()) {
            // avoid drag start on images
            // FIXME shouln't be this way, but disables dragstart on images
            // in demo with desktop browsers and this way makes development
            // easier
            Element el = ne.getEventTarget().cast();
            String msg = el.getParentElement().getClassName();
            if (msg.contains("embedded")) {
                ne.preventDefault();
            }
        }
        new Timer() {
            @Override
            public void run() {
                // Swipe must start soon or drag start will be ignored
                if(!swiping) {
                    dragging = false;
                }
            }
        }.schedule(200);;
    }
}
 
开发者ID:vaadin,项目名称:touchkit,代码行数:31,代码来源:VSwipeView.java


示例12: dragEnd

import com.vaadin.client.Util; //导入依赖的package包/类
protected void dragEnd(HumanInputEvent event) {
    if (dragging) {
        Event.releaseCapture(getElement());
        VConsole.log("Drag end");
        dragging = false;
        if (swiping) {
            if (np != null) {
                NativeEvent ne = event.getNativeEvent();
                int x = Util.getTouchOrMouseClientX(ne);
                int deltaX = x - dragstartX;
                VConsole.log("Speed" + lastSpeed);
                if (np.getPreviousView() != null
                        && (deltaX > getOffsetWidth() / 2 || lastSpeed > SPEED_THRESHOLD)) {
                    // navigate backward
                    np.navigateBackward();
                    if (swipeListener != null) {
                        swipeListener.onSwipeBack();
                    }
                } else if (np.getNextView() != null
                        && (deltaX < -getOffsetWidth() / 2 || (lastSpeed < -SPEED_THRESHOLD))) {
                    // navigate forward
                    np.navigateForward();
                    if (swipeListener != null) {
                        swipeListener.onSwipeForward();
                    }
                } else {
                    np.setHorizontalOffset(0, true);
                }
            }
            swiping = false;
        }
    }
}
 
开发者ID:vaadin,项目名称:touchkit,代码行数:34,代码来源:VSwipeView.java


示例13: getChildComponent

import com.vaadin.client.Util; //导入依赖的package包/类
@Override
protected ComponentConnector getChildComponent(Element element) {
    return Util.getConnectorForElement(getConnection(), getWidget(),
            element);
}
 
开发者ID:alump,项目名称:GridStack,代码行数:6,代码来源:GridStackLayoutConnector.java


示例14: setPosition

import com.vaadin.client.Util; //导入依赖的package包/类
@Override
public void setPosition(int offsetWidth, int offsetHeight) {

	int top = -1;
	int left = -1;

	offsetHeight = getOffsetHeight();

	int desiredWidth = box.getOffsetWidth();
	if (popupWidth != null) {
		try {
			desiredWidth = Integer.valueOf(popupWidth.replace("px", ""));
		} catch (NumberFormatException e) {
			desiredWidth = box.getOffsetWidth();
		}
		
	}
	Element menuFirstChild = getWidget().getElement().getFirstChild()
			.cast();
	int naturalMenuWidth = menuFirstChild.getOffsetWidth();

	if (popupOuterPadding == -1) {
		popupOuterPadding = Util.measureHorizontalPaddingAndBorder(
				getElement(), 2);
	}

	if (naturalMenuWidth < desiredWidth) {
		getWidget().setWidth((desiredWidth - popupOuterPadding) + "px");
		menuFirstChild.getStyle().setWidth(100, Unit.PCT);
		naturalMenuWidth = desiredWidth;
	}

	if (BrowserInfo.get().isIE()) {
		/*
		 * IE requires us to specify the width for the container
		 * element. Otherwise it will be 100% wide
		 */
		int rootWidth = naturalMenuWidth - popupOuterPadding;
		getContainerElement().getStyle().setWidth(rootWidth, Unit.PX);
	}

	if (offsetHeight + getPopupTop() > Window.getClientHeight()
			+ Window.getScrollTop()) {
		// popup on top of input instead
		top = getPopupTop() - offsetHeight - box.getOffsetHeight();
		if (top < 0) {
			top = 0;
		}
	} else {
		top = getPopupTop();
		/*
		 * Take popup top margin into account. getPopupTop() returns the
		 * top value including the margin but the value we give must not
		 * include the margin.
		 */
		int topMargin = (top - topPosition);
		top -= topMargin;
	}

	// fetch real width (mac FF bugs here due GWT popups overflow:auto )
	offsetWidth = menuFirstChild.getOffsetWidth();
	if (offsetWidth + getPopupLeft() > Window.getClientWidth()
			+ Window.getScrollLeft()) {
		left = box.getAbsoluteLeft() + box.getOffsetWidth()
				+ Window.getScrollLeft() - offsetWidth;
		if (left < 0) {
			left = 0;
		}
	} else {
		left = getPopupLeft();
	}
	setPopupPosition(left, top);

}
 
开发者ID:markoradinovic,项目名称:suggestfield,代码行数:75,代码来源:VSuggestField.java


示例15: measureSizes

import com.vaadin.client.Util; //导入依赖的package包/类
private void measureSizes() {
	moreItemsSpinnerHeight = Util.getRequiredHeight(moreItemsSpinner);
	log("lazylist - more items spinner height measured: " + moreItemsSpinnerHeight);
}
 
开发者ID:jarski,项目名称:LazyList,代码行数:5,代码来源:LazyListWidget.java


示例16: setPs

import com.vaadin.client.Util; //导入依赖的package包/类
protected void setPs(final String string) {
	cleanPs = Util.escapeHTML(string);
	cleanPs = cleanPs.replaceAll(" ", "&nbsp;");
	ps.setInnerHTML(cleanPs);
}
 
开发者ID:indvd00m,项目名称:vaadin7-console-addon,代码行数:6,代码来源:TextConsole.java


示例17: dragMove

import com.vaadin.client.Util; //导入依赖的package包/类
protected void dragMove(HumanInputEvent event) {
    if (np != null) {
        NativeEvent ne = event.getNativeEvent();
        if (touchDrag && Event.as(ne).getTypeInt() != Event.ONTOUCHMOVE) {
            return;
        }
        int x = Util.getTouchOrMouseClientX(ne);
        int y = Util.getTouchOrMouseClientY(ne);
        long time = new Date().getTime();
        // screens per second
        double screenwidths = (x - lastX) / (double) getOffsetWidth();
        double seconds = (time - lastTs) / 100d;
        lastSpeed = screenwidths / seconds;
        lastX = x;
        lastTs = time;
        int deltaX = x - dragstartX;
        if (swiping) {
            VConsole.log("Swipe move " + deltaX);
            np.setHorizontalOffset(deltaX, false);
            ne.preventDefault(); // prevent page scroll
        } else if (dragging) {
            Event.setCapture(getElement());
            int dragY = dragstartY - y;
            if (Math.abs(deltaX / (double) dragY) > 2) {
                swiping = true;
                np.setHorizontalOffset(deltaX, false);
                ne.preventDefault(); // prevent page scroll
            }
            if (BrowserInfo.get().requiresTouchScrollDelegate()) {
                if (Math.abs(deltaX / (double) dragY) < 0.5) {
                    if (Event.as(event.getNativeEvent()).getTypeInt() == Event.ONTOUCHMOVE) {
                        /*
                         * We'll "lazyly" activate touchScrollDelegate if
                         * the direction is enough down.
                         */
                        dragStartEvent.setNativeEvent(event
                                .getNativeEvent());
                        touchScrollDelegate.onTouchStart(dragStartEvent);
                        VConsole.log("Lazy started");
                        dragging = false;
                    }
                }
            }
        }
    }
}
 
开发者ID:vaadin,项目名称:touchkit,代码行数:47,代码来源:VSwipeView.java



注:本文中的com.vaadin.client.Util类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SubmitApplicationRequestPBImpl类代码示例发布时间:2022-05-22
下一篇:
Java ConfigurationUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap