Example usage for com.google.gwt.user.client.ui DockPanel add

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

Introduction

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

Prototype

public void add(IsWidget widget, DockLayoutConstant direction) 

Source Link

Document

Overloaded version for IsWidget.

Usage

From source file:com.dimdim.conference.ui.common.client.list.ListEntryPanel.java

License:Open Source License

protected Image setImage(DockPanel imagePanel, Image image, Image imageUrl, ClickListener clickListener,
        HorizontalPanel subPanel, String tooltip, boolean rightAlign) {
    Image image2 = image;//w w w.j ava2  s .c  o  m
    if (image != null) {
        //Window.alert("prev image = is not null");
        if (subPanel != null) {
            //Window.alert("subpanel = is not null so removing..");
            subPanel.remove(image);
            image2 = null;
        } else if (imagePanel != null) {
            imagePanel.remove(image);
            image2 = null;
        }

    }
    if (imageUrl != null) {
        /*
        if (imageUrl.endsWith("xxx"))
        {
           Image image = new Image(imageUrl);
           image.addStyleName("list-entry-panel-image");
           imagePanel.add(image,DockPanel.WEST);
           imagePanel.setCellHorizontalAlignment(image,HorizontalPanel.ALIGN_CENTER);
           imagePanel.setCellVerticalAlignment(image,VerticalPanel.ALIGN_MIDDLE);
           if (clickListener != null)
           {
              image.addClickListener(clickListener);
           }
        }
        else
        */
        //         else
        {
            image2 = imageUrl;
            image2.addStyleName("list-entry-panel-image");
            if (subPanel != null) {
                subPanel.add(image2);
                subPanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_CENTER);
                subPanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE);
            } else {
                if (rightAlign) {
                    imagePanel.add(image2, DockPanel.EAST);
                    imagePanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_RIGHT);
                    imagePanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE);
                } else {
                    imagePanel.add(image2, DockPanel.WEST);
                    imagePanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_CENTER);
                    imagePanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE);
                }
            }
            if (clickListener != null) {
                image2.addClickListener(clickListener);
                //image2.addStyleName("anchor-cursor");
            }
            if (tooltip != null) {
                image2.setTitle(tooltip);
            }
        }
    }
    return image2;
}

From source file:com.dimdim.conference.ui.envcheck.client.layout.CommonMessagePopup.java

License:Open Source License

protected void drawDialog() {
    vp = new VerticalPanel();
    RoundedPanel rp = new RoundedPanel(vp);

    vp.setStyleName("common-dialog-outer-panel");
    rp.setStyleName("common-dialog-rounded-corner-panel");

    DockPanel buttonPanel = new DockPanel();
    if (this.showCloseButton) {
        closeButton = new Button(closeButtonText, new ClickListener() {
            public void onClick(Widget sender) {
                hide();/*  w  w  w . ja va2 s.c om*/
                History.back(); //   TODO move out into a listener.
            }
        });
        closeButton.setStyleName("dm-popup-close-button");
        buttonPanel.add(closeButton, DockPanel.EAST);
        buttonPanel.setSpacing(0);
        HTML filler1 = new HTML(" ");
        buttonPanel.add(filler1, DockPanel.EAST);
    }
    if (this.dialogName != null) {
        //   Create a width adjustment panel.
        String widthStyle = this.dialogName + "-dialog-width";
        String heightStyle1 = this.dialogName + "-dialog-height-one";
        String heightStyle2 = this.dialogName + "-dialog-height-two";
        String contentWidthStyle = this.dialogName + "-dialog-content";

        content.addStyleName(contentWidthStyle);
        HorizontalPanel upperPanel = new HorizontalPanel();

        HTML upperLeftBar = new HTML(" ");
        upperLeftBar.setStyleName(heightStyle1);
        upperPanel.add(upperLeftBar);
        upperPanel.add(content);
        upperPanel.setCellWidth(content, "100%");
        upperPanel.setCellVerticalAlignment(content, VerticalPanel.ALIGN_MIDDLE);

        HorizontalPanel lowerPanel = new HorizontalPanel();
        lowerPanel.setStyleName(widthStyle);

        HTML lowerLeftBar = new HTML(" ");
        lowerLeftBar.setStyleName(heightStyle2);
        lowerPanel.add(lowerLeftBar);
        lowerPanel.add(buttonPanel);
        lowerPanel.setCellWidth(buttonPanel, "100%");
        lowerPanel.setCellHorizontalAlignment(buttonPanel, HorizontalPanel.ALIGN_RIGHT);
        lowerPanel.setCellVerticalAlignment(buttonPanel, VerticalPanel.ALIGN_MIDDLE);

        vp.add(upperPanel);
        vp.add(lowerPanel);
        this.addStyleName(this.dialogName + "-dialog-size");
    } else {
        vp.add(content);
        vp.setCellWidth(content, "100%");

        vp.add(buttonPanel);
        vp.setCellWidth(buttonPanel, "100%");
        vp.setCellHorizontalAlignment(buttonPanel, HorizontalPanel.ALIGN_RIGHT);
    }
    this.addPopupListener(this);

    this.add(vp);
}

