Java 类com.google.gwt.dom.client.Style 实例源码

项目:wbi    文件:MaterialItem.java   
@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());
    }
}
项目:empiria.player    文件:LabelledImgContent.java   
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);
}
项目:empiria.player    文件:PanelCache.java   
@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);
}
项目:empiria.player    文件:MultiPageView.java   
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();
}
项目:empiria.player    文件:MultiPageController.java   
@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);
    }
}
项目:empiria.player    文件:PanelCacheGWTTestCase.java   
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());

}
项目:mvp4g2-examples    文件:ShellView.java   
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);
}
项目:document-management-system    文件:ExtendedDockPanel.java   
/**
 * 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);
}
项目:document-management-system    文件:KeywordsPopup.java   
/**
 * 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);
    }
}
项目:document-management-system    文件:KeywordsWidget.java   
/**
 * 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);
    }
}
项目:document-management-system    文件:WidgetUtil.java   
/**
 * 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);
    }
}
项目:gwt-material-errai    文件:Header.java   
@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);
}
项目:gwt-material-errai    文件:CollectionCard.java   
@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);
}
项目:walkaround    文件:Walkaround.java   
/** 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);
}
项目:cuba    文件:CubaFileUploadProgressWindow.java   
@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();
            }
        });
    }
}
项目:cuba    文件:CubaTooltip.java   
protected void checkRequiredIndicatorVisible() {
    if (requiredIndicatorVisible == null) {
        Element requiredIndicatorFake = DOM.createDiv();
        requiredIndicatorFake.setClassName(REQUIRED_INDICATOR);
        requiredIndicatorFake.getStyle().setPosition(Style.Position.ABSOLUTE);

        String rootPanelId = ac.getConfiguration().getRootPanelId();
        Element rootPanel = Document.get().getElementById(rootPanelId);
        rootPanel.appendChild(requiredIndicatorFake);

        String display = new ComputedStyle(requiredIndicatorFake).getProperty("display");

        requiredIndicatorVisible = !"none".equals(display);

        rootPanel.removeChild(requiredIndicatorFake);
    }
}
项目:cuba    文件:CubaCheckBoxConnector.java   
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    getWidget().captionManagedByLayout = getState().captionManagedByLayout;

    super.onStateChanged(stateChangeEvent);

    if (!getWidget().captionManagedByLayout
            && isContextHelpIconEnabled()) {
        if (getWidget().contextHelpIcon == null) {
            getWidget().contextHelpIcon = DOM.createSpan();
            getWidget().contextHelpIcon.setInnerHTML("?");
            getWidget().contextHelpIcon.setClassName(CONTEXT_HELP_CLASSNAME);
            Roles.getTextboxRole().setAriaHiddenState(getWidget().contextHelpIcon, true);

            getWidget().getElement().appendChild(getWidget().contextHelpIcon);
            DOM.sinkEvents(getWidget().contextHelpIcon, VTooltip.TOOLTIP_EVENTS | Event.ONCLICK);
        } else {
            getWidget().contextHelpIcon.getStyle().clearDisplay();
        }
    } else if (getWidget().contextHelpIcon != null) {
        getWidget().contextHelpIcon.getStyle()
                .setDisplay(Style.Display.NONE);

        getWidget().setAriaInvalid(false);
    }
}
项目:cuba    文件:TableAggregationRow.java   
public void setCellWidth(int cellIx, int width) {
    // CAUTION: copied from VScrollTableRow with small changes
    final Element cell = DOM.getChild(tr, cellIx);
    Style wrapperStyle = cell.getFirstChildElement().getStyle();
    int wrapperWidth = width;
    if (BrowserInfo.get().isWebkit()
            || BrowserInfo.get().isOpera10()) {
                /*
                 * Some versions of Webkit and Opera ignore the width
                 * definition of zero width table cells. Instead, use 1px
                 * and compensate with a negative margin.
                 */
        if (width == 0) {
            wrapperWidth = 1;
            wrapperStyle.setMarginRight(-1, Style.Unit.PX);
        } else {
            wrapperStyle.clearMarginRight();
        }
    }
    wrapperStyle.setPropertyPx("width", wrapperWidth);
    cell.getStyle().setPropertyPx("width", width);
}
项目:cuba    文件:CubaGroupTableWidget.java   
@Override
public int getAvailableWidth() {
    // fix for Halo based themes #PL-4570
    // it does not set real width of group column to divider cell element

    int availableWidth = super.getAvailableWidth();
    HeaderCell headerCell = tHead.getHeaderCell(GROUP_DIVIDER_COLUMN_KEY);
    int groupCellWidth = headerCell.getOffsetWidth();
    Style headCellStyle = headerCell.getElement().getStyle();

    if (!(groupCellWidth + "px").equals(headCellStyle.getWidth())) {
        if (availableWidth - groupCellWidth > 0) {
            availableWidth -= groupCellWidth;
        }
    }

    return availableWidth;
}
项目:cuba    文件:CubaTreeTableWidget.java   
@Override
protected void initCellWithText(String text, char align, String style, boolean textIsHTML,
                                boolean sorted, String description, TableCellElement td) {
    super.initCellWithText(text, align, style, textIsHTML, sorted, description, td);

    Element tdElement = td.cast();
    Tools.textSelectionEnable(tdElement, _delegate.textSelectionEnabled);

    if (_delegate.clickableColumns != null && _delegate.clickableColumns.contains(currentColumnKey)) {
        Element wrapperElement = tdElement.getFirstChildElement();
        final Element clickableSpan = DOM.createSpan().cast();
        clickableSpan.setClassName(CUBA_TABLE_CLICKABLE_CELL_STYLE);

        clickableSpan.setInnerText(wrapperElement.getInnerText());

        wrapperElement.removeAllChildren();
        DOM.appendChild(wrapperElement, clickableSpan);
    }

    if (_delegate.multiLineCells) {
        Style wrapperStyle = tdElement.getFirstChildElement().getStyle();
        wrapperStyle.setWhiteSpace(Style.WhiteSpace.PRE_LINE);
    }
}
项目:cuba    文件:CubaFileDownloaderConnector.java   
public void downloadFileById(String resourceId) {
    final String url = getResourceUrl(resourceId);
    if (url != null && !url.isEmpty()) {
        final IFrameElement iframe = Document.get().createIFrameElement();

        Style style = iframe.getStyle();
        style.setVisibility(Style.Visibility.HIDDEN);
        style.setHeight(0, Style.Unit.PX);
        style.setWidth(0, Style.Unit.PX);

        iframe.setFrameBorder(0);
        iframe.setTabIndex(-1);
        iframe.setSrc(url);
        RootPanel.getBodyElement().appendChild(iframe);

        Timer removeTimer = new Timer() {
            @Override
            public void run() {
                iframe.removeFromParent();
            }
        };
        removeTimer.schedule(60 * 1000);
    }
}
项目:cuba    文件:TableWidgetDelegate.java   
public void reassignHeaderCellWidth(int colIndex, VScrollTable.HeaderCell hcell, int minWidth) {
    if (tableWidget.isCustomColumn(colIndex)) {
        return;
    }

    for (Widget rowWidget : (tableWidget).getRenderedRows()) {
        if (tableWidget.isGenericRow(rowWidget)) {
            VScrollTable.VScrollTableBody.VScrollTableRow row = (VScrollTable.VScrollTableBody.VScrollTableRow) rowWidget;

            double realColWidth = row.getRealCellWidth(colIndex);
            if (realColWidth > 0) {
                if (realColWidth > minWidth) {
                    Style hStyle = hcell.getElement().getStyle();

                    hStyle.setProperty("width", realColWidth + "px");
                    hStyle.setProperty("minWidth", realColWidth + "px");
                    hStyle.setProperty("maxWidth", realColWidth + "px");
                }

                break;
            }
        }
    }
}
项目:cuba    文件:CubaScrollTableWidget.java   
@Override
protected void initCellWithText(String text, char align, String style, boolean textIsHTML,
                                boolean sorted, String description, TableCellElement td) {
    super.initCellWithText(text, align, style, textIsHTML, sorted, description, td);

    final Element tdElement = td.cast();
    Tools.textSelectionEnable(tdElement, _delegate.textSelectionEnabled);

    if (_delegate.clickableColumns != null && _delegate.clickableColumns.contains(currentColumnKey)) {
        Element wrapperElement = tdElement.getFirstChildElement();
        final Element clickableSpan = DOM.createSpan().cast();
        clickableSpan.setClassName(CUBA_TABLE_CLICKABLE_CELL_STYLE);

        clickableSpan.setInnerText(wrapperElement.getInnerText());

        wrapperElement.removeAllChildren();
        DOM.appendChild(wrapperElement, clickableSpan);
    }

    if (_delegate.multiLineCells) {
        Style wrapperStyle = tdElement.getFirstChildElement().getStyle();
        wrapperStyle.setWhiteSpace(Style.WhiteSpace.PRE_LINE);
    }
}
项目:gwt-uploader    文件:GwtUploaderDemo.java   
@Override
public void onModuleLoad() {
  uploaderPanels.put("TextButtonAndProgressText", new TextButtonAndProgressText());
  uploaderPanels.put("ImageButtonAndProgressText", new ImageButtonAndProgressText());
  uploaderPanels.put("ImageButtonAndProgressBar", new ImageButtonAndProgressBar());
  uploaderPanels.put("MultiUploadWithProgressBar", new MultiUploadWithProgressBar());
  uploaderPanels.put("MultiUploadWithProgressBarAndDragAndDrop",
                     new MultiUploadWithProgressBarAndDragAndDrop());

  for (Map.Entry<String, UploaderSample> entry : uploaderPanels.entrySet()) {
    final UploaderSample sample = entry.getValue();
    final Widget uploaderPanel = sample.getUploaderPanel();
    final Button btnViewSource = new Button("View Source");
    btnViewSource.getElement().getStyle().setMarginTop(10, Style.Unit.PX);
    btnViewSource.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        sourceCodePopup.showSourceCode(sample.getUploaderCode());
      }
    });
    VerticalPanel panel = new VerticalPanel();
    panel.add(uploaderPanel);
    panel.add(btnViewSource);
    RootPanel.get(entry.getKey()).add(panel);
  }
}
项目:Wiab.pro    文件:DomUtil.java   
/** 
 * Sets specified cursor to the element.
 * 
 * @param element
 * @param cursorName name of the cursor
 * 
 * Walkaround of Chrome bug when cursor on the element needs mouse move to be actually changed.
 * http://code.google.com/p/chromium/issues/detail?id=26723#c87
 */
