Example usage for com.google.gwt.user.client.ui Image setAltText

List of usage examples for com.google.gwt.user.client.ui Image setAltText

Introduction

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

Prototype

public void setAltText(String altText) 

Source Link

Document

Sets the alternate text of the image for user agents that can't render the image.

Usage

From source file:ch.sebastienzurfluh.swissmuseum.core.client.view.pagewidget.ResourceWidget.java

License:Open Source License

@Override
public void notifyObserver(Observable source) {
    for (ResourceData resource : model.getAllNeededResources()) {
        // The following check is sufficient to determine unicity as there cannot be
        // two different resources with the same id, be it an IMAGE and a VIDEO.
        // This is explicitly reflected in the CakeConnector/MySQL by the use of a single
        // table Resources with an unique key column 'id'.
        if (resource.getReference().equals(this.getReference())) {
            switch (resource.getResourceType()) {
            case IMAGE:
                Image image = new Image(resource.getURL());
                image.setStyleName(primaryStyle + imageExtension);
                image.setAltText(resource.getTitle());

                final ResourceGallery imageGallery = new ResourceGallery(image.getUrl(), resource.getTitle(),
                        resource.getDetails());
                image.addClickHandler(new ClickHandler() {
                    @Override/*  w w w. ja v a  2 s  .  c  om*/
                    public void onClick(ClickEvent event) {
                        imageGallery.center();
                    }
                });
                resourceContainer.setWidget(image);
                break;
            case VIDEO:
                int id = Random.nextInt();
                HTML video = new HTML("<a href='" + resource.getURL() + "' target='_blank'>" + "<video id='"
                        + id + "' autobuffer class='" + primaryStyle + videoExtension + "'>" + "<source src='"
                        + resource.getURL() + "' " + "type='video/ogg; codecs=\"theora, vorbis\"'/>"
                        + "</video></a>");
                resourceContainer.setWidget(video);

                //               Video video = Video.createIfSupported();
                //               if (video == null) {
                //                  resourceContainer.setWidget(new Label("Your browser is not able to play"
                //                        + " this video"));
                //               } else {
                //                  video.setSrc(resource.getURL());
                //                  video.setStyleName(primaryStyle+videoExtension);
                //                  resourceContainer.setWidget(video);
                //               }
                break;
            default:
                // Destroy the object. It is never referenced outside of this object, but is
                // attached to it's parent.
                this.removeFromParent();
            }

            title.setText(resource.getTitle());
            details.setText(resource.getDetails());

            eventBus.fireEvent(new PageModifiedEvent());

            model.allNeededResourcesObservable.unsubscribeObserver(this);
            return;
        }
    }
}

From source file:com.automaster.autoview.client.ui.paineis.Topo.java