From source file:com.dimdim.conference.ui.layout2.client.ToolsPopupPanel.java

License:Open Source License

public ToolsPopupPanel(ResourceRoster resRoster, ClickListener shareClickListener, UIRosterEntry currentUser) {
    super(false);
    this.setStyleName("dm-hover-popup");
    this.addStyleName("tool-popup-panel");
    this.resRoster = resRoster;
    this.shareClickListener = shareClickListener;
    this.currentUser = currentUser;
    userManager = new UserRosterManager(currentUser);

    //      pane.addMouseListener(this);
    //      pane.addFocusListener(this);

    DockPanel outer = new DockPanel();
    outer.setStyleName("dm-hover-popup-body");
    //      pane.add(outer);

    //      headerPanel.setStyleName("dm-hover-popup-header");
    //      outer.add(headerPanel,DockPanel.NORTH);
    //      outer.setCellWidth(headerPanel,"100%");

    this.contentPanel.setStyleName("dm-hover-popup-content");
    outer.add(contentPanel, DockPanel.NORTH);
    //      outer.setCellHeight(contentPanel,"100%");

    this.contentPanel.add(this.toolsPanel);
    //      this.contentPanel.setCellHeight(this.toolsPanel, "100%");
    //      this.contentPanel.setCellWidth(this.toolsPanel, "100%");

    this.writeToolsPanel();
    //      this.linksPanel.setStyleName("dm-hover-popup-links-panel");
    //      outer.add(linksPanel,DockPanel.SOUTH);
    //      outer.setCellHeight(linksPanel,"100%");

    //      this.add(pane);
    this.add(outer);
    this.addPopupListener(this);
}

From source file:com.dimdim.conference.ui.resources.client.ResourceTypeListEntryPanel.java

License:Open Source License

protected Image setImage(DockPanel imagePanel, Image currentImage, Image newImage, ClickListener clickListener,
        HorizontalPanel subPanel, String tooltip, boolean rightAlign) {
    Image image2 = currentImage;// w ww.j a  va  2 s . c o m
    if (currentImage != null) {
        if (subPanel != null) {
            //Window.alert("subpanel = is not null so removing..");
            subPanel.remove(currentImage);
            image2 = null;
        } else if (imagePanel != null) {
            imagePanel.remove(currentImage);
            image2 = null;
        }
    }
    if (newImage != null) {
        {
            image2 = newImage;
            image2.addStyleName("list-entry-panel-image");
            if (subPanel != null) {
                subPanel.add(image2);
                subPanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_CENTER);
                subPanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE);
            } else {
                if (rightAlign) {
                    imagePanel.add(image2, DockPanel.EAST);
                    imagePanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_RIGHT);
                    imagePanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE);
                } else {
                    imagePanel.add(image2, DockPanel.WEST);
                    imagePanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_CENTER);
                    imagePanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE);
                }
            }
            if (clickListener != null) {
                image2.addClickListener(clickListener);
                //image2.addStyleName("anchor-cursor");
            }
            if (tooltip != null) {
                image2.setTitle(tooltip);
            }
        }
    }
    return image2;
}

