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:cc.kune.common.client.ui.dialogs.wizard.WizardDialog.java

License:GNU Affero Public License

/**
 * Instantiates a new wizard dialog./*from  w  w  w . j av a2 s. co  m*/
 *
 * @param dialogId
 *          the dialog id
 * @param header
 *          the header
 * @param modal
 *          the modal
 * @param minimizable
 *          the minimizable
 * @param width
 *          the width
 * @param height
 *          the height
 * @param backId
 *          the back id
 * @param nextId
 *          the next id
 * @param finishId
 *          the finish id
 * @param cancelId
 *          the cancel id
 * @param closeId
 *          the close id
 * @param i18n
 *          the i18n
 * @param maskWidget
 *          the mask widget
 * @param listener
 *          the listener
 */
public WizardDialog(final String dialogId, final String header, final boolean modal, final boolean minimizable,
        final String width, final String height, final String backId, final String nextId,
        final String finishId, final String cancelId, final String closeId, final I18nTranslationService i18n,
        final MaskWidgetView maskWidget, final WizardListener listener) {
    this.maskWidget = maskWidget;
    this.listener = listener;
    this.i18n = i18n;
    final Builder dialogBuilder = new BasicTopDialog.Builder(dialogId, false, modal, i18n.getDirection())
            .width(width).height(height).firstButtonId(cancelId).sndButtonId(finishId).title(header);
    dialog = dialogBuilder.build();
    dialog.setFirstBtnText(i18n.tWithNT("Cancel", "used in button"));
    dialog.getFirstBtn().addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            WizardDialog.this.listener.onCancel();
        }
    });

    nextButton = new CustomButton(i18n.tWithNT("Next ", "used in button"), new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            WizardDialog.this.listener.onNext();
        }
    });
    nextButton.ensureDebugId(nextId);
    nextButton.addStyleName("btn-group");
    nextButton.addStyleName("kune-Margin-Medium-l");
    dialog.getBtnPanel().addStyleName("btn-group");
    dialog.addCloseHandler(new CloseHandler<BSBasicDialog>() {

        @Override
        public void onClose(final CloseEvent<BSBasicDialog> event) {
            WizardDialog.this.listener.onClose();
        }
    });

    backButton = new CustomButton(i18n.tWithNT(" Back", "used in button"), new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            WizardDialog.this.listener.onBack();
        }
    });
    backButton.ensureDebugId(backId);
    backButton.addStyleName("btn-group");
    backButton.addStyleName("kune-Margin-Medium-l");
    dialog.getBtnPanel().add(backButton);
    dialog.getBtnPanel().add(nextButton);

    dialog.setSecondBtnId(finishId);
    dialog.setSecondBtnText(i18n.tWithNT("Finish", "used in button"));
    dialog.getSecondBtn().addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            WizardDialog.this.listener.onFinish();
        }
    });

    deck = new DeckPanel();
}

From source file:co.fxl.gui.gwt.GWTLayout.java

License:Open Source License

@Override
public ICardPanel card() {
    setComponent(new DeckPanel());
    return (ICardPanel) (panel.element = new GWTCardPanel(panel));
}

From source file:com.allen_sauer.gwt.dnd.demo.client.ui.MultiRowTabPanel.java

License:Apache License

public MultiRowTabPanel(int tabsPerRow) {
    this.tabsPerRow = tabsPerRow;
    VerticalPanel containerPanel = new VerticalPanel();
    initWidget(containerPanel);/* w  w w  . ja  v a2s  .  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.audata.client.widgets.Wizard.java

License:Open Source License

public Wizard(String title, WizardListener listener) {
    this.listener = listener;
    this.values = new HashMap();
    this.main = new VerticalPanel();
    this.main.setHeight("100%");
    this.main.setWidth("100%");
    this.main.setSpacing(5);
    Label titleLabel = new Label(title);
    titleLabel.addStyleName("audoc-sectionTitle");
    this.main.add(titleLabel);

    this.pages = new DeckPanel();
    this.pages.setSize("100%", "100%");
    this.main.add(this.pages);

    this.control = new HorizontalPanel();
    this.control.setSpacing(5);
    this.control.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT);
    this.control.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM);

    this.prev = new Button(LANG.previous_Text());
    this.prev.addClickListener(this);
    this.prev.setVisible(false);

    this.next = new Button(LANG.next_Text());
    this.next.addClickListener(this);

    this.finish = new Button(LANG.finish_Text());
    this.finish.addClickListener(this);
    this.finish.setVisible(false);

    this.control.add(this.prev);
    this.control.add(this.next);
    this.control.add(this.finish);
    this.main.add(this.control);

    this.initWidget(this.main);
    this.setSize("100%", "100%");
}

From source file:com.calclab.emite.hablar.client.PageView.java

License:Open Source License

public PageView() {
    setStyleName("hablar-Page");
    content = new DeckPanel();
    final FlowPanel flow = new FlowPanel();
    flow.add(content);//from w ww  .  java2s .  c  om
    add(flow, DockPanel.CENTER);
}

From source file:com.google.appinventor.client.editor.ProjectEditor.java

License:Open Source License

/**
 * Creates a {@code ProjectEditor} instance.
 *
 * @param projectRootNode  the project root node
 *//* w w  w  .j  a v  a2s  .  c  o  m*/
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%");
}

