com.google.gwt.user.client.ui.ComplexPanel Java Examples

The following examples show how to use com.google.gwt.user.client.ui.ComplexPanel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CubaEditorFieldWidget.java    From cuba with Apache License 2.0 6 votes vote down vote up
protected void tryFocusChild() {
    // Some components are based on Layout with several components within it.
    // In this case we can't set focus delegate, so we need to provide a workaround
    // to focus the first focusable component at least.
    Widget widget = getWidget();
    if (widget instanceof ComplexPanel) {
        ComplexPanel complexPanel = (ComplexPanel) widget;
        int widgetCount = complexPanel.getWidgetCount();
        for (int i = 0; i < widgetCount; i++) {
            Widget child = complexPanel.getWidget(i);
            if (child instanceof Focusable) {
                ((Focusable) child).focus();
                break;
            }
            if (child instanceof com.google.gwt.user.client.ui.Focusable) {
                ((com.google.gwt.user.client.ui.Focusable) child).setFocus(true);
                break;
            }
        }
    }
}
 
Example #2
Source File: VDDTabSheet.java    From cuba with Apache License 2.0 6 votes vote down vote up
public VDDTabSheet() {
    super();

    newTab.setClassName(CLASSNAME_NEW_TAB);

    // Get the tabBar
    tabBar = (ComplexPanel) getChildren().get(0);

    // Get the content
    tabPanel = (VTabsheetPanel) getChildren().get(1);

    // Get the spacer
    Element tBody = tabBar.getElement();
    spacer = tBody.getChild(tBody.getChildCount() - 1).getChild(0)
            .getChild(0).cast();
}
 
Example #3
Source File: MaterialLoaderTest.java    From gwt-material with Apache License 2.0 6 votes vote down vote up
protected void checkLoader(ComplexPanel panel) {
    assertTrue(panel.getWidget(0) instanceof MaterialWidget);
    MaterialWidget loaderWrapper = (MaterialWidget) panel.getWidget(0);
    assertTrue(loaderWrapper.getElement().hasClassName(CssName.LOADER_WRAPPER));
    assertTrue(loaderWrapper.getElement().hasClassName(CssName.VALIGN_WRAPPER));

    assertTrue(loaderWrapper.getWidget(0) instanceof MaterialPreLoader);
    MaterialPreLoader preLoader = (MaterialPreLoader) loaderWrapper.getWidget(0);
    checkPreLoader(preLoader);
    assertEquals(4, preLoader.getChildren().size());
    for (Widget w : preLoader.getChildren()) {
        assertTrue(w instanceof MaterialSpinner);
        MaterialSpinner spinner = (MaterialSpinner) w;
        checkSpinner(spinner);
    }

    MaterialLoader.loading(false);
    assertEquals(panel.getWidgetCount(), 0);
}
 
Example #4
Source File: GwtMockitoWidgetBaseClassesTest.java    From gwtmockito with Apache License 2.0 6 votes vote down vote up
@Test
public void testPanels() throws Exception {
  invokeAllAccessibleMethods(new AbsolutePanel() {});
  invokeAllAccessibleMethods(new CellPanel() {});
  invokeAllAccessibleMethods(new ComplexPanel() {});
  invokeAllAccessibleMethods(new DeckLayoutPanel() {});
  invokeAllAccessibleMethods(new DeckPanel() {});
  invokeAllAccessibleMethods(new DecoratorPanel() {});
  invokeAllAccessibleMethods(new DockLayoutPanel(Unit.PX) {});
  invokeAllAccessibleMethods(new DockPanel() {});
  invokeAllAccessibleMethods(new FlowPanel() {});
  invokeAllAccessibleMethods(new FocusPanel() {});
  invokeAllAccessibleMethods(new HorizontalPanel() {});
  invokeAllAccessibleMethods(new HTMLPanel("") {});
  invokeAllAccessibleMethods(new LayoutPanel() {});
  invokeAllAccessibleMethods(new PopupPanel() {});
  invokeAllAccessibleMethods(new RenderablePanel("") {});
  invokeAllAccessibleMethods(new ResizeLayoutPanel() {});
  invokeAllAccessibleMethods(new SimpleLayoutPanel() {});
  invokeAllAccessibleMethods(new SimplePanel() {});
  invokeAllAccessibleMethods(new SplitLayoutPanel() {});
  invokeAllAccessibleMethods(new StackPanel() {});
  invokeAllAccessibleMethods(new VerticalPanel() {});
}
 
