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

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

Introduction

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

Prototype

@Override
public void add(Widget widget) 

Source Link

Document

Adds a child widget to the panel.

Usage

From source file:org.ednovo.gooru.client.mvp.play.collection.preview.home.PreviewHomeView.java

License:Open Source License

public void setReplyLink() {
    Anchor resourceAnchor = new Anchor();
    resourceAnchor.setHref(getReplayLink());
    resourceAnchor.setStyleName("");
    resourceAnchor.addClickHandler(new ReplayCollectionEvent());
    HTMLPanel collectionHTMLPanel = new HTMLPanel("");
    collectionHTMLPanel.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().collectionreplay());

    Label collectionReplayButton = new Label(GL0632);
    collectionReplayButton.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().collectionreplayText());

    collectionHTMLPanel.add(collectionReplayButton);

    resourceAnchor.getElement().appendChild(collectionHTMLPanel.getElement());
    thumbnailContainer.clear();//from  w ww. j a  v  a  2s . c  om
    thumbnailContainer.add(resourceAnchor);
}

From source file:org.ednovo.gooru.client.mvp.play.collection.share.email.PrintSummaryPage.java

License:Open Source License

private void setOeQuestionsData(int i, String questionText, String questionAnswer) {
    final HTMLPanel oeQuestionDiv = new HTMLPanel("");
    final Label oeQuestionNumber = new Label("" + (i + 1));
    questionText = questionText.replaceAll("</p>", " ").replaceAll("<p>", "")
            .replaceAll("<br data-mce-bogus=\"1\">", "").replaceAll("<br>", "").replaceAll("</br>", "");
    final HTML oeQuestionSummary = new HTML(questionText);
    final HTML oeQuestionAnswer = new HTML(questionAnswer);
    oeQuestionDiv.getElement().setAttribute("style", cp0015);
    oeQuestionNumber.getElement().setAttribute("style", cp0017);
    oeQuestionSummary.getElement().setAttribute("style", cp0018);
    oeQuestionAnswer.getElement().setAttribute("style", cp0019);
    oeQuestionDiv.add(oeQuestionNumber);
    oeQuestionDiv.add(oeQuestionSummary);
    oeQuestionDiv.add(oeQuestionAnswer);
    //oeQuestionDiv.getElement().setAttribute("style",PlayerMessageProperties.cp0016);
    oeQuestionsBox.add(oeQuestionDiv);//from w  w w  . jav  a 2 s. c  o m
}

From source file:org.ednovo.gooru.client.mvp.play.collection.share.email.PrintSummaryPage.java

License:Open Source License

