Example usage for com.google.gwt.user.client.ui DeckPanel DeckPanel

List of usage examples for com.google.gwt.user.client.ui DeckPanel DeckPanel

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui DeckPanel DeckPanel.

Prototype

public DeckPanel() 

Source Link

Document

Creates an empty deck panel.

Usage

From source file:com.google.livingstories.client.contentmanager.ContentItemManager.java

License:Apache License

private Widget createSpecialAttributesPanel() {
    specialAttributesPanel = new DeckPanel();

    specialAttributesPanel.add(createEventAttributesPanel());
    contentItemTypeToEditorPanelMap.put(ContentItemType.EVENT, 0);

    specialAttributesPanel.add(createAssetAttributesPanel());
    contentItemTypeToEditorPanelMap.put(ContentItemType.ASSET, 1);

    playerAttributesPanel = new DeckPanel();
    playerAttributesPanel.add(createStoryPlayerAttributesPanel());
    playerAttributesPanel.add(createPlayerAttributesPanel());
    playerAttributesPanel.showWidget(0);
    specialAttributesPanel.add(playerAttributesPanel);
    contentItemTypeToEditorPanelMap.put(ContentItemType.PLAYER, 2);

    specialAttributesPanel.add(createNarrativeAttributesPanel());
    contentItemTypeToEditorPanelMap.put(ContentItemType.NARRATIVE, 3);

    specialAttributesPanel.add(createBackgroundAttributesPanel());
    contentItemTypeToEditorPanelMap.put(ContentItemType.BACKGROUND, 4);

    specialAttributesPanel.showWidget(0);
    return specialAttributesPanel;
}

From source file:com.google.testing.testify.risk.frontend.client.view.widgets.NavigationLink.java

License:Apache License

public NavigationLink(String text, long projectId, String targetHistoryToken,
        Function<Void, TaPagePresenter> createPresenterFunction) {
    this.targetHistoryToken = targetHistoryToken;
    this.projectId = projectId;
    this.createPresenterFunction = createPresenterFunction;

    panel = new DeckPanel();
    SimplePanel fakeLinkPanel = new SimplePanel();
    fakeLink = new Label(text);
    fakeLinkPanel.add(fakeLink);//ww  w  .jav a2 s . c o  m
    realLink = new Hyperlink(text, getHyperlinkTarget());
    panel.add(realLink);
    panel.add(fakeLinkPanel);
    enable();
    super.initWidget(panel);
}

From source file:com.mallentechinc.smartwire.client.SmartWireWeb.java

License:Open Source License