From source file:com.dimdim.conference.ui.resources.client.ResourceTypeListEntryPopupPanel.java

License:Open Source License

public void paintPanel(String typeName) {
    this.typeName = typeName;
    ClickListener headerClickListener = rtpcp.getTypePopupHeaderClickListener(typeName);
    ClickListener footerClickListener = rtpcp.getTypePopupFooterClickListener(this.typeName);

    /*if(UIResourceObject.RESOURCE_TYPE_COBROWSE.equalsIgnoreCase(typeName))
    {/*from w w  w .  ja v  a2  s .c  o  m*/
       headerClickListener = rtpcp.getShareCobClickListener();
    }*/
    pane.addMouseListener(this);
    pane.addFocusListener(this);

    DockPanel outer = new DockPanel();
    outer.setStyleName("dm-hover-popup-body");
    pane.add(outer);

    if (headerClickListener != null) {
        //         headerPanel.setStyleName("dm-hover-popup-header");
        outer.add(headerPanel, DockPanel.NORTH);
        outer.setCellWidth(headerPanel, "100%");

        String selectLabel = ConferenceGlobals.getDisplayString(typeName + ".select.label", "Upload Document");
        Label headerLink = new Label(selectLabel);
        //         headerLink.setStyleName("tool-entry");
        headerLink.setStyleName("resource-popup-header-entry");
        headerLink.addStyleName("anchor-cursor");
        headerPanel.add(headerLink);
        headerPanel.setCellWidth(headerLink, "100%");
        headerPanel.setStyleName("resource-popup-header-panel");
        headerPanel.setCellHorizontalAlignment(headerLink, HorizontalPanel.ALIGN_LEFT);
        headerPanel.setCellVerticalAlignment(headerLink, VerticalPanel.ALIGN_MIDDLE);
        headerLink.addClickListener(headerClickListener);
        headerLink.addClickListener(this);
    } else {
        //         Window.alert("No header listener");
    }

    this.writeListPanel(outer);
    //      this.contentPanel.setStyleName("dm-hover-popup-content");
    //      outer.add(contentPanel,DockPanel.NORTH);
    //      outer.setCellHeight(contentPanel,"100%");
    //      outer.setCellWidth(contentPanel,"100%");

    if (footerClickListener != null) {
        //         this.linksPanel.setStyleName("dm-hover-popup-header");
        outer.add(linksPanel, DockPanel.SOUTH);
        outer.setCellHeight(linksPanel, "100%");

        String manageLabel = ConferenceGlobals.getDisplayString(typeName + ".manage.label", "Manage Document");
        Label footerLink = new Label(manageLabel);
        //         footerLink.setStyleName("tool-entry");
        footerLink.setStyleName("resource-popup-footer-entry");
        footerLink.addStyleName("anchor-cursor");
        linksPanel.add(footerLink);
        linksPanel.setCellHorizontalAlignment(footerLink, HorizontalPanel.ALIGN_LEFT);
        linksPanel.setCellVerticalAlignment(footerLink, VerticalPanel.ALIGN_MIDDLE);
        footerLink.addClickListener(footerClickListener);
        footerLink.addClickListener(this);
    } else {
        //         Window.alert("No footer listener");
    }

    //      if (panel != null)
    //      {
    //         this.contentPanel.add(panel);
    //         this.contentPanel.setCellWidth(panel, "100%");
    //         this.contentPanel.setCellHeight(panel, "100%");
    //      }

    this.add(pane);
    this.addPopupListener(this);
}

