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

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

Introduction

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

Prototype

@Override
    public void setCellHorizontalAlignment(Widget w, HorizontalAlignmentConstant align) 

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 w  w w.  java  2 s.c o  m*/

    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}./*from  ww  w .  j a  va  2 s  .  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.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 .ja  v a  2s.  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.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;//from ww  w  .  j a  v  a  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

private void writeListPanel(DockPanel outer) {
    Vector vec = new Vector();
    UIResourceObject currentActiveResource = ConferenceGlobals.getCurrentSharedResource();
    numberOfItems = 0;/* ww w.j  a  v a2  s. c o  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.sun.labs.aura.music.wsitm.client.ui.Popup.java

License:Open Source License

public static void showPopup(Widget w, String title, final DialogBox popup) {

    DockPanel docPanel = new DockPanel();

    Label closeButton = new Label("Close");
    closeButton.setStyleName("clickableLabel");
    closeButton.addStyleName("whiteTxt");
    closeButton.addClickHandler(new ClickHandler() {
        @Override// ww w . ja v  a 2 s .  co m
        public void onClick(ClickEvent ce) {
            popup.hide();
        }
    });

    FlowPanel container = new FlowPanel();
    container.setStyleName("outerpopup");
    container.add(w);

    docPanel.add(container, DockPanel.CENTER);
    docPanel.add(closeButton, DockPanel.SOUTH);
    docPanel.setCellHorizontalAlignment(closeButton, DockPanel.ALIGN_RIGHT);
    popup.add(docPanel);
    popup.setText(title);
    popup.setAnimationEnabled(true);
    popup.center();
}

From source file:com.sun.labs.aura.music.wsitm.client.ui.swidget.SimpleSearchSwidget.java

License:Open Source License

private Widget createMainSection(String title, Widget widget, Widget adornment, ItemInfo[] tagCloud,
        StarRatingWidget starWidget, boolean addTagInputWidget) {
    Panel panel = new VerticalPanel();
    DockPanel h = new DockPanel();
    h.add(new Label(title), DockPanel.WEST);
    if (adornment != null) {
        h.add(adornment, DockPanel.EAST);
        h.setCellHorizontalAlignment(adornment, HorizontalPanel.ALIGN_RIGHT);
    }//from   w ww  . j a v  a2s  .c om
    if (starWidget != null) {
        h.add(starWidget, DockPanel.NORTH);
    }

    h.setWidth("100%");
    h.setStyleName("h1");
    panel.add(h);
    if (tagCloud != null) {
        if (tagInputWidget != null) {
            tagInputWidget.onDelete();
        }
        if (addTagInputWidget) {
            tagInputWidget = new TagInputWidget(musicServer, cdm, "artist", cdm.getCurrArtistID());
            cdm.getLoginListenerManager().addListener(tagInputWidget);
            //panel.add(tagInputWidget);
        }

        Panel p = TagDisplayLib.getTagsInPanel(tagCloud, TagDisplayLib.ORDER.SHUFFLE, cdm, TagColorType.TAG);
        // If there are not tags, this will be null
        if (p != null) {
            p.addStyleName("tagCloudMargin");
            panel.add(p);
        } else {
            panel.add(new HTML("<br /<br />"));
        }
    }
    panel.add(widget);
    return panel;
}

From source file:fr.aliasource.webmail.client.AdvancedSearchForms.java

License:GNU General Public License

private Widget createHeader() {
    HorizontalPanel hp = new HorizontalPanel();
    hp.getElement().setAttribute("style", "width:100%; padding-left: 10em");

    DockPanel titleBar = new DockPanel();
    Label title = new Label(I18N.strings.searchOptions());
    title.setStyleName("bold");
    Anchor hideOptions = new Anchor(I18N.strings.hideSearchOptions());
    hideOptions.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            hideOptions();//w  w  w  . j av a  2 s  .c  om
        }
    });

    titleBar.add(title, DockPanel.WEST);

    titleBar.add(hideOptions, DockPanel.EAST);
    titleBar.setCellHorizontalAlignment(hideOptions, DockPanel.ALIGN_RIGHT);
    titleBar.setStyleName("advancedSearchHeader");
    titleBar.setWidth("100%");

    hp.add(titleBar);
    return hp;
}

From source file:fr.aliasource.webmail.client.conversations.ConversationListActionsPanel.java

License:GNU General Public License

private void initConvToolbar(DockPanel convToolbar, final ConversationListPanel clp) {

    DockPanel leftActions = new DockPanel();

    actions = new HorizontalPanel();
    delete = new Button(I18N.strings.delete());
    delete.addStyleName("deleteButton");
    delete.setEnabled(false);/*from   www  . jav  a2 s .  co  m*/
    actions.add(delete);
    actions.setCellVerticalAlignment(delete, HorizontalPanel.ALIGN_MIDDLE);
    delete.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent ev) {
            clp.deleteConversation();
        }
    });

    // FIXME: merge reportSpam and notSpam in spamActions
    reportSpam = new Button(I18N.strings.markAsSpam());
    reportSpam.addStyleName("noWrap");
    reportSpam.setEnabled(false);
    actions.add(reportSpam);
    actions.setCellVerticalAlignment(reportSpam, HorizontalPanel.ALIGN_MIDDLE);
    reportSpam.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.moveConversation(WebmailController.get().getSelector().getCurrent(),
                    new Folder(WebmailController.get().getSetting(GetSettings.SPAM_FOLDER)), true, null);
        }
    });

    notSpam = new Button(I18N.strings.notSpam());
    notSpam.addStyleName("noWrap");
    notSpam.setEnabled(false);
    notSpam.setVisible(false);

    actions.add(notSpam);
    actions.setCellVerticalAlignment(notSpam, HorizontalPanel.ALIGN_MIDDLE);

    notSpam.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.moveConversation(WebmailController.get().getSelector().getCurrent(), new Folder("INBOX"), true,
                    null);
        }
    });

    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(0);
    moveToButton = new MoveConversationsMenu(I18N.strings.moveTo(), clp, true, position);
    hp.add(moveToButton);
    copyToButton = new MoveConversationsMenu(I18N.strings.copyTo(), clp, false, position);
    hp.add(copyToButton);

    actions.add(hp);
    actions.setCellVerticalAlignment(hp, HasVerticalAlignment.ALIGN_MIDDLE);

    moreActions = new MoreActionMenu(I18N.strings.moreActions(), clp, position);
    actions.add(moreActions);
    actions.setCellVerticalAlignment(moreActions, HorizontalPanel.ALIGN_MIDDLE);

    actions.setSpacing(3);

    actions.addStyleName("actionBox");

    leftActions.add(actions, DockPanel.NORTH);

    HorizontalPanel selection = new HorizontalPanel();
    selection.addStyleName("panelActions");
    selection.add(new Label(I18N.strings.select() + ": "));

    createSelectors(clp, selection);
    selection.addStyleName("selectionBox");
    leftActions.add(selection, DockPanel.SOUTH);

    convToolbar.add(leftActions, DockPanel.WEST);

    newest = new Button(" " + I18N.strings.newest());
    newest.addStyleName("noWrap");
    newest.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.showPage(1);
        }
    });
    newer = new Button(" " + I18N.strings.newer());
    newer.addStyleName("noWrap");
    newer.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.showPage(clp.getCurrentPage() - 1);
        }
    });

    countLabel = new Label();
    countLabel.addStyleName("noWrap");
    older = new Button(I18N.strings.older() + " ");
    older.addStyleName("noWrap");
    older.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.showPage(clp.getCurrentPage() + 1);
        }
    });

    oldest = new Button(I18N.strings.oldest() + " ");
    oldest.addStyleName("noWrap");
    oldest.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.showPage(clp.getLastPage());
        }
    });

    VerticalPanel rightVrt = new VerticalPanel();

    HorizontalPanel right = new HorizontalPanel();
    right.add(newest);
    right.add(newer);
    right.add(countLabel);
    right.setCellVerticalAlignment(countLabel, HorizontalPanel.ALIGN_MIDDLE);
    right.add(older);
    right.add(oldest);
    right.setSpacing(3);

    rightVrt.add(right);
    convFolderQuota = new ConversationFolderQuota(this.ui);
    rightVrt.add(convFolderQuota);
    rightVrt.setHorizontalAlignment(ALIGN_RIGHT);
    rightVrt.setCellHorizontalAlignment(convFolderQuota, VerticalPanel.ALIGN_RIGHT);

    right.setCellVerticalAlignment(right, VerticalPanel.ALIGN_MIDDLE);

    convToolbar.add(rightVrt, DockPanel.EAST);
    convToolbar.setCellHorizontalAlignment(rightVrt, DockPanel.ALIGN_RIGHT);

    newest.setVisible(false);
    newer.setVisible(false);
    older.setVisible(false);
    oldest.setVisible(false);
}

From source file:fr.aliasource.webmail.client.filter.CreateAFilterForm.java

License:GNU General Public License

private Widget createHeader(final View ui) {

    HorizontalPanel hp = new HorizontalPanel();
    hp.getElement().setAttribute("style", "width:100%; padding-left: 10em");

    DockPanel titleBar = new DockPanel();
    Label title = new Label(I18N.strings.createAFilter());
    title.setStyleName("bold");
    Anchor hideOptions = new Anchor(I18N.strings.hideFilterOptions());
    hideOptions.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            ui.getToolbar().getSearchBox().setVisible(true);
            content.clear();/*  www .j  a  v  a  2s .  c  o m*/
            createSearchCriteriaForm(ui);
            setVisible(false);
        }
    });

    titleBar.add(title, DockPanel.WEST);

    titleBar.add(hideOptions, DockPanel.EAST);
    titleBar.setCellHorizontalAlignment(hideOptions, DockPanel.ALIGN_RIGHT);
    titleBar.setStyleName("advancedSearchHeader");
    titleBar.setWidth("100%");

    hp.add(titleBar);
    return hp;

}