当前位置: 首页>>代码示例>>Java>>正文


Java DOM类代码示例

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


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

示例1: AccessibleCheckBox

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
protected AccessibleCheckBox(Element elem) {
    super(DOM.createSpan());
    inputElem = InputElement.as(elem);
    labelElem = Document.get().createLabelElement();

    getElement().appendChild(inputElem);
    getElement().appendChild(labelElem);

    String uid = DOM.createUniqueId();
    inputElem.setPropertyString("id", uid);
    labelElem.setHtmlFor(uid);

    // Accessibility: setting tab index to be 0 by default, ensuring element
    // appears in tab sequence. FocusWidget's setElement method already
    // calls setTabIndex, which is overridden below. However, at the time
    // that this call is made, inputElem has not been created. So, we have
    // to call setTabIndex again, once inputElem has been created.
    setTabIndex(0);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:20,代码来源:AccessibleCheckBox.java

示例2: setWidget

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
public void setWidget(Widget w, boolean delegateCaptionHandling) {
    if (w != null) {
        this.widgetType = VaadinWidgetUtils.getWidgetTypeByWidget(w);
        this.widgetElement = VaadinWidgetUtils.getElementByVaadinWidget(w, this.widgetType);
        if (this.widgetType.isAddStyle()) {
            this.widgetElement.addClassName(this.widgetType.getCssStyle());
        } else {
            this.widgetElement.setClassName(this.widgetType.getCssStyle());
        }
        if (delegateCaptionHandling) {
            getElement().appendChild(label = DOM.createLabel());
        } else {
            getElement().appendChild(label = DOM.createDiv());
        }
        getElement().appendChild(div);
    }
    super.setWidget(w);

    if (w != null) {
        getContainerElement().appendChild(small);
        getContainerElement().appendChild(feedback);
    }
}
 
开发者ID:knoobie,项目名称:bootstrap-formgroup,代码行数:24,代码来源:ClientSideFormGroup.java

示例3: init

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
@Override
protected void init() {
	clientWidth = DOM.getElementPropertyInt(label.getElement(), "clientHeight");
	clientWidth = DOM.getElementPropertyInt(label.getElement(), "clientHeight");
	clientHeight = DOM.getElementPropertyInt(label.getElement(), "clientHeight");
	offsetWidth = label.getOffsetWidth();
	offsetHeight = label.getOffsetHeight();
	offsetTop = DOM.getElementPropertyInt(label.getElement(), "offsetTop");
	offsetLeft = DOM.getElementPropertyInt(label.getElement(), "offsetLeft");

	boder = (offsetHeight - clientHeight) / 2;

	custom();

	this.setPixelSize((int) offsetWidth + offsetLeft * 2, (int) offsetHeight
			+ offsetTop * 2);
}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:18,代码来源:DatasetWidget.java

示例4: getContainerOffsetLeft

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
protected int getContainerOffsetLeft() {
	if (containerOffsetLeft < 0 || !sync) {
		int scrollLeft = 0;
		Element parent = DOM.getParent(getWidget().getElement());
		while (parent != null) {
			if (getScrollLeft(parent) > 0) {
				scrollLeft += getScrollLeft(parent);
				GWT.log("Scroll left detected : " + scrollLeft);
			}
			if (containerFinder.isContainer(parent)) {
				containerOffsetLeft = DOM.getAbsoluteLeft(parent) - scrollLeft;
			}
			parent = DOM.getParent(parent);
		}
	}
	return containerOffsetLeft;
}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:18,代码来源:NodeShape.java

示例5: onBrowserEvent

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
public void onBrowserEvent(final Event event) {
	Element td = getEventTargetCell(event);
	if (td==null) return;
    final Element tr = DOM.getParent(td);
	int col = DOM.getChildIndex(tr, td);
    Element body = DOM.getParent(tr);
    int row = DOM.getChildIndex(body, tr);
    
    Widget widget = getWidget(row, col);
    if (widget != null && widget instanceof UniTimeHeaderPanel) {
    	super.onBrowserEvent(event);
    	return;
    }
    
	switch (DOM.eventGetType(event)) {
	case Event.ONMOUSEOVER:
		getRowFormatter().addStyleName(row, "hover");
		break;
	case Event.ONMOUSEOUT:
		getRowFormatter().removeStyleName(row, "hover");
		break;
	}
	
	super.onBrowserEvent(event);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:26,代码来源:SimpleEditPage.java

示例6: setWidgetFontTypeface

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
/**
 * Sets the font typeface for the given widget.
 *
 * @param widget  widget to change font typeface for
 * @param typeface  "0" for normal, "1" for sans serif, "2" for serif and
 *                  "3" for monospace
 */
static void setWidgetFontTypeface(Widget widget, String typeface) {
  switch (Integer.parseInt(typeface)) {
    default:
      // This should never happen
      throw new IllegalArgumentException("Typeface:" + typeface);

    case 0:
    case 1:
      typeface = "sans-serif";
      break;

    case 2:
      typeface = "serif";
      break;

    case 3:
      typeface = "monospace";
      break;
  }
  DOM.setStyleAttribute(widget.getElement(), "fontFamily", typeface);
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:29,代码来源:MockComponentsUtil.java

示例7: onBrowserEvent

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
	if (!isEnabled()) return;

	super.onBrowserEvent(event);

    if ((event.getTypeInt() & Event.KEYEVENTS) != 0) {
    	int type = DOM.eventGetType(event);
    	char keyCode = (char) event.getKeyCode();
    	switch (type) {
    	case Event.ONKEYDOWN:
    		if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r') {
    			if (iDown != null) setResource(iDown);
    		}
    		break;
        case Event.ONKEYUP:
        	if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r') {
        		setResource(iUp);
        		onClick();
        	}
        	break;
    	}
    }
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:25,代码来源:ImageButton.java

示例8: setWidgetTextAlign

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
/**
 * Sets the text alignment for the given widget.
 *
 * @param widget  widget to change text alignment for
 * @param align  one of "0" for left, "1" for center or "2" for right
 */
static void setWidgetTextAlign(Widget widget, String align) {
  switch (Integer.parseInt(align)) {
    default:
      // This should never happen
      throw new IllegalArgumentException("align:" + align);

    case 0:
      align = "left";
      break;

    case 1:
      align = "center";
      break;

    case 2:
      align = "right";
      break;
  }
  DOM.setStyleAttribute(widget.getElement(), "textAlign", align);
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:27,代码来源:MockComponentsUtil.java

示例9: getCellForWidget

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
public int getCellForWidget(Widget w) {
	for (Element e = w.getElement(); e != null; e = DOM.getParent(e)) {
		if (e.getPropertyString("tagName").equalsIgnoreCase("span")) {
			if (DOM.getParent(e) == getElement())
				return DOM.getChildIndex(getElement(), e);
		}
		if (e == getElement()) { return -1; }
	}
	return -1;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:FlowForm.java

示例10: addRow

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
public int addRow(Widget header, Widget widget, int colSpan) {
	header.addStyleName("label-cell");
	int row = getRowCount();
	setWidget(row, 0, header);
	getCellFormatter().setStyleName(row, 0, "label-td");
	if (widget instanceof HasMobileScroll) {
		ScrollPanel scroll = new ScrollPanel(widget);
		scroll.addStyleName("table-cell");
		setWidget(row, 1, scroll);
		getCellFormatter().setStyleName(row, 1, "table-td");
	} else {
		widget.addStyleName("widget-cell");
		setWidget(row, 1, widget);
		getCellFormatter().setStyleName(row, 1, "widget-td");
	}
	if (colSpan != 1)
		getFlexCellFormatter().setColSpan(row, 1, colSpan);
	if (header.getElement().getId() == null || header.getElement().getId().isEmpty())
		header.getElement().setId(DOM.createUniqueId());
	if (widget instanceof UniTimeWidget)
		Roles.getTextboxRole().setAriaLabelledbyProperty(((UniTimeWidget)widget).getWidget().getElement(), Id.of(header.getElement()));
	else
		Roles.getTextboxRole().setAriaLabelledbyProperty(widget.getElement(), Id.of(header.getElement()));
	return row;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:26,代码来源:SimpleForm.java

示例11: onBrowserEvent

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
public void onBrowserEvent(Event event) {
	int x = 10 + event.getClientX() + getElement().getOwnerDocument().getScrollLeft();
	int y = 10 + event.getClientY() + getElement().getOwnerDocument().getScrollTop();
	
	switch (DOM.eventGetType(event)) {
	case Event.ONMOUSEMOVE:
		if (iHint.isShowing()) {
			iHint.setPopupPosition(x, y);
		} else {
			iShowHint.cancel();
			iHint.setPopupPosition(x, y);
			iShowHint.schedule(1000);
		}
		break;
	case Event.ONMOUSEOUT:
		iShowHint.cancel();
		if (iHint.isShowing())
			iHideHint.schedule(1000);
		break;
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:22,代码来源:HorizontalPanelWithHint.java

示例12: onBrowserEvent

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
	switch (DOM.eventGetType(event)) {
    case Event.ONMOUSEDOWN:
    	SelectionMode mode = null; 
    	for (SelectionMode m: SelectionMode.values())
    		if (hasUnselectedDays(m)) {
    			mode = m; break;
    		}
    	if (mode != null)
    		setAllSelected(true, mode);
    	else
    		setAllSelected(false, SelectionMode.All);
    	if (iCursor != null) iPanel.getWidget().setCursor(iCursor);
    	event.preventDefault();
    	break;
	}
	super.onBrowserEvent(event);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:20,代码来源:SessionDatesSelector.java

示例13: setImageProperty

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
private void setImageProperty(String text) {
  imagePropValue = text;
  String url = convertImagePropertyValueToUrl(text);
  if (url == null) {
    hasImage = false;
    url = "";
    setBackgroundColorProperty(backgroundColor);
    setShapeProperty(Integer.toString(shape));
  } else {
    hasImage = true;
    // Android Buttons do not show a background color if they have an image.
    // The container's background color shows through any transparent
    // portions of the Image, an effect we can get in the browser by
    // setting the widget's background color to COLOR_NONE.
    MockComponentsUtil.setWidgetBackgroundColor(buttonWidget,
        "&H" + COLOR_NONE);
    DOM.setStyleAttribute(buttonWidget.getElement(), "borderRadius", "0px");
  }
  MockComponentsUtil.setWidgetBackgroundImage(buttonWidget, url);
  image.setUrl(url);
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:22,代码来源:MockButtonBase.java

示例14: onBrowserEvent

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
public void onBrowserEvent(Event event) {
	if (iHint.getText().isEmpty()) return;
	iX = 10 + event.getClientX() + getElement().getOwnerDocument().getScrollLeft();
	iY = 10 + event.getClientY() + getElement().getOwnerDocument().getScrollTop();
	
	switch (DOM.eventGetType(event)) {
	case Event.ONMOUSEMOVE:
		if (iInfoPanel.isShowing()) {
			int maxX = Window.getScrollLeft() + Window.getClientWidth() - iInfoPanel.getOffsetWidth() - 10;
			iInfoPanel.setPopupPosition(Math.min(iX, maxX), iY);
		} else if (iInfo.getRowCount() > 0) {
			iShowInfo.cancel();
			iShowInfo.schedule(1000);
		}
		break;
	case Event.ONMOUSEOUT:
		iShowInfo.cancel();
		if (iInfoPanel.isShowing())
			iHideInfo.schedule(1000);
		break;
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:23,代码来源:InfoPanelImpl.java

示例15: getSubmitCompleteHandler

import com.google.gwt.user.client.DOM; //导入依赖的package包/类
private SubmitCompleteHandler getSubmitCompleteHandler() {
	return new SubmitCompleteHandler() {
		public void onSubmitComplete(final SubmitCompleteEvent event) {

			final Element label = DOM.createLabel();
			label.setInnerHTML(event.getResults());

			final String csvData = label.getInnerText();
			if (hasError(csvData)) {
				showAlert("Error: " + csvData);
			} else {
				parseCsvData(csvData);
				autoMessageBox.hide();
			}
		}

		private boolean hasError(final String contentFile) {
			return contentFile.startsWith("413")
					|| contentFile.startsWith("500");
		}
	};
}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:23,代码来源:JoinDataTool.java


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