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

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

Introduction

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

Prototype

@Override
    public void setCellWidth(Widget w, String width) 

Source Link

Usage

From source file:com.bramosystems.oss.player.core.client.skin.CustomPlayerControl.java

License:Apache License

private Widget getPlayerWidget(final UIStyleResource imgPack) {
    imgPack.ensureInjected();/*from   ww w. jav  a  2s .  com*/

    seekbar = new CSSSeekBar(5);
    seekbar.setStylePrimaryName(STYLE_NAME);
    seekbar.addStyleDependentName("seekbar");
    seekbar.setWidth("95%");
    seekbar.addSeekChangeHandler(new SeekChangeHandler() {

        @Override
        public void onSeekChanged(SeekChangeEvent event) {
            player.setPlayPosition(event.getSeekPosition() * player.getMediaDuration());
        }
    });

    playTimer = new Timer() {

        @Override
        public void run() {
            updateSeekState();
        }
    };

    play = new CPCButton(imgPack.playDisabled(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            switch (playState) {
            case Stop:
            case Pause:
                try { // play media...
                    play.setEnabled(false); // avoid multiple clicks
                    player.playMedia();
                } catch (PlayException ex) {
                    DebugEvent.fire(player, DebugEvent.MessageType.Error, ex.getMessage());
                }
                break;
            case Playing:
                player.pauseMedia();
            }
        }
    });
    play.setStyleName(imgPack.play());
    play.setEnabled(false);

    stop = new CPCButton(imgPack.stopDisabled(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            player.stopMedia();
        }
    });
    stop.setStyleName(imgPack.stop());
    stop.setEnabled(false);

    prev = new CPCButton(imgPack.prevDisabled(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (player instanceof PlaylistSupport) {
                try {
                    ((PlaylistSupport) player).playPrevious();
                } catch (PlayException ex) {
                    next.setEnabled(false);
                    DebugEvent.fire(player, DebugEvent.MessageType.Info, ex.getMessage());
                }
            }
        }
    });
    prev.setStyleName(imgPack.prev());
    prev.setEnabled(false);

    next = new CPCButton(imgPack.nextDisabled(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (player instanceof PlaylistSupport) {
                try {
                    ((PlaylistSupport) player).playNext();
                } catch (PlayException ex) {
                    next.setEnabled(false);
                    DebugEvent.fire(player, DebugEvent.MessageType.Info, ex.getMessage());
                }
            }
        }
    });
    next.setStyleName(imgPack.next());
    next.setEnabled(false);

    vc = new VolumeControl(5);
    vc.setStyleName(imgPack.volume());
    vc.setPopupStyleName(STYLE_NAME + "-volumeControl");
    vc.addVolumeChangeHandler(new VolumeChangeHandler() {

        @Override
        public void onVolumeChanged(VolumeChangeEvent event) {
            player.setVolume(event.getNewVolume());
        }
    });

    player.addLoadingProgressHandler(new LoadingProgressHandler() {

        @Override
        public void onLoadingProgress(LoadingProgressEvent event) {
            seekbar.setLoadingProgress(event.getProgress());
            vc.setVolume(player.getVolume());
            updateSeekState();
        }
    });
    player.addPlayStateHandler(new PlayStateHandler() {

        @Override
        public void onPlayStateChanged(PlayStateEvent event) {
            int index = event.getItemIndex();
            switch (event.getPlayState()) {
            case Paused:
                toPlayState(PlayState.Pause, imgPack);
                next.setEnabled(index < (((PlaylistSupport) player).getPlaylistSize() - 1));
                prev.setEnabled(index > 0);
                break;
            case Started:
                toPlayState(PlayState.Playing, imgPack);
                next.setEnabled(index < (((PlaylistSupport) player).getPlaylistSize() - 1));
                prev.setEnabled(index > 0);
                break;
            case Stopped:
            case Finished:
                toPlayState(PlayState.Stop, imgPack);
                next.setEnabled(false);
                prev.setEnabled(false);
                break;
            }
        }
    });
    player.addPlayerStateHandler(new PlayerStateHandler() {

        @Override
        public void onPlayerStateChanged(PlayerStateEvent event) {
            switch (event.getPlayerState()) {
            case Ready:
                play.setEnabled(true);
                vc.setVolume(player.getVolume());
            }
        }
    });

    // Time label..
    timeLabel = new Label("--:-- / --:--");
    timeLabel.setWordWrap(false);
    timeLabel.setHorizontalAlignment(Label.ALIGN_CENTER);

    // build the UI...
    DockPanel face = new DockPanel();
    face.setStyleName("");
    face.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
    face.setSpacing(3);
    face.add(vc, DockPanel.WEST);
    face.add(play, DockPanel.WEST);
    face.add(stop, DockPanel.WEST);
    face.add(prev, DockPanel.WEST);
    face.add(next, DockPanel.WEST);
    face.add(timeLabel, DockPanel.EAST);
    face.add(seekbar, DockPanel.CENTER);

    face.setCellWidth(seekbar, "100%");
    face.setCellHorizontalAlignment(seekbar, DockPanel.ALIGN_CENTER);
    return face;
}

From source file:com.bramosystems.oss.player.provider.sample.client.Capsule.java

License:Apache License

/**
 * Constructs <code>Capsule</code> player to automatically playback the
 * media located at {@code mediaURL}, if {@code autoplay} is {@code true} using
 * the specified {@code plugin}.//  w w  w. ja  v  a2s  .c o  m
 *
 * @param plugin plugin to use for playback.
 * @param mediaURL the URL of the media to playback
 * @param autoplay {@code true} to start playing automatically, {@code false} otherwise
 * @param uiResource the CSS resource to use for the UI
 *
 * @throws PluginVersionException if the required plugin version is not installed on the client.
 * @throws PluginNotFoundException if the plugin is not installed on the client.
 *
 * @see Plugin
 * @since 1.2
 */