From source file:com.google.appinventor.client.editor.simple.components.MockButtonBase.java

License:Open Source License

/**
 * Creates a new MockButtonBase component.
 *
 * @param editor  editor of source file the component belongs to
 *//*from   www. ja  v  a2 s .c  om*/
MockButtonBase(SimpleEditor editor, String type, ImageResource icon) {
    super(editor, type, icon);

    // Initialize mock button UI
    buttonWidget = new Button();
    buttonWidget.addStyleName("ode-SimpleMockButton");
    image = new Image();
    image.addErrorHandler(new ErrorHandler() {
        @Override
        public void onError(ErrorEvent event) {
            if (imagePropValue != null && !imagePropValue.isEmpty()) {
                OdeLog.elog("Error occurred while loading image " + imagePropValue);
            }
            refreshForm();
        }
    });
    image.addLoadHandler(new LoadHandler() {
        @Override
        public void onLoad(LoadEvent event) {
            refreshForm();
        }
    });
    DeckPanel deckPanel = new DeckPanel();
    deckPanel.setStylePrimaryName("ode-SimpleMockComponent");
    deckPanel.add(buttonWidget);
    deckPanel.add(image);
    deckPanel.showWidget(0);
    initComponent(deckPanel);
}

From source file:com.google.appinventor.client.Ode.java

License:Open Source License