public Topo() {

    this.setWidth100();
    this.setHeight(67);
    this.setBackgroundImage("../imagens/backgroundCinza.png");
    this.setBackgroundRepeat(BackgroundRepeat.REPEAT_X);
    //setAlign(Alignment.CENTER);
    //final HLayout topoAux = this; 
    final Image logo = new Image("imagens/autoView.png");
    logo.setTitle("autoView");
    logo.setAltText("AutoView Web");
    logo.addClickHandler(new com.google.gwt.event.dom.client.ClickHandler() {

        @Override/*from   ww w  . j  a va  2s .  co  m*/
        public void onClick(ClickEvent event) {
            SC.say("Verso 1.31. Todos os direitos reservados AutoMaster 2016 &copy;. Develop tool: [Adriano Vale].");
        }
    });
    HLayout painelLogo = new HLayout();
    painelLogo.setMargin(5);
    painelLogo.setHeight(60);
    painelLogo.setWidth("80%");
    painelLogo.setLayoutAlign(Alignment.LEFT);
    painelLogo.addMember(logo);

    final Image logoAuto = new Image("imagens/autoMaster.png");
    logo.setTitle("autoView");
    logoAuto.setAltText("AutoMaster");
    logoAuto.addClickHandler(new com.google.gwt.event.dom.client.ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            SC.say("Verso 1.31. Todos os direitos reservados AutoMaster 2016 &copy;. Develop tool: [Adriano Vale].");
        }
    });
    HLayout painelLogoAuto = new HLayout();
    painelLogoAuto.setMargin(5);
    //painelLogoAuto.setWidth(210);
    painelLogoAuto.setHeight(60);
    painelLogoAuto.setWidth("70%");
    painelLogoAuto.setLayoutAlign(Alignment.CENTER);
    painelLogoAuto.addMember(logoAuto);
    /*Label label = new Label("<strong><h3>AutoView Web</h3></strong>");
     label.setAlign(Alignment.CENTER);
     label.setWidth100();*/

    final Label labelDataHora = new Label();
    labelDataHora.setAlign(Alignment.CENTER);
    labelDataHora.setWidth(180);
    labelDataHora.setHeight(30);

    Info.relogio = new Timer() {
        @Override
        public void run() {
            if (Info.validaConexao()) {
                final String dataAtual = DateTimeFormat.getFormat(PredefinedFormat.DATE_LONG)
                        .format(new Timestamp(System.currentTimeMillis()), TimeZone.createTimeZone(180));
                final String hora = DateTimeFormat.getFormat(PredefinedFormat.TIME_MEDIUM)
                        .format(new Timestamp(System.currentTimeMillis()), TimeZone.createTimeZone(180));
                labelDataHora.setContents("<strong> " + dataAtual + " " + hora + "</strong>");
            }
            //GWT.log(""+new Timestamp(System.currentTimeMillis()));
        }
    };
    Info.relogio.scheduleRepeating(1000);

    Menu menuUsuario = new Menu();
    menuUsuario.setShowShadow(true);
    menuUsuario.setShadowDepth(10);
    menuUsuario.setWidth(180);
    final MenuItemSeparator separator = new MenuItemSeparator();

    //        MenuItem menuItemNovoUsuario = new MenuItem("Adicionar usurio de cliente", "../imagens/add.png");
    //        menuItemNovoUsuario.addClickHandler(new ClickHandler() {
    //
    //            @Override
    //            public void onClick(MenuItemClickEvent event) {
    //                NovoUsuarioCliente novoUsuarioCliente = new NovoUsuarioCliente();
    //                novoUsuarioCliente.setAnimateTime(1200);
    //                novoUsuarioCliente.animateShow(AnimationEffect.FADE);
    //            }
    //        });
    MenuItem menuItemEditarSenha = new MenuItem("Editar minha senha", "../imagens/edit.png");
    menuItemEditarSenha.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(MenuItemClickEvent event) {
            EditarSenha editarSenha = new EditarSenha();
            editarSenha.setAnimateTime(1200);
            editarSenha.animateShow(AnimationEffect.FADE);
        }
    });
    MenuItem menuItemSair = new MenuItem("Sair", "../imagens/exit.png");
    menuItemSair.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(MenuItemClickEvent event) {
            SC.ask("Sair", Info.usuarioLogado.get("nomeUsuario") + " voc deseja realmente sair?",
                    new BooleanCallback() {

                        @Override
                        public void execute(Boolean value) {
                            if (value != null && value) {
                                // usurio saiu do sistema //
                                Cookies.removeCookie("usuario");
                                Cookies.removeCookie("senha");
                                Info.registrarLog(Integer.parseInt(Info.usuarioLogado.get("codUsuario")), 47,
                                        new Timestamp(System.currentTimeMillis()),
                                        "Usurio: " + Info.usuarioLogado.get("nomeUsuario"));
                                Info.usuarioLogado.clear();
                                Info.enderecosResolvidos.clear();
                                Info.relogio.cancel();
                                TabFrota.atualizaFrota.cancel();
                                Info.atualizaVeiculosTodos.cancel();
                                Info.atualizaVeiculosNovasPosicoes.cancel();
                                Info.atualizaPosicoesSemEndereco.cancel();
                                Info.atualizaPosicoesSemEnderecoHistorico.cancel();
                                if (Info.atualizaVeiculosTodos.isRunning()) {
                                    GWT.log("CANCELOU: Info.atualizaVeiculosTodos.cancel();");
                                    Info.atualizaVeiculosTodos.cancel();
                                    GWT.log("CANCELOU: Info.atualizaVeiculosTodos.cancel();");
                                }
                                Info.atualizaLogUsuario.cancel();
                                Info.painelPrincipal.trocarPainel(new Login());
                            }
                        }
                    });
        }
    });
    menuUsuario.setItems(menuItemEditarSenha, separator, menuItemSair);

    MenuButton menuButton = new MenuButton("<strong>" + Info.usuarioLogado.get("nomeUsuario") + "</strong>",
            menuUsuario);
    menuButton.setWidth(180);
    menuButton.setHeight(30);
    menuButton.setAlign(Alignment.CENTER);

    //painelLogo.addMember(menuButton);
    VLayout painelInformacoes = new VLayout();
    painelInformacoes.setHeight(60);
    //painelInformacoes.setWidth(200);
    painelInformacoes.setAlign(Alignment.RIGHT);
    painelInformacoes.addMember(labelDataHora);
    painelInformacoes.addMember(menuButton);

    this.addMember(painelLogoAuto);
    this.addMember(painelLogo);
    this.addMember(painelInformacoes);

}