public void setQuestionsData(Map<String, AttemptedAnswersDo> attemptedAnswerMap) {
    int collectionItemsSize = collectionDo.getCollectionItems().size();
    int correctAnswers = 0;
    int questionResourceOptionsSize = 0;
    for (int i = 0; i < collectionItemsSize; i++) {
        int fiBCorrectCount = -1;
        CollectionItemDo collectionItemDo = collectionDo.getCollectionItems().get(i);
        if (collectionItemDo.getResource().getResourceType().getName()
                .equalsIgnoreCase("assessment-question")) {
            if (collectionItemDo.getResource().getType() == 6) {
                AttemptedAnswersDo attemptedAnswersDo = attemptedAnswerMap
                        .get(collectionItemDo.getCollectionItemId());
                String answerText = attemptedAnswersDo != null ? attemptedAnswersDo.getAnswersText() : "";
                setOeQuestionsData(i, collectionItemDo.getResource().getQuestionText(), answerText);
            } else {
                final HTMLPanel mcQuestionDiv = new HTMLPanel("");
                final Image mcQuestionChoice = new Image();
                final Label mcQuestionNumber = new Label("" + (i + 1));
                int answerArraySize = collectionItemDo.getResource().getAnswers().size();
                String questionText = collectionItemDo.getResource().getQuestionText();
                questionText = questionText.replaceAll("</p>", "").replaceAll("<p>", "")
                        .replaceAll("<br data-mce-bogus=\"1\">", "").replaceAll("<br>", "")
                        .replaceAll("</br>", "").replaceAll("&nbsp;", " ");
                final HTML mcQuestionAnswer = new HTML();
                HTML questionLabel = new HTML();
                final HTMLPanel fibQuestionPanel = new HTMLPanel("");
                if (collectionItemDo.getResource().getType() == 4) {
                    String[] fibArray = questionText.split(FIB_SEPARATOR);
                    mcQuestionsLbl.setText(MC_FIB_TITLE_TXT);
                    String fibQuestionTxt = "";
                    int k = 0;
                    boolean isFibAnswerCorrect = true;
                    boolean isUserAttempted = false;
                    for (int j = 0; j < fibArray.length; j++) {
                        fibQuestionTxt = fibQuestionTxt + fibArray[j];
                        if (j < answerArraySize) {
                            AttemptedAnswersDo attemptedAnswersDo = attemptedAnswerMap
                                    .get(collectionItemDo.getCollectionItemId());
                            String correctAnswer = getQuestionAnswerDo(k, collectionItemDo) != null
                                    ? getQuestionAnswerDo(k, collectionItemDo).getAnswerText()
                                    : "";
                            if (attemptedAnswersDo != null) {
                                isUserAttempted = true;
                                String enteredAnswer = attemptedAnswersDo.getFibAnswersList()[k];
                                if (correctAnswer.equalsIgnoreCase(enteredAnswer)) {
                                    fibQuestionTxt = fibQuestionTxt
                                            + "&nbsp;<div style=\"border-bottom:1px solid #515151;min-width:30px;display:inline-block;\">"
                                            + enteredAnswer + "</div>";
                                    if (isFibAnswerCorrect) {
                                        isFibAnswerCorrect = true;
                                    }//from  www  .  j  a  v a 2  s . c o m

                                } else {
                                    fibQuestionTxt = fibQuestionTxt
                                            + "&nbsp;<div style=\"border-bottom:1px solid #515151;min-width:30px;display:inline-block;\">"
                                            + enteredAnswer + "</div>";
                                    if (isFibAnswerCorrect) {
                                        isFibAnswerCorrect = false;
                                    }
                                }
                            } else {
                                fibQuestionTxt = fibQuestionTxt
                                        + "&nbsp;<div style=\"border-bottom:1px solid #515151;min-width:30px;display:inline-block;\"></div>";
                            }
                            k++;
                        }
                    }
                    if (isUserAttempted) {
                        if (isFibAnswerCorrect) {
                            correctAnswers++;
                            mcQuestionChoice.setUrl(getRightAnswerBundle());
                        } else {
                            mcQuestionChoice.setUrl(getWrongAnswerBundle());
                        }
                    }
                    questionLabel.setHTML(fibQuestionTxt);

                    fibQuestionPanel.add(questionLabel);
                    fibQuestionPanel.getElement().setAttribute("style", cp0023);
                } else {
                    mcQuestionAnswer.setHTML(questionText);
                    mcQuestionAnswer.getElement().setAttribute("style", cp0023);
                }

                mcQuestionDiv.getElement().setAttribute("style", cp0021);
                mcQuestionChoice.getElement().setAttribute("style", cp0022);
                mcQuestionNumber.getElement().setAttribute("style", cp0017);

                String correctQuestionOption = collectionItemDo.getResource().getGooruOid();
                String questionId = collectionItemDo.getResource().getGooruOid();

                mcQuestionDiv.add(mcQuestionChoice);
                mcQuestionDiv.add(mcQuestionNumber);

                if (collectionItemDo.getResource().getType() == 4) {
                    questionResourceOptionsSize++;
                    mcQuestionDiv.add(fibQuestionPanel);
                } else {
                    questionResourceOptionsSize++;
                    AttemptedAnswersDo attemptedAnswersDo = attemptedAnswerMap
                            .get(collectionItemDo.getCollectionItemId());
                    if (attemptedAnswersDo != null) {
                        boolean attemptedAnswers = attemptedAnswersDo.isAttemptResult();
                        if (attemptedAnswers) {
                            correctAnswers++;
                            mcQuestionChoice.setUrl(getRightAnswerBundle());
                        } else {
                            mcQuestionChoice.setUrl(getWrongAnswerBundle());
                        }
                    }
                    mcQuestionDiv.add(mcQuestionAnswer);
                }

                if (i == collectionItemsSize - 1) {
                    mcQuestionDiv.getElement().getStyle().setBorderWidth(0, Unit.PX);
                }
                mcQuestionsBox.add(mcQuestionDiv);
            }
        }
    }
    if (!(oeQuestionsBox.getWidgetCount() > 0)) {
        oeQuestionsContainer.setVisible(false);
    }
    if (!(mcQuestionsBox.getWidgetCount() > 0)) {
        mcQuestionsContainer.setVisible(false);
    }
    answerCount.setText(correctAnswers + " / " + questionResourceOptionsSize + " " + GL0314);
    answerCount.getElement().setAttribute("style", cp0026);

}