public void onModuleLoad() {

    RootPanel rootPanel = RootPanel.get();

    dockLayoutPanel = new DockLayoutPanel(Unit.EM);
    rootPanel.add(dockLayoutPanel, 10, 10);
    dockLayoutPanel.setSize("1100px", "900px");

    HorizontalPanel headerPanel = new HorizontalPanel();
    dockLayoutPanel.addNorth(headerPanel, 6);

    headerPanel.setWidth("1200px");
    headerPanel.setBorderWidth(0);/* w  ww .  j av a 2s  . c om*/

    Image logo = new Image("images/smartwire_logo.jpg");
    headerPanel.setCellWidth(logo, "400px");
    headerPanel.add(logo);

    headerPanel.add(new HTML("jxu"));

    Image logoff = new Image("images/doorlogoff.jpg");
    logoff.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            boolean confirm = Window.confirm("You are about to logoff");
            if (confirm) {
                //redirect("j_spring_security_logout");
                logoff();
            }

        }
    });
    headerPanel.add(logoff);

    HTML htmlCopyRight = new HTML("Copy Right 2012 mallentechinc.com", true);
    dockLayoutPanel.addSouth(htmlCopyRight, 7.7);

    tabPanel = new TabLayoutPanel(2.5, Unit.EM);
    tabPanel.setAnimationDuration(1000);
    tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX);
    dockLayoutPanel.add(tabPanel);

    tabPanel.addSelectionHandler(new SelectionHandler() {
        public void onSelection(SelectionEvent event) {
            // Let the user know what they just did.
            // Window.alert("You clicked tab " + event.getSelectedItem().toString());
            if (event.getSelectedItem().toString().equals("0")) {
                getAllUsers();
                deckPanel.showWidget(1);
            } else if (event.getSelectedItem().toString().equals("3")) {
                getAllCircuitsByUser("jxu");
                subsysContentDeckPanel.showWidget(1);
            }

        }
    });

    //user admin
    DockLayoutPanel userdockLayoutPanel = new DockLayoutPanel(Unit.EM);

    VerticalPanel userAdminMenuPanel = new VerticalPanel();
    userAdminMenuPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    userdockLayoutPanel.addWest(userAdminMenuPanel, 11);

    Button getAllUsersButton = new Button("Get All Users");
    getAllUsersButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            getAllUsers();
            deckPanel.showWidget(1);
        }
    });
    userAdminMenuPanel.setSpacing(2);
    userAdminMenuPanel.add(getAllUsersButton);

    Button addNewUserButton = new Button("Add New User");
    addNewUserButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            deckPanel.showWidget(2);

        }
    });
    userAdminMenuPanel.setSpacing(2);
    userAdminMenuPanel.add(addNewUserButton);
    userAdminMenuPanel.setSize("130px", "150px");

    //search user
    Button searchUserButton = new Button("Search User");
    searchUserButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("Working on it, stay tune...");

        }
    });
    userAdminMenuPanel.setSpacing(2);
    userAdminMenuPanel.add(searchUserButton);

    //user content area
    deckPanel = new DeckPanel();
    deckPanel.setAnimationEnabled(true);
    userdockLayoutPanel.add(deckPanel);

    //add default page for this
    HTML htmlNewHtml = new HTML("This is admin page", true);
    deckPanel.add(htmlNewHtml);

    //add flex table
    flexTable = new FlexTable();
    flexTable.setCellSpacing(2);
    flexTable.setCellPadding(2);
    deckPanel.add(flexTable);
    flexTable.setSize("700px", "");

    //add user input page
    userformPanel = new FormPanel();
    deckPanel.add(userformPanel);

    final VerticalPanel addUserFormContentPanel = new VerticalPanel();
    addUserFormContentPanel.setSpacing(3);

    addUserFormContentPanel.add(new Label("User Name"));
    userName = new TextBox();
    userName.setName("userName");
    addUserFormContentPanel.add(userName);

    addUserFormContentPanel.add(new Label("Password"));
    passWord = new PasswordTextBox();
    userName.setName("password");
    addUserFormContentPanel.add(passWord);

    addUserFormContentPanel.add(new Label("First Name"));
    firstName = new TextBox();
    firstName.setName("firstName");
    addUserFormContentPanel.add(firstName);

    addUserFormContentPanel.add(new Label("Last Name"));
    lastName = new TextBox();
    lastName.setName("lastName");
    addUserFormContentPanel.add(lastName);

    addUserFormContentPanel.add(new Label("Email"));
    email = new TextBox();
    email.setName("email");
    addUserFormContentPanel.add(email);

    addUserFormContentPanel.add(new Label("User Role"));

    userRole = new ListBox();
    userRole.addStyleName("demo-ListBox");
    userRole.addItem("ADMIN");
    userRole.addItem("USER");
    userRole.setName("userRole");
    addUserFormContentPanel.add(userRole);

    addUserFormContentPanel.add(new Label("Position"));

    position = new ListBox();
    position.addStyleName("demo-ListBox");
    position.addItem("EMPLOYEE");
    position.addItem("MANAGER");
    position.setName("position");
    addUserFormContentPanel.add(position);

    Button insertUserButton = new Button("Add New User");
    insertUserButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {

            //get user input
            String requestData = getAddUserInput();
            //add user
            saveUpdateUser(requestData);

        }
    });
    addUserFormContentPanel.add(insertUserButton);

    userformPanel.add(addUserFormContentPanel);

    tabPanel.add(userdockLayoutPanel, "User Admin");

    //end of user admin

    //arch
    DockLayoutPanel archdockLayoutPanel = new DockLayoutPanel(Unit.EM);
    tabPanel.add(archdockLayoutPanel, "Planning & Architecture");

    VerticalPanel archMenuPanel = new VerticalPanel();
    archMenuPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    archMenuPanel.setSize("160px", "140px");

    Button getAllOption = new Button("All Option Code");
    getAllOption.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("Working on it, stay tune...");
        }
    });
    archMenuPanel.setSpacing(2);
    archMenuPanel.add(getAllOption);

    Button addNewOptionButton = new Button("New Option Code");
    addNewOptionButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("Working on it, stay tune...");

        }
    });
    archMenuPanel.setSpacing(2);
    archMenuPanel.add(addNewOptionButton);

    //search user
    Button searchOptionCodeButton = new Button("Search Option Code");
    searchOptionCodeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("Working on it, stay tune...");

        }
    });
    archMenuPanel.setSpacing(2);
    archMenuPanel.add(searchOptionCodeButton);

    //search user
    Button functionCodeButton = new Button("Fuction Code");
    functionCodeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("Working on it, stay tune...");

        }
    });
    archMenuPanel.setSpacing(2);
    archMenuPanel.add(functionCodeButton);

    archdockLayoutPanel.addWest(archMenuPanel, 11);

    //end of arch

    //ee components

    DockLayoutPanel eeCompdockLayoutPanel = new DockLayoutPanel(Unit.EM);

    VerticalPanel eeCompMenuPanel = new VerticalPanel();
    eeCompMenuPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    eeCompMenuPanel.setSize("160px", "120px");

    Button device = new Button("Device");
    device.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("Working on it, stay tune...");
        }
    });
    eeCompMenuPanel.setSpacing(2);
    eeCompMenuPanel.add(device);

    eeCompdockLayoutPanel.addWest(eeCompMenuPanel, 11);
    tabPanel.add(eeCompdockLayoutPanel, "EE Components");

    //end of ee components      

    //sub system
    DockLayoutPanel subSystemdockLayoutPanel = new DockLayoutPanel(Unit.EM);

    VerticalPanel subsysMenuPanel = new VerticalPanel();
    subsysMenuPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    subsysMenuPanel.setSize("160px", "120px");

    Button myCircuits = new Button("My Sub Systems");
    myCircuits.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            getAllCircuitsByUser("jxu");
            subsysContentDeckPanel.showWidget(1);
        }
    });
    subsysMenuPanel.setSpacing(2);
    subsysMenuPanel.add(myCircuits);

    //all sub system
    Button allSubSystems = new Button("Sub Systems");
    allSubSystems.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("Working on it, stay tune...");
        }
    });
    subsysMenuPanel.setSpacing(2);
    subsysMenuPanel.add(allSubSystems);

    //sub system family
    Button allSubSystemFamily = new Button("Sub System Family");
    allSubSystemFamily.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("Working on it, stay tune...");
        }
    });
    subsysMenuPanel.setSpacing(2);
    subsysMenuPanel.add(allSubSystemFamily);

    subSystemdockLayoutPanel.addWest(subsysMenuPanel, 11);

    //sub system content
    subsysContentDeckPanel = new DeckPanel();
    subsysContentDeckPanel.setAnimationEnabled(true);

    //html
    HTML subsystemHtml = new HTML("This is place you can manager your Sub System", true);
    subsysContentDeckPanel.add(subsystemHtml);

    //add circuit page
    circuitsFlexTable = new FlexTable();
    circuitsFlexTable.setSize("500px", "100px");
    circuitsFlexTable.setCellPadding(2);
    circuitsFlexTable.setCellSpacing(2);
    subsysContentDeckPanel.add(this.circuitsFlexTable);

    subSystemdockLayoutPanel.add(subsysContentDeckPanel);

    //end of sub system content

    tabPanel.add(subSystemdockLayoutPanel, "Sub System Design");
    //end of system       

    //config vechile
    DockLayoutPanel vehicledockLayoutPanel = new DockLayoutPanel(Unit.EM);

    VerticalPanel vehicleMenuPanel = new VerticalPanel();
    vehicleMenuPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    vehicleMenuPanel.setSize("160px", "120px");

    Button addVehcile = new Button("Add Vehicle");
    addVehcile.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("Working on it, stay tune...");
        }
    });
    vehicleMenuPanel.setSpacing(2);
    vehicleMenuPanel.add(addVehcile);

    //all sub system
    Button addTrim = new Button("Add Trim");
    addTrim.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("Working on it, stay tune...");
        }
    });
    vehicleMenuPanel.setSpacing(2);
    vehicleMenuPanel.add(addTrim);

    vehicledockLayoutPanel.addWest(vehicleMenuPanel, 11);

    tabPanel.add(vehicledockLayoutPanel, "Vehicle Configurations");
    //end of //config vechile

    DockLayoutPanel qadockLayoutPanel = new DockLayoutPanel(Unit.EM);

    tabPanel.add(qadockLayoutPanel, "Quality Assurance");

    DockLayoutPanel midockLayoutPanel = new DockLayoutPanel(Unit.EM);

    tabPanel.add(midockLayoutPanel, "Manufacture Interface");

    tabPanel.selectTab(0);
    getAllUsers();
    deckPanel.showWidget(1);

}