From source file:com.edgenius.wiki.gwt.client.space.ThemeListPanel.java

License:Open Source License

public void onSuccess(ThemeListModel model) {
    slider.showLoading(false);/*  w  w  w  .ja  v  a2 s  .c  om*/

    if (ErrorCode.hasError(model)) {
        MessageWidget message = new MessageWidget();
        slider.setMessage(message);
        if (!GwtClientUtils.preSuccessCheck(model, message)) {
            return;
        }
    }
    if (model.themeList != null && model.themeList.size() > 0) {
        LinkedHashMap<String, Image> images = new LinkedHashMap<String, Image>();

        for (ThemeModel tModel : model.themeList) {
            Image image = new Image(tModel.previewImageName);
            image.setAltText(tModel.title);
            image.setTitle(tModel.description);

            images.put(tModel.name, image);
            //initial select - first if no selected.
            if (model.chosenThemeName == null) {
                model.chosenThemeName = tModel.name;
            }
        }
        slider.addImages(images);
        slider.setSelect(model.chosenThemeName);
    } else {
        slider.setMessage(new Label(Msg.consts.no_theme()));
    }

    if (targetDlg != null) {
        if (targetDlg.isShowing())
            targetDlg.center();
    }
}

From source file:com.fullmetalgalaxy.client.chat.MAppLittlePresences.java

License:Open Source License

@Override
public void onChannelMessage(Object p_message) {
    // redraw widget according to new presenceRoom
    PresenceRoom newPresenceRoom = (PresenceRoom) p_message;
    m_panel.clear();/* w w w  .  j ava 2s .  c  o m*/
    Set<String> pseudoList = new HashSet<String>();
    for (Presence presence : newPresenceRoom) {
        if (!pseudoList.contains(presence.getPseudo())) {
            pseudoList.add(presence.getPseudo());
            Image image = new Image(presence.getAvatarUrl());
            image.setPixelSize(32, 32);
            image.setAltText(presence.getPseudo());
            image.setTitle(presence.getPseudo());
            m_panel.add(image);
        }
    }
    if (pseudoList.size() <= 1) {
        // user is alone: don't display anything
        m_panel.clear();
    } else {
        m_panel.add(m_btnChat);
    }
}

From source file:com.fullmetalgalaxy.client.chat.MAppPresences.java

License:Open Source License

@Override
public void onChannelMessage(Object p_message) {
    // redraw widget according to new presenceRoom
    PresenceRoom newPresenceRoom = (PresenceRoom) p_message;
    m_panel.clear();/*from  www  . j a  v a 2 s. com*/
    Set<String> pseudoList = new HashSet<String>();
    for (Presence presence : newPresenceRoom) {
        if (!pseudoList.contains(presence.getPseudo())) {
            pseudoList.add(presence.getPseudo());
            Panel panel = new HorizontalPanel();
            Image image = new Image(presence.getAvatarUrl());
            image.setPixelSize(32, 32);
            image.setAltText(presence.getPseudo());
            image.setTitle(presence.getPseudo());
            panel.add(image);
            panel.add(new Label(presence.getPseudo()));
            m_panel.add(panel);
        }
    }
}

