/** * Called when the loading state changes. * * @param state the new loading state */ @Override protected void onLoadingStateChanged(LoadingState state) { Widget message = null; if (state == LoadingState.LOADING) { // Loading indicator. message = loadingIndicatorContainer; } else if (state == LoadingState.LOADED && getPresenter().isEmpty()) { // Empty table. message = emptyListWidgetContainer; } // Switch out the message to display. if (message != null) { messagesPanel.showWidget(messagesPanel.getWidgetIndex(message)); } // Show the correct container. showOrHide(getChildContainer(), message == null); messagesPanel.setVisible(message != null); // Fire an event. super.onLoadingStateChanged(state); }
public void insert(Widget w, int beforeIndex) { Element container = createWidgetContainer(); DOM.insertChild(getElement(), container, beforeIndex); // See add(Widget) for important comments insert(w, container, beforeIndex, true); finishWidgetInitialization(container, w); }
/** * Shows the widget at the specified index. This causes the currently- visible * widget to be hidden. * * @param index the index of the widget to be shown */ public void showWidget(int index) { checkIndexBoundsForAccess(index); Widget oldWidget = visibleWidget; visibleWidget = getWidget(index); if (visibleWidget != oldWidget) { if (slideAnimation == null) { slideAnimation = new SlideAnimation(); } slideAnimation.showWidget(oldWidget, visibleWidget, isAnimationEnabled && isAttached()); } }
public void insert(IsWidget w, int beforeIndex) { insert(asWidgetOrNull(w), beforeIndex); }
@Override public boolean remove(Widget w) { Element container = getContainer(w); boolean removed = super.remove(w); if (removed) { resetChildWidget(w); getElement().removeChild(container); if (visibleWidget == w) { visibleWidget = null; } } return removed; }
outerDiv.appendChild(messagesPanel.getElement()); adopt(messagesPanel); messagesPanel.add(emptyListWidgetContainer); messagesPanel.add(loadingIndicatorContainer);
/** * Called when the loading state changes. * * @param state the new loading state */ @Override protected void onLoadingStateChanged(LoadingState state) { Widget message = null; if (state == LoadingState.LOADING) { // Loading indicator. message = loadingIndicatorContainer; } else if (state == LoadingState.LOADED && getPresenter().isEmpty()) { // Empty table. message = emptyTableWidgetContainer; } // Switch out the message to display. if (message != null) { messagesPanel.showWidget(messagesPanel.getWidgetIndex(message)); } // Adjust the colspan of the messages panel container. tbodyLoadingCell.setColSpan(Math.max(1, getRealColumnCount())); // Show the correct container. showOrHide(getChildContainer(), message == null); showOrHide(tbodyLoading, message != null); // Fire an event. super.onLoadingStateChanged(state); }
@Override public void add(Widget w) { Element container = createWidgetContainer(); DOM.appendChild(getElement(), container); // The order of these methods is very important. In order to preserve // backward compatibility, the offsetWidth and offsetHeight of the child // widget should be defined (greater than zero) when w.onLoad() is called. // As a result, we first initialize the container with a height of 0px, then // we attach the child widget to the container. See Issue 2321 for more // details. super.add(w, container); // After w.onLoad is called, it is safe to make the container invisible and // set the height of the container and widget to 100%. finishWidgetInitialization(container, w); }
public void setEnableResetButton(boolean val) { if (resetPanel != null) resetPanel.showWidget(val ? 0: 1); }
/** * Gets the index of the currently-visible widget, if any. * * @return the visible widget's index, or -1 if there is no such widget */ public int getVisibleWidget() { return getWidgetIndex(visibleWidget); }
protected void insertProtected(Widget w, Widget tabWidget, int beforeIndex) { // Check to see if the TabPanel already contains the Widget. If so, // remove it and see if we need to shift the position to the left. int idx = getWidgetIndex(w); if (idx != -1) { remove(w); if (idx < beforeIndex) { beforeIndex--; } } tabBar.insertTabProtected(tabWidget, beforeIndex); super.insert(w, beforeIndex); } }
public synchronized void add(String name, Widget widget) { super.add(widget); Integer index = new Integer(widgetCount); widgetMap.put(name, index); intKeyedWidgetMap.put(index, name); widgetCount++; }
public void add(Widget widget, String name) { decks.add(widget); TabDelegate tab = new TabDelegate(name, decks.getWidgetCount() - 1); tabs.add(tab); tabContainer.add(tab); }
public VerticalTabLayoutPanel() { super(); layout = new HorizontalPanel(); layout.setStyleName("fill-layout"); this.tabContainer = new VerticalPanel(); this.tabContainer.setStyleName("vertical-tabpanel-tabs"); this.decks = new DeckPanel(); layout.add(tabContainer); layout.add(decks); decks.getElement().getParentElement().setAttribute("width", "100%"); }
public void setPixelSize(int width, int height) { super.setPixelSize(width, height); int deckPanelHeight = height - tabBar.getOffsetHeight(); deckPanel.setPixelSize(width, deckPanelHeight); for (int i = 0; i < deckPanel.getWidgetCount(); i++) { deckPanel.getWidget(i).setPixelSize(width, deckPanelHeight); } }
@Override public boolean remove(Widget w) { // Removal of items from the TabBar is delegated to the DeckPanel // to ensure consistency int idx = getWidgetIndex(w); if (idx != -1) { tabBar.removeTabProtected(idx); return super.remove(w); } return false; }
public WSTabPanel() { layoutPanel = new DockPanel(); layoutPanel.setSize("98%", "100%"); tabBar = new TabBar(); deckPanel = new DeckPanel(); deckPanel.setWidth("100%"); deckPanel.addStyleName("gwt-TabPanelBottom"); layoutPanel.add(tabBar, DockPanel.NORTH); layoutPanel.add(deckPanel, DockPanel.CENTER); tabBar.addSelectionHandler(new SelectionHandler<Integer>() { public void onSelection(SelectionEvent<Integer> integerSelectionEvent) { deckPanel.showWidget(integerSelectionEvent.getSelectedItem()); } }); initWidget(layoutPanel); }
/*************************************** * {@inheritDoc} */ @Override public com.google.gwt.user.client.ui.DeckPanel createDeckPanel( Container rContainer, StyleData rStyle) { return new com.google.gwt.user.client.ui.DeckPanel(); }
public Widget getWidget(int idx) { return deckPanel.getWidget(idx); }