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


Java Unit類代碼示例

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


Unit類屬於com.google.gwt.dom.client.Style包,在下文中一共展示了Unit類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: alignWidget

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
private void alignWidget(Widget widget, Point anchorPoint, String horizontalAlign, String verticalAlign) {
    Style style = widget.getElement().getStyle();
    double xPos = anchorPoint.getX();
    double yPos = anchorPoint.getY();

    if ("center".equals(horizontalAlign)) {
        xPos -= widget.getOffsetWidth() / 2;
    } else if ("right".equals(horizontalAlign)) {
        xPos -= widget.getOffsetWidth();
    }

    if ("center".equals(verticalAlign)) {
        yPos -= widget.getOffsetHeight() / 2;
    } else if ("bottom".equals(verticalAlign)) {
        yPos -= widget.getOffsetHeight();
    }

    style.setPosition(Position.ABSOLUTE);
    style.setTop(yPos, Unit.PX);
    style.setLeft(xPos, Unit.PX);
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:22,代碼來源:LabelledImgContent.java

示例2: onClick

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
@Override
protected void onClick() {
    setActive(!isActive());
    if (!attached) {
        volumeScrollBar.getElement().getStyle().setPosition(Position.ABSOLUTE);
        ((Panel) getParent()).add(volumeScrollBar);
        attached = true;
    }
    changeStyleForClick();
    if (isActive()) {
        volumeScrollBar.setVisible(true);
        int width = volumeScrollBar.getElement().getAbsoluteRight() - volumeScrollBar.getElement().getAbsoluteLeft();
        width = getElement().getAbsoluteRight() - getElement().getAbsoluteLeft() - width;
        volumeScrollBar.getElement().getStyle().setLeft(getElement().getAbsoluteLeft() + width / 2, Unit.PX);
        int height = volumeScrollBar.getElement().getAbsoluteBottom() - volumeScrollBar.getElement().getAbsoluteTop();
        volumeScrollBar.getElement().getStyle().setTop(getElement().getAbsoluteTop() - height, Unit.PX);

    } else {
        volumeScrollBar.setVisible(false);
    }
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:22,代碼來源:VolumeMediaButton.java

示例3: getElement

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
@Override
protected KeyValue<FlowPanel, FlowPanel> getElement(Integer index) {
    parent = panelFactory.getFlowPanel();
    FlowPanel childPanel = panelFactory.getFlowPanel();

    Style style = parent.getElement().getStyle();
    parent.getElement().setId(styleNames.QP_PAGE() + index.intValue());

    if (swipeType != SwipeType.DISABLED) {
        style.setPosition(Position.ABSOLUTE);
        style.setTop(0, Unit.PX);
        style.setLeft(WIDTH * index, Unit.PCT);
        style.setWidth(WIDTH, Unit.PCT);
    }

    childPanel.setHeight("100%");
    childPanel.setWidth("100%");
    parent.add(childPanel);
    return new KeyValue<FlowPanel, FlowPanel>(parent, childPanel);
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:21,代碼來源:PanelCache.java

示例4: setSwipeDisabled

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
public void setSwipeDisabled(boolean swipeDisabled) {
    Style style = controller.getStyle();
    Style elementStyle = getElement().getStyle();

    style.setWidth(controller.getWidth(), Unit.PCT);

    if (swipeDisabled) {
        style.clearPosition();
        style.clearTop();
        style.clearLeft();
        elementStyle.clearPosition();
    } else {
        style.setPosition(Position.ABSOLUTE);
        style.setTop(0, Unit.PX);
        style.setLeft(0, Unit.PX);
        elementStyle.setPosition(Position.RELATIVE);
    }

    setSwipeLength();
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:21,代碼來源:MultiPageView.java

示例5: move

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
@Override
public void move(boolean swipeRight, float length) {
    if (!focusDropped && UserAgentChecker.isStackAndroidBrowser()) {
        dropFocus();
    }
    if (swipeRight) {
        showProgressBarForPage(currentVisiblePage + 1);
    } else {
        showProgressBarForPage(currentVisiblePage - 1);
    }
    Style style = getStyle();
    float position = getPositionLeft();
    if (swipeRight) {
        style.setLeft(position - length, Unit.PCT);
    } else {
        style.setLeft(position + length, Unit.PCT);
    }
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:19,代碼來源:MultiPageController.java

示例6: RegisterView

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
public RegisterView() {
	initWidget(ourUiBinder.createAndBindUi(this));

	register.setText( Constants.registerUIMsg.register() );
	registerUsr.setText( Constants.registerUIMsg.registerUsr() );
	registerPwd.setText( Constants.registerUIMsg.registerPwd() );
	registerVer.setText( Constants.registerUIMsg.registerVer() );
	registerCmp.setText( Constants.registerUIMsg.registerCmp() );
	registerPst.setText( Constants.registerUIMsg.registerPst() );

	confirmBtn.removeStyleName("gwt-Button");
	confirmBtn.setText( Constants.registerUIMsg.confirm() );
	confirmBtn.getElement().getStyle().setMarginLeft(100, Unit.PX);
	confirmBtn.getElement().getStyle().setMarginTop(50, Unit.PX);
	confirmBtn.getElement().getStyle().setMarginBottom(100, Unit.PX);
}
 
開發者ID:ICT-BDA,項目名稱:EasyML,代碼行數:17,代碼來源:RegisterView.java

示例7: TeachingAssignmentsWidget

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
public TeachingAssignmentsWidget() {
	iHeader = new UniTimeHeaderPanel(MESSAGES.sectTeachingAssignments());
	iHeader.addCollapsibleHandler(new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			InstructorCookie.getInstance().setShowTeachingAssignments(event.getValue());
			if (iTable != null) {
				iTable.setVisible(event.getValue());
			} else if (event.getValue()) {
				refresh();
			}
		}
	});
	iHeader.setCollapsible(InstructorCookie.getInstance().isShowTeachingAssignments());
	iHeader.setTitleStyleName("unitime3-HeaderTitle");
	removeStyleName("unitime-NotPrintableBottomLine");
	
	addHeaderRow(iHeader);
	iHeader.getElement().getStyle().setMarginTop(10, Unit.PX);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:21,代碼來源:TeachingAssignmentsWidget.java

示例8: addButton

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
private Button addButton(String operation, String name, Character accessKey, String width, ClickHandler clickHandler) {
	Button button = new AriaButton(name);
	button.addClickHandler(clickHandler);
	ToolBox.setWhiteSpace(button.getElement().getStyle(), "nowrap");
	if (accessKey != null)
		button.setAccessKey(accessKey);
	if (width != null)
		ToolBox.setMinWidth(button.getElement().getStyle(), width);
	iOperations.put(operation, iButtons.getWidgetCount());
	iClickHandlers.put(operation, clickHandler);
	iButtons.add(button);
	button.getElement().getStyle().setMarginLeft(4, Unit.PX);
	for (UniTimeHeaderPanel clone: iClones) {
		Button clonedButton = clone.addButton(operation, name, null, width, clickHandler);
		clonedButton.addKeyDownHandler(iKeyDownHandler);
	}
	button.addKeyDownHandler(iKeyDownHandler);
	return button;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:20,代碼來源:UniTimeHeaderPanel.java

示例9: IconCell

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
public IconCell(ImageResource resource, final String title, String text) {
	super(null);
	iIcon = new Image(resource);
	iIcon.setTitle(title);
	iIcon.setAltText(title);
	if (text != null && !text.isEmpty()) {
		iLabel = new HTML(text, false);
		iPanel = new HorizontalPanel();
		iPanel.setStyleName("icon");
		iPanel.add(iIcon);
		iPanel.add(iLabel);
		iIcon.getElement().getStyle().setPaddingRight(3, Unit.PX);
		iPanel.setCellVerticalAlignment(iIcon, HasVerticalAlignment.ALIGN_MIDDLE);
	}
	iIcon.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			event.stopPropagation();
			UniTimeConfirmationDialog.info(title);
		}
	});
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:23,代碼來源:WebTable.java

示例10: add

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
public IconsCell add(ImageResource resource, final String title) {
	if (resource == null) return this;
	Image icon = new Image(resource);
	icon.setTitle(title);
	icon.setAltText(title);
	if (iPanel.getWidgetCount() > 0)
		icon.getElement().getStyle().setPaddingLeft(3, Unit.PX);
	iPanel.add(icon);
	iPanel.setCellVerticalAlignment(icon, HasVerticalAlignment.ALIGN_MIDDLE);
	if (title != null && !title.isEmpty()) {
		icon.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				event.stopPropagation();
				UniTimeConfirmationDialog.info(title);
			}
		});
	}
	return this;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:21,代碼來源:WebTable.java

示例11: resizeFilterIfNeeded

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
protected void resizeFilterIfNeeded() {
	if (!isAttached()) return;
	ChipPanel last = getLastChipPanel();
	iFilterOpen.setVisible(isEnabled() && !isFilterPopupShowing());
	iFilterClear.setVisible(isEnabled() && (!iFilter.getText().isEmpty() || last != null));
	int buttonWidth = (isFilterPopupShowing() ? iFilterClose : iFilterOpen).getElement().getOffsetWidth() + iFilterClear.getElement().getOffsetWidth() + 8;
	if (last != null) {
		int width = getAbsoluteLeft() + getOffsetWidth() - last.getAbsoluteLeft() - last.getOffsetWidth() - buttonWidth;
		if (width < 100)
			width = getElement().getClientWidth() - buttonWidth;
		iFilter.getElement().getStyle().setWidth(width, Unit.PX);
	} else {
		iFilter.getElement().getStyle().setWidth(getElement().getClientWidth() - buttonWidth, Unit.PX);
	}
	if (isSuggestionsShowing())
		iSuggestionsPopup.moveRelativeTo(this);
	if (isFilterPopupShowing())
		iFilterPopup.moveRelativeTo(this);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:20,代碼來源:FilterBox.java

示例12: move

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
public void move() {
       switch (iMode) {
       case PROPORTIONAL:
        iWidth = Math.max(3, iNrMeetings * (iCellWidth - 6.0) / iTotalNrColumns + (iColumn + iNrMeetings != iTotalNrColumns && iTotalNrColumns > 1 ? -3 : 0));
        iLeft = 4.0 + iCellWidth * getDay() + iColumn * (iCellWidth - 6.0) / iTotalNrColumns;
        break;
       case FILLSPACE:
        iWidth = (iCellWidth - 6.0) / iNrColumns + (iColumn + 1 != iNrColumns && iNrColumns > 1 ? -3 : 0);
        iLeft = 4.0 + iCellWidth * getDay() + iColumn * (iCellWidth - 6) / iNrColumns;
        break;
       case OVERLAP:
       	int weeks = (isVerticalSplitByWeek() ? iSelectedWeeks.size() : iRoomResources.size());
       	iWidth = iNrMeetings * (iCellWidth - 6.0) / weeks + (iColumn + iNrMeetings != weeks && weeks > 1 ? -3 : 0) - 5 * iNrColumns;
       	iLeft = 4.0 + iCellWidth * getDay() + iColumn * (iCellWidth - 6) / weeks + 5 * iNrColumns;
       }
	getElement().getStyle().setWidth(iWidth, Unit.PX);
	getElement().getStyle().setLeft(iLeft, Unit.PX);
	if (hasShadow()) {
		iShadow.getElement().getStyle().setWidth(iWidth, Unit.PX);
		iShadow.getElement().getStyle().setLeft(iLeft, Unit.PX);
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:23,代碼來源:TimeGrid.java

示例13: SelectionPanel

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
public SelectionPanel(boolean fixed) {
	setStyleName(fixed ? "selection" : "active-selection");
	if (fixed) {
		iRemove = new P("x"); iRemove.setHTML("&times;");
		iRemove.addMouseDownHandler(new MouseDownHandler() {
			@Override
			public void onMouseDown(MouseDownEvent event) {
				iSelections.remove(SelectionPanel.this);
				if (iSelection != null)
					iAllSelections.remove(iSelection);
			}
		});
		iRemove.getElement().getStyle().setRight(2, Unit.PX);
		iRemove.getElement().getStyle().setTop(2, Unit.PX);
		iRemove.getElement().getStyle().setPosition(Position.ABSOLUTE);
		add(iRemove);
		iText = new P("text");
		add(iText, 0, 0);
	}
	
	sinkEvents(Event.ONMOUSEDOWN);
	sinkEvents(Event.ONMOUSEUP);
	sinkEvents(Event.ONMOUSEMOVE);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:25,代碼來源:TimeGrid.java

示例14: recenter

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
public void recenter() {
	GwtHint.getInstance().hide();
	
	iScrollRooms.getElement().getStyle().clearHeight();
	if (getElement().getClientHeight() > Window.getClientHeight() - 100)
		iScrollRooms.getElement().getStyle().setHeight(Window.getClientHeight() - 200, Unit.PX);
	
	iScrollDates.getElement().getStyle().clearHeight();
	if (getElement().getClientHeight() > Window.getClientHeight() - 100) {
		iScrollDates.getElement().getStyle().setHeight(Window.getClientHeight() - 200, Unit.PX);
	}

	int left = (Window.getClientWidth() - getOffsetWidth()) >> 1;
    int top = (Window.getClientHeight() - getOffsetHeight()) >> 1;
	setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max( Window.getScrollTop() + top, 0));
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:17,代碼來源:AddMeetingsDialog.java

示例15: BusyPanel

import com.google.gwt.dom.client.Style.Unit; //導入依賴的package包/類
public BusyPanel(String text, int dayOfWeek, int startSlot, int length) {
	super();
	iText = text;
	iDayOfWeek = dayOfWeek;
	iStartSlot = startSlot;
	iLength = length;
	if (iText != null || !iText.isEmpty()) {
		setTitle(iText);
		boolean empty = true;
		for (int i = 0; i < 3; i++) {
			if (iMeetingTable[iDayOfWeek].length <= iStartSlot + i) { empty = false; break; }
			if (iMeetingTable[iDayOfWeek][iStartSlot + i] != null && !iMeetingTable[iDayOfWeek][iStartSlot + i].isEmpty()) {
				empty = false; break;
			}
		}
		if (empty) {
			HTML widget = new HTML(text, false);
			widget.setStyleName("text");
			setWidget(widget);
		}
	}
	setStyleName("busy");
	getElement().getStyle().setWidth(iCellWidth + (iPrint ? 3 : iDayOfWeek + 1 < iNrDays ? 3 : 0), Unit.PX);
	getElement().getStyle().setHeight(125 * iLength / 30, Unit.PX);
	iGrid.insert(this, iCellWidth * iDayOfWeek, 125 * iStartSlot / 30 - 50 * iStart, 1);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:27,代碼來源:TimeGrid.java


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