List of usage examples for com.google.gwt.user.client.ui Widget setHeight
public void setHeight(String height)
From source file:com.xpn.xwiki.gwt.api.client.app.XWikiGWTDefaultApp.java
License:Open Source License
public static void setMaxHeight(Widget widget) { int absoluteTop = getAbsoluteTop(widget); int newHeight = (Window.getClientHeight() - absoluteTop); if (newHeight > 0) { try {/* w ww . ja v a2s . co m*/ widget.setHeight(newHeight + "px"); } catch (Exception e) { // We need to catch this call since in IE7 // it seems to be able to break sometime on initial loading } } }
From source file:edu.caltech.ipac.firefly.ui.GwtUtil.java
public static final Widget createWidgetFromFieldGroup(Form searchForm, FieldGroupTag fg, FormHub formHub) { // check download restrictions String dlRestrict = fg.getDownloadRestriction(); if (dlRestrict != null) { String[] dlArr = dlRestrict.split("="); String dlKey = dlArr[0];/*from w w w. ja va 2s .c o m*/ String dlVal = dlArr[1]; InputField inF = searchForm.getField(dlKey); if (inF != null && inF.isVisible()) { String fieldDefValue = inF.getValue(); if (dlVal.equals(fieldDefValue) || (dlVal.equals("*") && fieldDefValue.length() > 0)) { // continue } else { return null; } } else { return null; } } // check role access boolean access = DynUtils.checkRoleAccess(fg.getAccess()); if (!access) { return null; } List<Widget> widgetList = new ArrayList<Widget>(); String fgType = fg.getType(); if (fgType.equalsIgnoreCase("tabPane")) { TabPane tp = new TabPane(); String tabHeight = fg.getHeight(); String tabWidth = fg.getWidth(); tp.setSize(tabWidth, tabHeight); if (BrowserUtil.isBrowser(Browser.FIREFOX)) { //tp.getDeckPanel().setSize("97%", "85%"); } List<UIComponent> uiCompList = fg.getUIComponents(); for (UIComponent uiComp : uiCompList) { if (uiComp instanceof FieldGroupTag) { FieldGroupTag fgChild = (FieldGroupTag) uiComp; Widget w = createWidgetFromFieldGroup(searchForm, fgChild, formHub); if (w != null) { tp.addTab(w, fgChild.getTitle()); } } } String tpName = fg.getTypeName(); if (!StringUtils.isEmpty(tpName)) { tp.setTabPaneName(tpName); formHub.bind(tp, tpName); } tp.selectTab(0); widgetList.add(tp); } else if (fgType.equalsIgnoreCase("activeTabPane")) { ActiveTabPane atp = new ActiveTabPane(); String tabHeight = fg.getHeight(); String tabWidth = fg.getWidth(); atp.setSize(tabWidth, tabHeight); if (BrowserUtil.isBrowser(Browser.FIREFOX)) { //atp.getDeckPanel().setSize("97%", "85%"); } List<UIComponent> uiCompList = fg.getUIComponents(); for (UIComponent uiComp : uiCompList) { if (uiComp instanceof FieldGroupTag) { FieldGroupTag fgChild = (FieldGroupTag) uiComp; Widget w = createWidgetFromFieldGroup(searchForm, fgChild, formHub); if (w != null) { atp.addTab(w, fgChild.getTitle()); } } } atp.selectTab(0); String atpName = fg.getTypeName(); if (!StringUtils.isEmpty(atpName)) { atp.setTabPaneName(atpName); formHub.bind(atp, atpName); } widgetList.add(atp); } else if (fgType.equalsIgnoreCase("DatePanel")) { DatePanel dp = new DatePanel(24 * 60 * 60); dp.setIntervalViolationError("Observation Date searches can only cover one 24 hour period."); widgetList.add(dp); } else { List<UIComponent> uiCompList = fg.getUIComponents(); WidgetFactory wfactory = Application.getInstance().getWidgetFactory(); for (UIComponent uiComp : uiCompList) { if (uiComp instanceof FieldGroupTag) { FieldGroupTag fgChild = (FieldGroupTag) uiComp; Widget w = createWidgetFromFieldGroup(searchForm, fgChild, formHub); if (w != null) { widgetList.add(w); } } else if (uiComp instanceof PreDefFieldTag) { PreDefFieldTag pdf = (PreDefFieldTag) uiComp; String id = pdf.getId(); Widget w = wfactory.createFormWidget(id, DynUtils.convertParams(pdf.getParams())); if (w instanceof UsesFormHub) { ((UsesFormHub) w).bind(formHub); } widgetList.add(w); } else if (uiComp instanceof LabelTag) { LabelTag xl = (LabelTag) uiComp; HTML hl = new HTML(xl.getHtmlString()); widgetList.add(hl); } else if (uiComp instanceof HelpTag) { HelpTag h = (HelpTag) uiComp; Widget icon = HelpManager.makeHelpIcon(h.getHelpId()); HTML text = GwtUtil.makeFaddedHelp(" " + h.getTitle() + " "); HorizontalPanel hp = new HorizontalPanel(); hp.add(text); hp.add(icon); widgetList.add(hp); } else if (uiComp instanceof FieldDefSource) { FieldDefSource fds = (FieldDefSource) uiComp; widgetList.add(FormBuilder.createField(fds)); } } } String spacing = fg.getSpacing(); if (spacing == null) spacing = "0"; FormBuilder.Config.Direction dir = FormBuilder.Config.Direction.VERTICAL; if (fg.getDirection().equalsIgnoreCase("horizontal")) { dir = FormBuilder.Config.Direction.HORIZONTAL; } Widget w = FormBuilder.createPanel(new FormBuilder.Config(dir, fg.getLabelWidth(), Integer.parseInt(spacing), HorizontalPanel.ALIGN_LEFT), widgetList.toArray(new Widget[widgetList.size()])); if (w instanceof VerticalPanel) { ((VerticalPanel) w).setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); } else if (w instanceof HorizontalPanel) { ((HorizontalPanel) w).setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); } String wWidth = fg.getWidth(); if (wWidth != null && wWidth.length() > 0) w.setWidth(wWidth); String wHeight = fg.getHeight(); if (wHeight != null && wHeight.length() > 0) w.setHeight(wHeight); Widget rval = w; if (fgType.equalsIgnoreCase("CollapsiblePanel")) { String fgTitle = fg.getTitle(); CollapsiblePanel cp = new CollapsiblePanel(fgTitle, w, false); String cpName = fg.getTypeName(); if (!StringUtils.isEmpty(cpName)) { cp.setPanelName(cpName); formHub.bind(cp, cpName); } rval = cp; } else if (fgType.equalsIgnoreCase("ActiveCollapsiblePanel")) { String fgTitle = fg.getTitle(); ActiveCollapsiblePanel acp = new ActiveCollapsiblePanel(fgTitle, w, false); String cpName = fg.getTypeName(); if (!StringUtils.isEmpty(cpName)) { acp.setPanelName(cpName); formHub.bind(acp, cpName); } rval = acp; } else if (fgType.equalsIgnoreCase("Frame")) { rval = createShadowTitlePanel(w, ""); } if (fg.getXid() != null) { rval.getElement().setId(fg.getXid()); } return rval; }
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 a v a 2 s. co m int width = getScrollWidth(); PopupUtil.showMinimalMsg(this, w, 5, PopupPane.Align.BOTTOM_CENTER_POPUP_BOTTOM, width); } }
From source file:gwt.material.design.client.data.component.CategoryComponent.java
License:Apache License
public void setHeight(String height) { this.height = height; Widget widget = getWidget(); if (widget != null && widget.isAttached()) { widget.setHeight(height); }/*from ww w .j a v a2 s.c o m*/ }
From source file:gwtBlocks.client.views.HTMLTableBuilder.java
License:Apache License
/** * Sets the cell's content to the provided widget. *//* ww w. j av a2 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: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 ww w. ja v a2 s . 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 height of a widget. * This takes into account decorations such as border, margin, and padding. *//*from w w w . j a va2 s. c o m*/ private static void setOffsetHeight(final Widget widget, int height) { widget.setHeight(height + "px"); final int offset = widget.getOffsetHeight(); if (offset > 0) { height -= offset - height; if (height > 0) { widget.setHeight(height + "px"); } } }
From source file:nz.co.doltech.gwt.sdm.ui.SuperDevModeUI.java
License:Apache License
public SuperDevModeUI() { resources.style().ensureInjected();/* w w w .j a v a 2 s. com*/ superDevCompiler.addPollCallback(new PollCallback() { @Override public void onPoll(float startTime) { if (progressPanel != null && progressPanel.getWidgetCount() > 0) { Paragraph paragraph = (Paragraph) progressPanel.getWidget(0); paragraph.setHTML(paragraph.getHTML() + "."); } } }); superDevCompiler.addCompileStartCallback(new StartedCallback() { @Override public void onStarted(String moduleName, String requestUrl) { progressPanel = new AbsolutePanel(); progressPanel.add(new Paragraph("Compiling " + moduleName)); showMessagePanel(progressPanel); } }); superDevCompiler.addCompileCompleteCallback(new CompletedCallback() { @Override public boolean onCompleted(JavaScriptObject json) { compilationStopped(); return false; } }); superDevCompiler.addCompileFailedCallback(new FailedCallback() { @Override public void onFailed(String reason, String logUrl) { btnCompile.setText("Try Again"); AbsolutePanel content = new AbsolutePanel(); content.getElement().getStyle().setColor("red"); content.add(new Paragraph(reason)); Widget error; if (!showErrorLog) { error = new Anchor("View Error Log", logUrl); ((Anchor) error).setTarget("_blank"); } else { error = new Frame(logUrl); error.setWidth("730px"); error.setHeight("300px"); } content.add(error); showMessagePanel(content); compilationStopped(); } }); RootPanel.getBodyElement().focus(); RootPanel.get().addDomHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_F5) { event.preventDefault(); startCompile(); } } }, KeyDownEvent.getType()); initWidget(uibinder.createAndBindUi(this)); }
From source file:org.cruxframework.crux.core.client.css.transition.UnsupportedTransitionHandler.java
License:Apache License
@Override public void setHeight(Widget widget, String height, int duration, Callback callback) { if (widget == null) { return;/*from w w w .ja va 2 s . c om*/ } widget.setHeight(height); if (callback != null) { callback.onTransitionCompleted(); } }
From source file:org.cruxframework.crux.smartfaces.client.storyboard.StoryboardPanel.java
License:Apache License
protected void configHeightWidth(final Widget panel) { if (!StringUtils.isEmpty(itemHeight)) { if (fixedHeight) { panel.setHeight(itemHeight); } else {/*from www .ja va 2 s.com*/ panel.getElement().getStyle().setProperty("minHeight", itemHeight); } } if (!StringUtils.isEmpty(itemWidth)) { if (fixedWidth) { panel.setWidth(itemWidth); } else { panel.getElement().getStyle().setProperty("minWidth", itemWidth); } } }