Java 类com.google.gwt.user.client.ui.StackPanel 实例源码

项目:qafe-platform    文件:QStack.java   
private int getIndexToInsertStack(StackPanel stackPanel) {
    int indexToInsert = getStackIndex();
    if(stackPanel.getWidgetCount() <= 0) {
        indexToInsert = 0 ;
    } else if(stackPanel.getWidgetCount() < indexToInsert) {
        indexToInsert = stackPanel.getWidgetCount();
    } else {
        for (int i = 0; i < stackPanel.getWidgetCount(); i++) {
            if(stackPanel.getWidget(i) instanceof QStack) {
                QStack stack = (QStack) stackPanel.getWidget(i);
                if(stack.getStackIndex() > indexToInsert) {
                    indexToInsert = i;
                    break;
                }
            }
        }
    }

    return indexToInsert;
}
项目:gwtmockito    文件:GwtMockitoWidgetBaseClassesTest.java   
@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() {});
}
项目:appinventor-extensions    文件:YoungAndroidPalettePanel.java   
/**
 * Creates a new component palette panel.
 *
 * @param editor parent editor of this panel
 */
public YoungAndroidPalettePanel(YaFormEditor editor) {
  this.editor = editor;
  COMPONENT_DATABASE = SimpleComponentDatabase.getInstance(editor.getProjectId());

  stackPalette = new StackPanel();

  paletteHelpers = new HashMap<ComponentCategory, PaletteHelper>();
  // If a category has a palette helper, add it to the paletteHelpers map here.
  paletteHelpers.put(ComponentCategory.LEGOMINDSTORMS, new LegoPaletteHelper());

  categoryPanels = new HashMap<ComponentCategory, VerticalPanel>();
  simplePaletteItems = new HashMap<String, SimplePaletteItem>();

  for (ComponentCategory category : ComponentCategory.values()) {
    if (showCategory(category)) {
      VerticalPanel categoryPanel = new VerticalPanel();
      categoryPanel.setWidth("100%");
      categoryPanels.put(category, categoryPanel);
      // The production version will not include a mapping for Extension because
      // only compile-time categories are included. This allows us to i18n the
      // Extension title for the palette.
      String title = ComponentCategory.EXTENSION.equals(category) ?
        MESSAGES.extensionComponentPallette() :
        ComponentsTranslation.getCategoryName(category.getName());
      stackPalette.add(categoryPanel, title);
    }
  }

  initExtensionPanel();

  stackPalette.setWidth("100%");
  initWidget(stackPalette);
}
项目:PortlandStateJava    文件:StackPanelExample.java   
public StackPanelExample() {
  super("Stack Panel");

  StackPanel stack = new StackPanel();
  stack.add(new Button("One"), "One");
  stack.add(new Button("Two"), "Two");
  stack.add(new Button("Three"), "Three");
  stack.add(new Button("Four"), "Four");
  add(stack);
}
项目:gwtmockito    文件:GwtMockitoTestRunner.java   
/**
 * 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;
}