本文整理汇总了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);
}
示例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);
}
}
示例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);
}
示例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();
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
});
}
示例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;
}
示例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);
}
示例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);
}
}
示例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("×");
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);
}
示例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));
}
示例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);
}