From source file:com.dimdim.conference.ui.resources.client.ResourceTypeListEntryPopupPanel.java

License:Open Source License

private void writeListPanel(DockPanel outer) {
    Vector vec = new Vector();
    UIResourceObject currentActiveResource = ConferenceGlobals.getCurrentSharedResource();
    numberOfItems = 0;/*from   ww w  .  jav a 2s . co m*/

    int size = this.resourceList.getListSize();
    for (int i = 0; i < size; i++) {
        UIResourceObject res = ((ResourceListEntry) this.resourceList.getListEntryAt(i)).getResource();
        if (res.getResourceType().equals(this.typeName)) {
            Label resLabel = new FixedLengthLabel(res.getResourceName(), 26);
            //            resLabel.setStyleName("tool-entry");
            resLabel.setStyleName("resource-entry");
            resLabel.addStyleName("anchor-cursor");
            resLabel.addClickListener(this);
            resLabel.addClickListener(this.rtpcp.getNameLabelClickListener(res));

            HorizontalPanel h1 = new HorizontalPanel();
            Widget img = new HorizontalPanel();

            if (currentActiveResource != null
                    && currentActiveResource.getResourceId().equals(res.getResourceId())) {
                img = this.getSharingInProgressImageUrl();
                //               h2.add(img);
                //               h2.setCellVerticalAlignment(img, VerticalPanel.ALIGN_MIDDLE);
                //               h2.setCellHorizontalAlignment(img, HorizontalPanel.ALIGN_CENTER);
            } else {
                img = new Label(" ");
                img.setWidth("18px");
                //               h2.add(filler);
            }
            //            h2.setWidth("18px");
            h1.add(img);
            //            h1.setCellWidth(img, "100%");
            h1.setCellHeight(img, "100%");
            h1.setCellHorizontalAlignment(img, HorizontalPanel.ALIGN_LEFT);
            h1.setCellVerticalAlignment(img, VerticalPanel.ALIGN_MIDDLE);
            h1.add(resLabel);
            h1.setCellWidth(resLabel, "100%");
            h1.setCellHeight(resLabel, "100%");
            h1.setCellVerticalAlignment(resLabel, VerticalPanel.ALIGN_MIDDLE);
            h1.setStyleName("resource-entry-panel");
            if (numberOfItems == 0) {
                h1.addStyleName("first-resource-entry-panel");
            }
            resLabel.addMouseListener(new ResourceHoverStyler(h1));
            vec.add(h1);
            //            panel.add(h1);
            //            panel.setCellWidth(h1, "100%");
            //            panel.setCellHorizontalAlignment(h1, HorizontalPanel.ALIGN_LEFT);
            //            panel.setCellVerticalAlignment(h1, VerticalPanel.ALIGN_MIDDLE);
            numberOfItems++;
        }
    }

    if (numberOfItems != 0) {
        int scrollLimit = UIParams.getUIParams().getBrowserParamIntValue("resource_popup_scroll_limit", 5);
        if (numberOfItems > scrollLimit) {
            ScrollPanel sp = new ScrollPanel();
            int width = UIParams.getUIParams().getBrowserParamIntValue("resource_popup_scroll_width", 250);
            int barWidth = UIParams.getUIParams().getBrowserParamIntValue("resource_popup_scroll_bar_width",
                    250);
            int height = UIParams.getUIParams().getBrowserParamIntValue("resource_popup_scroll_height", 150);
            sp.setSize(width + "px", height + "px");
            VerticalPanel panel = new VerticalPanel();
            panel.setSize((width - barWidth) + "px", height + "px");
            sp.add(panel);
            outer.add(sp, DockPanel.NORTH);
            outer.setCellHorizontalAlignment(sp, HorizontalPanel.ALIGN_LEFT);
            outer.setCellVerticalAlignment(sp, VerticalPanel.ALIGN_MIDDLE);
            int size2 = vec.size();
            for (int i = 0; i < size2; i++) {
                HorizontalPanel h = (HorizontalPanel) vec.elementAt(i);
                panel.add(h);
                panel.setCellWidth(h, "100%");
                panel.setCellHorizontalAlignment(h, HorizontalPanel.ALIGN_LEFT);
                panel.setCellVerticalAlignment(h, VerticalPanel.ALIGN_MIDDLE);
            }
        } else {
            int size2 = vec.size();
            for (int i = 0; i < size2; i++) {
                HorizontalPanel h = (HorizontalPanel) vec.elementAt(i);
                outer.add(h, DockPanel.NORTH);
                outer.setCellWidth(h, "100%");
                outer.setCellHorizontalAlignment(h, HorizontalPanel.ALIGN_LEFT);
                outer.setCellVerticalAlignment(h, VerticalPanel.ALIGN_MIDDLE);
            }
        }
    } else {
    }
}

