List of usage examples for com.google.gwt.user.client.ui ComplexPanel getWidget
public Widget getWidget(int index)
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 ww w . j a va 2 s. c om 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);//from w w w . j av a 2s .c o m } 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 ww .j a v a2 s. c o m*/ * 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);// w ww.j a va 2 s . c om } 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.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 www . j a v a2 s.c o m } } return items; }
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);/* ww w . j av a 2 s. com*/ widgets.addAll(findByClass(_class, child)); } } return widgets; }
From source file:org.dashbuilder.displayer.client.DisplayerScreenPresenter.java
License:Apache License
protected void adjustMenuActions(DisplayerSettings displayerSettings) { final ComplexPanel menu = (ComplexPanel) menuActionsButton.getWidget(1); menu.getWidget(2).setVisible(displayerSettings.isCSVExportAllowed()); menu.getWidget(3).setVisible(displayerSettings.isExcelExportAllowed()); }
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 www. jav a 2 s .c o 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(); } } } }
From source file:org.kie.uberfire.client.common.MultiPageEditorView.java
License:Apache License
private Widget getLastTab() { final ComplexPanel tabs = getTabs(); return tabs.getWidget(tabs.getWidgetCount() - 1); }
From source file:org.kie.uberfire.client.common.MultiPageEditorView.java
License:Apache License
private Widget getBeforeLastTab() { final ComplexPanel tabs = getTabs(); int index = tabs.getWidgetCount() - 2; if (index < 0) { return null; }/*from w w w .ja va 2 s . co m*/ return tabs.getWidget(index); }