Example usage for com.google.gwt.user.client.ui HorizontalPanel setVerticalAlignment

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

Introduction

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

Prototype

public void setVerticalAlignment(VerticalAlignmentConstant align) 

Source Link

Document

Sets the default vertical alignment to be used for widgets added to this panel.

Usage

From source file:com.square.composant.ged.square.client.composant.tagcloud.SelecteurTagCloud.java

License:Open Source License

/**
 * Constructeur paramtr.//from   w w w.  j  ava 2s .  co  m
 * @param iconeErreurChampManager un gestionnaire pour les icones d'erreur.
 */
public SelecteurTagCloud(IconeErreurChampManager iconeErreurChampManager) {
    listeTypesDocumentsSelectionnes = new ArrayList<TypeDocumentModel>();
    listeTagsVisibles = new ArrayList<Anchor>();
    listeIdsTypesDocumentsSelectionnes = new ArrayList<String>();
    listeRb = new ArrayList<RadioButton>();

    final HorizontalPanel panelPrincipal = new HorizontalPanel();
    panelPrincipal.setWidth("100%");

    final VerticalPanel colonneGauche = new VerticalPanel();
    colonneGauche.addStyleName("colonneGaucheSelectionTypes");
    final VerticalPanel colonneDroite = new VerticalPanel();
    colonneDroite.addStyleName("colonneDroiteSelectionTypes");

    final CaptionPanel categoriesPanel = new CaptionPanel(constants.captionCategories());
    categoriesPanel.addStyleName("captionCategories");
    panelCbCategories = new VerticalPanel();
    categoriesPanel.add(panelCbCategories);

    final CaptionPanel typologiesPanel = new CaptionPanel(constants.captionTypologies());
    typologiesPanel.ensureDebugId(DEBUG_CONSTANTS.debugIdCaptionPanelTypologies());
    typologiesPanel.addStyleName("captionTypologies");
    selectedLinks = new VerticalPanel();
    final ScrollPanel scroll = new ScrollPanel();
    scroll.addStyleName("scrollTypologies");
    scroll.add(selectedLinks);
    typologiesPanel.add(scroll);

    colonneGauche.add(categoriesPanel);
    colonneGauche.add(typologiesPanel);

    tbRecherche = new DecoratedTextBox();
    tbRecherche.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            rechercher(tbRecherche.getValue());
        }
    });
    final HorizontalPanel panelTbRecherche = new HorizontalPanel();
    panelTbRecherche.add(tbRecherche);
    if (iconeErreurChampManager != null) {
        final IconeErreurChamp icone = iconeErreurChampManager.createInstance(constants.erreurChampVide(),
                this);
        panelTbRecherche.add(icone);
        panelTbRecherche.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    }

    final ScrollPanel tagScroll = new ScrollPanel();
    tagCloud = new FlowPanel();
    tagScroll.add(tagCloud);
    tagCloud.addStyleName("tagCloud");
    tagScroll.addStyleName("tagScroll");
    colonneDroite.add(panelTbRecherche);
    colonneDroite.add(tagScroll);

    panelPrincipal.add(colonneGauche);
    panelPrincipal.add(colonneDroite);

    initWidget(panelPrincipal);
}

From source file:com.square.composant.ged.square.client.view.listecompacte.ListeCompacteDocumentsViewImpl.java

License:Open Source License

@Override
public HasClickHandlers ajouterLien(String nom, String url, String typeMime) {
    final HorizontalPanel panel = new HorizontalPanel();
    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    // Pour le moment, on n'affiche que le pdf en icone
    if (typeMime != null && typeMime.indexOf("pdf") > 0) {
        final Image image = new Image(viewConstants.dossierImagesTypesMime() + typeMime + ".png");
        panel.add(image);/*from   www  .  j a va 2 s  . c o m*/
    }
    final Anchor lien = new Anchor(nom, url, "_blank");
    lien.addStyleName("lienDocumentModeCompact");
    panel.add(lien);
    panel.addStyleName("blocDocumentModeCompact");
    documentsPanel.add(panel);
    return lien;
}