From source file:com.fullmetalgalaxy.client.game.tabmenu.WgtPlayers.java

License:Open Source License

private void initPlayerPanel() {
    m_banButtons.clear();//from w ww. j a va  2s  .com
    m_skipTurnButtons.clear();
    m_playerPanel.clear();
    int playerCount = GameEngine.model().getGame().getSetRegistration().size();
    String strPlayerCount = "" + playerCount;
    if (playerCount != GameEngine.model().getGame().getMaxNumberOfPlayer()) {
        strPlayerCount += "/" + GameEngine.model().getGame().getMaxNumberOfPlayer();
    }
    String strLabel = MAppBoard.s_messages.xPlayers(strPlayerCount);
    if (GameEngine.model().getGame().getMaxTeamAllowed() > 0) {
        String strTeamCount = "" + GameEngine.model().getGame().getTeams().size();
        if (GameEngine.model().getGame().getTeams().size() != GameEngine.model().getGame()
                .getMaxTeamAllowed()) {
            strTeamCount += "/" + GameEngine.model().getGame().getMaxTeamAllowed();
        }
        strLabel += " - " + MAppBoard.s_messages.xTeams(strTeamCount);
    }
    m_playerPanel.add(new Label(strLabel));

    // message to all link
    long pseudoList[] = new long[playerCount];
    int i = 0;
    for (EbRegistration registration : GameEngine.model().getGame().getSetRegistration()) {
        if (registration.getAccount() != null) {
            pseudoList[i] = registration.getAccount().getId();
        } else {
            pseudoList[i] = 0;
        }
        i++;
    }
    m_playerPanel.add(new HTML(
            "<a href='" + EbPublicAccount.getEMailUrl(GameEngine.model().getGame().getName(), pseudoList)
                    + "' >Envoyer un message  tous</a>"));

    // get player order
    List<EbTeam> sortedTeam = GameEngine.model().getGame().getTeamByPlayOrder();

    Grid m_playerGrid = new Grid(GameEngine.model().getGame().getSetRegistration().size() + 1, 9);
    m_playerGrid.setStyleName("fmp-array");

    m_playerGrid.setText(0, 0, ""); // team avatar
    m_playerGrid.setText(0, 1, ""); // avatar
    m_playerGrid.setText(0, 2, "login");
    m_playerGrid.setText(0, 3, "couleur(s)");
    m_playerGrid.setText(0, 4, "pt d'action");
    m_playerGrid.setHTML(0, 5, "pt de victoire<br/>(estimation)");
    m_playerGrid.setText(0, 6, ""); // must play before
    m_playerGrid.setText(0, 7, ""); // ban
    m_playerGrid.setText(0, 8, ""); // skip turn
    m_playerGrid.getRowFormatter().addStyleName(0, "fmp-home-gameline-caption");

    int index = 0;
    for (EbTeam team : sortedTeam)
        for (EbRegistration registration : team.getPlayers(GameEngine.model().getGame().getPreview())) {
            index++;

            String html = "";

            // display team avatar
            if (team.getCompany() != Company.Freelancer) {
                m_playerGrid.setHTML(index, 0,
                        "<IMG SRC='/images/avatar/" + team.getCompany()
                                + ".jpg' WIDTH=60 HEIGHT=60 BORDER=0 title='" + team.getCompany().getFullName()
                                + "'/>");
            }

            if (registration.haveAccount()) {
                // display avatar
                m_playerGrid.setHTML(index, 1, "<IMG SRC='" + registration.getAccount().getAvatarUrl()
                        + "' WIDTH=60 HEIGHT=60 BORDER=0 />");

                // display login
                // if player is connected, display in bold font
                if (AppMain.instance().isUserConnected(registration.getAccount().getPseudo())) {
                    html += "<b>";
                }
                String login = registration.getAccount().getPseudo();
                html += "<a href='" + registration.getAccount().getProfileUrl() + "' target='_blank'>" + login
                        + "</a>";
                if (AppMain.instance().isUserConnected(registration.getAccount().getPseudo())) {
                    html += "</b>";
                }
            } else {
                // display avatar
                m_playerGrid.setHTML(index, 1,
                        "<IMG SRC='/images/avatar/avatar-default.jpg' WIDTH=60 HEIGHT=60 BORDER=0 />");
                // display login
                html = "???";
            }

            // display email messages
            if (registration.getAccount() != null) {
                html += " <a target='_blank' href='"
                        + registration.getAccount().getEMailUrl(GameEngine.model().getGame().getName())
                        + "'><img src='/images/css/icon_pm.gif' border=0 alt='PM' /></a> ";
            }

            if (GameEngine.model().getGame().getCurrentPlayerIds().contains(registration.getId())) {
                html += AbstractImagePrototype.create(Icons.s_instance.action16()).getHTML();
            }
            if (registration.haveAccount()) {
                html += "<br/><img src='" + registration.getAccount().getGradUrl() + "' border=0 alt='GRAD'/>";
            }
            if (registration.isReplacement()) {
                EbPublicAccount resigned = registration.getOriginalAccount(GameEngine.model().getGame());
                html += "<br/><small>remplace&nbsp;<a href='" + resigned.getProfileUrl() + "' target='_blank'>"
                        + resigned.getPseudo() + "</a></small>";
            }
            m_playerGrid.setHTML(index, 2, html);

            // display all colors
            EnuColor color = registration.getEnuColor();
            int colorIndex = 0;
            String htmlColors = "";
            for (colorIndex = 0; colorIndex < EnuColor.getTotalNumberOfColor(); colorIndex++) {
                if (color.isColored(EnuColor.getColorFromIndex(colorIndex))) {
                    htmlColors += BoardIcons.icon16(EnuColor.getColorFromIndex(colorIndex).getValue())
                            .getHTML();
                }
            }
            if (color.getValue() == EnuColor.None) {
                htmlColors += " <IMG SRC='images/board/icon.gif' WIDTH=16 HEIGHT=16 BORDER=0 TITLE='"
                        + Messages.getColorString(0, color.getValue()) + "'> ";
            }
            m_playerGrid.setHTML(index, 3, htmlColors);

            // display action points
            m_playerGrid.setText(index, 4,
                    "" + registration.getPtAction() + "/"
                            + (GameEngine.model().getGame().getEbConfigGameTime().getActionPtMaxReserve()
                                    + ((registration.getEnuColor().getNbColor() - 1) * GameEngine.model()
                                            .getGame().getEbConfigGameTime().getActionPtMaxPerExtraShip())));

            // display Wining points
            m_playerGrid.setText(index, 5, "" + team.estimateWinningScore(GameEngine.model().getGame()));

            // display admin button
            if ((GameEngine.model().getGame().getAccountCreator() != null && AppMain.instance().getMyAccount()
                    .getId() == GameEngine.model().getGame().getAccountCreator().getId())
                    || AppMain.instance().iAmAdmin()) {
                if (registration.haveAccount()) {
                    // display ban button
                    Image banImage = new Image();
                    banImage.setUrl("/images/icons/ban.gif");
                    banImage.setAltText("BAN");
                    banImage.setTitle("Banir un joueur de cette partie");
                    banImage.addClickHandler(this);
                    m_playerGrid.setWidget(index, 7, banImage);
                    m_banButtons.put(banImage, registration);
                }

                // display endTurn button
                if ((GameEngine.model().getGame().getCurrentPlayerIds().contains(registration.getId()))) {
                    PushButton btnSkipTurn = new PushButton(new Image(Icons.s_instance.endTurn32()));
                    btnSkipTurn.setTitle(MAppBoard.s_messages.endTurn());
                    btnSkipTurn.setStyleName("fmp-PushButton32");
                    btnSkipTurn.addClickHandler(this);
                    m_playerGrid.setWidget(index, 8, btnSkipTurn);
                    m_skipTurnButtons.put(btnSkipTurn, registration);
                }

            }

        }

    m_playerPanel.add(m_playerGrid);

    // come from old WgtContextPlayers
    //
    Game game = GameEngine.model().getGame();
    if ((game.getGameType() == GameType.MultiPlayer || game.getGameType() == GameType.Initiation)) {
        VerticalPanel vpanel = new VerticalPanel();

        // other connected User
        vpanel.add(new Label("Visiteur(s) :"));
        for (Presence user : AppMain.instance().getPresenceRoom()) {
            if (!contain(GameEngine.model().getGame().getSetRegistration(), user.getPseudo())) {
                HTML html = new HTML("<b>" + user.getPseudo() + "</b>");
                html.setWidth("100%");
                vpanel.add(html);
            }
        }
        if ((game.getGameType() == GameType.MultiPlayer || game.getGameType() == GameType.Initiation)) {
            vpanel.add(m_btnChat);
            vpanel.add(new HTML("<a href='/chat.jsp?id=" + game.getId()
                    + "' target='_blank'><img src='/images/icon_new_window.gif'/></a>"));
        }
        m_playerPanel.add(vpanel);
    }
}