From source file:com.mansi.client.board.MultiRowTabPanel.java

License:Apache License

public MultiRowTabPanel(int tabsPerRow) {
    this.tabsPerRow = tabsPerRow;
    VerticalPanel containerPanel = new VerticalPanel();
    initWidget(containerPanel);//from w ww  .j a va2s.c o m

    tabBarsVerticalPanel = new StylableVerticalPanel();
    tabBarsVerticalPanel.setWidth("100%");
    masterDeckPanel = new DeckPanel();
    //  masterDeckPanel.addStyleName(CSS_DEMO_MULTI_ROW_TAB_PANEL_BOTTOM);
    containerPanel.add(tabBarsVerticalPanel);
    containerPanel.add(masterDeckPanel);
    History.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            selectTabByHistoryToken(event.getValue());
        }
    });
}

From source file:com.mashery.examples.api.client.EtsyExample.java

License:Open Source License

public EtsyExample(final PopupMapWidget mapWidget) {
    AbsolutePanel rootPanel = new AbsolutePanel();
    rootPanel.setSize("100%", "100%");

    SplitLayoutPanel panel = new SplitLayoutPanel();
    rootPanel.add(panel);/*from  w w w .  j a v a2  s.  co  m*/
    panel.setHeight("100%");

    FlowPanel topPanel = new FlowPanel();
    panel.addNorth(topPanel, 250d);

    topPanel.add(new HTML("<h1>Featured Listings</h1>"));

    dragController = new PickupDragController(rootPanel, false);
    dragController.setBehaviorDragProxy(true);
    dragController.setBehaviorMultipleSelection(false);
    dragController.setBehaviorDragStartSensitivity(2);

    featuredListingsTable = new FeaturedListingsTable(20);
    topPanel.add(new ScrollPanel(featuredListingsTable));

    DockLayoutPanel bottomPanelContainer = new DockLayoutPanel(Unit.PX);
    panel.add(bottomPanelContainer);

    bottomPanelContainer.addNorth(new HTML("<h1>Favorite Listings</h1>"), 50d);

    bottomPanel = new DeckPanel();
    bottomPanelContainer.add(bottomPanel);

    bottomPanel.add(new HTML("Obtaining your Etsy account information..."));

    favoriteListingsTable = new FavoriteListingsTable(20);

    dropController = new SimpleDropController(favoriteListingsTable) {
        public void onDrop(DragContext context) {
            Image img = (Image) context.draggable;
            String id = img.getElement().getId();
            if (id != null && id.startsWith("listing_")) {
                try {
                    int listingId = Integer.parseInt(id.substring("listing_".length()));
                    favoriteListingsTable.createUserFavoriteListing(listingId);
                } catch (NumberFormatException e) {
                    GWT.log("Unable to parse listing id.", e);
                }
            }
        }
    };

    dragController.registerDropController(dropController);

    FlowPanel userPanel = new FlowPanel();

    userPanel.add(userLabel = new InlineHTML());
    userPanel.add(new InlineHTML("&nbsp;&nbsp;&nbsp;"));
    Anchor disconnectLink = new Anchor("Disconnect", "#");
    userPanel.add(disconnectLink);
    disconnectLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            event.preventDefault();
            disconnectEtsyAccount();
        }
    });

    userPanel.add(new InlineHTML("&nbsp;|&nbsp;"));
    Anchor mapProfileLink = new Anchor("Map Profile", "#");
    userPanel.add(mapProfileLink);
    mapProfileLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            event.preventDefault();
            if (user != null) {
                UserProfile profile = user.getProfile();
                if (profile != null) {
                    MarkerOptions opt = new MarkerOptions();
                    opt.setTitle(profile.getLoginName());
                    opt.setPosition(new LatLng(profile.getLat(), profile.getLon()));
                    opt.setClickable(true);
                    opt.setVisible(true);
                    mapWidget.show(new Marker(opt));
                }
            }
        }
    });

    mapWidget.addAutoHidePartner(mapProfileLink.getElement());

    userPanel.add(new HTML());
    userPanel.add(favoriteListingsTable);

    bottomPanel.add(new ScrollPanel(userPanel));
    bottomPanel.add(new HTML("You must be logged in in order to manage your favorite listings."));
    bottomPanel.add(createOAuthPanel());

    etsySvc = GWT.create(EtsyService.class);

    infoPanel = new PopupPanel(true);
    infoPanel.setAutoHideOnHistoryEventsEnabled(true);
    infoGrid = new Grid(2, 1);
    infoPanel.setWidget(infoGrid);
    infoGrid.setWidth("240px");

    mapListingLink = new Anchor("Map", "#");
    mapListingLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            event.preventDefault();
            if (selectedListing == null)
                return;

            Shop shop = selectedListing.getShop();
            if (shop == null) {
                Window.alert("No shop information available.");
                return;
            }

            if (!shop.hasLatLon()) {
                Window.alert("No location information available.");
                return;
            }

            MarkerOptions opt = new MarkerOptions();
            opt.setTitle(shop.getShopName());
            opt.setPosition(new LatLng(shop.getLat(), shop.getLon()));
            opt.setClickable(true);
            opt.setVisible(true);
            mapWidget.show(new Marker(opt));
        }
    });

    mapWidget.addAutoHidePartner(mapListingLink.getElement());

    deleteFavListingLink = new Anchor("Delete", "#");
    deleteFavListingLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            event.preventDefault();
            favoriteListingsTable.deleteUserFavoriteListing(selectedListing.getListingId());
            infoPanel.hide();
        }
    });

    initWidget(rootPanel);

    bottomPanel.showWidget(0);
}