From source file:com.square.composant.tarificateur.square.client.view.adhesion.BlocInfoSanteCompleteViewImpl.java

License:Open Source License

/**
 * Ajoute un panel contenant les informations d'un enfant.
 * @param enfant/*  w w  w  . java  2  s  . co m*/
 */
private void construirePanel(String suffix) {
    final Label lNumSs = new Label(viewConstants.lNumSs());
    lRelation = new Label(viewConstants.relation());
    final Label lRegime = new Label(viewConstants.lRegime());
    final Label lCaisse = new Label(viewConstants.lCaisse());
    final Label lTns = new Label(viewConstants.lTns(), false);
    final Label lLoiMadelin = new Label(viewConstants.lLoiMadelin(), false);
    final Label lcouvertNow = new Label(viewConstants.lcouvertNow(), false);
    final Label lcouvert6DerniersMois = new Label(viewConstants.lcouvert6DerniersMois(), false);

    final SuggestListBoxSingleProperties<IdentifiantLibelleGwt> slbIdentifiantLibelleProperties = new SuggestListBoxSingleProperties<IdentifiantLibelleGwt>() {
        @Override
        public String getSelectSuggestRenderer(IdentifiantLibelleGwt row) {
            return row == null ? "" : row.getLibelle();
        }

        @Override
        public String[] getResultColumnsRenderer() {
            return new String[] {};
        }

        @Override
        public String[] getResultRowsRenderer(IdentifiantLibelleGwt row) {
            return new String[] { row == null ? "" : row.getLibelle() };
        }
    };

    final SuggestListBoxSingleProperties<IdentifiantEidLibelleModel> slbIdentifiantEidLibelleProperties = new SuggestListBoxSingleProperties<IdentifiantEidLibelleModel>() {
        @Override
        public String getSelectSuggestRenderer(IdentifiantEidLibelleModel row) {
            return row == null ? "" : row.getLibelle();
        }

        @Override
        public String[] getResultColumnsRenderer() {
            return new String[] {};
        }

        @Override
        public String[] getResultRowsRenderer(IdentifiantEidLibelleModel row) {
            return new String[] { row == null ? "" : row.getLibelle() };
        }
    };

    final SuggestListBoxSingleProperties<CaisseSimpleModel> slbCaisseProperties = new SuggestListBoxSingleProperties<CaisseSimpleModel>() {
        @Override
        public String getSelectSuggestRenderer(CaisseSimpleModel row) {
            return row == null ? "" : row.getCode() + "." + row.getCentre() + "." + row.getNom();
        }

        @Override
        public String[] getResultColumnsRenderer() {
            return new String[] {};
        }

        @Override
        public String[] getResultRowsRenderer(CaisseSimpleModel row) {
            return new String[] {
                    row == null ? "" : row.getCode() + "." + row.getCentre() + "." + row.getNom() };
        }
    };
    final SuggestListBoxSingleProperties<IdentifiantLibelleGwt> propertiesRelation = new SuggestListBoxSingleProperties<IdentifiantLibelleGwt>() {
        @Override
        public String getSelectSuggestRenderer(IdentifiantLibelleGwt row) {
            return row == null ? "" : row.getLibelle();
        }

        @Override
        public String[] getResultColumnsRenderer() {
            return new String[] {};
        }

        @Override
        public String[] getResultRowsRenderer(IdentifiantLibelleGwt row) {
            return new String[] { row == null ? "" : row.getLibelle() };
        }
    };

    lbSsReferents = new DecoratedSuggestListBoxSingle<IdentifiantEidLibelleModel>(
            slbIdentifiantEidLibelleProperties);
    tbNumSs = new DecoratedTextBox();
    tbNumSs.setMaxLength(InfosAdhesionViewImplConstants.LONGUEUR_NUM_SECURITE_SOCIALE);
    tbCleSs = new DecoratedTextBox();
    tbCleSs.setMaxLength(InfosAdhesionViewImplConstants.LONGUEUR_CLE_SECURITE_SOCIALE);
    tbCleSs.setWidth(InfosAdhesionViewImplConstants.LARGEUR_TB_CLE_SS);
    slbRelation = new DecoratedSuggestListBoxSingle<IdentifiantLibelleGwt>(propertiesRelation);
    setRelationVisible(false);
    lbRegime = new DecoratedSuggestListBoxSingle<IdentifiantLibelleGwt>(slbIdentifiantLibelleProperties);
    lbCaisse = new DecoratedSuggestListBoxSingle<CaisseSimpleModel>(slbCaisseProperties);
    cbTns = new CheckBox();
    cbLoiMadelin = new CheckBox();
    cbCouvertNow = new CheckBox();
    cbCouvert6DerniersMois = new CheckBox();

    final HorizontalPanel hpSecuSociale = new HorizontalPanel();
    hpSecuSociale.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hpSecuSociale.add(lbSsReferents);
    hpSecuSociale.add(new HTML("&nbsp;"));
    hpSecuSociale.add(tbNumSs);
    hpSecuSociale.add(new HTML("&nbsp;"));
    hpSecuSociale.add(construireBlocIcone(tbCleSs, "PersonneDto.numSecuriteSocial" + suffix));

    final FlexTable flexTable = new FlexTable();
    flexTable.setWidth(ComposantTarificateurConstants.POURCENT_100);
    flexTable.setCellSpacing(3);
    flexTable.setWidget(0, 0, lNumSs);
    flexTable.setWidget(0, 1, hpSecuSociale);
    flexTable.setWidget(1, 0, lRegime);
    flexTable.setWidget(1, 1, construireBlocIcone(lbRegime, "PersonneDto.eidRegime" + suffix));
    flexTable.setWidget(1, 2, lCaisse);
    flexTable.setWidget(1, 3, construireBlocIcone(lbCaisse, "PersonneDto.eidCaisse" + suffix));
    flexTable.setWidget(2, 0, lTns);
    flexTable.setWidget(2, 1, cbTns);
    flexTable.setWidget(2, 2, lLoiMadelin);
    flexTable.setWidget(2, 3, cbLoiMadelin);
    flexTable.setWidget(3, 0, lcouvertNow);
    flexTable.setWidget(3, 1, cbCouvertNow);
    flexTable.setWidget(3, 2, lcouvert6DerniersMois);
    flexTable.setWidget(3, 3, cbCouvert6DerniersMois);
    flexTable.setWidget(4, 0, lRelation);
    flexTable.setWidget(4, 1, construireBlocIcone(slbRelation, "RelationDto.type" + suffix));
    flexTable.getFlexCellFormatter().setColSpan(0, 1, 3);
    flexTable.getColumnFormatter().setWidth(0, InfosAdhesionViewImplConstants.LARGEUR_COL_LIBELLE_0);
    flexTable.getColumnFormatter().setWidth(1, InfosAdhesionViewImplConstants.LARGEUR_COL_CHAMP_1);
    flexTable.getColumnFormatter().setWidth(2, InfosAdhesionViewImplConstants.LARGEUR_COL_LIBELLE_2);
    flexTable.getColumnFormatter().setWidth(3, InfosAdhesionViewImplConstants.LARGEUR_COL_CHAMP_3);

    panel = new CaptionPanel();
    panel.add(flexTable);
    container.add(panel);
}

