/* * GWT-Ext Widget Library * Copyright(c) 2007-2008, GWT-Ext. * licensing@gwt-ext.com * * http://www.gwt-ext.com/license */ package com.gwtext.tutorials.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.ui.RootPanel; import com.gwtext.client.core.EventObject; import com.gwtext.client.widgets.Button; import com.gwtext.client.widgets.Panel; import com.gwtext.client.widgets.Toolbar; import com.gwtext.client.widgets.ToolbarButton; import com.gwtext.client.widgets.event.ButtonListenerAdapter; import com.gwtext.client.widgets.layout.CardLayout; public class Tutorials implements EntryPoint { public void onModuleLoad() { Panel panel = new Panel(); panel.setBorder(false); panel.setPaddings(15); final Panel wizardPanel = new Panel(); wizardPanel.setHeight(250); wizardPanel.setWidth(350); wizardPanel.setTitle("Example Wizard"); wizardPanel.setLayout(new CardLayout()); wizardPanel.setActiveItem(0); wizardPanel.setPaddings(15); ButtonListenerAdapter listener = new ButtonListenerAdapter() { public void onClick(Button button, EventObject e) { String btnID = button.getId(); CardLayout cardLayout = (CardLayout) wizardPanel.getLayout(); String panelID = cardLayout.getActiveItem().getId(); if (btnID.equals("move-prev")) { if (panelID.equals("card-3")) { cardLayout.setActiveItem(1); } else { cardLayout.setActiveItem(0); } } else { if (panelID.equals("card-1")) { cardLayout.setActiveItem(1); } else { cardLayout.setActiveItem(2); } } } }; Toolbar toolbar = new Toolbar(); ToolbarButton backButton = new ToolbarButton("Back", listener); backButton.setId("move-prev"); toolbar.addButton(backButton); toolbar.addFill(); ToolbarButton nextButton = new ToolbarButton("Next", listener); nextButton.setId("move-next"); toolbar.addButton(nextButton); wizardPanel.setBottomToolbar(toolbar); Panel first = new Panel(); first.setBorder(false); first.setId("card-1"); first.setHtml("
Welcome to the Wizard!
Step 1 of 3
"); Panel second = new Panel(); second.setBorder(false); second.setId("card-2"); second.setHtml("
Step 2 of 3
"); Panel third = new Panel(); third.setBorder(false); third.setId("card-3"); third.setHtml("
Congratulations!
Step 3 of 3 - Complete
"); wizardPanel.add(first); wizardPanel.add(second); wizardPanel.add(third); panel.add(wizardPanel); RootPanel.get().add(panel); } }