From source file:org.ednovo.gooru.client.mvp.rating.RatingUserWidgetView.java

License:Open Source License

@UiHandler("deleteReview")
public void onClickDeleteReview(ClickEvent event) {

    AppClientFactory.getInjector().getPlayerAppService().deleteRating(starRatingsDo.getDeleteRatingGooruOid(),
            new SimpleAsyncCallback<Void>() {

                @Override/*from  w  w  w  .  j av a  2s.  com*/
                public void onSuccess(Void result) {
                    reviewContainer.clear();
                    reviewContainer.addStyleName(style.deletePanel());
                    if (!starRatingsDo.getFreeText().equals("") && starRatingsDo.getFreeText() != null) {
                        AppClientFactory
                                .fireEvent(new DeletePlayerStarReviewEvent(starRatingsDo.getAssocGooruOid()));
                    } else {
                        AppClientFactory.fireEvent(new DeletePlayerStarRatingsEvent());
                    }

                    final HTMLPanel deletePanel = new HTMLPanel("");
                    Label deleteMsg = new Label();
                    deleteMsg.setText(i18n.GL1853());
                    deleteMsg.getElement().setAttribute("alt", i18n.GL1853());
                    deleteMsg.getElement().setAttribute("title", i18n.GL1853());
                    deleteMsg.setStyleName(style.lbldeleteMsg());
                    deletePanel.add(deleteMsg);
                    reviewContainer.add(deletePanel);
                    new FadeInAndOut(deletePanel.getElement(), 1000);
                    Timer timer = new Timer() {
                        @Override
                        public void run() {
                            int deleteIndex = reviewContainer.getWidgetIndex(deletePanel);
                            reviewContainer.remove(deleteIndex);
                            reviewContainer.setVisible(false);
                            AppClientFactory.fireEvent(new UpdateRatingOnDeleteEvent(true));
                            AppClientFactory
                                    .fireEvent(new UpdateRatingsGraphEvent(starRatingsDo.getAssocGooruOid()));

                        }
                    };
                    timer.schedule(1000);
                }
            });
}

From source file:org.ednovo.gooru.client.mvp.search.CenturySkills.AddCenturyView.java

License:Open Source License

/**
 * This will set the 21 century data based passed parameters
 * @param nodeList//w  ww .j  a  v a2s  . co m
 * @param ulPanel
 */
public void setPanelData(List<NodeDo> nodeList, UlPanel ulPanel) {
    for (final NodeDo nodeObj : nodeList) {
        liPanel = new LiPanel();
        if (!StringUtil.isEmpty(nodeObj.getCode())) {
            liPanel.setCodeId(nodeObj.getCodeId());
            liPanel.setTitle(nodeObj.getLabel().trim());
            AddCenturyColorPanelWidget addCenturyColorPanelWidget = new AddCenturyColorPanelWidget(
                    nodeObj.getCode());
            liPanel.add(addCenturyColorPanelWidget);
        }
        HTMLPanel pnlTitle = new HTMLPanel("");
        pnlTitle.setStyleName(AddCenturyBundle.INSTANCE.css().listText());
        final InlineLabel titleText = new InlineLabel(nodeObj.getLabel());
        titleText.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                if (titleText.getElement().getClassName()
                        .contains(AddCenturyBundle.INSTANCE.css().hilighTitleText())) {
                    titleText.removeStyleName(AddCenturyBundle.INSTANCE.css().hilighTitleText());
                    for (Map.Entry<Long, String> entry : selectedValues.entrySet()) {
                        if (entry.getValue().contains(titleText.getText().trim())) {
                            if (collectionIdFromCollectionInfo != null) {
                                getUiHandlers().deleteCourseOrStandard(collectionIdFromCollectionInfo,
                                        entry.getKey().toString());
                                if (collectionInfoSelectedValues != null
                                        && collectionInfoSelectedValues.containsKey(entry.getKey())) {
                                    collectionInfoSelectedValues.remove(entry.getKey());
                                }
                            }
                            selectedValues.remove(entry.getKey());
                            return;
                        }
                    }
                } else {
                    selectedValues.put(nodeObj.getCodeId(), nodeObj.getLabel());
                    titleText.addStyleName(AddCenturyBundle.INSTANCE.css().hilighTitleText());
                }
            }
        });
        pnlTitle.add(titleText);
        liPanel.add(pnlTitle);
        ulPanel.add(liPanel);
    }
}