From source file:com.square.composant.tarificateur.square.client.view.adhesion.BlocInfoSanteSimpleViewImpl.java

License:Open Source License

/**
 * Ajoute un panel contenant les informations d'un enfant.
 * @param enfant/*from w w  w  .  j av a 2  s.c o m*/
 */
private void construirePanel(String suffix) {
    final Label lNumSs = new Label(viewConstants.lNumSs());
    final Label lRegime = new Label(viewConstants.lRegime());
    final Label lCaisse = new Label(viewConstants.lCaisse());
    lRelation = new Label(viewConstants.relation());

    final SuggestListBoxSingleProperties<IdentifiantLibelleGwt> slbIdentifiantLibelleProperties = new SuggestListBoxSingleProperties<IdentifiantLibelleGwt>() {
        @Override
        public String getSelectSuggestRenderer(IdentifiantLibelleGwt row) {
            return row == null ? "" : row.getLibelle();
        }

        @Override
        public String[] getResultColumnsRenderer() {
            return new String[] {};
        }

        @Override
        public String[] getResultRowsRenderer(IdentifiantLibelleGwt row) {
            return new String[] { row == null ? "" : row.getLibelle() };
        }
    };

    final SuggestListBoxSingleProperties<IdentifiantEidLibelleModel> slbIdentifiantEidLibelleProperties = new SuggestListBoxSingleProperties<IdentifiantEidLibelleModel>() {
        @Override
        public String getSelectSuggestRenderer(IdentifiantEidLibelleModel row) {
            return row == null ? "" : row.getLibelle();
        }

        @Override
        public String[] getResultColumnsRenderer() {
            return new String[] {};
        }

        @Override
        public String[] getResultRowsRenderer(IdentifiantEidLibelleModel row) {
            return new String[] { row == null ? "" : row.getLibelle() };
        }
    };

    final SuggestListBoxSingleProperties<CaisseSimpleModel> slbCaisseProperties = new SuggestListBoxSingleProperties<CaisseSimpleModel>() {
        @Override
        public String getSelectSuggestRenderer(CaisseSimpleModel row) {
            return row == null ? "" : row.getCode() + "." + row.getCentre() + "." + row.getNom();
        }

        @Override
        public String[] getResultColumnsRenderer() {
            return new String[] {};
        }

        @Override
        public String[] getResultRowsRenderer(CaisseSimpleModel row) {
            return new String[] {
                    row == null ? "" : row.getCode() + "." + row.getCentre() + "." + row.getNom() };
        }
    };
    final SuggestListBoxSingleProperties<IdentifiantLibelleGwt> propertiesRelation = new SuggestListBoxSingleProperties<IdentifiantLibelleGwt>() {
        @Override
        public String getSelectSuggestRenderer(IdentifiantLibelleGwt row) {
            return row == null ? "" : row.getLibelle();
        }

        @Override
        public String[] getResultColumnsRenderer() {
            return new String[] {};
        }

        @Override
        public String[] getResultRowsRenderer(IdentifiantLibelleGwt row) {
            return new String[] { row == null ? "" : row.getLibelle() };
        }
    };

    lbSsReferents = new DecoratedSuggestListBoxSingle<IdentifiantEidLibelleModel>(
            slbIdentifiantEidLibelleProperties);
    tbNumSs = new DecoratedTextBox();
    tbNumSs.setMaxLength(InfosAdhesionViewImplConstants.LONGUEUR_NUM_SECURITE_SOCIALE);
    tbCleSs = new DecoratedTextBox();
    tbCleSs.setMaxLength(InfosAdhesionViewImplConstants.LONGUEUR_CLE_SECURITE_SOCIALE);
    tbCleSs.setWidth(InfosAdhesionViewImplConstants.LARGEUR_TB_CLE_SS);
    lbRegime = new DecoratedSuggestListBoxSingle<IdentifiantLibelleGwt>(slbIdentifiantLibelleProperties);
    lbCaisse = new DecoratedSuggestListBoxSingle<CaisseSimpleModel>(slbCaisseProperties);
    slbRelation = new DecoratedSuggestListBoxSingle<IdentifiantLibelleGwt>(propertiesRelation);
    setRelationVisible(false);

    final HorizontalPanel hpSecuSociale = new HorizontalPanel();
    hpSecuSociale.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hpSecuSociale.add(lbSsReferents);
    hpSecuSociale.add(new HTML("&nbsp;"));
    hpSecuSociale.add(tbNumSs);
    hpSecuSociale.add(new HTML("&nbsp;"));
    hpSecuSociale.add(construireBlocIcone(tbCleSs, "PersonneDto.numSecuriteSocial" + suffix));

    final FlexTable flexTable = new FlexTable();
    flexTable.setWidth(ComposantTarificateurConstants.POURCENT_100);
    flexTable.setCellSpacing(3);
    flexTable.setWidget(0, 0, lNumSs);
    flexTable.setWidget(0, 1, hpSecuSociale);
    flexTable.setWidget(1, 0, lRegime);
    flexTable.setWidget(1, 1, construireBlocIcone(lbRegime, "PersonneDto.eidRegime" + suffix));
    flexTable.setWidget(1, 2, lCaisse);
    flexTable.setWidget(1, 3, construireBlocIcone(lbCaisse, "PersonneDto.eidCaisse" + suffix));
    flexTable.setWidget(2, 0, lRelation);
    flexTable.setWidget(2, 1, construireBlocIcone(slbRelation, "RelationDto.type" + suffix));
    flexTable.getFlexCellFormatter().setColSpan(0, 1, 3);
    flexTable.getColumnFormatter().setWidth(0, InfosAdhesionViewImplConstants.LARGEUR_COL_LIBELLE_0);
    flexTable.getColumnFormatter().setWidth(1, InfosAdhesionViewImplConstants.LARGEUR_COL_CHAMP_1);
    flexTable.getColumnFormatter().setWidth(2, InfosAdhesionViewImplConstants.LARGEUR_COL_LIBELLE_2);
    flexTable.getColumnFormatter().setWidth(3, InfosAdhesionViewImplConstants.LARGEUR_COL_CHAMP_3);

    panel = new CaptionPanel();
    panel.add(flexTable);
    container.add(panel);
}

