List of usage examples for com.google.gwt.user.client.ui ComplexPanel getWidgetCount
public int getWidgetCount()
From source file:cc.alcina.framework.gwt.client.objecttree.ObjectTreeGridRenderer.java
License:Apache License
@Override protected void renderToPanel(TreeRenderable renderable, ComplexPanel cp, int depth, boolean soleChild, RenderContext renderContext, TreeRenderer parent) { super.renderToPanel(renderable, cp, depth, soleChild, renderContext, parent); if (depth == 0) { cellFormatter = (FlexCellFormatter) ft.getCellFormatter(); int widgetCount = cp.getWidgetCount(); colCountMax = 0;/*from www .ja v a2s . c o m*/ int level1WidgetIndex = -1; int row = -1; int col = 0; for (int i = 0; i < widgetCount; i++) { Widget w = cp.getWidget(0);// we'll be removing widgets, so // we'll always be looking at (0) if (w.getStyleName().contains("level-1")) { level1WidgetIndex = i; row++; col = 0; level1RendererRows.put(row, level1LabelMap.get(w)); } else { colCountMax = Math.max(colCountMax, i - level1WidgetIndex); } ft.setWidget(row, col, w); cellFormatter.setVerticalAlignment(row, col, HasVerticalAlignment.ALIGN_BOTTOM); if (col == 0) { cellFormatter.setStyleName(row, col, "td0"); } boolean isCustomiser = w.getStyleName().contains("customiser"); if (col == 1) {// && isCustomiser) { if (isCustomiser && !level1RendererRows.get(row).isSingleLineCustomiser()) { cellFormatter.setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_TOP); cellFormatter.addStyleName(row, 0, "multiline-caption"); } level1Rows.put(row, w); } // note, at this point, getWidget(0) is the _next_ widget boolean nextWidgetIsNewRow = i == widgetCount - 1 || cp.getWidget(0).getStyleName().contains("level-1"); if (nextWidgetIsNewRow) { cellFormatter.setColSpan(row, col, colCountMax - col + 1); } col++; } cp.clear(); cp.add(ft); } return; }
From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java
License:Apache License
public static void clearChildren(ComplexPanel cp) { for (int i = cp.getWidgetCount() - 1; i >= 0; i--) { Widget widget = cp.getWidget(i); cp.remove(i);// w w w . j ava 2s . c om } if (cp instanceof HasChildHandlers) { HasChildHandlers hch = (HasChildHandlers) cp; hch.detachHandlers(); } }
From source file:ch.unifr.pai.twice.layout.client.eclipseLayout.MiceSplitLayoutPanel.java
License:Apache License
/** * Adds a widget to the panel. If the widget is a {@link ResizeLayoutPanel}, this means that it is a container and therefore should be added directly. * Otherwise it has to be wrapped with such a {@link ResizeLayoutPanel} to ensure, that it is resizing accordingly to changing dimensions. * //from w w w .j a v a2 s . c om * If the widget that shall be added is {@link MiceSplitLayoutPanel} or a {@link MiceLayoutTabPanel}, it can be added to the newly created * {@link ResizeLayoutPanel} directly. For all other widgets, a new {@link MiceLayoutTabPanel} has to be introduced and the widget (or if it is a * {@link ComplexPanel} the children of the widget) has/have to be added to this tab. * * @see com.google.gwt.user.client.ui.SplitLayoutPanel#insert(com.google.gwt.user.client.ui.Widget, com.google.gwt.user.client.ui.DockLayoutPanel.Direction, * double, com.google.gwt.user.client.ui.Widget) */ @Override public void insert(Widget child, Direction direction, double size, Widget before) { if (child instanceof ResizeLayoutPanel) { super.insert(child, direction, size, before); } else { ResizeLayoutPanel panel = new ResizeLayoutPanel(); if (child instanceof MiceSplitLayoutPanel || child instanceof MiceLayoutTabPanel) { panel.setWidget(child); super.insert(panel, direction, size, before); } else { MiceLayoutTabPanel slot = new MiceLayoutTabPanel(20); if (child instanceof ComplexPanel) { ComplexPanel p = (ComplexPanel) child; for (int i = p.getWidgetCount(); i > 0; i--) { slot.add(p.getWidget(i - 1)); } if (slot.getWidgetCount() > 0) slot.selectTab(0); } else { slot.add(child); } panel.setWidget(slot); super.insert(panel, direction, size, before); } } }
From source file:com.goodow.web.ui.client.shell.one.ActivityPanel.java
License:Apache License
@Override public void setWidget(final IsWidget w) { if (w == null) { setVisible(false);//from w ww.ja va2 s .c o m } else { if (!shell.get().isAttached()) { // RootLayoutPanel.get().clear(); RootPanel.get().clear(); RootPanel.get().add(shell.get()); } setVisible(true); } super.setWidget(w); if (side != null && getParent() instanceof ComplexPanel) { ComplexPanel parent = (ComplexPanel) getParent(); int index = parent.getWidgetIndex(this); if (parent.getWidgetCount() > index + 1) { Widget centerWidget = parent.getWidget(index + 1); int margin = w == null ? 10 : getOffsetWidth(); if ("left".equals(side)) { centerWidget.getElement().getStyle().setMarginLeft(margin, Unit.PX); } else if ("right".equals(side)) { centerWidget.getElement().getStyle().setMarginRight(margin, Unit.PX); } } } }
From source file:com.google.livingstories.client.lsp.views.contentitems.LongContainerView.java
License:Apache License
private boolean hasChildWidget(ComplexPanel... panels) { for (ComplexPanel panel : panels) { if (panel.getWidgetCount() > 0) { return true; }/*from w ww . j a v a2 s . co m*/ } return false; }
From source file:com.qualogy.qafe.gwt.client.component.QChoiceHelper.java
License:Apache License
private List<Widget> getItems() { List<Widget> items = new ArrayList<Widget>(); if (uiObject instanceof ComplexPanel) { ComplexPanel complexPanel = (ComplexPanel) uiObject; int numItems = complexPanel.getWidgetCount(); for (int i = 0; i < numItems; i++) { Widget item = complexPanel.getWidget(i); items.add(item);//from ww w .j a v a 2 s. co m } } return items; }
From source file:com.xpn.xwiki.watch.client.ui.articles.ArticleListWidget.java
License:Open Source License
/** * Displays the comments zone panel and populates it if it's the first time it's printed. *//*from www . ja v a 2s .c o m*/ protected void showCommentsPanel(boolean visible, ComplexPanel commentsPanel, FeedArticle article, HTML commentsStatus) { if (visible && (commentsPanel.getWidgetCount() == 0)) { commentsPanel.setStyleName(watch.getStyleName("article", "comments-add")); refreshCommentsContainer((FlowPanel) commentsPanel, article, commentsStatus); } commentsPanel.setVisible(visible); }
From source file:com.xpn.xwiki.watch.client.ui.articles.ArticleListWidget.java
License:Open Source License
/** * Set the content panel visible, also handling panel initialization. Initially, if the panel is not visible, * it will be empty and will be initialized from the feed article upon first show, to optimize DOM manipulation * on list fill. //from w ww . j av a 2 s . co m */ protected void showContentPanel(boolean visible, ComplexPanel contentPanel, FeedArticle article) { if (visible && (contentPanel.getWidgetCount() == 0)) { // populate this panel HTML content = new HTML(article.getContent()); content.setStyleName(watch.getStyleName("article", "content")); contentPanel.add(content); final FeedArticle myArticle = article; content.addMouseListener(new MouseListener() { public void onMouseUp(Widget arg0, int arg1, int arg2) { Document doc = (Document) Document.get(); Selection sel = doc.getSelection(); if (sel.toString() == "") { return; } selection = sel.toString(); currentArticle = myArticle; popup.center(); } public void onMouseMove(Widget arg0, int arg1, int arg2) { } public void onMouseLeave(Widget arg0) { } public void onMouseEnter(Widget arg0) { } public void onMouseDown(Widget arg0, int arg1, int arg2) { } }); } contentPanel.setVisible(visible); }
From source file:gwt.material.design.components.client.utils.helper.DOMHelper.java
License:Apache License
@SuppressWarnings("unchecked") public static <W extends Widget> Set<W> findByClass(final Class<W> _class, final Widget parent) { final Set<W> widgets = new LinkedHashSet<>(); if (parent instanceof ComplexPanel) { final ComplexPanel complexPanel = (ComplexPanel) parent; for (int w = 0; w < complexPanel.getWidgetCount(); w++) { final Widget child = complexPanel.getWidget(w); if (child.getClass() == _class) widgets.add((W) child);//from w w w. j a v a 2 s.c om widgets.addAll(findByClass(_class, child)); } } return widgets; }
From source file:org.kie.uberfire.client.common.MultiPageEditorView.java
License:Apache License
@Override public void onResize() { final Widget parent = getParent(); if (parent != null) { final int width = parent.getOffsetWidth(); final int height = parent.getOffsetHeight(); setPixelSize(width, height);//from w ww. ja va 2 s .co m if (width == 0 && height == 0) { //it's `invisible` = makes no sense try to resize return; } final ComplexPanel content = getTabContent(); for (int i = 0; i < content.getWidgetCount(); i++) { final Widget widget = content.getWidget(i); if (widget instanceof TabPane) { final TabPane tabPane = (TabPane) widget; final LayoutPanel flowPanel = ((LayoutPanel) (tabPane).getWidget(0)); flowPanel.setPixelSize(width, height - getTabHeight()); //Resize children for (int iChild = 0; iChild < tabPane.getWidgetCount(); iChild++) { final Widget childWidget = tabPane.getWidget(iChild); if (childWidget instanceof RequiresResize) { ((RequiresResize) childWidget).onResize(); } } } } final ComplexPanel tabs = getTabs(); if (tabs != null && tabs.getWidgetCount() > 0) { final Widget firstTabItem = tabs.getWidget(0); final Widget lastTabItem = getLastTab(); if (width < getTabBarWidth() || tabs.getOffsetHeight() > firstTabItem.getOffsetHeight()) { shrinkTabBar(); } else if (lastTabItem instanceof DropdownTab && (getTabBarWidth() + getLastTab().getOffsetWidth()) < width) { expandTabBar(); } } } }