From source file:org.ednovo.gooru.client.mvp.search.NOSearchResultCollectionVc.java

License:Open Source License

public void setData(List<FeaturedCollectionContentDo> searchDo) {
    for (int i = 0; i < searchDo.size(); i++) {
        if (i < searchDo.size()) {
            for (int j = 0; j < searchDo.get(i).getScollections().size(); j++) {
                totalItem = totalItem + searchDo.get(i).getScollections().size();
                if (totalItem < 5) {
                    HTMLPanel collectionContainer = new HTMLPanel("");
                    collectionContainer.setStyleName(noResultStyle.collectionContainer());
                    HTMLEventPanel collectionThambnailBlueBar = new HTMLEventPanel("");
                    collectionThambnailBlueBar.setStyleName(noResultStyle.collectionThambnailBlueBar());
                    final HTMLPanel collectionThumbnail = new HTMLPanel("");
                    collectionThumbnail.getElement()
                            .setId(searchDo.get(i).getScollections().get(j).getGooruOid());
                    collectionThumbnail.setStyleName(noResultStyle.collectionThumbnail());
                    final Image collectionImage = new Image();
                    collectionImage.setHeight("80px");
                    collectionImage.setWidth("105px");
                    collectionImage.setUrl(searchDo.get(i).getScollections().get(j).getThumbnails().getUrl());
                    HTML titleText = new HTML();
                    titleText.setStyleName(noResultStyle.collectionTitle());
                    final String collectionTitle = searchDo.get(i).getScollections().get(j).getTitle();
                    collectionImage.setAltText(collectionTitle);
                    collectionImage.setTitle(collectionTitle);

                    if (collectionTitle.length() >= 32) {
                        titleText.setHTML(collectionTitle.substring(0, 25) + "...");
                    } else {
                        titleText.setHTML(collectionTitle);
                    }//from w ww. j  a  v  a 2  s. c  o  m
                    collectionThumbnail.add(collectionImage);
                    collectionImage.addErrorHandler(new ErrorHandler() {
                        @Override
                        public void onError(ErrorEvent event) {
                            collectionImage.setUrl(DEFAULT_COLLECTION_IMAGE);
                            collectionImage.setHeight("80px");
                            collectionImage.setWidth("105px");
                            collectionImage.setAltText(collectionTitle);
                            collectionImage.setTitle(collectionTitle);
                        }
                    });
                    collectionThambnailBlueBar.add(collectionThumbnail);
                    collectionContainer.add(collectionThambnailBlueBar);
                    collectionContainer.add(titleText);
                    suggestedCollectionContainer.add(collectionContainer);

                    collectionThambnailBlueBar.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                            MixpanelUtil.Search_No_Results_Click_Collection();
                            Map<String, String> params = new HashMap<String, String>();
                            params.put("id", collectionThumbnail.getElement().getId());
                            com.google.gwt.user.client.Window.scrollTo(0, 0);
                            AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.PREVIEW_PLAY, params);
                        }
                    });
                }
            }
        }
    }
}

From source file:org.ednovo.gooru.client.mvp.search.NoSearchResultsVc.java

License:Open Source License

