List of usage examples for com.google.gwt.user.client.ui Widget setWidth
public void setWidth(String width)
From source file:edu.caltech.ipac.firefly.visualize.graph.XYPlotBasicWidget.java
protected void setupNewChart(String title) { _selecting = false;/* ww w . j ava 2s . c o m*/ _savedZoomSelection = null; if (!_popoutWidgetSet) { //_vertPanel.add(_cpanel); //_vertPanel.setWidth("100%"); _cpanel.setWidth("100%"); _panel.setWidth("100%"); // _dockPanel.setSize("100%", "100%"); _dockPanel.addStyleName("component-background"); _dockPanel.addNorth(getMenuBar(), 37); _dockPanel.addWest(getOptionsPanel(), OPTIONS_PANEL_WIDTH); //_statusMessage = GwtUtil.makeFaddedHelp(" "); //GwtUtil.setStyles(_statusMessage, "textAlign", "left", "paddingTop", "2px", "borderTop", "1px solid #bbbbbb"); //ScrollPanel statusPanel = new ScrollPanel(); //statusPanel.setSize("100%", "100%"); //statusPanel.add(_statusMessage); //_dockPanel.addSouth(statusPanel, 20); _dockPanel.add(_panel); GwtUtil.DockLayout.hideWidget(_dockPanel, optionsPanel); setPopoutWidget(_dockPanel); _popoutWidgetSet = true; } setTitle(title); _chartTitle.setHTML(""); //removeCurrentChart(); if (_chart == null) { _chart = new GChart(_meta.getXSize(), _meta.getYSize()); _chart.setOptimizeForMemory(true); _chart.setPadding("5px"); _chart.setLegendBorderWidth(0); // no border _chart.setBackgroundColor("white"); _chart.setGridColor("#999999"); _chart.setHoverParameterInterpreter(new XYHoverParameterInterpreter()); _chart.setClipToPlotArea(true); _chart.setClipToDecoratedChart(false); Widget footnotes = GwtUtil.leftRightAlign(new Widget[] { _actionHelp }, new Widget[] { new HTML(" "), HelpManager.makeHelpIcon("visualization.xyplotViewer") }); footnotes.setWidth("100%"); _chart.setChartFootnotes(footnotes); _chart.setChartFootnotesLeftJustified(true); _chart.setChartFootnotesThickness(20); addMouseListeners(); _cpanel.setWidget(_chart); } // if we are not showing legend, inform the chart _chart.setLegendVisible(_showLegend || _meta.alwaysShowLegend()); }
From source file:edu.caltech.ipac.firefly.visualize.WebPlotView.java
public void showMouseHelp(Widget w) { w.setWidth("100%"); w.setHeight("100%"); if (getMiniPlotWidget().isExpanded()) { int width = (int) (getOffsetWidth() * .75); PopupUtil.showMinimalMsg(this, w, 5, PopupPane.Align.VISIBLE_BOTTOM, width); } else {// w w w. j av a 2 s. c o m int width = getScrollWidth(); PopupUtil.showMinimalMsg(this, w, 5, PopupPane.Align.BOTTOM_CENTER_POPUP_BOTTOM, width); } }
From source file:fr.fg.client.openjwt.ui.JSScrollPane.java
License:Open Source License
public void update() { int scrollUpButtonWidth = scrollUpButton.getPixelWidth(); int scrollBubbleWidth = scrollBubble.getPixelWidth(); int scrollDownButtonWidth = scrollDownButton.getPixelWidth(); viewHeight = getViewHeight();// ww w.jav a 2 s .c o m scrollTrack.setWidth(scrollBubbleWidth + "px"); int maxWidth = Math.max(Math.max(scrollUpButtonWidth, scrollBubbleWidth), scrollDownButtonWidth); int viewWidth = Math.max(0, getPixelWidth() - maxWidth); scrollBar.setSize(maxWidth + "px", getPixelHeight() + "px"); viewPort.setSize(viewWidth + "px", getPixelHeight() + "px"); Widget view = getView(); if (view != null) view.setWidth(viewWidth + "px"); updateBubble(); }
From source file:fr.fg.client.openjwt.ui.JSScrollPane.java
License:Open Source License
protected void updateBubble() { // Hauteur des lments du scrollpane int scrollPaneHeight = getPixelHeight(); int trackHeight = scrollPaneHeight - scrollUpButton.getPixelHeight() - scrollDownButton.getPixelHeight(); if (trackHeight < 0) trackHeight = 0;//from ww w. j ava 2 s . c o m Widget view = getView(); if (viewHeight == -1) viewHeight = getViewHeight(); // Positionne l'ascenseur en fonction de la position des lments du // scrollpane this.bubbleHeight = scrollPaneHeight >= viewHeight ? trackHeight : trackHeight * scrollPaneHeight / (double) viewHeight; int bubbleMinHeight = getUIPropertyInt(OpenJWT.SCROLL_BUBBLE_MIN_HEIGHT); if (this.top < -viewHeight + scrollPaneHeight) this.top = -viewHeight + scrollPaneHeight; if (this.top > 0) this.top = 0; if (view != null) viewPort.setWidgetPosition(getView(), 0, (int) top); if (bubbleHeight < bubbleMinHeight) { int offset = (bubbleMinHeight - (int) Math.ceil(bubbleHeight)) / 2; scrollBubble.setPixelHeight(bubbleMinHeight); int position = (int) Math.floor(-this.top * (viewHeight > 0 ? trackHeight / (double) viewHeight : 1)) - offset; if (position < 0) position = 0; if (position + bubbleMinHeight > trackHeight) position = trackHeight - bubbleMinHeight; scrollTrack.setWidgetPosition(scrollBubble, 0, position); } else { scrollBubble.setPixelHeight((int) Math.ceil(bubbleHeight)); scrollTrack.setWidgetPosition(scrollBubble, 0, (int) Math.floor(-this.top * (viewHeight > 0 ? trackHeight / (double) viewHeight : 1))); } // Affiche ou masque la scrollbar switch (scrollBarPolicy) { case SCROLLBAR_AS_NEEDED: scrollBar.setVisible(scrollPaneHeight < viewHeight); break; case SCROLLBAR_NEVER: scrollBar.setVisible(false); break; case SCROLLBAR_ALWAYS: scrollBar.setVisible(true); break; } // Recalcule l'espace disponible pour la vue int viewWidth = getPixelWidth() - (scrollBar.isVisible() ? scrollUpButton.getPixelWidth() : 0); viewPort.setWidth(viewWidth + "px"); if (view != null) view.setWidth(viewWidth + "px"); }
From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.util.CloseablePanel.java
public void collapse() { setWidth(getOffsetWidth() + "px"); toggleImage.setUrl(expandImage);/*from www . ja v a 2 s .c o m*/ toggleImage.setTitle("Click to expand"); // if collapsed representation is null, that means pretend it doesn't have one for now if (content instanceof HasCollapsedRepresentation && ((HasCollapsedRepresentation) content).getCollapsedRepresentation() != null) { //replace content with collapsed representation content.setVisible(false); contentPanel.remove(content); ((HasCollapsedRepresentation) content).collapse(); Widget collapseContent = ((HasCollapsedRepresentation) content).getCollapsedRepresentation(); collapseContent.setWidth("100%"); String expansionLinkText = ((HasCollapsedRepresentation) content).getExpansionLinkText(); if (expansionLinkText != null) { //use this text for the link that expands back to original content Hyperlink link = new Hyperlink(expansionLinkText, "_"); link.addClickListener(new ClickListener() { public void onClick(Widget sender) { expand(); } }); link.addStyleName("center"); link.addStyleName("padding5px"); VerticalPanel vpanel = new VerticalPanel(); vpanel.add(collapseContent); vpanel.add(link); collapseContent = vpanel; vpanel.setWidth("100%"); } contentPanel.clear(); contentPanel.add(collapseContent); } else { content.setVisible(false); } }
From source file:gwtBlocks.client.views.HTMLTableBuilder.java
License:Apache License
/** * Sets the cell's content to the provided widget. *//*from www . j a v a 2 s .c om*/ public B set(Widget widget) { if (_hStretch) widget.setWidth("100%"); if (_vStretch) widget.setHeight("100%"); _table.setWidget(_row, _col++, widget); return builder(); }
From source file:info.magnolia.ui.vaadin.gwt.client.form.formsection.widget.FormSectionWidget.java
License:Open Source License
public void updateFieldSectionWidths(int offsetWidth) { final Iterator<Widget> it = iterator(); while (it.hasNext()) { final Widget w = it.next(); w.setWidth(offsetWidth + "px"); }// w ww .j ava 2s. co m }
From source file:io.pelle.mango.client.gwt.ControlHelper.java
License:Open Source License
public <ValueType> ControlHelper(final Widget widget, final IBaseControl<?, ? extends IBaseControlModel> baseControl, IGwtControl gwtControl, boolean addValueChangeListener, boolean addDefaultStyle, boolean setWidth) { this.uiObject = widget; this.baseControl = baseControl; this.gwtControl = gwtControl; if (addDefaultStyle) { widget.addStyleName(Styles.FORM_CONTROL); }/*from w w w . j av a 2s.c om*/ if (baseControl.isReadonly()) { widget.getElement().setPropertyBoolean("disabled", baseControl.isReadonly()); widget.addStyleName(GwtStyles.CONTROL_DISABLED_STYLE); } if (setWidth) { widget.setWidth(WidthCalculationStrategy.getInstance().getControlWidthCss(baseControl.getModel())); } baseControl.addUpdateListener(this); if (widget instanceof HasValue<?>) { final HasValue<ValueType> hasValueWidget = (HasValue<ValueType>) widget; if (addValueChangeListener) { if (widget instanceof FocusWidget) { FocusWidget focusWidget = (FocusWidget) widget; focusWidget.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { setParseValue(hasValueWidget.getValue()); } }); } } widget.addDomHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { baseControl.endEdit(); } }, BlurEvent.getType()); } onUpdate(); }
From source file:mx.org.pescadormvp.core.client.internallinks.ItemPanel.java
License:Open Source License
/** * Set up the dimensions of the panel and the items it contains based * on the minimum space required by all the items. *//*from w w w. j av a 2s . c o m*/ public void setupSizes() { // find item dimensions int itemCount = getItemCount(); int requiredItemWidth = 0; int requiredItemHeight = 0; for (int i = 0; i < itemCount; i++) { IsItem item = getItem(i); int minWidth = item.getMinWidth(); int minHeight = item.getMinHeight(); if (requiredItemWidth < minWidth) requiredItemWidth = minWidth; if (requiredItemHeight < minHeight) requiredItemHeight = minHeight; } // set item dimensions for (int i = 0; i < itemCount; i++) { IsItem item = getItem(i); Widget itemWidget = item.asWidget(); item.resizeContentWidth(requiredItemWidth); item.resizeContentHeight(requiredItemHeight); itemWidget.setWidth(requiredItemWidth + "px"); itemWidget.setHeight(requiredItemHeight + "px"); } setWidth(requiredItemWidth + "px"); setHeight((requiredItemHeight * itemCount) + "px"); }
From source file:net.opentsdb.tsd.client.QueryUi.java
License:Open Source License
/** * Properly sets the total width of a widget. * This takes into account decorations such as border, margin, and padding. */// w w w.ja v a 2 s.c o m private static void setOffsetWidth(final Widget widget, int width) { widget.setWidth(width + "px"); final int offset = widget.getOffsetWidth(); if (offset > 0) { width -= offset - width; if (width > 0) { widget.setWidth(width + "px"); } } }