From source file:com.google.appinventor.client.editor.youngandroid.YaFormEditor.java

License:Open Source License

/**
 * Creates a new YaFormEditor.//from  w ww . j a  v a2  s  .  c o  m
 *
 * @param projectEditor  the project editor that contains this file editor
 * @param formNode the YoungAndroidFormNode associated with this YaFormEditor
 */
YaFormEditor(ProjectEditor projectEditor, YoungAndroidFormNode formNode) {
    super(projectEditor, formNode);

    this.formNode = formNode;
    COMPONENT_DATABASE = SimpleComponentDatabase.getInstance(getProjectId());

    // Get reference to the source structure explorer
    sourceStructureExplorer = SourceStructureBox.getSourceStructureBox().getSourceStructureExplorer();

    // Create UI elements for the designer panels.
    nonVisibleComponentsPanel = new SimpleNonVisibleComponentsPanel();
    visibleComponentsPanel = new SimpleVisibleComponentsPanel(this, nonVisibleComponentsPanel);
    DockPanel componentsPanel = new DockPanel();
    componentsPanel.setHorizontalAlignment(DockPanel.ALIGN_CENTER);
    componentsPanel.add(visibleComponentsPanel, DockPanel.NORTH);
    componentsPanel.add(nonVisibleComponentsPanel, DockPanel.SOUTH);
    componentsPanel.setSize("100%", "100%");

    // Create palettePanel, which will be used as the content of the PaletteBox.
    palettePanel = new YoungAndroidPalettePanel(this);
    palettePanel.loadComponents(new DropTargetProvider() {
        @Override
        public DropTarget[] getDropTargets() {
            // TODO(markf): Figure out a good way to memorize the targets or refactor things so that
            // getDropTargets() doesn't get called for each component.
            // NOTE: These targets must be specified in depth-first order.
            List<DropTarget> dropTargets = form.getDropTargetsWithin();
            dropTargets.add(visibleComponentsPanel);
            dropTargets.add(nonVisibleComponentsPanel);
            return dropTargets.toArray(new DropTarget[dropTargets.size()]);
        }
    });
    palettePanel.setSize("100%", "100%");
    addComponentDatabaseChangeListener(palettePanel);

    // Create designProperties, which will be used as the content of the PropertiesBox.
    designProperties = new PropertiesPanel();
    designProperties.setSize("100%", "100%");
    initWidget(componentsPanel);
    setSize("100%", "100%");
}

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

License:Open Source License

