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

The following examples show how to use com.google.gwt.user.client.ui.DeckPanel. 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: ProjectEditor.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a {@code ProjectEditor} instance.
 *
 * @param projectRootNode  the project root node
 */
public ProjectEditor(ProjectRootNode projectRootNode) {
  this.projectRootNode = projectRootNode;
  projectId = projectRootNode.getProjectId();
  project = Ode.getInstance().getProjectManager().getProject(projectId);

  openFileEditors = Maps.newHashMap();
  fileIds = new ArrayList<String>();

  deckPanel = new DeckPanel();

  VerticalPanel panel = new VerticalPanel();
  panel.add(deckPanel);
  deckPanel.setSize("100%", "100%");
  panel.setSize("100%", "100%");
  initWidget(panel);
  // Note: I'm not sure that the setSize call below does anything useful.
  setSize("100%", "100%");
}
 
Example #2
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 #3
Source File: PagedView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public PagedView(boolean navOnFirstPage) {
    this.navOnFirstPage = navOnFirstPage;

    deck = new DeckPanel();
    deck.addStyleName("fill-layout");
    bar = new LinkBar(navOnFirstPage);
}
 
Example #4
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;
}
 
Example #5
Source File: OffPageContainer.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
OffPageContainer() {
    this.deck = new DeckPanel();
    this.texts = new ArrayList<>();
}
 
Example #6
Source File: SimpleForm.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private Widget build() {

        deck = new DeckPanel();
        deck.setStyleName("fill-layout-width");

        // ----------------------
        // view panel

        VerticalPanel viewPanel = new VerticalPanel();
        viewPanel.setStyleName("fill-layout-width");
        viewPanel.addStyleName("form-view-panel");
        deck.add(viewPanel.asWidget());

        // ----------------------
        // edit panel

        VerticalPanel editPanel = new VerticalPanel();
        editPanel.setStyleName("fill-layout-width");
        editPanel.addStyleName("form-edit-panel");

        RenderMetaData metaData = new RenderMetaData();
        metaData.setNumColumns(numColumns);

        GroupRenderer groupRenderer = new DefaultGroupRenderer();;


        Map<String, FormItem> groupItems = new LinkedHashMap<String, FormItem>();
        for(FormItem item : items)
        {
            groupItems.put(item.getName(), item);
        }

        // edit view
        Widget widget = groupRenderer.render(metaData, "default", groupItems);
        editPanel.add(widget);

        // plain view
        PlainFormView plainView = new PlainFormView(items);
        plainView.setNumColumns(numColumns);
        plainViews.add(plainView);
        viewPanel.add(groupRenderer.renderPlain(metaData, "default", plainView));

        deck.add(editPanel);

        // toggle default view
        toggleViews();
        refreshPlainView(); // make sureit's build, even empty...

        return deck;
    }
 
Example #7
Source File: NewStackWizard.java    From core with GNU Lesser General Public License v2.1 3 votes vote down vote up
Widget asWidget() {

        deck = new DeckPanel();

        deck.add(new StackStep1(this).asWidget());

        step2 = new StackStep2(this);
        deck.add(step2.asWidget());

        deck.showWidget(0);

        return deck;

    }
 
Example #8
Source File: ConnectorOverview.java    From core with GNU Lesser General Public License v2.1 2 votes vote down vote up
Widget asWidget() {

        LayoutPanel layout = new LayoutPanel();

        VerticalPanel panel = new VerticalPanel();
        panel.setStyleName("rhs-content-panel");

        ScrollPanel scroll = new ScrollPanel(panel);
        layout.add(scroll);

        layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

        serverName = new HTML("Replace me");
        serverName.setStyleName("content-header-label");

        HorizontalPanel header = new HorizontalPanel();
        header.setStyleName("fill-layout-width");
        header.add(serverName);

        final DeckPanel deck = new DeckPanel();
        deck.addStyleName("fill-layout");

        final ListBox selector = new ListBox();

        selector.addItem("Type: Remote");
        selector.addItem("Type: In-VM");
        selector.addItem("Type: Generic");

        selector.addChangeHandler(changeEvent -> deck.showWidget(selector.getSelectedIndex()));

        header.add(selector);
        selector.getElement().getParentElement().setAttribute("align", "right");

        panel.add(header);
        panel.add(new ContentDescription(Console.CONSTANTS.jmsConnectorDescription()));

        genericConnectors = new ConnectorList(presenter, ConnectorType.GENERIC);
        remoteConnectors = new ConnectorList(presenter, ConnectorType.REMOTE);
        invmConnectors = new ConnectorList(presenter, ConnectorType.INVM);

        deck.add(remoteConnectors.asWidget());
        deck.add(invmConnectors.asWidget());
        deck.add(genericConnectors.asWidget());

        deck.showWidget(0);

        panel.add(deck);

        return layout;
    }
 
