List of usage examples for com.google.gwt.user.client Element getStyle
@Override
public Style getStyle()
From source file:cc.kune.core.client.ui.dialogs.tabbed.AbstractTabbedDialogPanel.java
License:GNU Affero Public License
/** * Sets the positions.// w w w . j ava 2s . c om */ private void setPositions() { for (int i = 0; i < tabPanel.getWidgetCount(); i++) { final Element element = tabPanel.getWidget(i).getElement(); element.getStyle().setPosition(Position.RELATIVE); element.getStyle().setOverflow(Overflow.VISIBLE); final Element parent = DOM.getParent(element); parent.getStyle().setPosition(Position.RELATIVE); parent.getStyle().setOverflow(Overflow.VISIBLE); final Element grand = DOM.getParent(parent); grand.getStyle().setPosition(Position.RELATIVE); grand.getStyle().setOverflow(Overflow.VISIBLE); final Element pGrand = DOM.getParent(grand); pGrand.getStyle().setPosition(Position.RELATIVE); pGrand.getStyle().setOverflow(Overflow.VISIBLE); } }
From source file:co.fxl.gui.gwt.GWTDisplay.java
License:Open Source License
@Override public IDialog showDialog() { return new DialogImpl() { @Override//from w ww. ja v a 2s . co m protected void decorate(IGridPanel grid) { GWTGridPanel gridPanel = (GWTGridPanel) grid; Element element = gridPanel.container.widget.getElement(); DOM.setStyleAttribute(element, "tableLayout", "fixed"); element.getStyle().setOverflow(Overflow.HIDDEN); DOM.setStyleAttribute(element, "wordWrap", "break-word"); } }; }
From source file:com.alkacon.geranium.client.ui.ToolbarPopup.java
License:Open Source License
/** * Positions the menu popup the button.<p> * /* w ww. j av a 2s.c o m*/ * @param popup the popup to position * @param button the toolbar button * @param toolbarWidth the width of the toolbar * @param isToolbarMode a flag indicating whether the button is in toolbar mode * @param arrow the arrow shaped connector element */ protected static void positionPopup(Popup popup, Widget button, int toolbarWidth, boolean isToolbarMode, Element arrow) { int spaceAssurance = 20; int space = toolbarWidth + (2 * spaceAssurance); // get the window client width int windowWidth = Window.getClientWidth(); // get the min left position int minLeft = (windowWidth - space) / 2; if (minLeft < spaceAssurance) { minLeft = spaceAssurance; } // get the max right position int maxRight = minLeft + space; // get the middle button position PositionBean buttonPosition = PositionBean.generatePositionInfo(button.getElement()); int buttonMiddle = (buttonPosition.getLeft() - Window.getScrollLeft()) + (buttonPosition.getWidth() / 2); // get the content width int contentWidth = popup.getOffsetWidth(); // the optimum left position is in the middle of the button minus the half content width // assume that the optimum fits into the space int contentLeft = buttonMiddle - (contentWidth / 2); if (minLeft > contentLeft) { // if the optimum left position of the popup is outside the min left position: // move the popup to the right (take the min left position as left) contentLeft = minLeft; } else if ((contentLeft + contentWidth) > maxRight) { // if the left position plus the content width is outside the max right position: // move the popup to the left (take the max right position minus the content width) contentLeft = maxRight - contentWidth; } // limit the right position if the popup is right outside the window if ((contentLeft + contentWidth + spaceAssurance) > windowWidth) { contentLeft = windowWidth - contentWidth - spaceAssurance; } // limit the left position if the popup is left outside the window if (contentLeft < spaceAssurance) { contentLeft = spaceAssurance; } int arrowSpace = 10; int arrowWidth = I_LayoutBundle.INSTANCE.gwtImages().menuArrowTopImage().getWidth(); int arrowHeight = I_LayoutBundle.INSTANCE.gwtImages().menuArrowTopImage().getHeight(); // the optimum position for the arrow is in the middle of the button int arrowLeft = buttonMiddle - contentLeft - (arrowWidth / 2); if ((arrowLeft + arrowWidth + arrowSpace) > contentWidth) { // limit the arrow position if the maximum is reached (content width 'minus x') arrowLeft = contentWidth - arrowWidth - arrowSpace; } else if ((arrowLeft - arrowSpace) < 0) { // limit the arrow position if the minimum is reached ('plus x') arrowLeft = arrowWidth + arrowSpace; } int arrowTop = -(arrowHeight - 2); String arrowClass = I_LayoutBundle.INSTANCE.dialogCss().menuArrowTop(); int contentTop = (((buttonPosition.getTop() + buttonPosition.getHeight()) - Window.getScrollTop()) + arrowHeight) - 2; if (!isToolbarMode) { contentTop = (buttonPosition.getTop() + buttonPosition.getHeight() + arrowHeight) - 2; int contentHeight = popup.getOffsetHeight(); int windowHeight = Window.getClientHeight(); if (((contentHeight + spaceAssurance) < windowHeight) && ((buttonPosition.getTop() - Window.getScrollTop()) > contentHeight) && (((contentHeight + spaceAssurance + contentTop) - Window.getScrollTop()) > windowHeight)) { // content fits into the window height, // there is enough space above the button // and there is to little space below the button // so show above contentTop = ((buttonPosition.getTop() - arrowHeight) + 2) - contentHeight; arrowTop = contentHeight - 1; arrowClass = I_LayoutBundle.INSTANCE.dialogCss().menuArrowBottom(); } } else { contentLeft = contentLeft - Window.getScrollLeft(); popup.setPositionFixed(); } arrow.setClassName(arrowClass); arrow.getStyle().setLeft(arrowLeft, Unit.PX); arrow.getStyle().setTop(arrowTop, Unit.PX); popup.showArrow(arrow); popup.setPopupPosition(contentLeft + Window.getScrollLeft(), contentTop); }
From source file:com.eduworks.gwt.client.pagebuilder.screen.ScreenTemplate.java
License:Apache License
public static void setAlertBoxMessage(String message, AlertType type, final String containerName) { Element messageContainer = DOM.getElementById(containerName); if (messageContainer != null) { messageContainer.getFirstChildElement().setInnerText(message); clearAlertState();/*from ww w . j ava 2 s . c om*/ if (type == AlertType.WARNING) { messageContainer.addClassName("warning"); messageContainer.getStyle().setColor("white"); } else if (type == AlertType.ERROR) { messageContainer.addClassName("alert"); messageContainer.getStyle().setColor("white"); } else if (type == AlertType.INFO) { messageContainer.addClassName("info"); messageContainer.getStyle().setColor("black"); } else if (type == AlertType.SUCCESS) { messageContainer.addClassName("success"); messageContainer.getStyle().setColor("white"); } else if (type == AlertType.SECONDARY) { messageContainer.addClassName("secondary"); messageContainer.getStyle().setColor("black"); } messageContainer.addClassName("active"); messageContainer.removeClassName("hidden"); Timer timeoutTimer = new Timer() { public void run() { hideAlertBox(containerName); } }; timeoutTimer.schedule(TIMER_STATUS_WINDOW_DELAY); } }
From source file:com.ephesoft.gxt.admin.client.presenter.document.DocumentTypeMenuPresenter.java
License:Open Source License
public void showTestClassificationView() { if (controller.getSelectedBatchClass().isDirty()) { applyBatchClassBeforeOperation(/* w w w .ja v a 2 s.c om*/ LocaleDictionary.getConstantValue(BatchClassConstants.TEST_CLASSIFICATION)); view.enableAllOtherMenuItems(true); view.setTestClassificationButtonDown(false); } else { testClassificationDialogWindow = new DialogWindow(new GrayWindowAppearance(), true, controller.getTestClassifyTypeView().getClassificationTypesComboBox()); testClassificationDialogWindow.addStyleName("testClassificationDialogWindow"); testClassificationDialogWindow.addStyleName("testExtractionDialogWindow"); BatchClassManagementEventBus.fireEvent(new ClearTestClassificationGridEvent()); BatchClassManagementEventBus.fireEvent(new TestClassificationDownloadEnableEvent(false)); BatchClassManagementEventBus.fireEvent(new TestClassificationClearMenuItemEnableEvent()); TestClassificationLayout testClassificationLayout = controller.getTestClassificationLayout(); testClassificationDialogWindow .setFocusWidget(controller.getTestClassifyTypeView().getClassificationTypesComboBox()); testClassificationDialogWindow.add(testClassificationLayout); testClassificationDialogWindow.setBorders(false); testClassificationDialogWindow.setModal(false); testClassificationDialogWindow.setWidth(getOffsetWidth()); final Element element = testClassificationDialogWindow.getElement(); final Style style = element.getStyle(); style.setHeight(getOffsetHeight(), Unit.PX); // testClassificationDialogWindow.setHeight(getOffsetHeight()); testClassificationDialogWindow.setPosition(getAbsoluteLeft(), getAbsoluteTop()); testClassificationDialogWindow.setOnEsc(false); testClassificationDialogWindow.setResizable(false); testClassificationDialogWindow.setClosable(false); testClassificationDialogWindow.setDraggable(false); testClassificationDialogWindow.setHeaderVisible(false); testClassificationDialogWindow.setPredefinedButtons(); controller.resizeGrid(getOffsetHeight(), getOffsetWidth()); BatchClassManagementEventBus.fireEvent(new BCMTreeMaskEvent(true)); testClassificationDialogWindow.show(); } }
From source file:com.ephesoft.gxt.admin.client.presenter.document.DocumentTypeMenuPresenter.java
License:Open Source License
@EventHandler public void beforeDialogWindowResize(DialogWindowResizeEvent beforeResize) { if (null != testExtractionDialogWindow && testExtractionDialogWindow.isVisible()) { testExtractionDialogWindow.setResizable(true); // final Element element = testExtractionDialogWindow.getElement(); // final Style style = element.getStyle(); // style.setHeight(getOffsetHeight(), Unit.PX); testExtractionDialogWindow.setHeight(getOffsetHeight()); testExtractionDialogWindow.setWidth(getOffsetWidth()); testExtractionDialogWindow.setPosition(getAbsoluteLeft(), getAbsoluteTop()); controller.setBorderLayoutContainer(getOffsetHeight(), getOffsetWidth()); testExtractionDialogWindow.setResizable(false); }//from w w w. j ava 2s. c om if (null != testClassificationDialogWindow && testClassificationDialogWindow.isVisible()) { testClassificationDialogWindow.setResizable(true); final Element element = testClassificationDialogWindow.getElement(); final Style style = element.getStyle(); style.setHeight(getOffsetHeight(), Unit.PX); // testClassificationDialogWindow.setHeight(getOffsetHeight()); testClassificationDialogWindow.setWidth(getOffsetWidth()); testClassificationDialogWindow.setPosition(getAbsoluteLeft(), getAbsoluteTop()); testClassificationDialogWindow.setResizable(false); controller.resizeGrid(getOffsetHeight(), getOffsetWidth()); } }
From source file:com.ephesoft.gxt.core.client.ui.widget.MultiFileUploader.java
License:Open Source License
private void setDimension(final Widget parent) { if (null != parent) { final Element element = dragDropLabel.getElement(); final Style style = element.getStyle(); final int height = parent.getOffsetHeight() - UPLOADER_BUTTON_HEIGHT - 2; final int heightToAssign = (height / 2) - FONT_SIZE; style.setHeight(heightToAssign, Unit.PX); style.setFontSize(FONT_SIZE, Unit.PX); style.setPaddingTop(heightToAssign, Unit.PX); style.setLineHeight(1, Unit.PX); dragDropLabel.setWidth("99%"); style.setLeft(6, Unit.PX);// w w w. j a v a 2s.co m isInitialized = true; Style uploadProgressStyle = uploadProgress.getElement().getStyle(); uploadProgressStyle.setMarginTop(height / 2, Unit.PX); } }
From source file:com.extjs.gxt.desktop.client.TaskBar.java
License:Open Source License
private void autoSize() { int count = items.size(); int aw = el().getStyleWidth(); if (!resizeButtons || count < 1) { return;// w w w .j av a 2s . c o m } int each = (int) Math.max(Math.min(Math.floor((aw - 4) / count) - buttonMargin, buttonWidth), minButtonWidth); NodeList<com.google.gwt.dom.client.Element> btns = stripWrap.dom.getElementsByTagName("button"); El b = items.get(0).el(); lastButtonWidth = b.findParent("li", 5).getWidth(); for (int i = 0, len = btns.getLength(); i < len; i++) { Element btn = btns.getItem(i).cast(); int tw = items.get(i).el().getParent().dom.getOffsetWidth(); int iw = btn.getOffsetWidth(); btn.getStyle().setPropertyPx("width", (each - (tw - iw))); } }
From source file:com.extjs.gxt.ui.client.core.impl.ComputedStyleImpl.java
License:sencha.com license
public void setStyleAttribute(Element elem, String name, Object value) { elem.getStyle().setProperty(checkCamelCache(Arrays.asList(name)).get(0), value == null ? "" : String.valueOf(value)); }
From source file:com.extjs.gxt.ui.client.widget.BoxComponent.java
License:sencha.com license
private List<FastMap<Object>> makeVisible() { if (ensureVisibilityOnSizing) { List<FastMap<Object>> list = new ArrayList<FastMap<Object>>(); Element p = getElement(); while (p != null && p != XDOM.getBody()) { if (fly(p).isStyleAttribute("display", "none")) { FastMap<Object> m = new FastMap<Object>(); m.put("element", p); m.put("origd", p.getStyle().getProperty("display")); boolean hasxhideoffset = fly(p).hasStyleName("x-hide-offset"); m.put("hasxhideoffset", hasxhideoffset); if (!hasxhideoffset) { fly(p).addStyleName("x-hide-offset"); }// w ww . ja va 2 s .c o m p.getStyle().setProperty("display", "block"); list.add(m); } p = (Element) p.getParentElement(); } return list; } return null; }