private void initializeUi() {
    BlocklyPanel.initUi();/*from w  ww . jav a  2  s  . co m*/

    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.code.p.gwtchismes.client.GWTCDatePickerAbstract.java

License:Apache License

protected void layoutButtons(String distribution) {
    navButtonsBottom.clear();/*from   w w w  . j  av a  2  s. c o  m*/
    navButtonsTop.clear();
    DockPanel[] panels = { topButtonsRow0, topButtonsRow1, topButtonsRow2, bottomButtonsRow0, bottomButtonsRow1,
            bottomButtonsRow2, leftButtons, rightButtons };
    String s[] = distribution.split("[;:,]");

    Widget w = null, m = null;
    for (int i = 0; i < panels.length && i < s.length; i++) {
        DockPanel p = panels[i];
        p.clear();

        if (s[i].length() == 0)
            continue;

        for (int j = 0; j < s[i].length(); j++) {
            if ((w = getButton(s[i], j)) != null) {
                p.add(w, p != rightButtons ? DockPanel.WEST : DockPanel.EAST);
            }
            if (j == s[i].length() / 2)
                m = w;
        }

        if (!p.iterator().hasNext())
            continue;

        p.setWidth("100%");
        if (p != leftButtons && p != rightButtons) {
            if (m != null) {
                p.setCellWidth(m, "100%");
                m.setWidth("100%");
            }
        }
        if (i < 3)
            navButtonsTop.add(p, DockPanel.NORTH);
        else if (i < 6)
            navButtonsBottom.add(p, DockPanel.NORTH);

        if (i < 6)
            p.addStyleName(StyleCButtonsRow + (i % 3));
    }
}

From source file:com.google.code.p.gwtchismes.client.GWTCDatePickerAbstract.java

License:Apache License

protected void layoutCalendar() {
    calendarGrid.clear();//from ww  w .ja v  a  2s . c om
    calendarGrid.setCellSpacing(0);
    for (int i = 0, row = -2, col = 0; i < simpleDatePickers.size(); i++) {
        if ((i % monthColumns) == 0) {
            col = 0;
            row += 2;
        } else if (i > 0) {
            calendarGrid.setHTML(row, col, "&nbsp;");
            calendarGrid.setHTML(row + 1, col, "&nbsp;");
            calendarGrid.getCellFormatter().addStyleName(row, col, StyleMonthSeparator);
            calendarGrid.getCellFormatter().addStyleName(row + 1, col, StyleMonthSeparator);
            col += 1;
        }

        if (monthSelectorHeader.getParent() == null || simpleDatePickers.size() > 1) {
            if (i == 0 || (i % monthColumns) == 0) {
                calendarGrid.getRowFormatter().addStyleName(row, StyleMonthLabels);
                calendarGrid.getRowFormatter().addStyleName(row + 1, StyleMonthCell);
            }
            Widget w = null;
            if (i == 0 && monthSelectorHeader.getElement().getParentElement() == null)
                w = monthSelectorHeader;
            //calendarGrid.setWidget(row, col, monthSelectorHeader);
            else
                w = monthHeaders.get(i);
            //calendarGrid.setWidget(row, col, monthHeaders.get(i));

            DockPanel p = null;
            if (leftButtons.iterator().hasNext() && leftButtons.getParent() == null && col == 0) {
                p = leftButtons;
                p.add(w, DockPanel.WEST);
                p.setCellWidth(w, "100%");
                w = p;
                if (simpleDatePickers.size() == 1) {
                    Iterator<Widget> it = p.iterator();
                    while (it.hasNext()) {
                        p.add(it.next(), DockPanel.WEST);
                    }
                }
            }
            if (rightButtons.iterator().hasNext() && rightButtons.getParent() == null
                    && ((i + 1) % monthColumns) == 0) {
                p = rightButtons;
                p.add(w, DockPanel.WEST);
                p.setCellWidth(w, "100%");
                w = p;
            }
            calendarGrid.setWidget(row, col, w);
        }

        calendarGrid.setWidget(row + 1, col, simpleDatePickers.get(i));
        calendarGrid.getColumnFormatter().addStyleName(i, "Month-" + i);
        simpleDatePickers.get(i).addValueChangeHandler(onDaySelected);
        col++;
    }
}