List of usage examples for com.google.gwt.dom.client Style setWidth
public void setWidth(double value, Unit unit)
From source file:at.ac.fhcampuswien.atom.client.gui.frames.TabLayoutPanelCopy.java
License:Apache License
/** * Creates an empty tab panel.//w w w . j a va 2 s . com * * @param barHeight the size of the tab bar * @param barUnit the unit in which the tab bar size is specified */ public TabLayoutPanelCopy(double barHeight, Unit barUnit) { LayoutPanel panel = new LayoutPanel(); initWidget(panel); // Add the tab bar to the panel. panel.add(tabBar); panel.setWidgetLeftRight(tabBar, 0, Unit.PX, 0, Unit.PX); panel.setWidgetTopHeight(tabBar, 0, Unit.PX, barHeight, barUnit); panel.setWidgetVerticalPosition(tabBar, Alignment.END); // Add the deck panel to the panel. // CHANGE4: styles again: deckPanel.addStyleName(CONTENT_CONTAINER_STYLE); panel.add(deckPanel); panel.setWidgetLeftRight(deckPanel, 0, Unit.PX, 0, Unit.PX); panel.setWidgetTopBottom(deckPanel, barHeight, barUnit, 0, Unit.PX); // Make the tab bar extremely wide so that tabs themselves never wrap. // (Its layout container is overflow:hidden) // CHANGE5: Adapt the TabBar Style element to our needs Style tabBarStyle = tabBar.getElement().getStyle(); tabBarStyle.setHeight(barHeight, barUnit); tabBarStyle.setWidth(BIG_ENOUGH_TO_NOT_WRAP, Unit.PX); // CHANGE6: We don't want the standard GWT styles // tabBar.setStyleName("gwt-TabLayoutPanelTabs"); // setStyleName("gwt-TabLayoutPanel"); }
From source file:burrito.client.widgets.form.EditForm.java
License:Apache License
public void makeButtonsStick(boolean stick) { getElement().getStyle().setPropertyPx("minHeight", getOffsetHeight()); Style style = buttonWrapper.getElement().getStyle(); buttonWrapper.addStyleName("k5-EditForm-fixedButtons"); if (stick) {/*from w ww.j a v a2 s. c o m*/ style.setPosition(Position.FIXED); style.setBottom(0, Unit.PX); style.setLeft(getAbsoluteLeft(), Unit.PX); style.setWidth(getOffsetWidth(), Unit.PX); } else { style.clearPosition(); style.clearBottom(); style.clearLeft(); style.clearWidth(); } }
From source file:cc.alcina.framework.gwt.client.widget.RelativePopupValidationFeedback.java
License:Apache License
@Override public void handleException(Object source, ValidationException exception) { final Widget w = (Widget) source; resolve(source);//from w w w . j ava 2 s .c o m if (!DomUtils.isVisibleAncestorChain(w.getElement())) { return; } Widget suppressValidationFeedbackFor = RenderContext.get().getSuppressValidationFeedbackFor(); if (suppressValidationFeedbackFor != null && suppressValidationFeedbackFor.getElement().isOrHasChild(w.getElement())) { return; } final RelativePopup p = new RelativePopup(); p.setVisible(false); popups.put(source, p); WidgetByElementTracker.get().register(p); p.setStyleName("gwittir-ValidationPopup"); if (getCss() != null) { p.addStyleName(getCss()); } if (exception instanceof ProcessingServerValidationException) { ProcessingServerValidationException psve = (ProcessingServerValidationException) exception; FlowPanel fp = new FlowPanel(); fp.setStyleName("gwittir-ServerValidation"); fp.add(new InlineLabel(this.getMessage(exception))); p.add(fp); psve.setSourceWidget(source); psve.setFeedback(this); } else { p.add(renderExceptionWidget(exception)); } int x = w.getAbsoluteLeft(); int y = w.getAbsoluteTop(); Widget pw = WidgetUtils.getPositioningParent(w); ComplexPanel cp = WidgetUtils.complexChildOrSelf(pw); if (!(pw instanceof RootPanel)) { x -= pw.getAbsoluteLeft(); y -= pw.getAbsoluteTop(); } cp.add(p); if (this.position == BOTTOM) { y += w.getOffsetHeight(); } else if (this.position == RIGHT) { x += w.getOffsetWidth(); } else if (this.position == LEFT) { x -= p.getOffsetWidth(); } else if (this.position == TOP) { y -= p.getOffsetHeight(); } Element h = p.getElement(); Style style = h.getStyle(); style.setPosition(Position.ABSOLUTE); style.setLeft(x, Unit.PX); style.setTop(y, Unit.PX); if (this.position == BOTTOM) { style.setWidth(w.getOffsetWidth(), Unit.PX); } p.setVisible(true); if (w instanceof SourcesPropertyChangeEvents) { // GWT.log("is PCE", null); PropertyChangeListener attachListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent propertyChangeEvent) { if (((Boolean) propertyChangeEvent.getNewValue()).booleanValue()) { p.setVisible(true); } else { p.setVisible(false); } } }; listeners.put(w, attachListener); ((SourcesPropertyChangeEvents) w).addPropertyChangeListener("attached", attachListener); ((SourcesPropertyChangeEvents) w).addPropertyChangeListener("visible", attachListener); } }
From source file:client.ui.components.MaterialButton.java
License:Open Source License
@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()); }//from w ww. j av a 2 s. c o m }
From source file:client.ui.components.MaterialItem.java
License:Open Source License
@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()); }/*from w ww. j av a 2 s .c o m*/ }
From source file:com.alkacon.acacia.client.ui.AttributeValueView.java
License:Open Source License
/** * @see com.alkacon.geranium.client.dnd.I_Draggable#getDragHelper(com.alkacon.geranium.client.dnd.I_DropTarget) *//*from w w w .j av a 2s. co m*/ public Element getDragHelper(I_DropTarget target) { closeHelpBubble(null); // using the widget element as the drag helper also to avoid cloning issues on input fields m_dragHelper = getElement(); Element parentElement = getElement().getParentElement(); if (parentElement == null) { parentElement = target.getElement(); } int elementTop = getElement().getAbsoluteTop(); int parentTop = parentElement.getAbsoluteTop(); Style style = m_dragHelper.getStyle(); style.setWidth(m_dragHelper.getOffsetWidth(), Unit.PX); // the dragging class will set position absolute style.setTop(elementTop - parentTop, Unit.PX); m_dragHelper.addClassName(formCss().dragHelper()); return m_dragHelper; }
From source file:com.alkacon.geranium.client.util.DebugLog.java
License:Open Source License
/** * Constructor.<p>//from w w w . j a va 2 s . c o m */ @SuppressWarnings("unused") private DebugLog() { 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_LayoutBundle.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_LayoutBundle.INSTANCE.constants().css().backgroundColorDialog()); style.setZIndex(10); }
From source file:com.axlight.gbrain.client.MainPane.java
License:Apache License
private void relocateCenter(int posX, int posY) { final Style glassStyle = Document.get().getElementById("gbrain-glass").getStyle(); glassStyle.setWidth(viewWidth, Unit.PX); glassStyle.setHeight(viewHeight, Unit.PX); glassStyle.setVisibility(Visibility.VISIBLE); viewX = posX - viewWidth / 2;/* www. j ava2s. c o m*/ viewY = posY - viewHeight / 2; nodeManager.updateView(viewX, viewY); coordinate.updateView(viewX, viewY); new Timer() { public void run() { int screenWidth = getWindowScreenWidth(); int screenHeight = getWindowScreenHeight(); int left = viewWidth / 2 - screenWidth / 2; int top = viewHeight / 2 - screenHeight / 2; Window.scrollTo(left, top); setWidgetPosition(buttonPanel, left, top + screenHeight - buttonPanel.getOffsetHeight()); glassStyle.setVisibility(Visibility.HIDDEN); } }.schedule(500); }
From source file:com.badlogic.gdx.backends.gwt.GwtApplication.java
License:Apache License
public PreloaderCallback getPreloaderCallback() { final Panel preloaderPanel = new VerticalPanel(); preloaderPanel.setStyleName("gdx-preloader"); final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png"); logo.setStyleName("logo"); preloaderPanel.add(logo);/*from w ww.j a v a 2 s .c o m*/ final Panel meterPanel = new SimplePanel(); meterPanel.setStyleName("gdx-meter"); meterPanel.addStyleName("red"); final InlineHTML meter = new InlineHTML(); final Style meterStyle = meter.getElement().getStyle(); meterStyle.setWidth(0, Unit.PCT); meterPanel.add(meter); preloaderPanel.add(meterPanel); getRootPanel().add(preloaderPanel); return new PreloaderCallback() { @Override public void error(String file) { System.out.println("error: " + file); } @Override public void update(PreloaderState state) { meterStyle.setWidth(100f * state.getProgress(), Unit.PCT); } }; }
From source file:com.bearsoft.gwt.ui.containers.window.WindowPanel.java
@Override public void maximize() { if (!maximized) { restoreSnapshot();//from w w w.j ava 2s.co m maximized = true; updateDecorCursors(); snapshotMetrics(); // editing Element movableElement = getMovableTarget().getElement(); Style targetStyle = getWidget().getElement().getStyle(); // content int leftInset = getWidget().getElement().getAbsoluteLeft() - movableElement.getAbsoluteLeft(); int rightInset = movableElement.getAbsoluteRight() - getWidget().getElement().getAbsoluteRight(); int hInsets = leftInset + rightInset; int topInset = getWidget().getElement().getAbsoluteTop() - movableElement.getAbsoluteTop(); int bottomInset = movableElement.getAbsoluteBottom() - getWidget().getElement().getAbsoluteBottom(); int vInsets = topInset + bottomInset; Element parentElement = getMovableTarget().getParent().getElement(); int parentScrollWidth = parentElement.getScrollWidth(); int parentScrollHeight; if (parentElement == Document.get().getBody())// Some browsers // return incorrect // height for body // element { parentScrollHeight = Document.get().getClientHeight(); } else { parentScrollHeight = parentElement.getScrollHeight(); } targetStyle.setWidth(parentScrollWidth - hInsets, Style.Unit.PX); targetStyle.setHeight(parentScrollHeight - vInsets, Style.Unit.PX); // editing targetStyle = movableElement.getStyle(); // window targetStyle.setLeft(0, Style.Unit.PX); targetStyle.setTop(0, Style.Unit.PX); onResize(); MaximizeEvent.<WindowUI>fire(this, this); } }