本文整理匯總了Java中com.google.gwt.dom.client.Style類的典型用法代碼示例。如果您正苦於以下問題:Java Style類的具體用法?Java Style怎麽用?Java Style使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Style類屬於com.google.gwt.dom.client包,在下文中一共展示了Style類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onClick
import com.google.gwt.dom.client.Style; //導入依賴的package包/類
@Override
public void onClick(ClickEvent event) {
if (animationEnabled) {
Element inkElement = ink.getElement();
inkElement.removeClassName(Class.ANIMATE.getName());
Style style = inkElement.getStyle();
int size = panel.getOffsetWidth();
style.setWidth(size, Style.Unit.PX);
style.setHeight(size, Style.Unit.PX);
style.setMarginLeft(-size / 2, Style.Unit.PX);
style.setMarginTop(-size / 2, Style.Unit.PX);
style.setLeft(event.getX(), Style.Unit.PX);
style.setTop(event.getY(), Style.Unit.PX);
inkElement.addClassName(Class.ANIMATE.getName());
}
}
示例2: alignWidget
import com.google.gwt.dom.client.Style; //導入依賴的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: getElement
import com.google.gwt.dom.client.Style; //導入依賴的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; //導入依賴的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; //導入依賴的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: testPageViewWithSwipeAndWithout
import com.google.gwt.dom.client.Style; //導入依賴的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());
}
示例7: createView
import com.google.gwt.dom.client.Style; //導入依賴的package包/類
public void createView() {
shell = new ResizeLayoutPanel();
shell.setSize("100%", "100%");
shell.addResizeHandler(new ResizeHandler() {
@Override
public void onResize(ResizeEvent event) {
forceLayout();
}
});
panel = new DockLayoutPanel(Style.Unit.PX);
panel.setSize("100%", "100%");
shell.add(panel);
Widget header = createNorth();
panel.addNorth(header, 128);
Widget footer = createSouth();
panel.addSouth(footer, 42);
}
示例8: setWidgetsSize
import com.google.gwt.dom.client.Style; //導入依賴的package包/類
/**
* SetWidgetsSize
*/
private void setWidgetsSize() {
// Calculating real height
usableHeight = Window.getClientHeight();
if (Main.get().hasHeaderCustomization) {
usableHeight -= 72;
RootLayoutPanel.get().setWidgetTopBottom(Main.get().mainPanel, 72, Style.Unit.PX, 0, Style.Unit.PX);
}
// Initialize dockPanel size
dockPanel.setSize("" + Window.getClientWidth() + "px", "" + usableHeight + "px");
// The active panel must be the last on initalization because establishes coordenates
leftBorderPanel.setSize(VERTICAL_BORDER_PANEL_WIDTH, usableHeight - (TopPanel.PANEL_HEIGHT + BottomPanel.PANEL_HEIGHT));
rightBorderPanel.setSize(VERTICAL_BORDER_PANEL_WIDTH, usableHeight - (TopPanel.PANEL_HEIGHT + BottomPanel.PANEL_HEIGHT));
centerWidth = Window.getClientWidth() - (2 * VERTICAL_BORDER_PANEL_WIDTH);
centerHeight = usableHeight - (TopPanel.PANEL_HEIGHT + BottomPanel.PANEL_HEIGHT);
topPanel.setWidth("" + Window.getClientWidth() + "px");
desktop.setSize(centerWidth, centerHeight);
search.setSize(centerWidth, centerHeight);
dashboard.setSize(centerWidth, centerHeight);
administration.setSize(centerWidth, centerHeight);
}
示例9: drawTagCloud
import com.google.gwt.dom.client.Style; //導入依賴的package包/類
/**
* Draws a tag cloud
*/
private void drawTagCloud(Collection<String> keywords) {
// Deletes all tag clouds keys
keywordsCloud.clear();
keywordsCloud.setMinFrequency(Main.get().mainPanel.dashboard.keyMapDashboard.getTotalMinFrequency());
keywordsCloud.setMaxFrequency(Main.get().mainPanel.dashboard.keyMapDashboard.getTotalMaxFrequency());
for (Iterator<String> it = keywords.iterator(); it.hasNext(); ) {
String keyword = it.next();
HTML tagKey = new HTML(keyword);
tagKey.setStyleName("okm-cloudTags");
Style linkStyle = tagKey.getElement().getStyle();
int fontSize = keywordsCloud.getLabelSize(Main.get().mainPanel.dashboard.keyMapDashboard
.getKeywordRate(keyword));
linkStyle.setProperty("fontSize", fontSize + "pt");
linkStyle.setProperty("color", keywordsCloud.getColor(fontSize));
if (fontSize > 0) {
linkStyle.setProperty("top", (keywordsCloud.getMaxFontSize() - fontSize) / 2 + "px");
}
keywordsCloud.add(tagKey);
}
}
示例10: drawTagCloud
import com.google.gwt.dom.client.Style; //導入依賴的package包/類
/**
* Draws a tag cloud
*/
private void drawTagCloud(Collection<String> keywords) {
// Deletes all tag clouds keys
keywordsCloud.clear();
keywordsCloud.setMinFrequency(Main.get().mainPanel.dashboard.keyMapDashboard.getTotalMinFrequency());
keywordsCloud.setMaxFrequency(Main.get().mainPanel.dashboard.keyMapDashboard.getTotalMaxFrequency());
for (Iterator<String> it = keywords.iterator(); it.hasNext(); ) {
String keyword = it.next();
HTML tagKey = new HTML(keyword);
tagKey.setStyleName("okm-cloudTags");
Style linkStyle = tagKey.getElement().getStyle();
int fontSize = keywordsCloud.getLabelSize(Main.get().mainPanel.dashboard.keyMapDashboard.getKeywordRate(keyword));
linkStyle.setProperty("fontSize", fontSize + "pt");
linkStyle.setProperty("color", keywordsCloud.getColor(fontSize));
if (fontSize > 0) {
linkStyle.setProperty("top", (keywordsCloud.getMaxFontSize() - fontSize) / 2 + "px");
}
keywordsCloud.add(tagKey);
}
}
示例11: drawTagCloud
import com.google.gwt.dom.client.Style; //導入依賴的package包/類
/**
* Draws a tag cloud
*/
public static void drawTagCloud(final TagCloud keywordsCloud, Collection<String> keywords) {
// Deletes all tag clouds keys
keywordsCloud.clear();
keywordsCloud.setMinFrequency(Main.get().mainPanel.dashboard.keyMapDashboard.getTotalMinFrequency());
keywordsCloud.setMaxFrequency(Main.get().mainPanel.dashboard.keyMapDashboard.getTotalMaxFrequency());
for (Iterator<String> it = keywords.iterator(); it.hasNext(); ) {
String keyword = it.next();
HTML tagKey = new HTML(keyword);
tagKey.setStyleName("okm-cloudTags");
Style linkStyle = tagKey.getElement().getStyle();
int fontSize = keywordsCloud.getLabelSize(Main.get().mainPanel.dashboard.keyMapDashboard.getKeywordRate(keyword));
linkStyle.setProperty("fontSize", fontSize + "pt");
linkStyle.setProperty("color", keywordsCloud.getColor(fontSize));
if (fontSize > 0) {
linkStyle.setProperty("top", (keywordsCloud.getMaxFontSize() - fontSize) / 2 + "px");
}
keywordsCloud.add(tagKey);
}
}
示例12: init
import com.google.gwt.dom.client.Style; //導入依賴的package包/類
@PostConstruct
private void init() {
navBar.setBackgroundColor("light-blue");
navBar.setActivates("side-nav");
header.add(navBar);
header.add(tabs);
navBrand.setText("GMD Errai");
for(Links l : DataHelper.getAllNavSectionLinks()){
MaterialLink link = new MaterialLink();
link.setIconType(l.getIcon());
link.setHref(l.getLink());
navSection.add(link);
}
navBar.add(navBrand);
navSection.setFloat(Style.Float.RIGHT);
navBar.add(navSection);
}
示例13: init
import com.google.gwt.dom.client.Style; //導入依賴的package包/類
@PostConstruct
public void init() {
cardImage.add(image);
card.add(cardImage);
content.setTextColor("white");
content.setHeight("120px");
profileImage.setHeight("32px");
profileImage.setWidth("32px");
profileImage.setCircle(true);
profileImage.setMarginTop(-32);
profileImage.setLayoutPosition(Style.Position.ABSOLUTE);
content.add(profileImage);
title.setFontSize("1em");
content.add(title);
description.setOpacity(0.6);
description.setMarginTop(4);
content.add(description);
card.add(content);
}
示例14: attachLogPanel
import com.google.gwt.dom.client.Style; //導入依賴的package包/類
/** Reveals the log div, and executes a task when done. */
// The async API for this method is intended to support two things: a cool
// spew animation, and also the potential to runAsync the whole LogPanel code.
private static void attachLogPanel() {
Logs.get().addHandler(domLogger);
final Panel logHolder = RootPanel.get("logHolder");
logHolder.setVisible(true);
// Need one layout and paint cycle after revealing it to start animation.
// Use high priority to avoid potential starvation by other tasks if a
// problem is occurring.
SchedulerInstance.getHighPriorityTimer().scheduleDelayed(new Task() {
@Override
public void execute() {
logHolder.add(domLogger);
Style waveStyle = Document.get().getElementById(WAVEPANEL_PLACEHOLDER).getStyle();
Style logStyle = logHolder.getElement().getStyle();
logStyle.setHeight(250, Unit.PX);
waveStyle.setBottom(250, Unit.PX);
}
}, 50);
}
示例15: onAttach
import com.google.gwt.dom.client.Style; //導入依賴的package包/類
@Override
protected void onAttach() {
super.onAttach();
/*
* When this window gets reattached, set the tabstop to the previous
* state.
*/
setTabStopEnabled(doTabStop);
// Fix for #14413. Any pseudo elements inside these elements are not
// visible on initial render unless we shake the DOM.
if (BrowserInfo.get().isIE8()) {
closeBox.getStyle().setDisplay(Style.Display.NONE);
Scheduler.get().scheduleFinally(new Command() {
@Override
public void execute() {
closeBox.getStyle().clearDisplay();
}
});
}
}