List of usage examples for com.google.gwt.dom.client Style setTop
public void setTop(double value, Unit unit)
From source file:org.opencms.ade.contenteditor.client.CmsContentEditor.java
License:Open Source License
/** * Bypasses a focus bug in IE which can happen if the user opens the HTML code editor from the WYSIWYG editor.<p> * * The next time they open the editor form from the same container page, the user may be unable to focus on any input * fields. To prevent this, we create a dummy input field outside the visible screen region and focus it when opening * the editor./* w w w .ja v a2s .co m*/ */ public void fixFocus() { TextBox invisibleTextBox = new TextBox(); Style style = invisibleTextBox.getElement().getStyle(); style.setPosition(Position.FIXED); style.setLeft(-99999, Unit.PX); style.setTop(-99999, Unit.PX); m_basePanel.add(invisibleTextBox); // base panel is already attached at this point, so we can just set the focus invisibleTextBox.setFocus(true); }
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 w ww .ja va2 s . co m*/ * @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> * //from w ww .j a v a 2s .c o 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.CmsHighlightingBorder.java
License:Open Source License
/** * Sets the border position.<p>// ww w .j a v a2 s .c o m * * @param height the height * @param width the width * @param positionLeft the absolute left position * @param positionTop the absolute top position */ public void setPosition(int height, int width, int positionLeft, int positionTop) { positionLeft -= BORDER_OFFSET; // make sure highlighting does not introduce additional horizontal scroll-bars if (positionLeft < 0) { // position left should not be negative width += positionLeft; positionLeft = 0; } width += (2 * BORDER_OFFSET) - BORDER_WIDTH; if ((Window.getClientWidth() < (width + positionLeft)) && (Window.getScrollLeft() == 0)) { // highlighting should not extend over the right hand width = Window.getClientWidth() - (positionLeft + BORDER_WIDTH); } Style style = getElement().getStyle(); style.setLeft(positionLeft, Unit.PX); style.setTop(positionTop - BORDER_OFFSET, Unit.PX); setHeight((height + (2 * BORDER_OFFSET)) - BORDER_WIDTH); setWidth(width); }
From source file:org.opencms.gwt.client.ui.CmsListItem.java
License:Open Source License
/** * @see org.opencms.gwt.client.dnd.I_CmsDraggable#getDragHelper(I_CmsDropTarget) */// w ww. j a va2 s . co m public Element getDragHelper(I_CmsDropTarget target) { if (m_helper == null) { if (m_listItemWidget != null) { m_listItemWidget.setAdditionalInfoVisible(false); Iterator<Widget> buttonIterator = m_listItemWidget.getButtonPanel().iterator(); while (buttonIterator.hasNext()) { Widget button = buttonIterator.next(); if (button != m_moveHandle) { button.getElement().getStyle().setVisibility(Visibility.HIDDEN); } } } m_helper = CmsDomUtil.clone(getElement()); // remove all decorations List<com.google.gwt.dom.client.Element> elems = CmsDomUtil.getElementsByClass( I_CmsLayoutBundle.INSTANCE.floatDecoratedPanelCss().decorationBox(), CmsDomUtil.Tag.div, m_helper); for (com.google.gwt.dom.client.Element elem : elems) { elem.removeFromParent(); } // we append the drag helper to the body to prevent any kind of issues // (ie when the parent is styled with overflow:hidden) // and we put it additionally inside a absolute positioned provisional parent // ON the original parent for the eventual animation when releasing Element parentElement = getElement().getParentElement(); if (parentElement == null) { parentElement = target.getElement(); } int elementTop = getElement().getAbsoluteTop(); int parentTop = parentElement.getAbsoluteTop(); m_provisionalParent = DOM.createElement(parentElement.getTagName()); RootPanel.getBodyElement().appendChild(m_provisionalParent); m_provisionalParent.addClassName(I_CmsLayoutBundle.INSTANCE.generalCss().clearStyles()); m_provisionalParent.getStyle().setWidth(parentElement.getOffsetWidth(), Unit.PX); m_provisionalParent.appendChild(m_helper); Style style = m_helper.getStyle(); style.setWidth(m_helper.getOffsetWidth(), Unit.PX); // the dragging class will set position absolute m_helper.addClassName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().dragging()); style.setTop(elementTop - parentTop, Unit.PX); m_provisionalParent.getStyle().setPosition(Position.ABSOLUTE); m_provisionalParent.getStyle().setTop(parentTop, Unit.PX); m_provisionalParent.getStyle().setLeft(parentElement.getAbsoluteLeft(), Unit.PX); m_provisionalParent.getStyle().setZIndex(I_CmsLayoutBundle.INSTANCE.constants().css().zIndexDND()); } // ensure mouse out if (m_listItemWidget != null) { m_listItemWidget.forceMouseOut(); } CmsDomUtil.ensureMouseOut(this); return m_helper; }
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 . j a va2 s. c om 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>/*from w w w. jav a 2s . c om*/ */ @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.opencms.gwt.client.util.CmsTextMetrics.java
License:Open Source License
/** * Binds this text metrics instance to an element from which to copy existing * CSS styles that can affect the size of the rendered text.<p> * //from w ww. java2s . com * @param element the element * @param attributes the attributes to bind */ protected void bind(Element element, CmsDomUtil.Style... attributes) { if (m_elem == null) { // create playground m_elem = DOM.createDiv(); Style style = m_elem.getStyle(); style.setVisibility(Style.Visibility.HIDDEN); style.setPosition(Style.Position.ABSOLUTE); style.setLeft(-5000, Style.Unit.PX); style.setTop(-5000, Style.Unit.PX); } // copy all relevant CSS properties Style style = m_elem.getStyle(); for (CmsDomUtil.Style attr : attributes) { String attrName = attr.toString(); style.setProperty(attrName, CmsDomUtil.getCurrentStyle(element, attr)); } // append playground RootPanel.getBodyElement().appendChild(m_elem); }
From source file:org.opennms.features.vaadin.nodemaps.internal.gwt.client.ui.controls.search.SearchControl.java
License:Open Source License
protected void updateAutocompleteStyle(final Widget widget) { // we only need to do this once if (m_updated.contains(widget)) { return;/* w ww . ja v a2 s . c o m*/ } final Style style = widget.getElement().getStyle(); // ugh style.setPosition(Position.ABSOLUTE); style.setLeft(5, Unit.PX); style.setTop(25, Unit.PX); m_updated.add(widget); }
From source file:org.opennms.features.vaadin.nodemaps.internal.gwt.client.ui.NodeMapWidget.java
License:Open Source License
public NodeMapWidget() { m_eventManager = new OpenNMSEventManager(); m_eventManager.addHandler(FilteredMarkersUpdatedEvent.TYPE, this); m_eventManager.addHandler(ApplicationInitializedEvent.TYPE, this); m_componentTracker = new ComponentTracker(m_eventManager); m_componentTracker.track(MarkerContainer.class); m_componentTracker.track(MarkerFilterImpl.class); m_componentTracker.track(AlarmControl.class); m_componentTracker.track(SearchControl.class); m_componentTracker.track(SearchStateManager.class); m_mapPanel.setWidth("100%"); m_mapPanel.setHeight("100%"); final Style mapStyle = m_mapPanel.getElement().getStyle(); mapStyle.setPosition(Position.ABSOLUTE); mapStyle.setTop(0, Unit.PX); mapStyle.setLeft(0, Unit.PX);//from ww w . j a va2 s .c o m this.setWidth("100%"); this.setHeight("100%"); this.add(m_mapPanel); m_div = m_mapPanel.getElement().cast(); m_div.setId("gwt-map"); setStyleName("v-openlayers"); LOG.info("NodeMapWidget(): div ID = " + m_div.getId()); // addPassThroughHandlers(); addAttachHandler(new Handler() { @Override public void onAttachOrDetach(final AttachEvent event) { if (event.isAttached()) { LOG.info("NodeMapWidget.onAttach()"); m_filter = new MarkerFilterImpl("", AlarmSeverity.NORMAL, m_eventManager, m_componentTracker); m_markerContainer = new MarkerContainer(m_filter, m_eventManager, m_componentTracker); } else { LOG.info("NodeMapwidget.onDetach()"); if (m_markerContainer != null) m_markerContainer.onUnload(); if (m_filter != null) m_filter.onUnload(); destroyMap(); } } }); }