public void setData(SearchDo<ResourceSearchResultDo> searchInput) {
    //resourcesCount.setText("There are "+searchInput.getSearchHits()+" suggested resources for you!");
    for (int i = 0; i < searchInput.getSearchResults().size(); i++) {
        if (i < 5) {
            final String category = searchInput.getSearchResults().get(i).getCategory();
            HTMLPanel resourceContainer = new HTMLPanel("");
            resourceContainer.setStyleName(noResultStyle.resourceContainer());
            final HTMLEventPanel resourceThumbnail = new HTMLEventPanel("");
            resourceThumbnail.setStyleName(noResultStyle.resourceThumbnail());
            resourceThumbnail.getElement().setId(searchInput.getSearchResults().get(i).getGooruOid());

            final Image resourceImage = new Image(searchInput.getSearchResults().get(i).getUrl());
            resourceImage.setHeight("60px");
            resourceImage.setWidth("80px");

            HTMLPanel resourceTypeIcon = new HTMLPanel("");
            resourceTypeIcon.getElement().setAttribute("style", "position: absolute");
            resourceTypeIcon.setStyleName(getResourceCategoryIcon(category));
            resourceThumbnail.add(resourceImage);
            resourceThumbnail.add(resourceTypeIcon);

            HTML titleText = new HTML();
            titleText.setStyleName(noResultStyle.resourceTitle());
            final String resourceTitle = searchInput.getSearchResults().get(i).getResourceTitle();
            resourceImage.setAltText(resourceTitle);
            resourceImage.setTitle(resourceTitle);
            if (resourceTitle.length() >= 18) {
                titleText.setHTML(resourceTitle.substring(0, 17) + "...");
            } else {
                titleText.setHTML(resourceTitle);
            }/*  w w w  . j a v  a 2 s . c  o  m*/

            resourceContainer.add(resourceThumbnail);
            resourceContainer.add(titleText);
            suggestedResourcesContainer.add(resourceContainer);
            resourceThumbnail.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    MixpanelUtil.Search_No_Results_Click_Resource();
                    Map<String, String> params = new HashMap<String, String>();
                    params.put("id", resourceThumbnail.getElement().getId());
                    params.put("pn", "resource");
                    com.google.gwt.user.client.Window.scrollTo(0, 0);
                    AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.RESOURCE_PLAY, params);
                }
            });

            resourceImage.addErrorHandler(new ErrorHandler() {
                @Override
                public void onError(ErrorEvent event) {
                    String categoryImage = setDefaultResourceThumbnail(category);
                    resourceImage.setUrl(categoryImage);
                    resourceImage.setAltText(resourceTitle);
                    resourceImage.setTitle(resourceTitle);
                }
            });
        }
    }
}

From source file:org.ednovo.gooru.client.mvp.search.SearchFilterVc.java

License:Open Source License

/**
 * @param disclosurePanelVc instance of DisclosurePanelUc which gets added widget
 * @param key check box name/* www  .  j ava2  s.  c om*/
 * @param value check box value
 */
public void renderCheckBox(HTMLPanel disclosurePanelVc, String key, String value) {
    if (chkNotFriendly == null) {
        chkNotFriendly = new CheckBox();
    }
    chkNotFriendly.setText(value);
    disclosurePanelVc.setStyleName("mobilefriendlyContainer");
    chkNotFriendly.setName(key);
    if (value.equalsIgnoreCase("Mobile Friendly")) {
        chkNotFriendly.getElement().setId("chkNotFriendly");
        chkNotFriendly.getElement().getStyle().setMarginTop(20, Unit.PX);
        /*chkNotFriendly.getElement().getStyle().setMarginLeft(9, Unit.PX);
        chkNotFriendly.getElement().getStyle().setWidth(102, Unit.PX);*/
    }
    chkNotFriendly.setStyleName(CssTokens.FILTER_CHECKBOX);
    chkNotFriendly.addStyleName(value.toLowerCase());
    disclosurePanelVc.add(chkNotFriendly);
    chkNotFriendly.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (chkNotFriendly.getValue()) {
                MixpanelUtil.MOS_Filter("Selected");
            } else {
                MixpanelUtil.MOS_Filter("Unselected");
            }
            AppClientFactory.fireEvent(new GetSearchKeyWordEvent());
        }
    });

}

From source file:org.ednovo.gooru.client.mvp.shelf.collection.tab.resource.add.AddSearchResourceView.java

License:Open Source License

