本文整理匯總了Java中com.google.gwt.dom.client.Style.Position類的典型用法代碼示例。如果您正苦於以下問題:Java Position類的具體用法?Java Position怎麽用?Java Position使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Position類屬於com.google.gwt.dom.client.Style包,在下文中一共展示了Position類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: VImageViewer
import com.google.gwt.dom.client.Style.Position; //導入依賴的package包/類
public VImageViewer() {
/* Create widget's root panel */
panelRoot = new FlowPanel();
Style style = panelRoot.getElement().getStyle();
style.setPosition(Position.RELATIVE);
setStyleName(CLASSNAME);
panelRoot.setStyleName(CLASSNAME + "-flow");
style.setWidth(100, Unit.PCT);
style.setHeight(100, Unit.PCT);
/* Create image container */
imageContainer = new FlowPanel();
style = imageContainer.getElement().getStyle();
style.setPosition(Position.ABSOLUTE);
style.setOverflow(Overflow.HIDDEN);
/* Add widgets */
setWidget(panelRoot);
panelRoot.add(imageContainer);
/* Register handlers */
addDomHandler(this, KeyDownEvent.getType());
addDomHandler(this, ClickEvent.getType());
addMouseWheelHandler(new MouseWheelHandler() {
public void onMouseWheel(MouseWheelEvent event) {
event.preventDefault();
if (event.isNorth()) {
moveImages(true);
} else {
moveImages(false);
}
}
});
}
示例2: alignWidget
import com.google.gwt.dom.client.Style.Position; //導入依賴的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);
}
示例3: openFullscreenIE
import com.google.gwt.dom.client.Style.Position; //導入依賴的package包/類
protected void openFullscreenIE(MediaWrapper<?> mediaWrapper, Element template) {
if (mediaWrapper != null && template != null) {
clearFullScreenView();
lastMediaWrapper = mediaWrapper;
VideoFullScreenView parent = getFullScreenView();
Widget widget = mediaWrapper.getMediaObject();
parent.getContainer().add(widget);
resizeToFullScreen(parent.asWidget(), Position.FIXED);
resizeToFullScreen(widget, Position.ABSOLUTE);
parseTemplate(mediaWrapper, template, parent.getControls());
fireEvent(true, mediaWrapper);
RootPanel.get().add(parent);
resizeToFullScreen(lastMediaWrapper.getMediaObject(), Position.FIXED);
resizeToFullScreen(view.asWidget(), Position.FIXED);
resizeToFullScreen(widget, Position.ABSOLUTE);
}
}
示例4: onClick
import com.google.gwt.dom.client.Style.Position; //導入依賴的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);
}
}
示例5: getElement
import com.google.gwt.dom.client.Style.Position; //導入依賴的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);
}
示例6: setSwipeDisabled
import com.google.gwt.dom.client.Style.Position; //導入依賴的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();
}
示例7: testPageViewWithSwipeAndWithout
import com.google.gwt.dom.client.Style.Position; //導入依賴的package包/類
public void testPageViewWithSwipeAndWithout() {
PanelCache cache = PlayerGinjectorFactory.getNewPlayerGinjectorForGWTTestCase().getPanelCache();
assertTrue(cache.isEmpty());
KeyValue<FlowPanel, FlowPanel> value = cache.getOrCreateAndPut(0);
Style style = value.getKey().getElement().getStyle();
assertTrue(style.getPosition().equals(Position.ABSOLUTE.getCssName()));
assertTrue(style.getTop().equals("0px"));
assertEquals("0.0%", style.getLeft());
assertEquals("100.0%", style.getWidth());
value = cache.getOrCreateAndPut(2);
style = value.getKey().getElement().getStyle();
assertEquals(Position.ABSOLUTE.getCssName(), style.getPosition());
assertEquals("0px", style.getTop());
assertEquals("200.0%", style.getLeft());
assertEquals("100.0%", style.getWidth());
cache.setSwipeType(SwipeType.DISABLED);
value = cache.getOrCreateAndPut(3);
assertNotSame(Position.ABSOLUTE.getCssName(), style.getPosition());
assertNotSame("0px", style.getTop());
assertNotSame("200.0%", style.getLeft());
assertNotSame("100.0%", style.getWidth());
}
示例8: SelectionPanel
import com.google.gwt.dom.client.Style.Position; //導入依賴的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);
}
示例9: ActionBar
import com.google.gwt.dom.client.Style.Position; //導入依賴的package包/類
public ActionBar() {
super();
setWidth(300);
setHeaderVisible(false);
addStyleName(ThemeStyles.get().style().borderBottom());
setPosition(0, 0);
getElement().getStyle().setPosition(Position.ABSOLUTE);
HorizontalPanel horizontalGroup = new HorizontalPanel();
horizontalGroup.add(getMenuButton());
horizontalGroup.add(new SeparatorToolItem());
Image image = new Image(ImageProvider.INSTANCE.menulogoGeowe());
horizontalGroup.add(image);
horizontalGroup.add(new SeparatorToolItem());
horizontalGroup.add(new SeparatorToolItem());
horizontalGroup.add(getGeocodingButton());
setWidget(horizontalGroup);
}
示例10: show
import com.google.gwt.dom.client.Style.Position; //導入依賴的package包/類
public void show() {
this.panel.setPopupPositionAndShow( new PositionCallback(){
@Override
public void setPosition( int offsetWidth, int offsetHeight )
{
panel.getElement().getStyle().setPosition( Position.FIXED );
panel.getElement().getStyle().setTop( 0, Unit.PX );
// panel.getElement().getStyle().setLeft( 0, Unit.PX );
// panel.getElement().getStyle().setBottom( 0, Unit.PX );
panel.getElement().getStyle().setRight( 0, Unit.PX );
panel.getElement().getStyle().setProperty( "left", "" );
panel.getElement().getStyle().setProperty( "bottom", "" );
// DOM.setStyleAttribute( panel.getElement(), "position", "fixed" );
// DOM.setStyleAttribute( panel.getElement(), "top", "0" );
// DOM.setStyleAttribute( panel.getElement(), "left", "" );
// DOM.setStyleAttribute( panel.getElement(), "bottom", "" );
// DOM.setStyleAttribute( panel.getElement(), "right", "0px" );
}
} );
}
示例11: SimpleTabPanel
import com.google.gwt.dom.client.Style.Position; //導入依賴的package包/類
public SimpleTabPanel() {
_hp = new HorizontalPanel();
_hp.setHeight100();
_hp.setPosition(Position.ABSOLUTE);
_hp.setLeft(0);
AbsolutePanel ap = new AbsolutePanel();
ap.setOverflow(Overflow.HIDDEN);
ap.setPreferredHeight(TAB_BAR_HEIGHT);
ap.add(_hp);
add(ap);
_sp = new SimplePanel();
_sp.fitToParent();
_sp.setBorderTop(2, BorderStyle.SOLID, TAB_COLOR);
_sp.setBorderLeft(1, BorderStyle.SOLID, TAB_COLOR);
_sp.setBorderRight(1, BorderStyle.SOLID, TAB_COLOR);
_sp.setBorderBottom(1, BorderStyle.SOLID, TAB_COLOR);
add(_sp);
_buttons = new HashMap<String, TabButton>();
_widgets = new HashMap<String, Widget>();
_listeners = new HashMap<String, TabListener>();
}
示例12: TabBar
import com.google.gwt.dom.client.Style.Position; //導入依賴的package包/類
public TabBar(CTabPanel tabPanel) {
_tabPanel = tabPanel;
_tabsArea = new HorizontalPanel();
_tabsArea.setHeight100();
_tabsArea.setPosition(Position.ABSOLUTE);
_tabsArea.setLeft(0);
_tabsArea.setZIndex(Z_INDEX_TABS);
add(_tabsArea);
initControlsAreaLeft();
initControlsAreaRight();
setOverflow(Overflow.HIDDEN);
setBorderBottom(3, Style.BorderStyle.SOLID, TAB_COLOUR_SELECTED);
setWidth100();
setPreferredHeight(DEFAULT_TAB_BAR_HEIGHT);
}
示例13: createSpanElement
import com.google.gwt.dom.client.Style.Position; //導入依賴的package包/類
private SpanElement createSpanElement(final Cursor cursor,
final double left,
final double width) {
final SpanElement span = document.createSpanElement();
span.setAttribute("title",
title);
final Style style = span.getStyle();
style.setCursor(cursor);
style.setPosition(Position.ABSOLUTE);
style.setBottom(0,
PX);
style.setHeight(source.getOffsetHeight(),
PX);
style.setTop(source.getOffsetTop(),
PX);
style.setWidth(width,
PX);
style.setLeft(left,
PX);
return span;
}
示例14: TankMovingAnimation
import com.google.gwt.dom.client.Style.Position; //導入依賴的package包/類
public TankMovingAnimation(HTML mapContainer, int startX, int startY, int endX, int endY,
ImageResource resource, Audio sfx, int tankSize) {
piece = resource;
this.startX = startX;
this.startY = startY;
this.endX = endX;
this.endY = endY;
this.startWidth = tankSize;
this.startHeight = tankSize;
sound = sfx;
cancelled = false;
panel = new AbsolutePanel();
moving = new Image(resource);
moving.setPixelSize(startWidth, startHeight);
panel.add(moving, startX, startY);
panel.getElement().getStyle().setOverflow(Overflow.VISIBLE);
panel.getElement().getStyle().setPosition(Position.RELATIVE);
mapContainer.getElement().insertFirst(panel.getElement());
}
示例15: Arrow
import com.google.gwt.dom.client.Style.Position; //導入依賴的package包/類
public Arrow(final Orientation orientation, final int borderWidth) {
setElement(d);
this.orientation = orientation;
this.borderWidth = borderWidth;
d.appendChild(d1);
d.appendChild(d2);
d.getStyle().setPosition(Position.ABSOLUTE);
d1.getStyle().setPosition(Position.ABSOLUTE);
d1.getStyle().setHeight(0, Unit.PX);
d1.getStyle().setWidth(0, Unit.PX);
d1.getStyle().setPropertyPx(orientation.pos, 0);
d1.getStyle().setPropertyPx(orientation.altPos, 0);
d1.getStyle().setBorderStyle(BorderStyle.SOLID);
d2.getStyle().setPosition(Position.ABSOLUTE);
d2.getStyle().setHeight(0, Unit.PX);
d2.getStyle().setWidth(0, Unit.PX);
d2.getStyle().setPropertyPx(orientation.pos, borderWidth);
d2.getStyle().setPropertyPx(orientation.altPos, borderWidth);
d2.getStyle().setBorderStyle(BorderStyle.SOLID);
topBottom = orientation == Orientation.TOP || orientation == Orientation.BOTTOM;
}