private void initializeUi() {
    BlocklyPanel.initUi();/*from   w ww.  j  a  v  a  2 s. c om*/

    rpcStatusPopup = new RpcStatusPopup();

    // Register services with RPC status popup
    rpcStatusPopup.register((ExtendedServiceProxy<?>) helpService);
    rpcStatusPopup.register((ExtendedServiceProxy<?>) projectService);
    rpcStatusPopup.register((ExtendedServiceProxy<?>) galleryService);
    rpcStatusPopup.register((ExtendedServiceProxy<?>) userInfoService);

    Window.setTitle(MESSAGES.titleYoungAndroid());
    Window.enableScrolling(true);

    topPanel = new TopPanel();
    statusPanel = new StatusPanel();

    DockPanel mainPanel = new DockPanel();
    mainPanel.add(topPanel, DockPanel.NORTH);

    // Create tab panel for subsequent tabs
    deckPanel = new DeckPanel() {
        @Override
        public final void onBrowserEvent(Event event) {
            switch (event.getTypeInt()) {
            case Event.ONCONTEXTMENU:
                event.preventDefault();
                break;
            }
        }
    };

    deckPanel.setAnimationEnabled(true);
    deckPanel.sinkEvents(Event.ONCONTEXTMENU);
    deckPanel.setStyleName("ode-DeckPanel");

    // Projects tab
    VerticalPanel pVertPanel = new VerticalPanel();
    pVertPanel.setWidth("100%");
    pVertPanel.setSpacing(0);
    HorizontalPanel projectListPanel = new HorizontalPanel();
    projectListPanel.setWidth("100%");
    projectToolbar = new ProjectToolbar();
    projectListPanel.add(ProjectListBox.getProjectListBox());
    pVertPanel.add(projectToolbar);
    pVertPanel.add(projectListPanel);
    projectsTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(pVertPanel);

    // Design tab
    VerticalPanel dVertPanel = new VerticalPanel();
    dVertPanel.setWidth("100%");
    dVertPanel.setHeight("100%");

    // Add the Code Navigation arrow
    //    switchToBlocksButton = new VerticalPanel();
    //    switchToBlocksButton.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    //    switchToBlocksButton.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    //    switchToBlocksButton.setStyleName("ode-NavArrow");
    //    switchToBlocksButton.add(new Image(RIGHT_ARROW_IMAGE_URL));
    //    switchToBlocksButton.setWidth("25px");
    //    switchToBlocksButton.setHeight("100%");

    // Add the Code Navigation arrow
    //    switchToDesignerButton = new VerticalPanel();
    //    switchToDesignerButton.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    //    switchToDesignerButton.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    //    switchToDesignerButton.setStyleName("ode-NavArrow");
    //    switchToDesignerButton.add(new Image(LEFT_ARROW_IMAGE_URL));
    //    switchToDesignerButton.setWidth("25px");
    //    switchToDesignerButton.setHeight("100%");

    designToolbar = new DesignToolbar();
    dVertPanel.add(designToolbar);

    workColumns = new HorizontalPanel();
    workColumns.setWidth("100%");

    //workColumns.add(switchToDesignerButton);

    Box palletebox = PaletteBox.getPaletteBox();
    palletebox.setWidth("222px");
    workColumns.add(palletebox);

    Box viewerbox = ViewerBox.getViewerBox();
    workColumns.add(viewerbox);
    workColumns.setCellWidth(viewerbox, "97%");
    workColumns.setCellHeight(viewerbox, "97%");

    structureAndAssets = new VerticalPanel();
    structureAndAssets.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    // Only one of the SourceStructureBox and the BlockSelectorBox is visible
    // at any given time, according to whether we are showing the form editor
    // or the blocks editor. They share the same screen real estate.
    structureAndAssets.add(SourceStructureBox.getSourceStructureBox());
    structureAndAssets.add(BlockSelectorBox.getBlockSelectorBox()); // initially not visible
    structureAndAssets.add(AssetListBox.getAssetListBox());
    workColumns.add(structureAndAssets);

    Box propertiesbox = PropertiesBox.getPropertiesBox();
    propertiesbox.setWidth("222px");
    workColumns.add(propertiesbox);
    //switchToBlocksButton.setHeight("650px");
    //workColumns.add(switchToBlocksButton);
    dVertPanel.add(workColumns);
    designTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(dVertPanel);

    // Gallery list tab
    VerticalPanel gVertPanel = new VerticalPanel();
    gVertPanel.setWidth("100%");
    gVertPanel.setSpacing(0);
    galleryListToolbar = new GalleryToolbar();
    gVertPanel.add(galleryListToolbar);
    HorizontalPanel appListPanel = new HorizontalPanel();
    appListPanel.setWidth("100%");
    appListPanel.add(GalleryListBox.getGalleryListBox());

    gVertPanel.add(appListPanel);
    galleryTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(gVertPanel);

    // Gallery app tab
    VerticalPanel aVertPanel = new VerticalPanel();
    aVertPanel.setWidth("100%");
    aVertPanel.setSpacing(0);
    galleryPageToolbar = new GalleryToolbar();
    aVertPanel.add(galleryPageToolbar);
    HorizontalPanel appPanel = new HorizontalPanel();
    appPanel.setWidth("100%");
    appPanel.add(GalleryAppBox.getGalleryAppBox());

    aVertPanel.add(appPanel);
    galleryAppTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(aVertPanel);

    // User Admin Panel
    VerticalPanel uaVertPanel = new VerticalPanel();
    uaVertPanel.setWidth("100%");
    uaVertPanel.setSpacing(0);
    HorizontalPanel adminUserListPanel = new HorizontalPanel();
    adminUserListPanel.setWidth("100%");
    adminUserListPanel.add(AdminUserListBox.getAdminUserListBox());
    uaVertPanel.add(adminUserListPanel);
    userAdminTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(uaVertPanel);

    // KM: DEBUGGING BEGIN
    // User profile tab
    VerticalPanel uVertPanel = new VerticalPanel();
    uVertPanel.setWidth("100%");
    uVertPanel.setSpacing(0);
    HorizontalPanel userProfilePanel = new HorizontalPanel();
    userProfilePanel.setWidth("100%");
    userProfilePanel.add(ProfileBox.getUserProfileBox());

    uVertPanel.add(userProfilePanel);
    userProfileTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(uVertPanel);
    // KM: DEBUGGING END

    // Private User Profile TabPanel
    VerticalPanel ppVertPanel = new VerticalPanel();
    ppVertPanel.setWidth("100%");
    ppVertPanel.setSpacing(0);
    HorizontalPanel privateUserProfileTabPanel = new HorizontalPanel();
    privateUserProfileTabPanel.setWidth("100%");
    privateUserProfileTabPanel.add(PrivateUserProfileTabPanel.getPrivateUserProfileTabPanel());
    ppVertPanel.add(privateUserProfileTabPanel);
    privateUserProfileIndex = deckPanel.getWidgetCount();
    deckPanel.add(ppVertPanel);

    // Moderation Page tab
    VerticalPanel mPVertPanel = new VerticalPanel();
    mPVertPanel.setWidth("100%");
    mPVertPanel.setSpacing(0);
    HorizontalPanel moderationPagePanel = new HorizontalPanel();
    moderationPagePanel.setWidth("100%");

    moderationPagePanel.add(ModerationPageBox.getModerationPageBox());

    mPVertPanel.add(moderationPagePanel);
    moderationPageTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(mPVertPanel);

    // Debugging tab
    if (AppInventorFeatures.hasDebuggingView()) {

        Button dismissButton = new Button(MESSAGES.dismissButton());
        dismissButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                if (currentView == DESIGNER)
                    switchToDesignView();
                else
                    switchToProjectsView();
            }
        });

        ColumnLayout defaultLayout = new ColumnLayout("Default");
        Column column = defaultLayout.addColumn(100);
        column.add(MessagesOutputBox.class, 300, false);
        column.add(OdeLogBox.class, 300, false);
        final WorkAreaPanel debuggingTab = new WorkAreaPanel(new OdeBoxRegistry(), defaultLayout);

        debuggingTab.add(dismissButton);

        debuggingTabIndex = deckPanel.getWidgetCount();
        deckPanel.add(debuggingTab);

        // Hook the window resize event, so that we can adjust the UI.
        Window.addResizeHandler(new ResizeHandler() {
            @Override
            public void onResize(ResizeEvent event) {
                resizeWorkArea(debuggingTab);
            }
        });

        // Call the window resized handler to get the initial sizes setup. Doing this in a deferred
        // command causes it to occur after all widgets' sizes have been computed by the browser.
        DeferredCommand.addCommand(new Command() {
            @Override
            public void execute() {
                resizeWorkArea(debuggingTab);
            }
        });

        resizeWorkArea(debuggingTab);
    }

    // We do not select the designer tab here because at this point there is no current project.
    // Instead, we select the projects tab. If the user has a previously opened project, we will
    // open it and switch to the designer after the user settings are loaded.
    // Remember, the user may not have any projects at all yet.
    // Or, the user may have deleted their previously opened project.
    // ***** THE DESIGNER TAB DOES NOT DISPLAY CORRECTLY IF THERE IS NO CURRENT PROJECT. *****
    deckPanel.showWidget(projectsTabIndex);

    mainPanel.add(deckPanel, DockPanel.CENTER);
    mainPanel.setCellHeight(deckPanel, "100%");
    mainPanel.setCellWidth(deckPanel, "100%");

    //    mainPanel.add(switchToDesignerButton, DockPanel.WEST);
    //    mainPanel.add(switchToBlocksButton, DockPanel.EAST);

    //Commenting out for now to gain more space for the blocks editor
    mainPanel.add(statusPanel, DockPanel.SOUTH);
    mainPanel.setSize("100%", "100%");
    RootPanel.get().add(mainPanel);

    // Add a handler to the RootPanel to keep track of Google Chrome Pinch Zooming and
    // handle relevant bugs. Chrome maps a Pinch Zoom to a MouseWheelEvent with the
    // control key pressed.
    RootPanel.get().addDomHandler(new MouseWheelHandler() {
        @Override
        public void onMouseWheel(MouseWheelEvent event) {
            if (event.isControlKeyDown()) {
                // Trip the appropriate flag in PZAwarePositionCallback when the page
                // is Pinch Zoomed. Note that this flag does not need to be removed when
                // the browser is un-zoomed because the patched function for determining
                // absolute position works in all circumstances.
                PZAwarePositionCallback.setPinchZoomed(true);
            }
        }
    }, MouseWheelEvent.getType());

    // There is no sure-fire way of preventing people from accidentally navigating away from ODE
    // (e.g. by hitting the Backspace key). What we do need though is to make sure that people will
    // not lose any work because of this. We hook into the window closing  event to detect the
    // situation.
    Window.addWindowClosingHandler(new Window.ClosingHandler() {
        @Override
        public void onWindowClosing(Window.ClosingEvent event) {
            onClosing();
        }
    });

    setupMotd();
}