From source file:com.mashery.examples.api.client.Examples.java

License:Open Source License

@Override
public void onModuleLoad() {
    DockLayoutPanel mainPanel = new DockLayoutPanel(Unit.PX);
    RootLayoutPanel.get().add(mainPanel);

    DockLayoutPanel headerPanel = new DockLayoutPanel(Unit.PX);
    mainPanel.addNorth(headerPanel, 80d);

    FlexTable rightPanel = new FlexTable();
    headerPanel.addEast(rightPanel, 250d);
    rightPanel.setCellPadding(4);/*from ww  w. j av a  2  s  . co m*/
    rightPanel.setSize("100%", "100%");
    rightPanel.getCellFormatter().setHeight(0, 0, "100%");
    rightPanel.getCellFormatter().setWidth(1, 0, "100%");
    rightPanel.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT,
            HasVerticalAlignment.ALIGN_TOP);
    ((FlexTable.FlexCellFormatter) rightPanel.getCellFormatter()).setColSpan(0, 0, 2);

    final FlowPanel userPanel = new FlowPanel();
    rightPanel.setWidget(0, 0, userPanel);

    LoginServiceAsync loginSvc = GWT.create(LoginService.class);
    loginSvc.getUserEmail(new AsyncCallback<String>() {

        @Override
        public void onSuccess(final String email) {
            final Anchor loginLink = new Anchor();
            loginLink.setHref(email == null ? "/examples/login" : "/examples/login?logout=true");
            loginLink.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    String callbackURL = Window.Location.createUrlBuilder().buildString();
                    StringBuilder buf = new StringBuilder("/examples/login?callbackURL=");
                    buf.append(URL.encodeQueryString(callbackURL));
                    if (email != null)
                        buf.append("&logout=true");

                    loginLink.setHref(buf.toString());
                }
            });

            if (email == null) {
                loginLink.setHTML("Sign&nbsp;in");
            } else {
                loginLink.setHTML("Sign&nbsp;out");
                userPanel.add(new InlineLabel(email));
                userPanel.add(new InlineHTML("&nbsp;|&nbsp;"));
            }

            userPanel.add(loginLink);
        }

        @Override
        public void onFailure(Throwable caught) {
            userPanel.add(new Label(caught.getLocalizedMessage()));
        }
    });

    mapWidget = new PopupMapWidget();
    rightPanel.setWidget(1, 1, mapWidget);

    Grid logoPanel = new Grid(1, 2);
    logoPanel.setCellSpacing(8);
    logoPanel.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP);
    headerPanel.add(logoPanel);

    Image masheryLogoImg = new Image("resources/img/mashery.gif");
    Anchor masheryLink = new Anchor();
    masheryLink.setTitle("Mashery, Inc.");
    masheryLink.setHref("http://developer.mashery.com");
    masheryLink.getElement().appendChild(masheryLogoImg.getElement());
    logoPanel.setWidget(0, 0, masheryLink);

    InlineLabel logoLabel = new InlineLabel("Mashery Examples");
    logoLabel.getElement().getStyle().setFontWeight(FontWeight.BOLD);
    logoLabel.getElement().getStyle().setFontSize(28d, Unit.PT);
    logoLabel.getElement().getStyle().setColor("#c1080a");
    logoPanel.setWidget(0, 1, logoLabel);

    SplitLayoutPanel centerPanel = new SplitLayoutPanel();
    mainPanel.add(centerPanel);

    final StackLayoutPanel examplesPanel = new StackLayoutPanel(Unit.PX);
    centerPanel.addWest(examplesPanel, 200d);

    contentPanel = new DeckPanel();
    centerPanel.add(contentPanel);
    contentPanel.getElement().getStyle().setPaddingLeft(8d, Unit.PX);
    contentPanel.setAnimationEnabled(true);

    addExample(new Example("quova", "Quova") {
        @Override
        public Widget createContent() {
            return new QuovaExample(mapWidget);
        }
    }, examplesPanel);

    addExample(new Example("etsy", "Etsy") {
        @Override
        public Widget createContent() {
            return new EtsyExample(mapWidget);
        }
    }, examplesPanel);

    addExample(new Example("weatherbug", "WeatherBug") {
        @Override
        public Widget createContent() {
            return new WeatherBugExample(mapWidget);
        }
    }, examplesPanel);

    addExample(new Example("hotwire", "Hotwire") {
        @Override
        public Widget createContent() {
            return new HotwireExample(mapWidget);
        }
    }, examplesPanel);

    addExample(new Example("active", "Active") {
        @Override
        public Widget createContent() {
            return new ActiveExample(mapWidget);
        }
    }, examplesPanel);

    String historyToken = History.getToken();
    Integer index = exampleIndex.get(historyToken);
    if (index == null)
        index = 0;

    examplesPanel.showWidget(index);
    showExample(index);

    examplesPanel.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> event) {
            int index = event.getSelectedItem();
            Example example = examples.get(index);
            if (example != null)
                History.newItem(example.getId());
        }
    });

    History.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            String historyToken = event.getValue();
            Integer index = exampleIndex.get(historyToken);
            if (index != null) {
                examplesPanel.showWidget(index);
                showExample(index);
            }
        }
    });
}