From source file:com.square.composant.tarificateur.square.client.view.transaction.recherche.PopupRechercheTransactionViewImpl.java

License:Open Source License

/**
 * Constructeur./*w  w  w. j  a  v a  2  s. co  m*/
 */
public PopupRechercheTransactionViewImpl() {
    super(ComposantTarificateur.CONSTANTS.titrePopupRechercheTransaction(), false, false, true);

    // Label / Champ de recherche numro transaction
    final Label lNumTransaction = new Label(viewConstants.libelleNumTransaction());
    tbNumTransaction = new DecoratedTextBox();

    final HorizontalPanel hpNumTransaction = new HorizontalPanel();
    hpNumTransaction.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hpNumTransaction.setSpacing(5);
    hpNumTransaction.add(lNumTransaction);
    hpNumTransaction.add(tbNumTransaction);

    // Bouton pour lancer la recherche
    btnRechercherOpp = new DecoratedButton(viewConstants.libelleBtnRechercherOpp());
    btnAnnuler = new DecoratedButton(viewConstants.libelleAnnuler());

    final HorizontalPanel hpBoutons = new HorizontalPanel();
    hpBoutons.setWidth(ComposantTarificateurConstants.POURCENT_100);
    hpBoutons.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hpBoutons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hpBoutons.setSpacing(5);
    hpBoutons.add(btnRechercherOpp);
    hpBoutons.add(btnAnnuler);

    container = new VerticalPanel();
    container.add(hpNumTransaction);
    container.add(hpBoutons);
    focusPanel = new FocusPanel(container);
    this.setWidget(focusPanel);
    this.addStyleName(ComposantTarificateur.RESOURCES.css().popupRechercheOppTransaction());
}

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

