當前位置: 首頁>>代碼示例>>Java>>正文


Java DivElement.setAttribute方法代碼示例

本文整理匯總了Java中com.google.gwt.dom.client.DivElement.setAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java DivElement.setAttribute方法的具體用法?Java DivElement.setAttribute怎麽用?Java DivElement.setAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.dom.client.DivElement的用法示例。


在下文中一共展示了DivElement.setAttribute方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createInfoTextElement

import com.google.gwt.dom.client.DivElement; //導入方法依賴的package包/類
private Element createInfoTextElement(NodePresentation presentation) {
  DivElement textElement = Document.get().createDivElement();

  StringBuilder sb = new StringBuilder();

  if (presentation.getInfoTextWrapper() != null) {
    sb.append(presentation.getInfoTextWrapper().first);
  }

  if (!Strings.isNullOrEmpty(presentation.getInfoText())) {
    sb.append(presentation.getInfoText());
  }

  if (presentation.getInfoTextWrapper() != null) {
    sb.append(presentation.getInfoTextWrapper().second);
  }

  textElement.setInnerText(sb.toString());
  textElement.setAttribute("style", presentation.getInfoTextCss());

  // TODO support text colorization

  return textElement;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:25,代碼來源:DefaultPresentationRenderer.java

示例2: redrawMonthPicker

import com.google.gwt.dom.client.DivElement; //導入方法依賴的package包/類
private void redrawMonthPicker() {
	this.monthPicker.getStyle().setWidth(this.calendarTable.getClientWidth(), Unit.PX);
	this.calendarTable.getStyle().setDisplay(Display.NONE);
	this.monthPicker.getStyle().clearDisplay();

	int currentYear = this.cursor.getYear() + InputDatePicker.YEAR_OFFSET;
	if (this.monthPickerInner.getChildCount() == 0) {
		for (int year = currentYear - 100; year < currentYear + 100; year++) {
			DivElement yearDiv = Document.get().createDivElement();
			yearDiv.setInnerText(String.valueOf(year));
			StyleUtils.addStyle(yearDiv, InputDatePicker.STYLE_YEAR_BUTTON);
			Event.sinkEvents(yearDiv, Event.ONCLICK);
			this.monthPickerInner.appendChild(yearDiv);
			yearDiv.setAttribute(InputDatePicker.ATTRIBUTE_DATA_YEAR, String.valueOf(year));
		}
	}
	this.openMonthOfYear(this.cursor.getYear() + InputDatePicker.YEAR_OFFSET);
}
 
開發者ID:Putnami,項目名稱:putnami-web-toolkit,代碼行數:19,代碼來源:InputDatePicker.java

示例3: updateFontDimensions

import com.google.gwt.dom.client.DivElement; //導入方法依賴的package包/類
private void updateFontDimensions() {

		// Test element for font size
		DivElement test = Document.get().createDivElement();
		test.setAttribute("style", "position: absolute;");
		test.setInnerHTML("X");
		term.appendChild(test);

		fontW = test.getClientWidth();
		fontH = test.getClientHeight();
		if (fontW <= 0 || fontW > 100) {
			fontW = test.getOffsetWidth();
		}
		if (fontH <= 0 || fontH > 100) {
			fontH = test.getOffsetHeight();
		}
		if (fontW <= 0 || fontW > 100) {
			fontW = 1;
		}
		if (fontH <= 0 || fontH > 100) {
			fontH = 1;
		}
		term.removeChild(test);
	}
 
開發者ID:indvd00m,項目名稱:vaadin7-console-addon,代碼行數:25,代碼來源:TextConsole.java

示例4: appendText

import com.google.gwt.dom.client.DivElement; //導入方法依賴的package包/類
private void appendText( final String text, final String color )
{
  final DivElement div = Document.get().createDivElement();
  div.setInnerText( text );
  div.setAttribute( "style", "color:" + color );
  _messages.getElement().appendChild( div );
  _scrollPanel.scrollToBottom();
}
 
開發者ID:realityforge,項目名稱:gwt-webpoller-example,代碼行數:9,代碼來源:Example.java

示例5: print

import com.google.gwt.dom.client.DivElement; //導入方法依賴的package包/類
public void print(String j,int calc, PrayTime p, double latitude,double longitude, int day){
	Element sub = DOM.getElementById("prayer-times-"+j+"-" + day);
	if(sub != null){
		String[] dateTitle = p.getMonthInfo(day);
		sub.removeAllChildren();
		Document doc = Document.get();
		DivElement l = doc.createDivElement();
		l.setAttribute("class", "timeslot__label g-color-slate-grey js-timeslot-label js-sticky-element fixed");
		l.setAttribute("style", "position: absolute; top: 0px; width: 100px; height: 100px; overflow: hidden; display: block; z-index: 1000; -webkit-transform: translate3d(0px, 0px, 0px); left: 0px;");
		l.setInnerHTML(dateTitle[0] +"<span>"+dateTitle[1]+"</span>");
		sub.appendChild(l);
		DivElement l1 = doc.createDivElement();
		l1.setAttribute("class", "event__content -quran");
		l1.setAttribute("id", "prayer-times-2");
		String html = p.print(latitude, longitude, title, day);
		l1.setInnerHTML(html);
		sub.appendChild(l1);
		//<span  class="video-card__speakers g-light-grey" style="position:relative; bottom:0; right:0; font-size:10px;">Shafii,ISNA</span>
		SpanElement l2 = doc.createSpanElement();
		l2.setAttribute("class", "video-card__speakers g-light-grey");
		l2.setAttribute("style", "position:relative; bottom:0; right:0; font-size:10px;");
		l2.setInnerText(createSubText(j, calc));
		sub.appendChild(l2);
		if(j.equals("Shafii") && calc == 0){
			//updateDescription(html);
		}
	}
}
 
開發者ID:arscyper,項目名稱:adan,代碼行數:29,代碼來源:Schedule.java

示例6: output

import com.google.gwt.dom.client.DivElement; //導入方法依賴的package包/類
public void output(String text, String color) {
	DivElement div = Document.get().createDivElement();
	div.setInnerText(text);
	div.setAttribute("style", "color:" + color);
	messages.getElement().appendChild(div);
	scrollPanel.scrollToBottom();
}
 
開發者ID:rzschech,項目名稱:gwt-comet,代碼行數:8,代碼來源:ChatEntryPoint.java

示例7: output

import com.google.gwt.dom.client.DivElement; //導入方法依賴的package包/類
public void output(String text, String color) {
	DivElement div = Document.get().createDivElement();
	div.setInnerText(text);
	div.setAttribute("style", "font-family:monospace;white-space:pre;color:" + color);
	messages.getElement().appendChild(div);
	scrollPanel.scrollToBottom();
}
 
開發者ID:rzschech,項目名稱:gwt-comet,代碼行數:8,代碼來源:CometTestEntryPoint.java

示例8: redrawCalendarPicker

import com.google.gwt.dom.client.DivElement; //導入方法依賴的package包/類
private void redrawCalendarPicker() {
	this.monthPicker.getStyle().setDisplay(Display.NONE);
	this.calendarTable.getStyle().clearDisplay();

	this.calendatBody.removeAllChildren();

	int firstDayOfWeek = InputDatePicker.DATE_TIME_FORMAT_INFO.firstDayOfTheWeek();
	int lastDayOfWeek = (firstDayOfWeek + InputDatePicker.DAYS_IN_WEEK) % InputDatePicker.DAYS_IN_WEEK;

	/* Display month */
	this.monthPickerButton.setInnerHTML(InputDatePicker.MONTH_YEAR_FORMAT.format(this.cursor)
		+ "<span class=\"caret\"></span>");

	Date lastMonth = new Date(this.cursor.getTime());
	CalendarUtil.addMonthsToDate(lastMonth, -1);
	this.pagePreviusMonthLi.setAttribute(InputDatePicker.ATTRIBUTE_DATA_CURSOR, InputDatePicker.ATTRIBUTE_DATE_FORMAT
		.format(lastMonth));
	this.pageTodayLi.setAttribute(InputDatePicker.ATTRIBUTE_DATA_CURSOR, InputDatePicker.ATTRIBUTE_DATE_FORMAT
		.format(this.today));
	Date nextMonth = new Date(this.cursor.getTime());
	CalendarUtil.addMonthsToDate(nextMonth, 1);
	this.pageNextMonthLi.setAttribute(InputDatePicker.ATTRIBUTE_DATA_CURSOR, InputDatePicker.ATTRIBUTE_DATE_FORMAT
		.format(nextMonth));

	/* Draw daypicker */
	Date dateToDrow = new Date(this.cursor.getTime());
	int selectedMonth = dateToDrow.getMonth();
	int firstMonthToDisplay = (selectedMonth + 11) % 12;
	int lastMonthToDisplay = (selectedMonth + 13) % 12;
	do {
		CalendarUtil.addDaysToDate(dateToDrow, -1);
	} while (firstMonthToDisplay != dateToDrow.getMonth() || dateToDrow.getDay() != firstDayOfWeek);

	// drow calendarTable
	TableRowElement headRow = null;
	while (dateToDrow.getMonth() != lastMonthToDisplay || dateToDrow.getDay() != lastDayOfWeek
		|| dateToDrow.getDate() == 1 && dateToDrow.getDay() == firstDayOfWeek) {
		if (headRow == null || dateToDrow.getDay() == firstDayOfWeek) {
			headRow = Document.get().createTRElement();
			this.calendatBody.appendChild(headRow);
		}
		TableCellElement td = Document.get().createTDElement();
		headRow.appendChild(td);
		DivElement div = Document.get().createDivElement();
		td.appendChild(div);
		div.setInnerText(String.valueOf(dateToDrow.getDate()));
		div.setAttribute(InputDatePicker.ATTRIBUTE_DATA_DATE, InputDatePicker.ATTRIBUTE_DATE_FORMAT.format(dateToDrow));
		if (dateToDrow.getMonth() != selectedMonth) {
			StyleUtils.addStyle(td, InputDatePicker.STYLE_MUTED);
		}
		if (dateToDrow.equals(this.cursor)) {
			StyleUtils.addStyle(td, InputDatePicker.STYLE_SELECTED);
		}
		if (this.today.equals(dateToDrow)) {
			StyleUtils.addStyle(td, InputDatePicker.STYLE_TODAY);
		}
		Event.sinkEvents(div, Event.ONCLICK);

		CalendarUtil.addDaysToDate(dateToDrow, 1);
	}
}
 
開發者ID:Putnami,項目名稱:putnami-web-toolkit,代碼行數:62,代碼來源:InputDatePicker.java

示例9: createPresentableTextElement

import com.google.gwt.dom.client.DivElement; //導入方法依賴的package包/類
private Element createPresentableTextElement(NodePresentation presentation) {
  DivElement textElement = Document.get().createDivElement();

  textElement.setInnerText(nullToEmpty(presentation.getPresentableText()));
  textElement.setAttribute("style", presentation.getPresentableTextCss());

  // TODO support text colorization

  return textElement;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:11,代碼來源:DefaultPresentationRenderer.java


注:本文中的com.google.gwt.dom.client.DivElement.setAttribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。