public Capsule(Plugin plugin, String mediaURL, boolean autoplay, CapsuleUIResource uiResource)
        throws PluginNotFoundException, PluginVersionException, LoadException { // TODO: remove LoadEx on API 2.0.3 release ...
    super(plugin, mediaURL, autoplay, "64px", "100%");
    uiRes = uiResource;
    uiRes.ensureInjected();
    playState = PlayState.Stop;
    mItems = new ArrayList<MediaInfo.MediaInfoKey>();

    progress = new ProgressBar();
    progress.setWidth("95%");

    playTimer = new Timer() {

        @Override
        public void run() {
            progress.setTime(getPlayPosition(), getMediaDuration());
        }
    };
    infoTimer = new Timer() {

        @Override
        public void run() {
            if (mItems.size() > 0) {
                MediaInfo.MediaInfoKey item = mItems.get(infoIndex);
                progress.setInfo(item.toString() + ": " + mInfo.getItem(item));
                infoIndex++;
                infoIndex %= mItems.size();
            } else {
                cancel();
            }
        }

        @Override
        public void cancel() {
            super.cancel();
            progress.setInfo("");
        }
    };

    play = new CButton(uiRes.pauseDisabled(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            switch (playState) {
            case Stop:
            case Pause:
                try { // play media...
                    play.setEnabled(false);
                    playMedia();
                } catch (PlayException ex) {
                    fireError(ex.getMessage());
                }
                break;
            case Playing:
                pauseMedia();
            }
        }
    });
    play.setStyleName(uiRes.play());
    play.setEnabled(false);

    stop = new CButton(uiRes.stopDisabled(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            stopMedia();
        }
    });
    stop.setStyleName(uiRes.stop());
    stop.setEnabled(false);

    vc = new VolumeControl(5);
    vc.setStyleName(uiRes.volume());
    vc.addVolumeChangeHandler(new VolumeChangeHandler() {

        @Override
        public void onVolumeChanged(VolumeChangeEvent event) {
            setVolume(event.getNewVolume());
        }
    });
    vc.setPopupStyleName("player-Capsule-volumeControl");

    addLoadingProgressHandler(new LoadingProgressHandler() {

        @Override
        public void onLoadingProgress(LoadingProgressEvent event) {
            double prog = event.getProgress();
            progress.setLoadingProgress(prog);
            if (prog == 1.0) {
                progress.setTime(0, getMediaDuration());
                vc.setVolume(getVolume());
            }
        }
    });
    addPlayStateHandler(new PlayStateHandler() {

        @Override
        public void onPlayStateChanged(PlayStateEvent event) {
            switch (event.getPlayState()) {
            case Stopped:
            case Finished:
                toPlayState(PlayState.Stop);
                break;
            case Paused:
                toPlayState(PlayState.Pause);
                break;
            case Started:
                toPlayState(PlayState.Playing);
                break;
            }
        }
    });
    addPlayerStateHandler(new PlayerStateHandler() {

        @Override
        public void onPlayerStateChanged(PlayerStateEvent event) {
            switch (event.getPlayerState()) {
            case BufferingFinished:
            case BufferingStarted:
                break;
            case Ready:
                play.setEnabled(true);
                vc.setVolume(getVolume());
            }
        }
    });

    // build the UI...
    DockPanel main = new DockPanel();
    main.setStyleName("player-Capsule");
    main.setSpacing(0);
    main.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
    main.setSize("100%", "64px");

    main.add(new CEdge(uiRes.leftEdge()), DockPanel.WEST);
    main.add(play, DockPanel.WEST);
    main.add(stop, DockPanel.WEST);
    main.add(new CEdge(uiRes.rightEdge()), DockPanel.EAST);
    main.add(vc, DockPanel.EAST);
    main.add(progress, DockPanel.CENTER);
    main.setCellWidth(progress, "100%");
    main.setCellHorizontalAlignment(progress, DockPanel.ALIGN_CENTER);
    setPlayerControlWidget(main);
    setWidth("100%");
}

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

License:Open Source License

public ListEntryHoverPopupPanel() {
    super(false);
    this.setStyleName("dm-hover-popup");

    //pane.setSize("100%","100%");
    //      pane.addMouseListener(this);
    //      pane.addFocusListener(this);

    DockPanel outer = new DockPanel();
    //      outer.setSize("100%","100%");
    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.setCellWidth(contentPanel,"100%");
    outer.setCellHeight(contentPanel, "100%");

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

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

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))
    {//w w w .  j a  v  a  2s.  com
       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;/* www  . ja  va  2s.  com*/

    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.education.lessons.ui.client.login.OpenIDPanel.java

License:Open Source License

private void expandPanel() {
    formPanel.setVisible(true);//from www.jav a2  s .c o  m
    eastPanel.setVisible(true);
    DockPanel dock = (DockPanel) getWidget();
    dock.setCellWidth(eastPanel, "300px");
}

From source file:com.education.lessons.ui.client.login.OpenIDPanel.java

License:Open Source License

private void collapsePanel() {
    formPanel.setVisible(false);//  ww w.ja va2  s  .com
    eastPanel.setVisible(false);
    DockPanel dock = (DockPanel) getWidget();
    dock.setCellWidth(eastPanel, "0");
}

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

License:Open Source License

private void initializeUi() {
    BlocklyPanel.initUi();/*www . j av a2 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.code.p.gwtchismes.client.GWTCDatePickerAbstract.java

License:Apache License

protected void layoutButtons(String distribution) {
    navButtonsBottom.clear();//from w  ww. ja v  a  2s  .  co 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   w ww.j a v a2  s.  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++;
    }
}