From source file:com.google.api.explorer.client.history.EmbeddedHistoryItemView.java

License:Apache License

/**
 * Set the value of the panel reserved for the formatted response. There are a couple different
 * scenarios to tackle. If we can determine that the request returned an image, and the request is
 * repeatable, we will create an image tag with a source of the original request.
 *
 * If the response is a non-JSON text type, we just show it directly.
 *
 * In all other cases we try to process the text as JSON and if for some reason that fails, we
 * just hide it under an opaque tag that says as much information as we know about the response.
 *
 * @param request Request object with the API key replaced.
 * @param response Response from the server.
 * @param originalPath Path object before we replaced the API key.
 * @param linkFactory Which links factory should be used when generating links and navigation
 *        menus.//from   w w w.  j  a  va2s .  co m
 */
private void setResponseContent(ApiRequest request, ApiResponse response, String originalPath,
        PrettifierLinkFactory linkFactory) {

    HeaderValue authorization = response.getHeaders().get(AUTH_HEADER);
    HeaderValue contentTypeHeader = response.getHeaders().get(CONTENT_TYPE_HEADER);
    GWT.log("Headers: " + response.getHeaders().entrySet());
    String contentType = contentTypeHeader == null ? "Unspecified" : contentTypeHeader.getValue();

    if (request.getHttpMethod() == HttpMethod.GET && contentType.startsWith(IMAGE_TYPE_PREFIX)
            && authorization == null) {

        // In the very special case that we performed a get and were given an
        // image, display it
        Image img = new Image();
        img.setUrl(Config.getBaseUrl() + originalPath);
        img.setAltText(Config.getBaseUrl() + request.getRequestPath());
        responseBodyDiv.add(img);
    } else if (contentType.startsWith(TEXT_TYPE_PREFIX)) {
        // We have non-JSON text, just show it.
        responseBodyDiv.add(new Label(response.getBodyAsString()));
    } else {
        // Treat the response as JSON, although we don't really know what it is
        try {
            JsonPrettifier.prettify(request.getService(), responseBodyDiv, response.getBodyAsString(),
                    linkFactory);
        } catch (JsonFormatException e) {
            // If JSON processing fails, just say what we know about the data
            responseBodyDiv.add(new Label("[" + contentType + " data]"));
        }

        // Check if there was an error, and, if so, display it to the user.
        ErrorCase error = getErrorMessage(response);
        if (error != null) {
            setErrorMessage(error.getErrorLabel());
        }
    }
}

