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

Java WidgetUtil类代码示例

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

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



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

示例1: updateCaptions

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
/**
 * @param bigMode
 *            If false, event is so small that caption must be in time-row
 */
private void updateCaptions(boolean bigMode) {
    String innerHtml;
    String htmlOrText;

    String timeAsText = Strings.format(
            calendarItem.getDateCaptionFormat(),
            calendarItem.getFormattedStartTime(),
            calendarItem.getFormattedEndTime());

    if (dateCell.weekgrid.getCalendar().isItemCaptionAsHtml()) {
        htmlOrText = calendarItem.getCaption();
    } else {
        htmlOrText = WidgetUtil.escapeHTML(calendarItem.getCaption());
    }

    if (bigMode) {
        innerHtml = "<span>" + timeAsText + "</span><br />" + htmlOrText;
    } else {
        innerHtml = "<span>" + timeAsText + "<span></span></span> " + htmlOrText;
    }

    caption.setInnerHTML(innerHtml);
    eventContent.setInnerHTML("");
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:29,代码来源:DateCellDayItem.java


示例2: isLocationValid

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
/**
 * Checks if the location is a valid drop location
 *
 * @param elementOver
 *            The element to check
 * @return
 */
private boolean isLocationValid(Element elementOver) {
    Element weekGridElement = calendarConnector.getWidget().getWeekGrid()
            .getElement();
    Element timeBarElement = calendarConnector.getWidget().getWeekGrid()
            .getTimeBar().getElement();

    Element todayBarElement = null;
    if (calendarConnector.getWidget().getWeekGrid().hasToday()) {
        todayBarElement = calendarConnector.getWidget().getWeekGrid()
                .getDateCellOfToday().getTodaybarElement();
    }

    // drops are not allowed in:
    // - weekday header
    // - allday event list
    // - todaybar
    // - timebar
    // - items
    return DOM.isOrHasChild(weekGridElement, elementOver)
            && !DOM.isOrHasChild(timeBarElement, elementOver)
            && todayBarElement != elementOver
            && (WidgetUtil.findWidget(elementOver,
                    DateCellDayItem.class) == null);
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:32,代码来源:CalendarWeekDropHandler.java


示例3: renderCaption

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
/**
 * Renders the caption in the DIV element
 */
private void renderCaption() {
    StringBuilder html = new StringBuilder();
    String textOrHtml;
    if (calendar.isItemCaptionAsHtml()) {
        textOrHtml = caption;
    } else {
        textOrHtml = WidgetUtil.escapeHTML(caption);
    }

    if (caption != null && time != null) {
        html.append("<span class=\"" + STYLENAME + "-time\">");
        html.append(calendar.getTimeFormat().format(time));
        html.append("</span> ");
        html.append(textOrHtml);
    } else if (caption != null) {
        html.append(textOrHtml);
    } else if (time != null) {
        html.append("<span class=\"" + STYLENAME + "-time\">");
        html.append(calendar.getTimeFormat().format(time));
        html.append("</span>");
    }
    super.setHTML(html.toString());
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:27,代码来源:MonthItemLabel.java


示例4: setWidthPX

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
public void setWidthPX(int width) {
    if (isHorizontalScrollable()) {
        updateCellWidths();

        // Otherwise the scroll wrapper is somehow too narrow = horizontal
        // scroll
        wrapper.setWidth(content.getOffsetWidth() + WidgetUtil.getNativeScrollbarSize() + "px");

        this.width = content.getOffsetWidth() - timebar.getOffsetWidth();

    } else {
        this.width = (width == -1) ? width
                : width - timebar.getOffsetWidth();

        if (isVerticalScrollable() && width != -1) {
            this.width = this.width - WidgetUtil.getNativeScrollbarSize();
        }
        updateCellWidths();
    }
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:21,代码来源:WeekGrid.java


示例5: getDisplayString

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
/**
 * Gets the visible row in the popup as a HTML string. The string
 * contains an image tag with the rows icon (if an icon has been
 * specified) and the caption of the item
 */

@Override
public String getDisplayString() {
	final StringBuilder sb = new StringBuilder();
	ApplicationConnection client = VComboBoxMultiselect.this.connector.getConnection();
	final Icon icon = client.getIcon(client.translateVaadinUri(this.untranslatedIconUri));
	if (icon != null) {
		sb.append(icon.getElement()
			.getString());
	}
	String content;
	if ("".equals(this.caption)) {
		// Ensure that empty options use the same height as other
		// options and are not collapsed (#7506)
		content = "&nbsp;";
	} else {
		content = WidgetUtil.escapeHTML(this.caption);
	}
	sb.append("<span>" + content + "</span>");
	return sb.toString();
}
 
开发者ID:bonprix,项目名称:vaadin-combobox-multiselect,代码行数:27,代码来源:VComboBoxMultiselect.java


示例6: updateSuggestionPopupMinWidth

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
/**
 * Update minimum width for combo box textarea based on input prompt and
 * suggestions.
 * <p>
 * For internal use only. May be removed or replaced in the future.
 */
public void updateSuggestionPopupMinWidth() {
	debug("VComboBoxMultiselect: updateSuggestionPopupMinWidth()");

	// used only to calculate minimum width
	String captions = WidgetUtil.escapeHTML(this.inputPrompt);

	for (ComboBoxMultiselectSuggestion suggestion : this.currentSuggestions) {
		// Collect captions so we can calculate minimum width for
		// textarea
		if (captions.length() > 0) {
			captions += "|";
		}
		captions += WidgetUtil.escapeHTML(suggestion.getReplacementString());
	}

	// Calculate minimum textarea width
	this.suggestionPopupMinWidth = minWidth(captions);
}
 
开发者ID:bonprix,项目名称:vaadin-combobox-multiselect,代码行数:25,代码来源:VComboBoxMultiselect.java


示例7: setVisible

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
@Override
public void setVisible(boolean visible) {
    /*
     * Visibility with VWindow works differently than with other Paintables
     * in Vaadin. Invisible VWindows are not attached to DOM at all. Flag is
     * used to avoid visibility call from
     * ApplicationConnection.updateComponent();
     */
    if (!visibilityChangesDisabled) {
        super.setVisible(visible);
    }

    if (visible
            && BrowserInfo.get().requiresPositionAbsoluteOverflowAutoFix()) {

        /*
         * Shake up the DOM a bit to make the window shed unnecessary
         * scrollbars and resize correctly afterwards. The version fixing
         * ticket #11994 which was changing the size to 110% was replaced
         * with this due to ticket #12943
         */
        WidgetUtil
                .runWebkitOverflowAutoFix(contents.getFirstChildElement());
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:CubaFileUploadProgressWindow.java


示例8: getUsedWidth

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
@Override
public int getUsedWidth() {
    if (!isCaptionInline()) {
        return super.getUsedWidth();
    }

    int widgetWidth = getWidgetWidth();
    if (getCaption() == null) {
        return widgetWidth;
    } else if (getCaption().shouldBePlacedAfterComponent() || isCaptionInline()) {
        widgetWidth += getCaptionWidth();
        if (rightCaption != null) {
            widgetWidth += WidgetUtil.getRequiredWidth(rightCaption);
        }
        return widgetWidth;
    } else {
        if (rightCaption != null) {
            widgetWidth += WidgetUtil.getRequiredWidth(rightCaption);
        }
        return Math.max(widgetWidth, getCaptionWidth());
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:CubaFieldGroupLayoutComponentSlot.java


示例9: init

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
@Override
protected void init() {
    super.init();

    getWidget().tabContextMenuHandler = new CubaTabSheetWidget.TabContextMenuHandler() {
        @Override
        public void onContextMenu(int tabIndex, ContextMenuEvent event) {
            lastContextMenuX = WidgetUtil.getTouchOrMouseClientX(event.getNativeEvent());
            lastContextMenuY = WidgetUtil.getTouchOrMouseClientY(event.getNativeEvent());

            if (getState().hasActionsHandlers) {
                rpc.onTabContextMenu(tabIndex);

                event.stopPropagation();
                event.preventDefault();
            }
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:CubaTabSheetConnector.java


示例10: onBrowserEvent

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
    super.onBrowserEvent(event);

    if (isEnabled()) {
        switch (DOM.eventGetType(event)) {
            case Event.ONMOUSEOVER:
                Element targetElement = DOM.eventGetTarget(event);
                Object targetWidget = WidgetUtil.findWidget(targetElement, null);
                if (targetWidget instanceof MenuItemWidget) {
                    setFocusedItem((MenuItemWidget) targetWidget);
                }
                break;
            case Event.ONMOUSEOUT:
                if (!focused) {
                    setFocusedItem(null);
                }
                break;
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:CubaSideMenuWidget.java


示例11: init

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
@Override
protected void init() {
    super.init();

    getWidget().contextMenuHandler = new CubaWindowWidget.ContextMenuHandler() {
        @Override
        public void onContextMenu(Event event) {
            lastContextMenuX = WidgetUtil.getTouchOrMouseClientX(event);
            lastContextMenuY = WidgetUtil.getTouchOrMouseClientY(event);

            if (getState().hasContextActionHandlers) {
                rpc.onWindowContextMenu();

                event.stopPropagation();
                event.preventDefault();
            }
        }
    };
    getWidget().clickOnModalityCurtain = () -> rpc.performCloseAction();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:21,代码来源:CubaWindowConnector.java


示例12: onPreviewNativeEvent

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
@Override
protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
    super.onPreviewNativeEvent(event);

    NativeEvent nativeEvent = event.getNativeEvent();
    Element target = Element.as(nativeEvent.getEventTarget());

    if (Event.ONCLICK == event.getTypeInt()) {
        final Widget hoveredButton = WidgetUtil.findWidget(target, null);
        if (getElement().isOrHasChild(target)) {
            Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                @Override
                public void execute() {
                    hide();

                    if (BrowserInfo.get().isIE9()) {
                        if (hoveredButton instanceof CubaButtonWidget) {
                            hoveredButton.removeStyleName("ie9-hover");
                        }
                    }
                }
            });
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:Tools.java


示例13: onKeyDown

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent keyDownEvent) {

    if (keyDownEvent.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {

        SimplePanel panel = WidgetUtil.findWidget(WidgetUtil.getFocusedElement(), SimplePanel.class);

        if (panel != null) {
            WidgetUtil.focus(panel.getParent().getElement());

            // prevent further bubbling of the event as it has only
            // navigational purpose if thrown at this depth. A subsequent
            // press of ESC is not stopped, so ESC abort actions of the
            // application should work as soon as the focus is in
            // "navigational mode" on a grid-cell
            keyDownEvent.preventDefault();
            keyDownEvent.stopPropagation();
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:21,代码来源:EscKeyDownHandler.java


示例14: getRenderedWidth

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
@Override
public int getRenderedWidth() {
    int width = 0;

    if (icon != null) {
        width += WidgetUtil.getRequiredWidth(icon.getElement());
    }

    if (captionText != null) {
        width += WidgetUtil.getRequiredWidth(captionText);
    }
    if (requiredFieldIndicator != null && requiredFieldIndicator.getParentElement() == getElement()) {
        width += WidgetUtil.getRequiredWidth(requiredFieldIndicator);
    }
    if (errorIndicatorElement != null && errorIndicatorElement.getParentElement() == getElement()) {
        width += WidgetUtil.getRequiredWidth(errorIndicatorElement);
    }
    if (contextHelpIndicatorElement != null && contextHelpIndicatorElement.getParentElement() == getElement()) {
        width += WidgetUtil.getRequiredWidth(contextHelpIndicatorElement);
    }
    return width;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:CubaCaptionWidget.java


示例15: ctrlClickSelect

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
@Override
protected void ctrlClickSelect(SelectionModel<JsonObject> model, CellReference<JsonObject> cell, GridClickEvent e) {
	// Plain control click, or no previously selected.
	if (!e.isShiftKeyDown() || previous < 0) {
		super.ctrlClickSelect(model, cell, e);
		previous = cell.getRowIndex();
		return;
	}

	// Stop selecting text for now.
	WidgetUtil.setTextSelectionEnabled(grid.getElement(), false);
	WidgetUtil.clearTextSelection();

	// This works on the premise that grid fires the data available event to
	// any newly added handlers.
	boolean ctrlOrMeta = e.isControlKeyDown() || e.isMetaKeyDown();
	handler = grid.addDataAvailableHandler(new ShiftSelector(cell, model, ctrlOrMeta));
}
 
开发者ID:tsuoanttila,项目名称:GridExtensionPack,代码行数:19,代码来源:ShiftCtrlClickSelectionHandler.java


示例16: setInternalWidths

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
/** For internal use only. May be removed or replaced in the future. */
public void setInternalWidths() {
	getElement().getStyle().setPosition(Position.RELATIVE);
	int bordersAndPaddings = WidgetUtil.measureHorizontalPaddingAndBorder(buttons.getElement(), 0);
	int upDownBordersAndPaddings = WidgetUtil.measureHorizontalPaddingAndBorder(upDownButtons.getElement(), 0);
	int buttonWidth = WidgetUtil.getRequiredWidth(buttons);
	int upDownButtonsWidth = WidgetUtil.getRequiredWidth(upDownButtons);
	int totalWidth = getOffsetWidth();

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

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

	selectionsListBox.setWidth(spaceForSelect + "px");
	if (selectionsCaption != null) {
		selectionsCaption.setWidth(spaceForSelect + "px");
	}
	captionWrapper.setWidth("100%");
}
 
开发者ID:tepi,项目名称:ListBuilder,代码行数:24,代码来源:VListBuilder.java


示例17: dragAccepted

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
@Override
protected void dragAccepted(VDragEvent drag) {
    deEmphasis();
    currentTargetElement = drag.getElementOver();
    currentTargetDay = WidgetUtil.findWidget(currentTargetElement,
            DateCell.class);
    emphasis();
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:9,代码来源:CalendarWeekDropHandler.java


示例18: dragAccepted

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
@Override
protected void dragAccepted(VDragEvent drag) {
    deEmphasis();
    currentTargetElement = drag.getElementOver();
    currentTargetDay = WidgetUtil.findWidget(currentTargetElement,
            SimpleDayCell.class);
    emphasis();
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:9,代码来源:CalendarMonthDropHandler.java


示例19: setHorizontalSized

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
/**
 * @param isHorizontalSized
 *            if true, this DateCell is sized with CSS and not via
 *            {@link #setWidthPX(int)}
 */
public void setHorizontalSized(boolean isHorizontalSized) {
    if (isHorizontalSized) {
        addStyleDependentName("Hsized");

        width = getOffsetWidth()
                - WidgetUtil.measureHorizontalBorder(getElement());
        // Update moveWidth for any DateCellDayItem child
        updateEventCellsWidth();
        recalculateItemWidths();
    } else {
        removeStyleDependentName("Hsized");
    }
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:19,代码来源:DateCell.java


示例20: updateMenuWidth

import com.vaadin.client.WidgetUtil; //导入依赖的package包/类
/**
 * Adds in-line CSS rules to the DOM according to the
 * suggestionPopupWidth field
 *
 * @param desiredWidth
 * @param naturalMenuWidth
 */
private void updateMenuWidth(final int desiredWidth, int naturalMenuWidth) {
	/**
	 * Three different width modes for the suggestion pop-up:
	 *
	 * 1. Legacy "null"-mode: width is determined by the longest item
	 * caption for each page while still maintaining minimum width of
	 * (desiredWidth - popupOuterPadding)
	 *
	 * 2. relative to the component itself
	 *
	 * 3. fixed width
	 */
	String width = "auto";
	if (VComboBoxMultiselect.this.suggestionPopupWidth == null) {
		if (naturalMenuWidth < desiredWidth) {
			naturalMenuWidth = desiredWidth - this.popupOuterPadding;
			width = desiredWidth - this.popupOuterPadding + "px";
		}
	} else if (isrelativeUnits(VComboBoxMultiselect.this.suggestionPopupWidth)) {
		float mainComponentWidth = desiredWidth - this.popupOuterPadding;
		// convert percentage value to fraction
		int widthInPx = Math
			.round(mainComponentWidth * asFraction(VComboBoxMultiselect.this.suggestionPopupWidth));
		width = widthInPx + "px";
	} else {
		// use as fixed width CSS definition
		width = WidgetUtil.escapeAttribute(VComboBoxMultiselect.this.suggestionPopupWidth);
	}
	this.menu.setWidth(width);
}
 
开发者ID:bonprix,项目名称:vaadin-combobox-multiselect,代码行数:38,代码来源:VComboBoxMultiselect.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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