From source file:com.mcherm.zithiacharsheet.client.ZithiaCharsheetEntryPoint.java

License:Apache License

/**
 * This is the entry point method./*w  w  w . ja  v a 2 s.c  o  m*/
 */
public void onModuleLoad() {
    // -- Create widgets --
    final DeckPanel mainPanel = new DeckPanel();
    RootPanel.get("charsheet").add(mainPanel);

    // -- Set up the card in the deck for showing the list --
    mainPanel.add(new CharacterList(new CharacterList.ButtonActions() {

        public void onGoButton(CharacterMetadata metadata) {
            mainPanel.showWidget(1); // Show the character sheet
            zithiaCharsheet.setCharacterId(metadata.getId(), new FailureAction() {
                public void onFailure(Throwable caught) {
                    Window.alert("Load of character failed: " + caught);
                    mainPanel.showWidget(0);
                }
            });
        }

        public void onNewButton() {
            mainPanel.showWidget(1); // Show the character sheet
            // FIXME: Maybe we need to empty it out; for now we won't.
            zithiaCharsheet.saveAsNewCharacter();
        }
    }));

    mainPanel.add(zithiaCharsheet);
    mainPanel.showWidget(0); // Show the select list
}

From source file:com.nanosim.client.ContentWidget.java

License:Apache License

