com.google.gwt.dom.client.Style.Unit Java Examples
The following examples show how to use
com.google.gwt.dom.client.Style.Unit.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BasicToolBar.java From geowe-core with GNU General Public License v3.0 | 6 votes |
@Override public Widget asWidget() { if (widget == null) { widget = new VerticalLayoutContainer(); widget.getElement().getStyle().setPosition(Position.ABSOLUTE); widget.getElement().getStyle().setRight(5, Unit.PX); widget.getElement().getStyle().setBottom(5, Unit.PX); widget.setHeight("120px"); widget.setWidth("420px"); ScrollSupport scrollSupport = widget.getScrollSupport(); scrollSupport.setScrollMode(ScrollMode.AUTOX); widget.add(w3wPanel); widget.add(toolBar); widget.setVisible(true); } return widget; }
Example #2
Source File: TextLayer.java From djvu-html5 with GNU General Public License v2.0 | 6 votes |
/** * @param left position of page's left edge on the canvas * @param top position of page's top edge on the canvas */ public void setViewPosition(int pageNum, int left, int top, double zoom) { boolean pageChanged = currentPage != pageNum; TextPage page = getPage(pageNum); if (pageChanged) { getPage(currentPage).removeStyleName(PAGE_STYLE_VISIBLE); page.addStyleName(PAGE_STYLE_VISIBLE); } page.resize(zoom, pageChanged); currentPage = pageNum; Element layerElement = getElement(); Element pageElement = page.getElement(); pageElement.getStyle().setMarginLeft(Math.max(left, 0) + EXTRA_PAGE_MARGIN, Unit.PX); int targetScrollLeft = Math.max(-left, 0) + EXTRA_PAGE_MARGIN; if (layerElement.getScrollLeft() != targetScrollLeft) layerElement.setScrollLeft(targetScrollLeft); int targetScrollTop = pageElement.getOffsetTop() - top; if (layerElement.getScrollTop() != targetScrollTop) layerElement.setScrollTop(targetScrollTop); }
Example #3
Source File: RegisterView.java From EasyML with Apache License 2.0 | 6 votes |
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); }
Example #4
Source File: Arrow.java From bitcoin-transaction-explorer with MIT License | 6 votes |
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; }
Example #5
Source File: CursorDisplay.java From swellrt with Apache License 2.0 | 6 votes |
@Override public void onUpdate(EditorUpdateEvent event) { OffsetPosition p = NativeSelectionUtil.slowGetPosition(); if (p != null) { EditorStaticDeps.logger.trace().log("x: " + p.left + "y: " + p.top); if (p.offsetParent == null) { // If offsetParent is null, interpret offsetX and offsetY as // absolute positions if (DEBUG_CURSOR.getParentElement() != Document.get().getBody()) { Document.get().getBody().appendChild(DEBUG_CURSOR); } DEBUG_CURSOR.getStyle().setTop(p.top - Document.get().getBody().getAbsoluteTop(), Unit.PX); DEBUG_CURSOR.getStyle().setLeft(p.left - Document.get().getBody().getAbsoluteLeft(), Unit.PX); } else { if (editorImpl.getElement() != null && DEBUG_CURSOR.getParentElement() != editorImpl.getElement()) { editorImpl.getElement().appendChild(DEBUG_CURSOR); } DEBUG_CURSOR.getStyle().setTop(p.top, Unit.PX); DEBUG_CURSOR.getStyle().setLeft(p.left, Unit.PX); } } }
Example #6
Source File: TimeGrid.java From unitime with Apache License 2.0 | 6 votes |
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); }
Example #7
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 6 votes |
private void updateSpacerBlocks(double dayWidthPx) { double spaceLeft = getResolutionDivWidth() - (blocksInRange * dayWidthPx); if (spaceLeft > 0) { for (DivElement e : spacerBlocks) { e.getStyle().clearDisplay(); e.getStyle().setWidth(spaceLeft, Unit.PX); } resSpacerDiv = createResolutionBlock(); resSpacerDiv.addClassName(STYLE_SPACER); resSpacerDiv.getStyle().setWidth(spaceLeft, Unit.PX); resSpacerDiv.setInnerText(" "); resolutionDiv.appendChild(resSpacerDiv); } else { hideSpacerBlocks(); } }
Example #8
Source File: DateCellDayItem.java From calendar-component with Apache License 2.0 | 6 votes |
public void updatePosition(long startFromMinutes, long durationInMinutes) { if (startFromMinutes < 0) { startFromMinutes = 0; } top = weekGrid.getPixelTopFor((int) startFromMinutes); getElement().getStyle().setTop(top, Unit.PX); if (durationInMinutes > 0) { int heightMinutes = weekGrid.getPixelLengthFor( (int) startFromMinutes, (int) durationInMinutes); setHeight(heightMinutes); } else { setHeight(-1); } boolean multiRowCaption = (durationInMinutes > 30); updateCaptions(multiRowCaption); }
Example #9
Source File: WebTable.java From unitime with Apache License 2.0 | 6 votes |
public IconsCell add(ImageResource resource, final String title, final boolean html) { if (resource == null) return this; Image icon = new Image(resource); String text = title; if (html) { HTML h = new HTML(title); text = h.getText(); } icon.setTitle(text); icon.setAltText(text); if (iPanel.getWidgetCount() > 0) icon.getElement().getStyle().setMarginLeft(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, html); } }); } return this; }
Example #10
Source File: WebTable.java From unitime with Apache License 2.0 | 6 votes |
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); } if (title != null && !title.isEmpty()) { iIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.stopPropagation(); UniTimeConfirmationDialog.info(title); } }); } }
Example #11
Source File: DateCell.java From calendar-component with Apache License 2.0 | 6 votes |
public void setToday(Date today, int width) { this.today = today; addStyleDependentName("today"); Element lastChild = (Element) getElement().getLastChild(); if (lastChild.getClassName().equals("v-calendar-current-time")) { todaybar = lastChild; } else { todaybar = DOM.createDiv(); todaybar.setClassName("v-calendar-current-time"); getElement().appendChild(todaybar); } if (width != -1) { todaybar.getStyle().setWidth(width, Unit.PX); } // position is calculated later, when we know the cell heights }
Example #12
Source File: SampleEntryPoint.java From gwteventbinder with Apache License 2.0 | 6 votes |
@Override public void onModuleLoad() { // Create the object graph - a real application would use Gin SimpleEventBus eventBus = new SimpleEventBus(); SidebarPresenter sidebarPresenter = new SidebarPresenter(eventBus); Button sidebarView = new Button("Contacts"); sidebarView.getElement().getStyle().setFloat(Style.Float.LEFT); sidebarView.getElement().getStyle().setMarginRight(20, Unit.PX); sidebarPresenter.setView(sidebarView); RootPanel.get().add(sidebarView); ContactsPresenter contactsPresenter = new ContactsPresenter(eventBus); VerticalPanel contactsView = new VerticalPanel(); contactsPresenter.setView(contactsView); RootPanel.get().add(contactsView); // Start listening for events in the presenter contactsPresenter.start(); // Eagerly bind the server proxy ServerProxy server = new ServerProxy(eventBus); }
Example #13
Source File: HistorySearch.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * HistorySearch */ public HistorySearch() { stackPanel = new StackLayoutPanel(Unit.PX); searchSaved = new SearchSaved(); userNews = new UserNews(); scrollSearchSavedPanel = new ScrollPanel(); scrollUserNewsSavedPanel = new ScrollPanel(); scrollSearchSavedPanel.addStyleName("okm-PanelSelected"); scrollUserNewsSavedPanel.addStyleName("okm-PanelSelected"); scrollSearchSavedPanel.add(searchSaved); scrollSearchSavedPanel.setSize("100%", "100%"); scrollUserNewsSavedPanel.add(userNews); scrollUserNewsSavedPanel.setSize("100%", "100%"); stackPanel.add(scrollSearchSavedPanel, Util.createHeaderHTML("img/icon/stackpanel/find.gif", Main.i18n("leftpanel.label.stored.search")), true, 22); stackPanel.add(scrollUserNewsSavedPanel, Util.createHeaderHTML("img/icon/news.gif", Main.i18n("leftpanel.label.user.search")), true, 22); stackPanel.showWidget(0); stackPanel.setStyleName("okm-StackPanel"); stackPanel.addStyleName("okm-DisableSelect"); initWidget(stackPanel); }
Example #14
Source File: GanttWidget.java From gantt with Apache License 2.0 | 6 votes |
@Override public boolean remove(Widget w) { if (!(w instanceof StepWidget)) { return super.remove(w); } else { int startIndex = getWidgetIndex(w); int height = getElementHeightWithMargin(w.getElement()); contentHeight -= height; if ((startIndex = removeAndReturnIndex(w)) >= 0) { updateTopForAllStepsBelow(startIndex, -height); // update content height content.getStyle().setHeight(contentHeight, Unit.PX); return true; } return false; } }
Example #15
Source File: ContextField.java From bitcoin-transaction-explorer with MIT License | 6 votes |
@Override public void run() { // Make sure we're not animating container.addStyleName(style.noAnimation()); // Remove all but the last widget while(container.getWidgetCount() > 1) { container.remove(0); } // Reset the 'top' attribute to 0, and enforce the DOM change container.getElement().getStyle().setTop(0, Unit.PX); ComputedStyle.getStyleProperty(container.getElement(), "top"); // Re-enable animation container.removeStyleName(style.noAnimation()); }
Example #16
Source File: CenterPopupPositioner.java From incubator-retired-wave with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void setPopupPositionAndMakeVisible(Element relative, final Element p) { ScheduleCommand.addCommand(new Scheduler.Task() { @Override public void execute() { p.getStyle().setLeft((RootPanel.get().getOffsetWidth() - p.getOffsetWidth()) / 2, Unit.PX); int height = PositionUtil.boundHeightToScreen(p.getOffsetHeight()); int top = (RootPanel.get().getOffsetHeight() - height) / 2; // Prevent negative top position. p.getStyle().setTop(Math.max(top, MIN_OFFSET_HEIGHT_DEFAULT), Unit.PX); p.getStyle().setHeight(height, Unit.PX); p.getStyle().setVisibility(Visibility.VISIBLE); } }); }
Example #17
Source File: ContextField.java From bitcoin-transaction-explorer with MIT License | 6 votes |
public void setContent(final String text, final boolean animate) { // Bug out if the text to display is the same as the current text if (text != null && text.equals(currentText)) { return; } if(!animate) { container.clear(); } final Label lbl = new Label(text); container.add(lbl); if(animate) { container.getElement().getStyle().setTop(- (container.getWidgetCount() - 1) * FIELD_HEIGHT, Unit.PX); // This is gonna suck if there's more than a couple of these running, so thank god Mr Moore invented that law of his cleanupTimer.cancel(); cleanupTimer.schedule(CLEAN_UP_DELAY); } else { container.getElement().getStyle().setTop(0, Unit.PX); } currentText = text; }
Example #18
Source File: ZoomStatusWidget.java From geowe-core with GNU General Public License v3.0 | 6 votes |
@Override public Widget asWidget() { if (widget == null) { final String width = "60px"; final String height = "10px"; widget = new HorizontalLayoutContainer(); widget.getElement().getStyle().setPosition(Position.ABSOLUTE); widget.getElement().getStyle().setLeft(10, Unit.PX); widget.getElement().getStyle().setBottom(90, Unit.PX); widget.setSize(width, height); hp = new HorizontalPanel(); hp.setSpacing(2); hp.getElement().getStyle().setBackgroundColor("#FFFFFF"); hp.setSize(width, height); hp.add(getZoomLabel()); widget.add(hp); } return widget; }
Example #19
Source File: MaterialCutOut.java From gwt-material-addins with Apache License 2.0 | 5 votes |
/** * Gets the computed background color, based on the backgroundColor CSS * class. */ protected void setupComputedBackgroundColor() { // temp is just a widget created to evaluate the computed background // color MaterialWidget temp = new MaterialWidget(Document.get().createDivElement()); temp.setBackgroundColor(backgroundColor); // setting a style to make it invisible for the user Style style = temp.getElement().getStyle(); style.setPosition(Position.FIXED); style.setWidth(1, Unit.PX); style.setHeight(1, Unit.PX); style.setLeft(-10, Unit.PX); style.setTop(-10, Unit.PX); style.setZIndex(-10000); // adding it to the body (on Chrome the component must be added to the // DOM before getting computed values). String computed = ColorHelper.setupComputedBackgroundColor(backgroundColor); // convert rgb to rgba, considering the opacity field if (opacity < 1 && computed.startsWith("rgb(")) { computed = computed.replace("rgb(", "rgba(").replace(")", ", " + opacity + ")"); } computedBackgroundColor = computed; }
Example #20
Source File: StackViewer.java From bitcoin-transaction-explorer with MIT License | 5 votes |
@Override protected ContextField<StackObject> addField(final ContextField<StackObject> field) { if(fields.size() > 1) { field.getElement().getStyle().setMarginTop(10, Unit.PX); } return super.addField(field); }
Example #21
Source File: MaterialCutOut.java From gwt-material-addins with Apache License 2.0 | 5 votes |
protected void setCutOutStyle() { Style style = getElement().getStyle(); style.setWidth(100, Unit.PCT); style.setHeight(100, Unit.PCT); style.setPosition(Position.FIXED); style.setTop(0, Unit.PX); style.setLeft(0, Unit.PX); style.setZIndex(10000); focusElement.setClassName(AddinsCssName.MATERIAL_CUTOUT_FOCUS); style = focusElement.getStyle(); style.setProperty("content", "\'\'"); style.setPosition(Position.ABSOLUTE); style.setZIndex(-1); }
Example #22
Source File: WrappingGridConnector.java From GridExtensionPack with Apache License 2.0 | 5 votes |
private void adjustScrollBarHeight(double startY) { // Adjust scrollbar position double scrollHeight = 0; for (Element e : getGridParts("div")) { if (e.getClassName().contains("v-grid-scroller-vertical")) { double gridh = getGridPart("table").getParentElement().getOffsetHeight(); scrollHeight = gridh - startY; e.getStyle().setHeight(scrollHeight, Unit.PX); break; } } }
Example #23
Source File: ScrollPanel.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private void reset() { this.getElement().getStyle().setOverflow(Overflow.AUTO); if (this.offsetTop != null && this.offsetBottom != null) { this.getElement().getStyle().setHeight( Document.get().getClientHeight() - this.offsetTop.intValue() - this.offsetBottom.intValue(), Unit.PX); } if (this.offsetLeft != null && this.offsetRight != null) { this.getElement().getStyle().setWidth( Document.get().getClientWidth() - this.offsetLeft.intValue() - this.offsetRight.intValue(), Unit.PX); } }
Example #24
Source File: WrappingGridConnector.java From GridExtensionPack with Apache License 2.0 | 5 votes |
/** * Apply header height * * @param rowHeights * @return */ private double setHeaderHeight(double[] rowHeights) { double totalHeaderHeight = 0; int rownum = 0; for (Element row : getGridParts("tr", getGridPart("thead"))) { row.getStyle().setHeight(rowHeights[rownum], Unit.PX); totalHeaderHeight += getHeight(row); ++rownum; } return totalHeaderHeight; }
Example #25
Source File: WrappingGridConnector.java From GridExtensionPack with Apache License 2.0 | 5 votes |
/** * Go through all elements and remove wrapping rules, restoring normalcy */ private void disableWrapping() { for (Element e : getGridParts("th")) { removeWrappingRules(e); } for (Element row : getGridParts("tr", getGridPart("thead"))) { row.getStyle().setHeight(DEFAULT_HEIGHT, Unit.PX); } setBodyStartY(grid.getHeaderRowCount() * DEFAULT_HEIGHT); }
Example #26
Source File: LineRendering.java From swellrt with Apache License 2.0 | 5 votes |
@Override public Element createDomImpl(Renderable element) { UListElement e = Document.get().createULElement(); // Be careful if you want to move these into CSS - they might affect rendering // of email notifications in gmail. Find a nicer way to deal with this. e.getStyle().setPadding(0, Unit.PX); e.getStyle().setMargin(0, Unit.PX); return element.setAutoAppendContainer(e); }
Example #27
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 5 votes |
private void setWidth(Element element, int multiplier) { if (isTimelineOverflowingHorizontally()) { element.getStyle().setWidth(multiplier * minResolutionWidth, Unit.PX); } else { if (isAlwaysCalculatePixelWidths()) { element.getStyle().setWidth(multiplier * dayOrHourWidthPx, Unit.PX); } else { setCssPercentageWidth(element, blocksInRange, dayWidthPercentage, multiplier); } } }
Example #28
Source File: PasteBufferImpl.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
protected void positionPasteBuffer(Element element) { if (SHOW_DEBUG_PASTEBUFFER) { element.getStyle().setPosition(Position.ABSOLUTE); element.getStyle().setHeight(150, Unit.PX); element.getStyle().setLeft(1000, Unit.PX); element.getStyle().setTop(10, Unit.PX); } else { element.getStyle().setPosition(Position.ABSOLUTE); element.getStyle().setTop(-100, Unit.PX); // arbitrary numbers element.getStyle().setHeight(50, Unit.PX); } }
Example #29
Source File: GanttWidget.java From gantt with Apache License 2.0 | 5 votes |
private void updateNowElement(boolean syncWithServerTime) { if (timeline == null || nowElement == null) { return; } if (timeline.isTimelineOverflowingHorizontally()) { nowElement.getStyle().setLeft(timeline.getLeftPositionForDate(timeline.getNow()), Unit.PX); } else { nowElement.getStyle().setLeft(timeline.getLeftPositionPercentageForDate(timeline.getNow(), getContentWidth()), Unit.PCT); } if (syncWithServerTime) { ganttRpc.requestCurrentTime(); } }
Example #30
Source File: InteractiveSuggestionsManager.java From swellrt with Apache License 2.0 | 5 votes |
@Override public void setPopupPositionAndMakeVisible(Element reference, final Element popup) { Style popupStyle = popup.getStyle(); // TODO(danilatos): Do something more intelligent than arbitrary constants (which might be // susceptible to font size changes, etc) popupStyle.setLeft(popupAnchor.getAbsoluteLeft() - popup.getOffsetWidth() + 26, Unit.PX); popupStyle.setTop(popupAnchor.getAbsoluteBottom() + 5, Unit.PX); popupStyle.setVisibility(Visibility.VISIBLE); }