List of usage examples for com.google.gwt.user.client.ui Widget setVisible
@Override
public void setVisible(boolean visible)
From source file:bufferings.ktr.wjr.client.ui.widget.WjrTabPanel.java
License:Apache License
/** * Selects the tab and show its contents. * /*w w w . j a va 2 s. c o m*/ * @param index * The index of the tab to show. */ public void selectTab(int index) { checkIndex(index); if (index == selectedIndex) { return; } BeforeSelectionEvent<Integer> event = BeforeSelectionEvent.fire(this, index); if ((event != null) && event.isCanceled()) { return; } if (selectedIndex != -1) { Widget child = children.get(selectedIndex); Element container = panel.getWidgetContainerElement(child); container.getStyle().setDisplay(Display.NONE); child.setVisible(false); tabs.get(selectedIndex).setSelected(false); } Widget child = children.get(index); Element container = panel.getWidgetContainerElement(child); container.getStyle().clearDisplay(); child.setVisible(true); tabs.get(index).setSelected(true); selectedIndex = index; SelectionEvent.fire(this, index); }
From source file:bufferings.ktr.wjr.client.ui.widget.WjrTabPanel.java
License:Apache License
/** * Layouts the content widget.//w ww . ja v a 2 s. c o m * * @param child * The content widget. */ protected void layoutChild(Widget child) { panel.setWidgetLeftRight(child, PADDING, Unit.PX, PADDING, Unit.PX); panel.setWidgetTopBottom(child, BAR_HEIGHT + PADDING, Unit.PX, 0, Unit.PX); panel.getWidgetContainerElement(child).getStyle().setDisplay(Display.NONE); child.setVisible(false); }
From source file:burrito.client.widgets.form.EditForm.java
License:Apache License
public void setWidgetVisible(Widget widget, boolean visible) { widget.setVisible(visible); for (Widget companionWidget : companionWidgetsMap.get(widget)) { companionWidget.setVisible(visible); }/*from w w w .ja va 2 s. c o m*/ }
From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java
License:Apache License
public static void maximiseWidget(Widget widget) { restoreFromMaximise();/* w w w. j a v a 2s. co m*/ hiddenWidgets = new ArrayList<Widget>(); morphedWidgets = new ArrayList<SplitLayoutPanel>(); elementLayouts = new ArrayList<ElementLayout>(); Element e = widget.getElement(); while (widget.getParent() != null) { Widget parent = widget.getParent(); if (parent instanceof SplitLayoutPanel) { morphSplitPanel((SplitLayoutPanel) parent, widget, false); } else if (parent instanceof HasWidgets && !(parent instanceof TabPanel)) { HasWidgets hw = (HasWidgets) parent; for (Iterator<Widget> itr = hw.iterator(); itr.hasNext();) { Widget w = itr.next(); if (w != widget && w.isVisible()) { hiddenWidgets.add(w); w.setVisible(false); } } } widget = widget.getParent(); } while (e.getParentElement() != RootPanel.get().getElement()) { ElementLayout layout = new ElementLayout(e); elementLayouts.add(layout); layout.maximise(); e = e.getParentElement(); } }
From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java
License:Apache License
private static void morphSplitPanel(SplitLayoutPanel splitPanel, Widget keepChild, boolean restore) { final String zeroSize = "0px"; boolean hsp = isDirectionalLayoutPanel(splitPanel, true); for (int index = 0; index < splitPanel.getWidgetCount(); index++) { Widget w = splitPanel.getWidget(index); if (CommonUtils.simpleClassName(w.getClass()).contains("Splitter")) { w.setVisible(restore); } else {/*from ww w. ja v a 2s. c om*/ Element container = splitPanel.getWidgetContainerElement(w); container.getStyle().setDisplay(restore || keepChild == w ? Display.BLOCK : Display.NONE); } } if (!restore) { morphedWidgets.add(splitPanel); } }
From source file:cc.alcina.framework.gwt.client.widget.richtext.RichTextToolbar.java
License:Apache License
public void stylesAndIndentsOnly() { List<Widget> toHide = (List) Arrays.asList(subscript, superscript, strikethrough, hr, ol, ul, insertImage, createLink, removeFormat, removeLink, backColors, foreColors, fonts, fontSizes, justifyCenter, justifyLeft, justifyRight);/*from ww w .j ava2s. c o m*/ for (Widget widget : toHide) { widget.setVisible(false); } }
From source file:com.audata.client.AuDoc.java
License:Open Source License
/** * Switches the main section to the specified * content type// w w w . ja v a2 s . c o m * @param section An integer used to determine the section type to use. Use AuDoc.SECTION_* to specify section */ public void switchMain(int section) { Widget p = null; try { this.main.clear(); } catch (Exception e) { Window.alert(e.getMessage()); } switch (section) { case (AuDoc.SECTION_ADMIN): p = new AdminPanel(); break; case (AuDoc.SECTION_HOME): p = new HomePanel(); break; case (AuDoc.SECTION_NEW): //p = new RecordPanel("a"); p = new NewRecord(); break; case (AuDoc.SECTION_REPORT): p = new ReportPanel(); break; case (AuDoc.SECTION_SEARCH): p = new SearchPanel(this); break; default: p = new HomePanel(); break; } //p.setVisible(false); p.setVisible(true); this.main.add(p); //Effect.appear(p); if (section == AuDoc.SECTION_RAPID) { RapidBookingDialog rbd = new RapidBookingDialog(); rbd.show(); } }
From source file:com.brainz.wokhei.client.about.AboutModulePart.java
protected void hideAllPanels() { for (Widget panel : _panels) { panel.setVisible(false); } }
From source file:com.calclab.emite.example.pingpong.client.PingPongWidget.java
License:Open Source License
public PingPongWidget() { maxOutput = 500;//from w ww .j a v a2 s.c om hideEvents = true; header = new VerticalPanel(); add(header); currentUser = new Label("no user yet."); sessionStatus = new Label("no session status yet."); final FlowPanel status = new FlowPanel(); status.add(currentUser); status.add(sessionStatus); add(status); login = new Button("Login"); logout = new Button("Logout"); clear = new Button("Clear"); final CheckBox hideEventsCheck = new CheckBox("Hide events"); buttons = new FlowPanel(); buttons.add(login); buttons.add(logout); buttons.add(clear); buttons.add(hideEventsCheck); add(buttons); output = new VerticalPanel(); add(output); hideEventsCheck.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(final ValueChangeEvent<Boolean> event) { hideEvents = event.getValue(); final int widgetCount = output.getWidgetCount(); for (int index = 0; index < widgetCount; index++) { final Widget w = output.getWidget(index); if (isEventWidget(w)) { w.setVisible(!hideEvents); } } } }); hideEventsCheck.setValue(hideEvents); }
From source file:com.cbroglie.eliminationscheduler.client.ui.TokenSeparatedList.java
License:Apache License
/** * Call this to make a widget visible or invisible. You should not call * setVisible() directly on the widget, otherwise its separating token * will be lost./*from w w w . j av a2 s . c o m*/ * * @param widget The widget on which to change visibility. * @param visible The desired visibility. */ public void setWidgetVisible(Widget widget, boolean visible) { int index = getWidgetIndex(widget); if (index < 0) { throw new NoSuchElementException("Widget not found."); } widget.setVisible(visible); // Check special cases if (index < leftmostVisibleIndex && visible) { // Making a widget visible to the left of the current leftmost visible widget. // or making the leftmost visible widget visible again. // Make visible the separator of the previous leftmost visible widget, unless none were visible. if (leftmostVisibleIndex < getWidgetCount()) { getWidget(leftmostVisibleIndex - 1).setVisible(true); } leftmostVisibleIndex = index; } else if (index == leftmostVisibleIndex && !visible) { // Making the leftmost visible widget invisible. // Find the new leftmost visible widget. leftmostVisibleIndex += 2; while (leftmostVisibleIndex < getWidgetCount()) { if (getWidget(leftmostVisibleIndex).isVisible()) { break; } leftmostVisibleIndex += 2; } // Make invisible the separator of the new leftmost visible widget, unless they are all invisible if (leftmostVisibleIndex < getWidgetCount()) { getWidget(leftmostVisibleIndex - 1).setVisible(false); } } else if (index > leftmostVisibleIndex) { // Typical case, apply the same visibility to the widget's separator. getWidget(index - 1).setVisible(visible); } }