/**
 * Initialize this widget by creating the elements that should be added to the
 * page./*  ww  w .  j  a  va2s  .  c o  m*/
 */
protected final Widget createWidget() {
    deckPanel = new DeckPanel();

    setStyleName(DEFAULT_STYLE_NAME);

    // Add a tab handler
    tabBar.addSelectionHandler(this);

    // Create a container for the main example
    final VerticalPanel vPanel = new VerticalPanel();
    add(vPanel, constants.contentWidgetExample());

    // Add the name
    HTML nameWidget = new HTML(getName());
    nameWidget.setStyleName(DEFAULT_STYLE_NAME + "-name");
    vPanel.add(nameWidget);

    // Add the description
    HTML descWidget = new HTML(getDescription());
    descWidget.setStyleName(DEFAULT_STYLE_NAME + "-description");
    vPanel.add(descWidget);

    // Add source code tab
    if (hasSource()) {
        sourceWidget = new HTML();
        add(sourceWidget, constants.contentWidgetSource());
    } else {
        sourceLoaded = true;
    }

    // Add style tab
    if (hasStyle()) {
        styleDefs = new HashMap<String, String>();
        styleWidget = new HTML();
        add(styleWidget, constants.contentWidgetStyle());
    }

    // Initialize the Nanosim widget (if any) and add it to the page
    Widget widget = onInitialize();
    if (widget != null) {
        vPanel.add(widget);
    }
    onInitializeComplete();

    return deckPanel;
}

From source file:com.phideltcmu.recruiter.client.DynamicRecruiter.java

License:Creative Commons License

/**
 * This is the entry point method.//from   ww w  . ja  va 2  s  .  c  o m
 */
public void onModuleLoad() {
    registerWithGlobalBus();
    RootPanel.get("top-left").add(topLeftText);
    RootPanel.get("top-left").add(topLeftText2);
    DeckPanel stateDeck = new DeckPanel();
    stateDeck.setWidth("100%");
    stateDeck.setHeight("100%");
    stateManager = new StateManager(stateDeck);
    RootPanel.get("container").add(stateDeck);
    promptLogin();
}

From source file:com.sun.labs.aura.dbbrowser.client.MainSelector.java

License:Open Source License

public MainSelector() {
    super();/*from   w w  w.  j a  v a2  s  . c o m*/
    toolLinks = new HorizontalPanel();
    toolLinks.setStylePrimaryName("db-topBar");
    toolLinks.add(new Label("Select a function: "));
    add(toolLinks, NORTH);
    contents = new DeckPanel();
    add(contents, CENTER);
}