@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() {}); }
private void showRootPresenter() { SimpleLayoutPanel mainPanel = new SimpleLayoutPanel(); RootLayoutPanel.get().add(mainPanel); RootLayoutPanel.get().getElement().getStyle().setZIndex(0); workspacePresenterProvider.get().go(mainPanel); }
public ExpandAnimation( final Widget w, final Map<Widget, OriginalStyleInfo> maximizedWidgetOriginalStyles, final SimpleLayoutPanel perspectiveRootContainer, final Command onCompleteCallback) { super(w, maximizedWidgetOriginalStyles, onCompleteCallback); this.perspectiveRootContainer = perspectiveRootContainer; }
@Test public void testExpandAnimation() { final WorkbenchLayoutImpl.ExpandAnimation expandAnimation = new WorkbenchLayoutImpl.ExpandAnimation(widget, Maps.<Widget, WorkbenchLayoutImpl.OriginalStyleInfo>newHashMap(), mock(SimpleLayoutPanel.class), null); expandAnimation.onComplete(); verify(((RequiresResize) widget)).onResize(); }
@Test public void testExpandAnimationWithCallback() { final Command callback = mock(Command.class); final WorkbenchLayoutImpl.ExpandAnimation expandAnimation = new WorkbenchLayoutImpl.ExpandAnimation(widget, Maps.<Widget, WorkbenchLayoutImpl.OriginalStyleInfo>newHashMap(), mock(SimpleLayoutPanel.class), callback); expandAnimation.onComplete(); verify(((RequiresResize) widget)).onResize(); verify(callback).execute(); }
private Page06View() { style = GWT.<Page06Resources>create(Page06Resources.class) .css(); style.ensureInjected(); headerPanel = new SimpleLayoutPanel(); Label label = new Label("Page 06"); label.setStyleName(style.headline()); headerPanel.add(label); initWidget(headerPanel); }
private Page02View() { style = GWT.<Page02Resources>create(Page02Resources.class) .css(); style.ensureInjected(); headerPanel = new SimpleLayoutPanel(); Label label = new Label("Page 02"); label.setStyleName(style.headline()); headerPanel.add(label); initWidget(headerPanel); }
private NavigationView() { style = GWT.<NavigationResources>create(NavigationResources.class) .css(); style.ensureInjected(); headerPanel = new SimpleLayoutPanel(); Label label = new Label("Hyperlink Navigation - Test With NavigationConfirmation & History"); label.setStyleName(style.headline()); headerPanel.add(label); initWidget(headerPanel); }
private Page05View() { style = GWT.<Page05Resources>create(Page05Resources.class) .css(); style.ensureInjected(); headerPanel = new SimpleLayoutPanel(); Label label = new Label("Page 05"); label.setStyleName(style.headline()); headerPanel.add(label); initWidget(headerPanel); }
public ShellView() { shell = new DockLayoutPanel(Style.Unit.PX); header = new SimpleLayoutPanel(); navigation = new SimpleLayoutPanel(); content = new SimpleLayoutPanel(); shell.addNorth(header, 75); shell.addWest(navigation, 275); shell.add(content); initWidget(shell); }
private HeaderView() { style = GWT.<HeaderResources>create(HeaderResources.class) .css(); style.ensureInjected(); headerPanel = new SimpleLayoutPanel(); Label label = new Label("Hyperlink Navigation - Test With NavigationConfirmation & History"); label.setStyleName(style.headline()); headerPanel.add(label); initWidget(headerPanel); }
private Page04View() { style = GWT.<Page04Resources>create(Page04Resources.class) .css(); style.ensureInjected(); headerPanel = new SimpleLayoutPanel(); Label label = new Label("Page 04"); label.setStyleName(style.headline()); headerPanel.add(label); initWidget(headerPanel); }
private Page01View() { style = GWT.<Page01Resources>create(Page01Resources.class) .css(); style.ensureInjected(); headerPanel = new SimpleLayoutPanel(); Label label = new Label("Page 01"); label.setStyleName(style.headline()); headerPanel.add(label); initWidget(headerPanel); }
private Page03View() { style = GWT.<Page03Resources>create(Page03Resources.class) .css(); style.ensureInjected(); headerPanel = new SimpleLayoutPanel(); Label label = new Label("Page 03"); label.setStyleName(style.headline()); headerPanel.add(label); initWidget(headerPanel); }
public FullHeightLayoutPanel() { SimpleLayoutPanel s = new SimpleLayoutPanel(); s.add( panel ); panel.setWidth( "100%" ); panel.setHeight( "100%" ); initWidget( s ); }
/** * This would fail if we didn't stub the create methods from DOM. See * https://github.com/google/gwtmockito/issues/4. */ @Test @SuppressWarnings("unused") public void shouldAllowCreatingLayoutPanels() { new SimpleLayoutPanel(); // Expect no exceptions }
@Test @SuppressWarnings("unused") public void testShouldAllowLayoutPanelSubclasses() { class MyPanel extends SimpleLayoutPanel { public MyPanel() { Label label = GWT.create(Label.class); add(label); } } new MyPanel(); }
@AssistedInject public SplitEditorPartViewImpl(@Assisted IsWidget specimenWidget) { this.specimenWidget = specimenWidget; rootPanel = new SimpleLayoutPanel(); rootPanel.add(specimenWidget); }
@Override public SimpleLayoutPanel getEditorContainer() { return editorPanel; }
/** Returns the container where the editor should be placed. */ SimpleLayoutPanel getEditorContainer();
public DialogBoxForLayoutWidget( String title, IsWidget content ) { int m = 50; ImageResource closeImage = ImageResources.INSTANCE.close(); int titleSize = Math.max( closeImage.getHeight(), closeImage.getWidth() ) + 5; dock = new LayoutPanel(); Glass glass = new Glass(); dock.add( glass ); DivWidget backGround = new DivWidget(); backGround.addStyleName( ResizablePanel.CSS.bkgnd() ); dock.add( backGround ); dock.setWidgetLeftRight( backGround, m, Unit.PX, m, Unit.PX ); dock.setWidgetTopBottom( backGround, m, Unit.PX, m, Unit.PX ); DivWidget titleWidget = new DivWidget(); titleWidget.addStyleName( ResizablePanel.CSS.title() ); titleWidget.getElement().setInnerText( title ); dock.add( titleWidget ); dock.setWidgetLeftRight( titleWidget, m, Unit.PX, m + titleSize, Unit.PX ); dock.setWidgetTopHeight( titleWidget, m, Unit.PX, titleSize, Unit.PX ); closeWidget = new Image( closeImage ); dock.add( closeWidget ); dock.setWidgetRightWidth( closeWidget, m, Unit.PX, titleSize, Unit.PX ); dock.setWidgetTopHeight( closeWidget, m, Unit.PX, titleSize, Unit.PX ); SimpleLayoutPanel contentPanel = new SimpleLayoutPanel(); contentPanel.setWidget( content.asWidget() ); contentPanel.addStyleName( ResizablePanel.CSS.content() ); dock.add( contentPanel ); dock.setWidgetLeftRight( contentPanel, m, Unit.PX, m, Unit.PX ); dock.setWidgetTopBottom( contentPanel, m + titleSize, Unit.PX, m, Unit.PX ); closeWidget.addClickHandler( new ClickHandler() { @Override public void onClick( ClickEvent event ) { if( isAutoHide ) hide(); } } ); }
public ContentWidgetView(boolean hasMargins, boolean scrollable) { this.hasMargins = hasMargins; examplePanel = scrollable ? new ScrollPanel() : new SimpleLayoutPanel(); examplePanel.setSize("100%", "100%"); initWidget(uiBinder.createAndBindUi(this)); }
@Override public void run() { /* Add handlers, setup activities */ GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() { @Override public void onUncaughtException(Throwable e) { /* open the umbrella if it's an umbrella */ e = unwrapException(e); e.printStackTrace(); LOG.log(Level.SEVERE, "Uncaught exception", e); } private static final int MAX_UNWRAPS = 10; private Throwable unwrapException(Throwable throwable) { Throwable result = throwable; int attempts = 0; while (attempts < MAX_UNWRAPS) { if (result instanceof UmbrellaException && ((UmbrellaException) result).getCauses().size() == 1) { result = ((UmbrellaException) throwable).getCauses().iterator().next(); } else if (result instanceof com.google.web.bindery.event.shared.UmbrellaException && ((com.google.web.bindery.event.shared.UmbrellaException) result).getCauses().size() == 1) { result = ((com.google.web.bindery.event.shared.UmbrellaException) throwable).getCauses() .iterator().next(); } else { break; } attempts++; } return result; } }); /* activity management */ CachingActivityMapper cached = new CachingActivityMapper(mainActivityMapper); ActivityManager mainActivityManager = new ActivityManager(cached, eventBus); mainActivityManager.setDisplay(applicationActivity.getViewPanel()); /* add a panel for the desktop to add to if it needs to */ SimpleLayoutPanel sp = new SimpleLayoutPanel(); RootLayoutPanel.get().add(sp); applicationActivity.start(sp, eventBus); }
public SimpleView() { container = new SimpleLayoutPanel(); initWidget(container); container.setSize("100%", "100%"); }
public SimpleLayoutPanel getContainer() { return container; }
/** * 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> * @Override * protected Collection<Class<?>> getClassesToStub() { * Collection<Class<?>> 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; }
public SimpleLayoutPanel getWidget() { return panel; }