private static void setCursor(Element element, String cursorName) {
  String currentCursorName = element.getStyle().getCursor();
  if (!currentCursorName.equals(cursorName)) {
    Element wkch = Document.get().createDivElement();
    com.google.gwt.dom.client.Style wkchStyle = wkch.getStyle();
    wkchStyle.setOverflow(Style.Overflow.HIDDEN);
    wkchStyle.setPosition(Style.Position.ABSOLUTE);
    wkchStyle.setLeft(0, Style.Unit.PX);
    wkchStyle.setTop(0, Style.Unit.PX);
    wkchStyle.setWidth(100, Style.Unit.PCT);
    wkchStyle.setHeight(100, Style.Unit.PCT);

    Element wkch2 = Document.get().createDivElement();
    com.google.gwt.dom.client.Style wkch2Style = wkch2.getStyle();
    wkch2Style.setWidth(200, Style.Unit.PCT);
    wkch2Style.setHeight(200, Style.Unit.PCT);
    wkch.appendChild(wkch2);

    element.appendChild(wkch);
    element.getStyle().setProperty(STYLE_CURSOR_PROPERTY, cursorName);
    wkch.setScrollLeft(1);
    wkch.setScrollLeft(0);
    element.removeChild(wkch);
  }
}
项目:gwt-material-chat    文件:Header.java   
@PostConstruct
public void init() {
    navBar.setActivates("sideNav");
    navBar.setType(NavBarType.FIXED);
    navBrand.setText("Chat App");
    navBar.add(navBrand);
    navSection.setFloat(Style.Float.RIGHT);
    navSection.setHideOn(HideOn.NONE);
    iconUsers.setIconType(IconType.ACCOUNT_CIRCLE);
    badgeUsers.setText("0");
    badgeUsers.setBackgroundColor("pink");
    badgeUsers.setRight(16);
    badgeUsers.setCircle(true);
    iconUsers.add(badgeUsers);

    navSection.add(iconUsers);
    navBar.add(navSection);
}
项目:gwtmvp    文件:Loader.java   
/**
 * Decreases the shown counter for a specific loader and hides the element if it has reached zero.
 * For non-counted loaders this hides the element immediately.
 * 
 * @param tag The tag of the loader to hide, note that {@code null} is reserved for the global
 *          (general) loader.
 */