From source file:com.google.gerrit.client.info.WebLinkInfo.java

License:Apache License

public final Anchor toAnchor() {
    Anchor a = new Anchor();
    a.setHref(url());/* w ww .  java  2s . co m*/
    if (target() != null && !target().isEmpty()) {
        a.setTarget(target());
    }
    if (imageUrl() != null && !imageUrl().isEmpty()) {
        Image img = new Image();
        img.setAltText(name());
        img.setUrl(imageUrl());
        img.setTitle(name());
        a.getElement().appendChild(img.getElement());
    } else {
        a.setText("(" + name() + ")");
    }
    return a;
}

From source file:com.google.sampling.experiential.client.ExperimentRow.java

License:Open Source License

public ExperimentRow(Images resources, ExperimentDAO experiment, ExperimentListener listener, boolean joined,
        boolean findView) {
    this.images = resources;
    this.myConstants = GWT.create(MyConstants.class);
    this.experiment = experiment;
    this.joined = joined;
    this.findView = findView;
    this.listeners = new ArrayList<ExperimentListener>();
    if (listener != null) {
        listeners.add(listener);//w  w w  .j av a 2  s  . co m
    }
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setStyleName("paco-experimentRow");
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setSpacing(1);
    horizontalPanel.setHeight("42px");
    initWidget(horizontalPanel);

    Image experimentIcon = new Image(resources.question());
    experimentIcon.setAltText(myConstants.experimentIcon());
    horizontalPanel.add(experimentIcon);
    horizontalPanel.setCellHeight(experimentIcon, "42");
    horizontalPanel.setCellWidth(experimentIcon, "42");
    horizontalPanel.setCellHorizontalAlignment(experimentIcon, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setCellVerticalAlignment(experimentIcon, HasVerticalAlignment.ALIGN_BOTTOM);
    experimentIcon.setSize("42px", "42px");

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setHeight("39px");
    horizontalPanel.add(verticalPanel);

    HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    horizontalPanel_2.setHeight("19px");
    verticalPanel.add(horizontalPanel_2);

    Label experimentTitleLabel = new Label(experiment.getTitle());
    if (experiment.getDeleted() != null && experiment.getDeleted()) {
        experimentTitleLabel.setStyleName("gwt-Link-underline-strikethrough");
    } else {
        experimentTitleLabel.setStyleName("gwt-Link-underline");
    }
    horizontalPanel_2.add(experimentTitleLabel);
    horizontalPanel_2.setCellWidth(experimentTitleLabel, "22px");
    horizontalPanel_2.setCellHeight(experimentTitleLabel, "18px");
    experimentTitleLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    horizontalPanel.setCellVerticalAlignment(experimentTitleLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    experimentTitleLabel.setWidth("180px");
    ClickHandler titleHandler = new ClickHandler() {
        public void onClick(ClickEvent event) {
            showExperimentDetails();
        }
    };
    if (!isExperimentPurged()) {
        experimentTitleLabel.addClickHandler(titleHandler);
        experimentIcon.addClickHandler(titleHandler);
    }

    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    horizontalPanel_1.setSpacing(1);
    verticalPanel.add(horizontalPanel_1);

    createButtonPanel(experiment, joined, horizontalPanel, horizontalPanel_1, findView);

}

From source file:edu.ycp.cs.netcoder.client.TopBar.java

License:Open Source License

public TopBar() {
    String urlBase = GWT.getModuleBaseURL();

    FlowPanel panel = new FlowPanel();
    panel.setStyleName("NetCoderTopBar");
    this.hPanel = new FlowPanel();
    InlineLabel productName = new InlineLabel("NetCoder");
    productName.setStyleName("NetCoderProductName");
    hPanel.add(productName);/*from   www. j ava 2s.c om*/
    Image logoImg = new Image(urlBase + "/images/NetCoderLogoSmall.png");
    logoImg.setAltText("[logo]");
    logoImg.setStyleName("NetCoderLogo");
    hPanel.add(logoImg);
    Image agplImg = new Image(urlBase + "/images/agplv3-88x31.png");
    agplImg.setAltText("[agpl logo]");
    agplImg.setStyleName("NetCoderAGPLLogo");
    hPanel.add(agplImg);

    hPanel2 = new FlowPanel();
    hPanel2.setStyleName("NetCoderUsernameAndLogout");
    loggedInAsLabel = new InlineLabel();
    loggedInAsLabel.setStyleName("NetCoderLoggedInAs");
    hPanel2.add(loggedInAsLabel);

    panel.add(hPanel);
    panel.add(hPanel2);

    initWidget(panel);
}