private void setData(SearchDo<ResourceSearchResultDo> result) {
    if (result.getSearchHits() == 0) {
        searchResultspanel.setVisible(false);
    } else {//from  w  w w.j av  a 2 s.co  m
        searchResultspanel.setVisible(true);
        totalResources.setText(StringUtil.generateMessage(GL0335, Integer.toString(result.getSearchHits())));
        final List<ResourceSearchResultDo> searchResults = result.getSearchResults();
        for (int i = 0; i < 4; i++) {
            final String thumbnailUrl = searchResults.get(i).getUrl();
            category = searchResults.get(i).getCategory();
            if (category != null) {
                if (category.equalsIgnoreCase("lesson") || category.equalsIgnoreCase("textbook")
                        || category.equalsIgnoreCase("handout")) {
                    category = category.replaceAll("lesson", "text").replaceAll("textbook", "text")
                            .replaceAll("handout", "text");
                }
                if (category.equalsIgnoreCase("slide")) {
                    category = category.replaceAll("slide", "image");
                }
                if (category.equalsIgnoreCase("exam") || category.equalsIgnoreCase("website")
                        || category.equalsIgnoreCase("challenge")) {
                    category = category.replaceAll("exam", "webpage").replaceAll("website", "webpage")
                            .replaceAll("challenge", "webpage");
                }
            }
            HTMLPanel thumbnailContainer = new HTMLPanel("");

            addResourceThumbnailContent = new HTMLPanel("");
            addResourceThumbnailContent
                    .setStyleName(CollectionEditResourceCBundle.INSTANCE.css().addResourceThumbnailContent());
            final Image resourceThumbnail = new Image();
            resourceThumbnail.setUrl(thumbnailUrl);
            resourceThumbnail.getElement().getStyle().setHeight(60, Unit.PX);
            resourceThumbnail.getElement().getStyle().setWidth(80, Unit.PX);

            addResourceSprite = new HTMLPanel("");
            addResourceSprite.addStyleName(UcCBundle.INSTANCE.css().resourceName());
            addResourceSprite.addStyleName(category.toLowerCase() + SMALL);
            addResourceImgDesc = new HTML();
            String resourceTitle = searchResults.get(i).getResourceTitle();
            if (resourceTitle.length() > 25) {
                resourceTitle = resourceTitle.substring(0, 24) + "...";
            }

            thumbnailContainer.add(resourceThumbnail);
            thumbnailContainer.add(addResourceSprite);
            thumbnailContainer.getElement().getStyle().setHeight(65, Unit.PX);

            addResourceImgDesc.setHTML(resourceTitle);
            addResourceImgDesc.setStyleName(CollectionEditResourceCBundle.INSTANCE.css().addResourceImgDesc());

            addResourceThumbnailContent.add(thumbnailContainer);
            addResourceThumbnailContent.add(addResourceImgDesc);
            suggestedResourcesPanel.add(addResourceThumbnailContent);

            resourceThumbnail.addErrorHandler(new ErrorHandler() {
                @Override
                public void onError(ErrorEvent event) {
                    resourceThumbnail.setUrl(DEFULT_IMAGE_PREFIX + category.toLowerCase() + PNG);
                }
            });
        }

        suggestedResourcesPanel.add(viewAllResourcesBtn);
        viewAllResourcesBtn.getElement().getStyle().setMarginLeft(-236, Unit.PX);
        viewAllResourcesBtn.getElement().getStyle().setPosition(Position.ABSOLUTE);
        viewAllResourcesBtn.getElement().getStyle().setMarginTop(33, Unit.PX);
    }
}

From source file:org.ednovo.gooru.client.uc.CourseListUc.java

License:Open Source License

private void setCourseData(final List<LibraryCodeDo> libraryCodeDo) {
    final HTMLPanel panel = new HTMLPanel("");
    panel.clear();/*from w ww .  j ava2  s .  c om*/
    contentPanel.clear();
    Map<String, Integer> courseList = new HashMap<String, Integer>();
    for (int j = 0; j < libraryCodeDo.size(); j++) {
        String courseListValues = libraryCodeDo.get(j).getLabel();
        Label courseValues = new Label(courseListValues);
        courseValues.setStyleName(res.css().infoCourseListText());
        courseValues.getElement().setId(courseListValues);
        courseList.put(courseListValues, j);
        panel.add(courseValues);

    }
    contentPanel.add(panel);
    final Map<String, Integer> course = courseList;
    Iterator<Widget> widgets = panel.iterator();
    while (widgets.hasNext()) {
        final Widget widget = widgets.next();
        if (widget instanceof Label) {
            ((Label) widget).addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    isSelected = true;
                    int subjectCode = course.get(widget.getElement().getId());
                    courseName = libraryCodeDo.get(subjectCode).getLabel();

                    courseCode = libraryCodeDo.get(subjectCode).getCodeId();
                    final Iterator<Widget> widgetsPanel = panel.iterator();

                    while (widgetsPanel.hasNext()) {
                        widgetsPanel.next().removeStyleName(res.css().collectionInfoCourseList());
                    }
                    widget.addStyleName(res.css().collectionInfoCourseList());

                }
            });
        }
    }

}