From source file:com.google.appinventor.client.wizards.Wizard.java

License:Open Source License

/**
 * Creates a new wizard./*from w w  w.ja  v a  2  s. c  o m*/
 * <p>
 * Implementations are expected to build the wizard dialog in their
 * constructor. In particular, it is expected that
 * {@link #addPage(Panel)} and {@link #initFinishCommand(Command)}
 * will be called before the constructor terminates.
 *
 * @param title title displayed in wizard dialog box
 * @param modal indicates modality of the wizard
 * @param adaptiveSizing instead of using the minimal size for the
 *                       wizard also considers the size of the browser area
 */
protected Wizard(String title, boolean modal, boolean adaptiveSizing) {
    // Initialize UI
    // TODO(lizlooney) - investigate using built-in modality support. The
    // reasons for not using it initially are no longer valid.
    super(false, false);

    this.modal = modal;
    this.adaptiveSizing = adaptiveSizing;

    setStylePrimaryName("ode-DialogBox");
    setText(title);

    ClickListener buttonListener = new ClickListener() {
        @Override
        public void onClick(Widget sender) {
            if (sender == cancelButton) {
                handleCancelClick();
            } else if (sender == nextButton) {
                showNextPage();
            } else if (sender == backButton) {
                showPreviousPage();
            } else if (sender == okButton) {
                handleOkClick();
            }
        }
    };
    cancelButton = new Button(MESSAGES.cancelButton());
    cancelButton.addClickListener(buttonListener);
    backButton = new Button(MESSAGES.backButton());
    backButton.addClickListener(buttonListener);
    nextButton = new Button(MESSAGES.nextButton());
    nextButton.addClickListener(buttonListener);
    okButton = new Button(MESSAGES.okButton());
    okButton.addClickListener(buttonListener);

    buttonPanel = new HorizontalPanel();
    buttonPanel.add(cancelButton);
    buttonPanel.add(backButton);
    buttonPanel.add(nextButton);
    buttonPanel.add(okButton);
    buttonPanel.setSize("100%", "24px");

    pageDeck = new DeckPanel();
    pageDeck.setSize("100%", "100%");

    pagePanel = new AbsolutePanel();
    pagePanel.add(pageDeck);
    pagePanel.setWidth("100%");

    VerticalPanel contentPanel = new VerticalPanel();
    contentPanel.add(pagePanel);
    contentPanel.add(buttonPanel);
    contentPanel.setSize("100%", "100%");

    add(contentPanel);
}

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

License:Apache License

private Widget createContentPanel() {
    contentPanel = new DeckPanel();

    Label chooseContentItemLabel = new Label("Choose something to edit, or create new content.");
    chooseContentItemLabel.setStylePrimaryName("title");
    DOM.setStyleAttribute(chooseContentItemLabel.getElement(), "marginTop", "5em");
    contentPanel.add(chooseContentItemLabel);

    VerticalPanel editorContentPanel = new VerticalPanel();
    editorContentPanel.add(createSaveDeletePanel(topSaveControls));
    editorContentPanel.add(createEditorPanel());
    editorContentPanel.add(createSaveDeletePanel(bottomSaveControls));
    contentPanel.add(editorContentPanel);

    Label previewTitle = new Label("Preview");
    previewTitle.setStylePrimaryName("header");
    previewPanel = new SimplePanel();
    previewPanel.setStylePrimaryName("previewPanel");

    editorContentPanel.add(previewTitle);
    editorContentPanel.add(previewPanel);

    contentPanel.showWidget(0);/*from  w w  w.j  a v  a2 s .  c  o m*/
    return contentPanel;
}