public static void hide(String tag) {
  Entry entry = entries.get(tag);
  if (entry == null) {
    return;
  }
  if (entry.showedCounter == -1) {
    entry.element.getStyle().setDisplay(Style.Display.NONE);
  } else {
    if (entry.showedCounter > 0) {
      entry.showedCounter--;
    }
    if (entry.showedCounter == 0) {
      entry.element.getStyle().setDisplay(Style.Display.NONE);
    }
  }
}
项目:blogwt    文件:MapHelper.java   
/**
 * @param element
 * @param lines
 * @param params
 */
public static void showMap (Element element, List<String> lines,
        Map<String, String> params) {
    Style s = element.getStyle();

    float width = floatParam(params, "width", 100);
    Unit widthUnits = unitParam(params, "widthUnits", Unit.PCT);
    s.setWidth(width, widthUnits);

    float height = floatParam(params, "height", 200);
    Unit heightUnits = unitParam(params, "heightUnits", Unit.PT);
    s.setHeight(height, heightUnits);

    float lat = floatParam(params, "lat", -34.397f);
    float lng = floatParam(params, "lng", 150.644f);

    int zoom = intParam(params, "zoom", 8);

    String markerName = params.get("markerName");

    showMap(element, lat, lng, zoom, markerName);
}
项目:appformer    文件:TreeItemTest.java   
@Before
public void setup() {
    final Element element = mock(Element.class);
    when(content.getElement()).thenReturn(element);
    final Style style = mock(Style.class);
    when(element.getStyle()).thenReturn(style);
    testedRoot = new TreeItem(TreeItem.Type.ROOT,
                              ROOT_VALUE,
                              ROOT_LABEL,
                              widget,
                              () -> content);
    testedRoot.setTree(tree);
    testedContainer = new TreeItem(TreeItem.Type.CONTAINER,
                                   CONTAINER_VALUE,
                                   CONTAINER_LABEL,
                                   widget,
                                   () -> content);
    testedItem = new TreeItem(TreeItem.Type.ITEM,
                              ITEM_VALUE,
                              ITEM_LABEL,
                              widget,
                              () -> content);
}
项目:appformer    文件:TopMenuBar.java   
private void addEntry(String entry, boolean logout) {
    AnchorElement anchor = Document.get().createAnchorElement();
    anchor.setInnerText(entry);

    Event.sinkEvents(anchor, Event.ONCLICK);
    Event.setEventListener(anchor, event -> {
        if (Event.ONCLICK == event.getTypeInt()) {
            if (!logout) {
                onRoleClicked(entry);
            } else {
                onLogoutClicked();
            }
        }
    });

    LIElement li = Document.get().createLIElement();
    li.getStyle().setCursor(Style.Cursor.POINTER);
    li.appendChild(anchor);
    roleList.appendChild((Node) li);
}
项目:che    文件:GitHubAuthenticatorViewImpl.java   
@Inject
public GitHubAuthenticatorViewImpl(
    DialogFactory dialogFactory,
    GitHubLocalizationConstant locale,
    ProductInfoDataProvider productInfoDataProvider) {
  this.dialogFactory = dialogFactory;
  this.locale = locale;

  isGenerateKeys = new CheckBox(locale.authGenerateKeyLabel());
  isGenerateKeys.setValue(true);

  contentPanel = new DockLayoutPanel(Style.Unit.PX);
  contentPanel.addNorth(
      new InlineHTML(locale.authorizationDialogText(productInfoDataProvider.getName())), 20);
  contentPanel.addNorth(isGenerateKeys, 20);
}
项目:kie-docker-ci    文件:NavigationDateItemView.java   
private void positionItems() {

    // Day text.
    final Style dayStyle = day.getElement().getStyle();
    dayStyle.setPosition(Style.Position.ABSOLUTE);
    dayStyle.setMarginTop( (ICON_SIZE / 2) * -1, Style.Unit.PX);
    dayStyle.setMarginLeft( ( ICON_SIZE / 2 ) + 10, Style.Unit.PX);

    // Month text.
    final Style monthStyle = month.getElement().getStyle();
    monthStyle.setPosition(Style.Position.ABSOLUTE);
    monthStyle.setMarginTop(25, Style.Unit.PX);
    monthStyle.setMarginLeft( ( ICON_SIZE / 2 ) + (month.getOffsetWidth() / 2), Style.Unit.PX);

    // Count number.
    final Style countStyle = countText.getElement().getStyle();
    countStyle.setPosition(Style.Position.ABSOLUTE);
    countStyle.setMarginTop(20, Style.Unit.PX);
    countStyle.setMarginLeft( ( ICON_SIZE - 20 ), Style.Unit.PX);
}
项目:firefly    文件:PopupContainerForRegion.java   
public void show() {

        LayoutManager lm= Application.getInstance().getLayoutManager();
        _layout.clear();

        lm.getRegion(LayoutManager.POPOUT_REGION).setDisplay(GwtUtil.wrap(_layout,4,4,4,4,true));
//        lm.getRegion(LayoutManager.POPOUT_REGION).setDisplay(_layout);
//        lm.getRegion(LayoutManager.POPOUT_REGION).show();
        _layout.addNorth(headerBar, TOOLBAR_HEIGHT);
        DockLayoutPanel p= new DockLayoutPanel(Style.Unit.PX);
//        _layout.add(GwtUtil.wrap(_popout.getToplevelExpandRoot(), 1,4,1,4));
        _layout.add(GwtUtil.wrap(_popout.getToplevelExpandRoot(), 1,4,1,4));

        _showing= true;
        GwtUtil.setHidden(_close, !isCloseShowing());

        _close.setDesc("Close");
    }