Example #9
Source File: AcceptorOverview.java    From core with GNU Lesser General Public License v2.1 2 votes vote down vote up
Widget asWidget() {
    LayoutPanel layout = new LayoutPanel();

    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("rhs-content-panel");

    ScrollPanel scroll = new ScrollPanel(panel);
    layout.add(scroll);

    layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

    serverName = new HTML(Console.CONSTANTS.replace_me());
    serverName.setStyleName("content-header-label");

    HorizontalPanel header = new HorizontalPanel();
    header.setStyleName("fill-layout-width");
    header.add(serverName);

    final DeckPanel deck = new DeckPanel();
    deck.addStyleName("fill-layout");

    final ListBox selector = new ListBox();

    selector.addItem("Type: Remote");
    selector.addItem("Type: In-VM");
    selector.addItem("Type: Generic");

    selector.addChangeHandler(changeEvent -> deck.showWidget(selector.getSelectedIndex()));

    header.add(selector);
    selector.getElement().getParentElement().setAttribute("align", "right");

    panel.add(header);
    panel.add(new ContentDescription(Console.CONSTANTS.hornetq_acceptor_type_desc()));

    genericAcceptors = new AcceptorList(presenter, AcceptorType.GENERIC);
    remoteAcceptors = new AcceptorList(presenter, AcceptorType.REMOTE);
    invmAcceptors = new AcceptorList(presenter, AcceptorType.INVM);

    deck.add(remoteAcceptors.asWidget());
    deck.add(invmAcceptors.asWidget());
    deck.add(genericAcceptors.asWidget());

    deck.showWidget(0);

    panel.add(deck);

    return layout;
}
 
Example #10
Source File: ConnectorOverview.java    From core with GNU Lesser General Public License v2.1 2 votes vote down vote up
Widget asWidget() {

        LayoutPanel layout = new LayoutPanel();

        VerticalPanel panel = new VerticalPanel();
        panel.setStyleName("rhs-content-panel");

        ScrollPanel scroll = new ScrollPanel(panel);
        layout.add(scroll);

        layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

        // ---

        serverName = new HTML("Replace me");
        serverName.setStyleName("content-header-label");


        HorizontalPanel header = new HorizontalPanel();
        header.setStyleName("fill-layout-width");
        header.add(serverName);

        // ----

        final DeckPanel deck = new DeckPanel();
        deck.addStyleName("fill-layout");

        final ListBox selector = new ListBox();

        selector.addItem("Type: Remote");
        selector.addItem("Type: In-VM");
        selector.addItem("Type: Generic");

        selector.addChangeHandler(new ChangeHandler() {
            @Override
            public void onChange(ChangeEvent changeEvent) {
                deck.showWidget(selector.getSelectedIndex());
            }
        });

        header.add(selector);
        selector.getElement().getParentElement().setAttribute("align", "right");


        panel.add(header);
        panel.add(new ContentDescription(Console.CONSTANTS.jmsConnectorDescription()));

        genericConnectors = new ConnectorList(presenter, ConnectorType.GENERIC);
        remoteConnectors = new ConnectorList(presenter, ConnectorType.REMOTE);
        invmConnectors = new ConnectorList(presenter, ConnectorType.INVM);

        deck.add(remoteConnectors.asWidget());
        deck.add(invmConnectors.asWidget());
        deck.add(genericConnectors.asWidget());

        deck.showWidget(0);

        panel.add(deck);

        return layout;
    }
 
Example #11
Source File: AcceptorOverview.java    From core with GNU Lesser General Public License v2.1 2 votes vote down vote up
Widget asWidget() {

        LayoutPanel layout = new LayoutPanel();

        VerticalPanel panel = new VerticalPanel();
        panel.setStyleName("rhs-content-panel");

        ScrollPanel scroll = new ScrollPanel(panel);
        layout.add(scroll);

        layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

        // ---

        serverName = new HTML(Console.CONSTANTS.replace_me());
        serverName.setStyleName("content-header-label");


        HorizontalPanel header = new HorizontalPanel();
        header.setStyleName("fill-layout-width");
        header.add(serverName);

        // ----

        final DeckPanel deck = new DeckPanel();
        deck.addStyleName("fill-layout");

        final ListBox selector = new ListBox();

        selector.addItem("Type: Remote");
        selector.addItem("Type: In-VM");
        selector.addItem("Type: Generic");

        selector.addChangeHandler(new ChangeHandler() {
            @Override
            public void onChange(ChangeEvent changeEvent) {
                deck.showWidget(selector.getSelectedIndex());
            }
        });

        header.add(selector);
        selector.getElement().getParentElement().setAttribute("align", "right");


        panel.add(header);
        panel.add(new ContentDescription(Console.CONSTANTS.hornetq_acceptor_type_desc()));

        genericAcceptors = new AcceptorList(presenter, AcceptorType.GENERIC);
        remoteAcceptors = new AcceptorList(presenter, AcceptorType.REMOTE);
        invmAcceptors = new AcceptorList(presenter, AcceptorType.INVM);

        deck.add(remoteAcceptors.asWidget());
        deck.add(invmAcceptors.asWidget());
        deck.add(genericAcceptors.asWidget());

        deck.showWidget(0);

        panel.add(deck);

        return layout;
    }
 
Example #12
Source File: Pages.java    From core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Gets the deck panel within this tab panel. Adding or removing Widgets from
 * the DeckPanel is not supported and will throw
 * UnsupportedOperationExceptions.
 *
 * @return the deck panel
 */
public DeckPanel getDeckPanel() {
    return deck;
}