License:Open Source License

public static HorizontalPanel getHisto(String name, int value, int maxValue, int maxWidth, String text) {

    int leftWidth = Math.round(((float) value / (float) maxValue) * (float) maxWidth);
    if (leftWidth < 1) {
        leftWidth = 1;/*w  ww .j a va2 s  .c o m*/
    } else if (leftWidth > maxWidth) {
        leftWidth = maxWidth;
    }
    int rightWidth = maxWidth - leftWidth;
    boolean alert = false;
    if (value / (float) maxValue > 0.75) {
        alert = true;
    }

    HorizontalPanel all = new HorizontalPanel();
    all.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    all.add(new StyleLabel(name + ":", "viz-histoName"));

    HorizontalPanel table = new HorizontalPanel();
    table.setWidth(maxWidth + "px");
    table.setBorderWidth(0);
    table.setSpacing(0);

    Widget left = new Label("");
    if (alert) {
        left.setStyleName("viz-histoLeftAlert");
    } else {
        left.setStyleName("viz-histoLeft");
    }
    left.setWidth(leftWidth + "");
    left.setHeight("10px");
    left.getElement().getStyle().setPropertyPx("fontSize", 6);

    Widget right = new Label("");
    if (alert) {
        right.setStyleName("viz-histoRightAlert");
    } else {
        right.setStyleName("viz-histoRight");
    }
    right.setWidth(rightWidth + "");
    right.setHeight("10px");
    right.getElement().getStyle().setPropertyPx("fontSize", 6);

    table.add(left);
    table.add(right);
    all.add(table);
    all.add(new StyleLabel(text, "viz-histoText"));
    return all;
}

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