项目:che    文件:ItemsList.java   
ItemWidget(MenuItem item) {
  this.item = item;

  addStyleName(resources.css().popupItem());

  final Element itemLabel = Document.get().createDivElement();
  itemLabel.setInnerText(item.getName());
  itemLabel.getStyle().setFloat(Style.Float.LEFT);

  getElement().appendChild(itemLabel);

  if (dataProvider.isGroup(item)) {
    DivElement arrow = Document.get().createDivElement();
    arrow.setInnerHTML(FontAwesome.PLAY);
    arrow.addClassName(resources.css().arrow());
    getElement().appendChild(arrow);
  }

  attachEventHandlers();
}
项目:appformer    文件:ShowcaseEntryPoint.java   
private void hideLoadingPopup() {
    final Element e = RootPanel.get("loading").getElement();

    new Animation() {

        @Override
        protected void onUpdate(double progress) {
            e.getStyle().setOpacity(1.0 - progress);
        }

        @Override
        protected void onComplete() {
            e.getStyle().setVisibility(Style.Visibility.HIDDEN);
        }
    }.run(500);
}
项目:appformer    文件:WorkbenchToolBarView.java   
private void collapse() {
    new CollapseAnimation().animate(getOffsetWidth(),
                                    8,
                                    500);

    container.removeFromParent();
    container.getElement().getStyle().setTop(getAbsoluteTop(),
                                             Style.Unit.PX);
    container.getElement().getStyle().setPosition(Style.Position.FIXED);
    container.getElement().getStyle().setZIndex(Integer.MAX_VALUE);
    RootPanel.get().add(container);

    tip.setTitle(WorkbenchConstants.INSTANCE.expandToolbar());
    tip.setPlacement(Placement.RIGHT);
    tip.setWidget(viewControl);
    tip.reconfigure();

    state = State.COLLAPSED;
}
项目:wbi    文件:MaterialButton.java   
@Override
public void onClick(ClickEvent event) {
    if (animationEnabled) {
        ink.removeClassName(Class.ANIMATE.getName());

        Style style = ink.getStyle();
        int size = anchor.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);

        ink.addClassName(Class.ANIMATE.getName());
    }
}
项目:appformer    文件:BaseNavWidgetView.java   
@Override
public void addItem(String id, String name, String description, Command onItemSelected) {
    AnchorElement anchor = Document.get().createAnchorElement();
    anchor.setInnerText(name);
    if (description != null && !description.equals(name)) {
        anchor.setTitle(description);
    }

    LIElement li = Document.get().createLIElement();
    li.getStyle().setCursor(Style.Cursor.POINTER);
    li.appendChild(anchor);
    navWidget.appendChild((Node) li);
    itemMap.put(id, li);

    Event.sinkEvents(anchor, Event.ONCLICK);
    Event.setEventListener(anchor, event -> {
        if (Event.ONCLICK == event.getTypeInt()) {
            onItemSelected.execute();
        }
    });
}
项目:gwt-material    文件:MaterialWidgetTest.java   
public void testFontSize() {
    // UiBinder
    // given
    T widget = getWidget(false);

    // when / then
    widget.setFontSize("12px");
    assertEquals("12px", widget.getFontSize());

    widget.setFontSize(14, Style.Unit.PX);
    assertEquals("14px", widget.getFontSize());

    // Standard
    // given
    attachWidget();

    // when / then
    widget.setFontSize("12px");
    assertEquals("12px", widget.getElement().getStyle().getFontSize());

    widget.setFontSize(14, Style.Unit.PX);
    assertEquals("14px", widget.getElement().getStyle().getFontSize());
}
项目:che    文件:FindUsagesViewImpl.java   
@Inject
public FindUsagesViewImpl(
    NodeFactory nodeFactory, JavaLocalizationConstant localizationConstant) {
  this.nodeFactory = nodeFactory;
  setTitle(localizationConstant.findUsagesPartTitle());
  DockLayoutPanel panel = new DockLayoutPanel(Style.Unit.PX);

  NodeStorage storage =
      new NodeStorage(
          new NodeUniqueKeyProvider() {
            @Override
            public String getKey(@NotNull Node item) {
              return String.valueOf(item.hashCode());
            }
          });
  NodeLoader loader = new NodeLoader(Collections.<NodeInterceptor>emptySet());
  tree = new Tree(storage, loader);
  panel.add(tree);
  setContentWidget(panel);
  panel.ensureDebugId("findUsages-panel");
}