List of usage examples for com.google.gwt.dom.client Style setRight
public void setRight(double value, Unit unit)
From source file:org.opencms.ade.containerpage.client.ui.CmsListCollectorEditor.java
License:Open Source License
/** * @see org.opencms.gwt.client.ui.A_CmsDirectEditButtons#setPosition(org.opencms.gwt.client.util.CmsPositionBean, com.google.gwt.user.client.Element) *///from w w w .j av a 2 s .c om @Override public void setPosition(CmsPositionBean position, com.google.gwt.user.client.Element containerElement) { m_position = position; Element parent = CmsDomUtil.getPositioningParent(getElement()); if (!containerElement.isOrHasChild(parent)) { // the container element should have position relative, // so don't use any positioning parent that is not a child of the container-element parent = containerElement; } Style style = getElement().getStyle(); style.setRight( parent.getOffsetWidth() - (m_position.getLeft() + m_position.getWidth() - parent.getAbsoluteLeft()), Unit.PX); int top = m_position.getTop() - parent.getAbsoluteTop(); if (top < 25) { // if top is <25 the buttons might overlap with the option bar, so increase to 25 top = 25; } style.setTop(top, Unit.PX); }
From source file:org.opencms.ade.editprovider.client.CmsDirectEditButtons.java
License:Open Source License
/** * Sets the position. Make sure the widget is attached to the DOM.<p> * /*from www .j av a2 s.c om*/ * @param position the absolute position * @param buttonsPosition the corrected position for the buttons * * @param containerElement the parent container element */ public void setPosition(CmsPositionBean position, CmsPositionBean buttonsPosition, com.google.gwt.user.client.Element containerElement) { m_position = position; Element parent = CmsDomUtil.getPositioningParent(getElement()); Style style = getElement().getStyle(); style.setRight( parent.getOffsetWidth() - ((buttonsPosition.getLeft() + buttonsPosition.getWidth()) - parent.getAbsoluteLeft()), Unit.PX); int top = buttonsPosition.getTop() - parent.getAbsoluteTop(); if (top < 0) { top = 0; } style.setTop(top, Unit.PX); }
From source file:org.opencms.gwt.client.ui.A_CmsDirectEditButtons.java
License:Open Source License
/** * Sets the position. Make sure the widget is attached to the DOM.<p> * // ww w . j a va 2 s. co m * @param position the absolute position * @param containerElement the parent container element */ public void setPosition(CmsPositionBean position, com.google.gwt.user.client.Element containerElement) { m_position = position; Element parent = CmsDomUtil.getPositioningParent(getElement()); Style style = getElement().getStyle(); style.setRight(parent.getOffsetWidth() - ((m_position.getLeft() + m_position.getWidth()) - parent.getAbsoluteLeft()), Unit.PX); int top = m_position.getTop() - parent.getAbsoluteTop(); if (top < 25) { // if top is <25 the buttons might overlap with the option bar, so increase to 25 top = 25; } style.setTop(top, Unit.PX); }
From source file:org.opencms.gwt.client.ui.input.CmsGalleryField.java
License:Open Source License
/** * Internal method which opens the gallery dialog.<p> */// w w w . ja v a2s . c o m protected void openGalleryDialog() { String title = org.opencms.gwt.client.Messages.get() .key(org.opencms.gwt.client.Messages.GUI_GALLERY_SELECT_DIALOG_TITLE_0); final CmsFramePopup popup = new CmsFramePopup(title, buildGalleryUrl()); popup.setCloseHandler(new Runnable() { public void run() { m_textbox.setGhostMode(false); } }); popup.setId(m_id); popup.getFrame().setSize("700px", "490px"); popup.center(); CmsPushButton button = new CmsPushButton(I_CmsImageBundle.INSTANCE.style().closeIcon()); Style style = button.getElement().getStyle(); style.setRight(4, Unit.PX); style.setTop(0, Unit.PX); style.setPosition(Position.ABSOLUTE); style.setCursor(Cursor.POINTER); button.addClickHandler(new ClickHandler() { /** * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent) */ public void onClick(ClickEvent event) { popup.hide(); } }); popup.insertFront(button); }
From source file:org.opencms.gwt.client.util.CmsDebugLog.java
License:Open Source License
/** * Constructor.<p>// w w w. java 2 s .c o m */ @SuppressWarnings("unused") private CmsDebugLog() { if (!DEBUG) { return; } m_html = new HTML(); initWidget(m_html); Style style = getElement().getStyle(); style.setWidth(200, Unit.PX); style.setHeight(500, Unit.PX); style.setPadding(10, Unit.PX); style.setOverflow(Overflow.AUTO); style.setBorderStyle(BorderStyle.SOLID); style.setBorderColor(I_CmsLayoutBundle.INSTANCE.constants().css().borderColor()); style.setBorderWidth(1, Unit.PX); style.setPosition(Position.FIXED); style.setTop(50, Unit.PX); style.setRight(50, Unit.PX); style.setBackgroundColor(I_CmsLayoutBundle.INSTANCE.constants().css().backgroundColorDialog()); style.setZIndex(10); }
From source file:org.opennms.features.vaadin.nodemaps.internal.gwt.client.ui.NodeMapWidget.java
License:Open Source License
private void addAlarmControl() { LOG.info("NodeMapWidget.addAlarmControl()"); m_alarmControl = new AlarmControl(m_eventManager, m_componentTracker); final String id = m_alarmControl.getElement().getId(); if (id == null || "".equals(id)) { m_alarmControl.getElement().setId("alarm-control"); } else {/*from ww w . ja v a 2 s .co m*/ LOG.info("NodeMapWidget.addAlarmControl(): id = " + id); } final HTMLPanel mapParent = HTMLPanel.wrap(m_mapPanel.getParent().getElement()); final Style searchStyle = m_alarmControl.getElement().getStyle(); searchStyle.setPosition(Position.ABSOLUTE); searchStyle.setTop(5, Unit.PX); searchStyle.setRight(5, Unit.PX); searchStyle.setZIndex(1000); mapParent.add(m_alarmControl); }
From source file:org.rstudio.core.client.widget.FullscreenPopupPanel.java
License:Open Source License
public FullscreenPopupPanel(Widget titleWidget, Widget mainWidget, int margin, boolean closeOnEscape) { super(false, false, closeOnEscape); NineUpBorder border = new NineUpBorder(RES, 32, 20, 17, 20); if (titleWidget != null) addTitleWidget(border, titleWidget); addCloseButton(border);// w w w. j a v a 2s .co m border.setSize("100%", "100%"); border.setFillColor("white"); border.setWidget(mainWidget); setWidget(border); setGlassEnabled(true); Style popupStyle = getElement().getStyle(); popupStyle.setZIndex(1001); popupStyle.setPosition(Style.Position.ABSOLUTE); popupStyle.setTop(margin, Unit.PX); popupStyle.setBottom(margin, Unit.PX); popupStyle.setLeft(margin, Unit.PX); popupStyle.setRight(margin, Unit.PX); Style contentStyle = ((Element) getElement().getFirstChild()).getStyle(); contentStyle.setWidth(100, Unit.PCT); contentStyle.setHeight(100, Unit.PCT); }
From source file:org.rstudio.core.client.widget.ModalDialogBase.java
License:Open Source License
protected ProgressIndicator addProgressIndicator(final boolean closeOnCompleted) { final SlideLabel label = new SlideLabel(true); Element labelEl = label.getElement(); Style labelStyle = labelEl.getStyle(); labelStyle.setPosition(Style.Position.ABSOLUTE); labelStyle.setLeft(0, Style.Unit.PX); labelStyle.setRight(0, Style.Unit.PX); labelStyle.setTop(-12, Style.Unit.PX); getWidget().getElement().getParentElement().appendChild(labelEl); return new ProgressIndicator() { public void onProgress(String message) { if (message == null) { label.setText("", true); if (showing_) clearProgress();//from w ww . j av a 2s.com } else { label.setText(message, false); if (!showing_) { enableControls(false); label.show(); showing_ = true; } } } public void onCompleted() { clearProgress(); if (closeOnCompleted) closeDialog(); } public void onError(String message) { clearProgress(); RStudioGinjector.INSTANCE.getGlobalDisplay().showErrorMessage("Error", message); } @Override public void clearProgress() { if (showing_) { enableControls(true); label.hide(); showing_ = false; } } private boolean showing_; }; }
From source file:org.rstudio.studio.client.workbench.views.presentation.zoom.PresentationZoomPopup.java
License:Open Source License
public static void show() { Label mainWidget = new Label("mainWidget"); mainWidget.setSize("100%", "100%"); LayoutPanel layoutPanel = new LayoutPanel(); layoutPanel.setSize("100%", "100%"); layoutPanel.add(mainWidget);/*from w w w.ja va 2 s . c om*/ layoutPanel.setWidgetLeftRight(mainWidget, 0, Unit.PX, 0, Unit.PX); layoutPanel.setWidgetTopBottom(mainWidget, 0, Unit.PX, 0, Unit.PX); ModalPopupPanel popup = new ModalPopupPanel(false, false, true); Resources res = GWT.<Resources>create(Resources.class); NineUpBorder border = new NineUpBorder(res, 32, 20, 17, 20); addCloseButton(popup, border); border.setSize("100%", "100%"); border.setFillColor("white"); border.setWidget(layoutPanel); popup.setWidget(border); popup.setGlassEnabled(true); Style popupStyle = popup.getElement().getStyle(); popupStyle.setZIndex(1001); popupStyle.setPosition(Style.Position.ABSOLUTE); popupStyle.setTop(0, Unit.PX); popupStyle.setBottom(0, Unit.PX); popupStyle.setLeft(0, Unit.PX); popupStyle.setRight(0, Unit.PX); Style contentStyle = ((Element) popup.getElement().getFirstChild()).getStyle(); contentStyle.setWidth(100, Unit.PCT); contentStyle.setHeight(100, Unit.PCT); popup.center(); }
From source file:org.rstudio.studio.client.workbench.views.source.editors.text.ChunkPlotPage.java
License:Open Source License
public ChunkPlotPage(final String url, NotebookPlotMetadata metadata, int ordinal, final Command onRenderComplete, ChunkOutputSize chunkOutputSize) { super(ordinal); thumbnail_ = new HTMLPanel(""); if (ChunkPlotWidget.isFixedSizePlotUrl(url)) { final Image thumbnail = new Image(); thumbnail_.add(thumbnail);/*from ww w. j a v a 2 s . c o m*/ thumbnail_.getElement().getStyle().setTextAlign(TextAlign.CENTER); plot_ = new ChunkPlotWidget(url, metadata, new Command() { @Override public void execute() { ImageElementEx plot = plot_.getElement().cast(); ImageElementEx img = thumbnail.getElement().cast(); if (plot.naturalHeight() < plot.naturalWidth()) { img.getStyle().setProperty("width", "100%"); img.getStyle().setProperty("height", "auto"); } else { img.getStyle().setProperty("height", "100%"); img.getStyle().setProperty("width", "auto"); } thumbnail.setUrl(url); onRenderComplete.execute(); } }, chunkOutputSize); } else { // automatically expand non-fixed plots thumbnail_.add(new FixedRatioWidget(new Image(url), ChunkOutputUi.OUTPUT_ASPECT, 100)); plot_ = new ChunkPlotWidget(url, metadata, onRenderComplete, chunkOutputSize); } // look for messages or warnings in metadata boolean hasMessages = false; boolean hasWarnings = false; if (metadata != null) { for (int i = 0; i < metadata.getConditions().length(); i++) { int condition = metadata.getConditions().get(i).getInt(0); if (condition == ChunkConditionBar.CONDITION_MESSAGE) hasMessages = true; else if (condition == ChunkConditionBar.CONDITION_WARNING) hasWarnings = true; } } if (hasMessages || hasWarnings) { Image condImage = new Image(); if (hasWarnings) condImage.setResource(new ImageResource2x(ThemeResources.INSTANCE.warningSmall2x())); else if (hasMessages) condImage.setResource(new ImageResource2x(ThemeResources.INSTANCE.infoSmall2x())); condImage.setWidth("8px"); condImage.setHeight("7px"); Style style = condImage.getElement().getStyle(); style.setPosition(Position.ABSOLUTE); style.setBottom(5, Unit.PX); style.setRight(5, Unit.PX); thumbnail_.add(condImage); } }