License:Open Source License

private Widget getBioWidget(ArtistDetails artistDetails) {
    HTML html = new HTML();
    html.setHTML(artistDetails.getBestArtistImageAsHTML() + artistDetails.getBiographySummary());
    html.setStyleName("bio");

    artistStar = new StarRatingWidget(musicServer, cdm, artistDetails.getId(),
            StarRatingWidget.InitialRating.FETCH, StarRatingWidget.Size.MEDIUM);
    cdm.getLoginListenerManager().addListener(artistStar);

    HorizontalPanel hP = new HorizontalPanel();
    hP.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    playButton = new PlayButton(cdm, artistDetails.toArtistCompact(), PlayButton.PLAY_ICON_SIZE.MEDIUM,
            musicServer);/*from   ww w. j  a va2 s  . co  m*/
    if (playButton != null) {
        cdm.getMusicProviderSwitchListenerManager().addListener(playButton);
        playButton.addStyleName("pointer");
        hP.add(playButton);
    }

    ArtistCompact aC = artistDetails.toArtistCompact();
    SteeringWheelWidget steerButton = new SteeringWheelWidget(SteeringWheelWidget.wheelSize.BIG,
            new DDEClickHandler<ClientDataManager, ArtistCompact>(cdm, aC) {

                @Override
                public void onClick(ClickEvent ce) {
                    data.setSteerableReset(true);
                    History.newItem("steering:" + sndData.getId());
                }
            });
    steerButton.setTitle("Steerable recommendations starting with " + aC.getName() + "'s tag cloud");
    hP.add(new ContextMenuSteeringWheelWidget(cdm, steerButton, aC));

    //return createMainSection(artistDetails.getName(), html,
    //        hP, artistDetails.getDistinctiveTags(), artistStar, true);
    return createMainSection(artistDetails.getName(), html, hP, artistDetails.getDistinctiveTags(), null, true);
}

From source file:com.sun.labs.aura.music.wsitm.client.ui.widget.CompactArtistWidget.java

License:Open Source License