Example #5
Source File: MaterialProgressTest.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
public void testProgressBasic() {
    MaterialLoader.progress(true);
    ComplexPanel panel = RootPanel.get();

    // when / then
    checkProgress(panel);
}
 
Example #6
Source File: MaterialProgressTest.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
protected void checkProgress(ComplexPanel panel) {
    assertNotNull(panel.getWidget(0));
    assertTrue(panel.getWidget(0) instanceof MaterialWidget);
    MaterialWidget loaderWrapper = (MaterialWidget) panel.getWidget(0);
    assertTrue(loaderWrapper.getElement().hasClassName(CssName.PROGRESS_WRAPPER));
    assertTrue(loaderWrapper.getElement().hasClassName(CssName.VALIGN_WRAPPER));

    assertTrue(loaderWrapper.getWidget(0) instanceof MaterialProgress);
    MaterialProgress progress = (MaterialProgress) loaderWrapper.getWidget(0);
    checkProgressBar(progress);
    checkProgressValue(progress);

    MaterialLoader.loading(false);
    assertEquals(0, panel.getWidgetCount());
}
 
Example #7
Source File: MaterialLoaderTest.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
public void testLoaderBasic() {
    MaterialLoader.loading(true);
    ComplexPanel panel = RootPanel.get();

    // when / then
    checkLoader(panel);
}
 
Example #8
Source File: DisplayerScreenPresenter.java    From dashbuilder with Apache License 2.0 4 votes vote down vote up
protected void adjustMenuActions(DisplayerSettings displayerSettings) {
    final ComplexPanel menu = (ComplexPanel) menuActionsButton.getWidget(1);
    menu.getWidget(2).setVisible(displayerSettings.isCSVExportAllowed());
    menu.getWidget(3).setVisible(displayerSettings.isExcelExportAllowed());
}
 
Example #9
Source File: GwtMockitoTestRunner.java    From gwtmockito with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a collection of classes whose non-abstract methods should always be replaced with
 * no-ops. By default, this list includes {@link Composite}, {@link DOM} {@link UIObject},
 * {@link Widget}, {@link Image}, and most subclasses of {@link Panel}. It will also include any
 * classes specified via the {@link WithClassesToStub} annotation on the test class. This makes
 * it much safer to test code that uses or extends these types.
 * <p>
 * This list can be customized via {@link WithClassesToStub} or by defining a new test runner
 * extending {@link GwtMockitoTestRunner} and overriding this method. This allows users to
 * explicitly stub out particular classes that are causing problems in tests. If you override this
 * method, you will probably want to retain the classes that are stubbed here by doing something
 * like this:
 *
 * <pre>
 * &#064;Override
 * protected Collection&lt;Class&lt;?&gt;&gt; getClassesToStub() {
 *   Collection&lt;Class&lt;?&gt;&gt; classes = super.getClassesToStub();
 *   classes.add(MyBaseWidget.class);
 *   return classes;
 * }
 * </pre>
 *
 * @return a collection of classes whose methods should be stubbed with no-ops while running tests
 */
protected Collection<Class<?>> getClassesToStub() {
  Collection<Class<?>> classes = new LinkedList<Class<?>>();
  classes.add(Composite.class);
  classes.add(DOM.class);
  classes.add(UIObject.class);
  classes.add(Widget.class);

  classes.add(DataGrid.class);
  classes.add(HTMLTable.class);
  classes.add(Image.class);

  classes.add(AbsolutePanel.class);
  classes.add(CellList.class);
  classes.add(CellPanel.class);
  classes.add(CellTable.class);
  classes.add(ComplexPanel.class);
  classes.add(DeckLayoutPanel.class);
  classes.add(DeckPanel.class);
  classes.add(DecoratorPanel.class);
  classes.add(DockLayoutPanel.class);
  classes.add(DockPanel.class);
  classes.add(FlowPanel.class);
  classes.add(FocusPanel.class);
  classes.add(HorizontalPanel.class);
  classes.add(HTMLPanel.class);
  classes.add(LayoutPanel.class);
  classes.add(Panel.class);
  classes.add(PopupPanel.class);
  classes.add(RenderablePanel.class);
  classes.add(ResizeLayoutPanel.class);
  classes.add(SimpleLayoutPanel.class);
  classes.add(SimplePanel.class);
  classes.add(SplitLayoutPanel.class);
  classes.add(StackPanel.class);
  classes.add(VerticalPanel.class);
  classes.add(ValueListBox.class);

  WithClassesToStub annotation = unitTestClass.getAnnotation(WithClassesToStub.class);
  if (annotation != null) {
    classes.addAll(Arrays.asList(annotation.value()));
  }

  return classes;
}