public CompactArtistWidget(ArtistCompact aC, ClientDataManager tCdm, MusicSearchInterfaceAsync tMusicServer,
        SwapableTxtButton whyB, SwapableTxtButton diffB, InitialRating iR, Set<String> userTags,
        String backgroundColor) {

    this.cdm = tCdm;
    this.musicServer = tMusicServer;

    artistId = aC.getId();/*from  w w w. j  a  va2 s .c o m*/

    HorizontalPanel artistPanel = new HorizontalPanel();
    artistPanel.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    artistPanel.setStyleName("artistPanel");

    ClickHandler cH = new DEClickHandler<String>("artist:" + aC.getId()) {
        @Override
        public void onClick(ClickEvent ce) {
            History.newItem(data);
        }
    };

    //ContextMenuImage img = new MouseOverRollImage(aC);
    Image.prefetch(aC.getImageURL()); // force image load. Needed for IE
    Image img = new Image(aC.getImageURL());
    if (img == null) {
        img = new Image("nopic.gif");
    }
    img.setStyleName("image");
    img.setHeight("75px");
    img.setWidth("75px");
    img.addClickHandler(cH);
    img.addStyleName("largeMarginRight");

    artistPanel.add(img);

    HorizontalPanel aNamePanel = new HorizontalPanel();
    aNamePanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    aNamePanel.setWidth("210px");

    aNamePanel.add(new ContextMenuArtistLabel(aC, cdm));

    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    playButton = new PlayButton(cdm, aC, PlayButton.PLAY_ICON_SIZE.SMALL, musicServer);
    if (playButton != null) {
        cdm.getMusicProviderSwitchListenerManager().addListener(playButton);
        playButton.getElement().getStyle().setProperty("align", "right");
        playButton.addStyleName("largeMarginRight");
        buttonPanel.add(playButton);
    }

    SteeringWheelWidget steerButton = new SteeringWheelWidget(SteeringWheelWidget.wheelSize.SMALL,
            new DDEClickHandler<ClientDataManager, ArtistCompact>(cdm, aC) {
                @Override
                public void onClick(ClickEvent ce) {
                    data.setSteerableReset(true);
                    History.newItem("steering:" + sndData.getId());
                }
            });
    steerButton.setTitle("Steerable recommendations starting with " + aC.getName() + "'s tag cloud");
    steerButton.addStyleName("largeMarginRight");
    buttonPanel.add(new ContextMenuSteeringWheelWidget(cdm, steerButton, aC));

    //steeringMenu
    VerticalPanel swapableButtonPanel = new VerticalPanel();
    swapableButtonPanel.setStyleName("smallTagClick");
    boolean empty = true;
    if (whyB != null) {
        swapableButtonPanel.add(whyB);
        empty = false;
    }
    if (diffB != null) {
        swapableButtonPanel.add(diffB);
        empty = false;
    }
    if (!empty) {
        buttonPanel.add(swapableButtonPanel);
    }

    aNamePanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    aNamePanel.add(buttonPanel);

    VerticalPanel txtPanel = new VerticalPanel();
    txtPanel.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    txtPanel.add(aNamePanel);

    if (userTags != null && userTags.size() > 0) {
        Panel tagsLabel = getNDistinctiveTags("Your tags: ", userTags, 4);
        tagsLabel.setStyleName("recoTags");
        txtPanel.add(tagsLabel);
    }

    Panel tagsLabel = getNDistinctiveTags("Tags: ", aC, 4);
    tagsLabel.setStyleName("recoTags");
    txtPanel.add(tagsLabel);
    /*
    star = new StarRatingWidget(musicServer, cdm, aC.getId(),
        iR, StarRatingWidget.Size.SMALL);
            
    cdm.getRatingListenerManager().addListener(aC.getId(), star);
    cdm.getLoginListenerManager().addListener(star);
            
    Label starLbl = new Label("Your rating: ");
    starLbl.setStyleName("recoTags");
    starLbl.addStyleName("marginRight");
    starLbl.addStyleName("bold");
            
    Label tagLbl = new Label("Add tags");
    tagLbl.setStyleName("recoTags");
    tagLbl.addStyleName("bold");
    tagLbl.addStyleName("pointer");
    tagLbl.addClickHandler(new DEClickHandler<ArtistCompact>(aC) {
    @Override
    public void onClick(ClickEvent event) {
        TagInputWidget.showTagInputPopup(data, musicServer, cdm);
    }
    });
            
    Grid starGrid = new Grid(1,3);
    starGrid.setWidth("100%");
    starGrid.getCellFormatter().setHorizontalAlignment(0, 0, HorizontalPanel.ALIGN_LEFT);
    starGrid.setWidget(0, 0, starLbl);
    starGrid.setWidget(0, 1, star);
    starGrid.getCellFormatter().setHorizontalAlignment(0, 2, HorizontalPanel.ALIGN_RIGHT);
    starGrid.setWidget(0, 2, tagLbl);
    txtPanel.add(starGrid);
    */
    Widget w = WebLib.getSmallPopularityWidget(aC.getNormPopularity(), true, true);
    w.getElement().getStyle().setPropertyPx("marginTop", 5);
    txtPanel.add(w);

    artistPanel.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    artistPanel.add(txtPanel);
    artistPanel.setWidth("298px");
    if (backgroundColor != null) {
        artistPanel.getElement().getStyle().setProperty("background", backgroundColor);
        artistPanel.getElement().getStyle().setProperty("backgroundColor", backgroundColor);
        RoundedPanel rP = new RoundedPanel(artistPanel);
        rP.setCornerColor(backgroundColor);
        rP.addStyleName("largeMarginBottom");
        initWidget(rP);
    } else {
        artistPanel.addStyleName("largeMarginBottom");
        initWidget(artistPanel);
    }
}

From source file:com.sun.labs.aura.music.wsitm.client.ui.widget.PageHeaderWidget.java

License:Open Source License

private void createConfigSubHeaderPanel() {

    HorizontalPanel hP = new HorizontalPanel();
    hP.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    hP.setStyleName("pageConfigHeader");
    hP.addStyleName("somePadding");
    hP.setWidth("100%");

    Label simLbl = new Label("Similarity type : ");
    simLbl.setStyleName("headerMenuMed headerMenuMedC");
    hP.add(simLbl);/*from  w  w w. j a  v  a  2 s . com*/

    listbox = new ListBox(false);
    invokeGetSimTypes();
    listbox.addItem("Loading...");
    hP.add(listbox);

    RoundedPanel rp = new RoundedPanel(hP, RoundedPanel.BOTTOM, 2);
    rp.setCornerStyleName("popupColors");

    configSubHeaderPanel = new FlowPanel();
    configSubHeaderPanel.setStyleName("subMenuMargin");
    configSubHeaderPanel.setWidth("225px");
    configSubHeaderPanel.add(rp);
}

From source file:com.sun.labs.aura.music.wsitm.client.ui.widget.PageHeaderWidget.java

License:Open Source License

/**
 * Called after a successful login by the invoke methods that just received
 * the new ListenerDetails containing the login information. Updates page header UI
 * @param l//from   w  w  w . j  a v a  2s . com
 */
private void updatePanelAfterLogin(ListenerDetails l) {

    if (l != null && l.isLoggedIn()) {

        cdm.setListenerDetails(l);

        String name;
        if (l.getNickName() != null) {
            name = l.getNickName();
        } else if (l.getRealName() != null) {
            name = l.getRealName();
        } else {
            name = l.getOpenId();
        }

        HorizontalPanel hP = new HorizontalPanel();
        hP.setSpacing(4);
        Label loggedLbl = new Label(name);
        loggedLbl.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent ce) {
                History.newItem("userpref:");
            }
        });
        loggedLbl.addStyleName("headerMenuMedItem headerMenuMedItemC");
        hP.add(loggedLbl);

        VerticalPanel vP = new VerticalPanel();

        Label lnk = new Label("Logout");
        lnk.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent ce) {
                cdm.resetUser();
                invokeTerminateSession();
            }
        });
        lnk.setStyleName("headerMenuTinyItem headerMenuTinyItemC");
        vP.add(lnk);

        hP.add(vP);

        HorizontalPanel buttonsPanel = new HorizontalPanel();
        buttonsPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
        Image steerable = new SteeringWheelWidget(SteeringWheelWidget.wheelSize.SMALL, new ClickHandler() {
            @Override
            public void onClick(ClickEvent ce) {
                cdm.setSteerableReset(true);
                History.newItem("steering:userCloud");
            }
        });
        steerable.setTitle("Steerable recommendations starting with your personal tag cloud");
        buttonsPanel.add(steerable);

        // Plays a random recommendation
        instantRecPlayWidget = new InstantRecPlayWidget();
        if (instantRecPlayWidget != null) {
            buttonsPanel.add(instantRecPlayWidget);
        }

        hP.add(buttonsPanel);
        mainPanel.setWidget(0, 0, hP);
    } else {
        populateLoginBox();
    }
}