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

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

Introduction

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

Prototype

private HTMLPanel(Element elem) 

Source Link

Document

Construct a new HTMLPanel with the specified element.

Usage

From source file:org.discotools.gwt.leaflet.client.widget.MapWidget.java

License:Open Source License

public MapWidget(String name) {

    // Show it in a 'div' element
    initWidget(/*  w  w w. ja va  2 s  .c om*/
            new HTMLPanel("<div id=\"" + name + "\" style=\"width:100%; height: 100%; position: relative;\">" +

                    "MapPane: " + name +

                    "</div>"));

}

From source file:org.drools.workbench.screens.guided.dtable.client.widget.table.cells.AnalysisPopup.java

License:Apache License

public void setHTML(String html) {
    panel.clear();
    panel.setWidget(new HTMLPanel(html));
}

From source file:org.eclipse.che.ide.ext.tutorials.client.GuidePage.java

License:Open Source License

/** {@inheritDoc} */
@Override/*from   w  w w .  j  a  va2s.co  m*/
public void go(final AcceptsOneWidget container) {
    CurrentProject activeProject = appContext.getCurrentProject();
    if (activeProject != null) {
        projectServiceClient.getFileContent(
                activeProject.getRootProject().getPath() + '/' + DEFAULT_GUIDE_FILE_NAME,
                new AsyncRequestCallback<String>(new StringUnmarshaller()) {
                    @Override
                    protected void onSuccess(String result) {
                        final HTMLPanel htmlPanel = new HTMLPanel("");
                        container.setWidget(htmlPanel);
                        htmlPanel.getElement().setInnerHTML(result);
                        htmlPanel.setStyleName(resources.tutorialsCss().scrollPanel());
                    }

                    @Override
                    protected void onFailure(Throwable exception) {
                        Log.error(GuidePage.class, exception);
                    }
                });
    }
}

From source file:org.eclipse.che.ide.ui.window.View.java

License:Open Source License

View(Window.Resources res, boolean showBottomPanel) {
    this.res = res;
    this.css = res.windowCss();
    windowWidth = com.google.gwt.user.client.Window.getClientWidth();
    clientLeft = Document.get().getBodyOffsetLeft();
    clientTop = Document.get().getBodyOffsetTop();
    initWidget(uiBinder.createAndBindUi(this));
    footer = new HTMLPanel("");
    if (showBottomPanel) {
        footer.setStyleName(res.windowCss().footer());
        contentContainer.add(footer);//  w w  w  .  j a v  a2  s  .  co m
    }
    handleEvents();

    FocusPanel dummyFocusElement = new FocusPanel();
    dummyFocusElement.setTabIndex(0);
    dummyFocusElement.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            setFocus();
        }
    });
    contentContainer.add(dummyFocusElement);
}

From source file:org.ednovo.gooru.application.client.home.presearch.PreSearchView.java

License:Open Source License

public final void populateStandardValues() {
    for (String standardsTypesArray1 : standardsTypesArray) {
        List<String> standardsDescriptionList = Arrays.asList(standardsTypesArray1.split(","));
        LiPanel liPanel = new LiPanel();
        for (int j = 0; j < standardsDescriptionList.size(); j++) {
            HTMLPanel headerDiv = new HTMLPanel("");
            if (j == 0) {
                if (standardsDescriptionList.get(j).equalsIgnoreCase("CA SS")) {
                    liPanel.getElement().setId("CA");
                } else {
                    liPanel.getElement().setId(standardsDescriptionList.get(j));
                }/*ww w  . jav a  2  s  .com*/

                if ((!isCCSSAvailable) && standardsDescriptionList.get(j).equalsIgnoreCase("CCSS")) {
                    liPanel.getElement().setAttribute("style", "opacity:0.5;");
                } else if ((!isCAAvailable) && standardsDescriptionList.get(j).equalsIgnoreCase("CA SS")) {
                    liPanel.getElement().setAttribute("style", "opacity:0.5;");
                } else if ((!isNGSSAvailable) && standardsDescriptionList.get(j).equalsIgnoreCase("NGSS")) {
                    liPanel.getElement().setAttribute("style", "opacity:0.5;");
                } else if ((!isTEKSAvailable) && standardsDescriptionList.get(j).equalsIgnoreCase("TEKS")) {
                    liPanel.getElement().setAttribute("style", "opacity:0.5;");
                }

                headerDiv.setStyleName("liPanelStyle");
            } else {
                if (standardsDescriptionList.get(j).equalsIgnoreCase("College Career and Civic Life")) {
                    standardsDescriptionList.set(j, "College, Career, and Civic Life");
                    headerDiv.setStyleName("liPanelStylenonBold");
                    liPanel.getElement().setAttribute("standarddesc", "College, Career, and Civic Life");
                } else {
                    headerDiv.setStyleName("liPanelStylenonBold");
                    liPanel.getElement().setAttribute("standarddesc", standardsDescriptionList.get(j));
                }
            }
            headerDiv.getElement().setInnerHTML(standardsDescriptionList.get(j));
            liPanel.add(headerDiv);
        }
        if (liPanel.getElement().getAttribute("style") != null
                && !liPanel.getElement().getAttribute("style").equalsIgnoreCase("opacity:0.5;")) {
            liPanel.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    standardsDropListValues.setVisible(false);
                    String standardsVal = event.getRelativeElement().getAttribute("id");
                    String standardsDesc = event.getRelativeElement().getAttribute("standarddesc");

                    searchLiPanelWithCloseArray.clear();
                    //   setUpdatedStandards
                    /*   for(int i=0;i<ulSelectedItems.getWidgetCount();i++){
                          searchLiPanelWithCloseArray.add((LiPanelWithClose) ulSelectedItems.getWidget(i));
                       }*/

                    getUiHandlers().showStandardsPopup(standardsVal, standardsDesc,
                            searchLiPanelWithCloseArray);
                }
            });
        }
        standardsDropListValues.add(liPanel);
    }
}

From source file:org.ednovo.gooru.client.mvp.analytics.collectionSummaryTeacher.CollectionSummaryTeacherView.java

License:Open Source License

/**
 * This is used to print opened questions data
 * @param result/*from  w  w  w.j  ava  2  s . c  o m*/
 */
void setOpenendedQuestionsPrintData(ArrayList<UserDataDo> result) {
    try {
        printOpendedData.clear();
        int totalUserCount = collectionMetaData.getUserCount();
        DataTable data = DataTable.create();
        data.addColumn(ColumnType.NUMBER, i18n.GL3259());
        data.addColumn(ColumnType.STRING, i18n.GL0308());
        data.addColumn(ColumnType.STRING, i18n.GL3260());
        data.addColumn(ColumnType.STRING, i18n.GL2084());
        data.addColumn(ColumnType.STRING, i18n.GL3261());
        data.addColumn(ColumnType.STRING, i18n.GL3273());
        data.addRows(result.size());
        if (result.size() != 0) {
            for (int i = 0; i < result.size(); i++) {
                data.setCell(i, 0, result.get(i).getItemSequence(), null, getPropertiesCell());

                //Set Question Title
                Label questionTitle = new Label(AnalyticsUtil
                        .html2text(result.get(i).getTitle() != null ? result.get(i).getTitle() : ""));
                questionTitle.setStyleName(res.css().alignCenterAndBackground());
                questionTitle.addStyleName(res.css().alignLeft());
                data.setValue(i, 1, questionTitle.toString());

                //Set completion
                HTMLPanel completionpnl = new HTMLPanel("");
                Label progressBar = new Label();
                progressBar.setStyleName(res.css().setProgressBar());
                completionpnl.add(progressBar);
                Label incompleteProgressBar = new Label();
                incompleteProgressBar.setStyleName(res.css().setIncorrectProgressBar());
                completionpnl.add(incompleteProgressBar);
                int attemptedCount = result.get(i).getTotalAttemptUserCount();
                float maxAvgVal = ((float) attemptedCount) / ((float) totalUserCount);
                progressBar.getElement().getStyle().setWidth(maxAvgVal * 100, Unit.PX);
                incompleteProgressBar.getElement().getStyle().setWidth((100 - maxAvgVal * 100), Unit.PX);
                Label studentTextlbl = new Label(attemptedCount + "/" + totalUserCount + " Students");
                studentTextlbl.setStyleName(res.css().alignCenterAndBackground());
                studentTextlbl.getElement().getStyle().setWidth(100, Unit.PX);
                completionpnl.add(studentTextlbl);
                data.setValue(i, 2, completionpnl.toString());

                //Set time spent
                data.setValue(i, 3,
                        AnalyticsUtil.getTimeStampLabel(result.get(i).getAvgTimeSpent()).toString());

                //Set reactions
                int reaction = result.get(i).getAvgReaction();
                HTMLPanel reactionpnl = new HTMLPanel("");
                reactionpnl.add(new AnalyticsReactionWidget(reaction));
                Label reactioncount = new Label();
                reactionpnl.add(reactioncount);
                reactioncount.setText(reaction + "/5");
                reactioncount.setStyleName(res.css().alignCenterAndBackground());
                data.setValue(i, 4, reactionpnl.toString());

                //set View response label
                Label viewResponselbl = new Label("");
                viewResponselbl.setStyleName(res.css().viewResponseTextOpended());
                data.setValue(i, 5, viewResponselbl.toString());
            }
        }
        Options options = Options.create();
        options.setAllowHtml(true);
        final Table table = new Table(data, options);
        table.getElement().setId("opendedData");
        printOpendedData.add(table);
        if (result.size() == 0) {
            Label erroeMsg = new Label();
            erroeMsg.setStyleName(res.css().displayMessageTextForOEQuestions());
            erroeMsg.setText(i18n.GL3264());
            printOpendedData.add(erroeMsg);
        }
        //To add OE questions
        opendedQuestionHeading.setText(i18n.GL3266());
        opendedQuestionHeading.getElement().getStyle().setPaddingTop(15, Unit.PX);
        opendedQuestionHeading.getElement().getStyle().setPaddingBottom(20, Unit.PX);
        opendedQuestionHeading.getElement().getStyle().setTextAlign(TextAlign.LEFT);
        printWidget.add(opendedQuestionHeading);
        printWidget.add(printOpendedData);
        printOpendedData.getElement().getStyle().setPaddingBottom(20, Unit.PX);
    } catch (Exception e) {
        AppClientFactory.printSevereLogger(
                "CollectionSummaryTeacherView : setOpenendedQuestionsPrintData : " + e.getMessage());
    }
}

From source file:org.ednovo.gooru.client.mvp.analytics.collectionSummaryTeacher.CollectionSummaryTeacherView.java

License:Open Source License

/**
 * This method is used to set opended question data.
 * @param result//from  www.  ja  va 2 s  . c o  m
 */
void setOpenendedQuestionsData(ArrayList<UserDataDo> result) {

    int totalUserCount = collectionMetaData.getUserCount();
    DataTable data = DataTable.create();
    data.addColumn(ColumnType.NUMBER, i18n.GL3259());
    data.addColumn(ColumnType.STRING, i18n.GL0308());
    data.addColumn(ColumnType.STRING, i18n.GL3260());
    data.addColumn(ColumnType.STRING, i18n.GL2084());
    data.addColumn(ColumnType.STRING, i18n.GL3261());
    data.addColumn(ColumnType.STRING, i18n.GL3273());
    data.addRows(result.size());
    if (result.size() != 0) {

        for (int i = 0; i < result.size(); i++) {
            data.setCell(i, 0, result.get(i).getItemSequence(), null, getPropertiesCell());

            //Set Question Title
            Label questionTitle = new Label(AnalyticsUtil.html2text(result.get(i).getTitle()));
            questionTitle.setStyleName(res.css().alignCenterAndBackground());
            questionTitle.addStyleName(res.css().alignLeft());
            data.setValue(i, 1, questionTitle.toString());

            //Set completion
            HTMLPanel completionpnl = new HTMLPanel("");
            Label progressBar = new Label();
            progressBar.setStyleName(res.css().setProgressBar());
            completionpnl.add(progressBar);
            Label incompleteProgressBar = new Label();
            incompleteProgressBar.setStyleName(res.css().setIncorrectProgressBar());
            completionpnl.add(incompleteProgressBar);
            int attemptedCount = result.get(i).getTotalAttemptUserCount();
            float maxAvgVal = ((float) attemptedCount) / ((float) totalUserCount);
            progressBar.getElement().getStyle().setWidth(maxAvgVal * 100, Unit.PX);
            incompleteProgressBar.getElement().getStyle().setWidth((100 - maxAvgVal * 100), Unit.PX);
            Label studentTextlbl = new Label(attemptedCount + "/" + totalUserCount + " Students");
            studentTextlbl.setStyleName(res.css().alignCenterAndBackground());
            studentTextlbl.getElement().getStyle().setWidth(100, Unit.PX);
            completionpnl.add(studentTextlbl);
            data.setValue(i, 2, completionpnl.toString());

            //Set time spent
            data.setValue(i, 3, AnalyticsUtil.getTimeStampLabel(result.get(i).getAvgTimeSpent()).toString());

            //Set reactions
            int reaction = result.get(i).getAvgReaction();
            HTMLPanel reactionpnl = new HTMLPanel("");
            reactionpnl.add(new AnalyticsReactionWidget(reaction));
            Label reactioncount = new Label();
            reactionpnl.add(reactioncount);
            reactioncount.setText(reaction + "/5");
            reactioncount.setStyleName(res.css().alignCenterAndBackground());
            data.setValue(i, 4, reactionpnl.toString());

            //set View response label
            Label viewResponselbl = new Label(i18n.GL2286());
            viewResponselbl.setStyleName(res.css().viewResponseTextOpended());
            viewResponselbl.getElement().setAttribute("resourceGooruId", result.get(i).getResourceGooruOId());
            viewResponselbl.getElement().setAttribute("questionType", result.get(i).getType());
            viewResponselbl.getElement().setAttribute("labelType", "View Response");
            data.setValue(i, 5, viewResponselbl.toString());
        }
    }
    Options options = Options.create();
    options.setAllowHtml(true);
    final Table table = new Table(data, options);
    table.getElement().setId("opendedData");
    teacherOpenendedData.add(table);
    if (result.size() == 0) {
        Label erroeMsg = new Label();
        erroeMsg.setStyleName(res.css().displayMessageTextForOEQuestions());
        erroeMsg.setText(i18n.GL3118());
        teacherOpenendedData.add(erroeMsg);
    }
    table.addDomHandler(new ClickOnTableCell(), ClickEvent.getType());
    table.getElement().getFirstChildElement().getFirstChildElement().getFirstChildElement().getStyle()
            .setProperty("width", "98% !important");
}

From source file:org.ednovo.gooru.client.mvp.analytics.collectionSummaryTeacher.CollectionSummaryTeacherView.java

License:Open Source License

/**
 * This method is used to print collection breakdown data
 * @param result/* w ww. j  a  va  2s . com*/
 */
void setCollectionBreakDownPrintData(ArrayList<UserDataDo> result) {
    try {
        printResourceData.clear();
        UserDataDo maxAvgValue = Collections.max(result, new Comparator<UserDataDo>() {
            public int compare(UserDataDo o1, UserDataDo o2) {
                Long obj1 = new Long(o1.getTimeSpent());
                Long obj2 = new Long(o2.getTimeSpent());
                return obj1.compareTo(obj2);
            }
        });

        final DataTable data = DataTable.create();
        data.addColumn(ColumnType.NUMBER, i18n.GL3259());
        data.addColumn(ColumnType.STRING, i18n.GL3267());
        data.addColumn(ColumnType.STRING, i18n.GL3182());
        data.addColumn(ColumnType.STRING, i18n.GL3268());
        data.addColumn(ColumnType.STRING, i18n.GL0934());
        data.addColumn(ColumnType.STRING, i18n.GL3261());
        int rowCount = 0, rowVal = 0;
        for (int i = 0; i < result.size(); i++) {
            rowCount = rowCount + 1;
        }
        data.addRows(rowCount);

        for (int i = 0; i < result.size(); i++) {
            data.setCell(rowVal, 0, result.get(i).getItemSequence(), null, getPropertiesCell());
            //set Format
            String resourceCategory = result.get(i).getResourceFormat() != null
                    ? result.get(i).getResourceFormat().trim()
                    : "";
            String categoryStyle = "";
            if (resourceCategory.equalsIgnoreCase("website") || resourceCategory.equalsIgnoreCase("webpage")) {
                resourceCategory = "webpage";
                categoryStyle = res.css().category_new_type_webpage();
            } else if (resourceCategory.equalsIgnoreCase("slide")
                    || resourceCategory.equalsIgnoreCase("image")) {
                resourceCategory = "image";
                categoryStyle = res.css().category_new_type_image();
            } else if (resourceCategory.equalsIgnoreCase("handout")
                    || resourceCategory.equalsIgnoreCase("lesson")
                    || resourceCategory.equalsIgnoreCase("textbook")
                    || resourceCategory.equalsIgnoreCase("text")) {
                resourceCategory = "text";
                categoryStyle = res.css().category_new_type_text();
            } else if (resourceCategory.equalsIgnoreCase("exam")) {
                resourceCategory = "webpage";
                categoryStyle = res.css().category_new_type_webpage();
            } else if (resourceCategory.equalsIgnoreCase("video")) {
                resourceCategory = "video";
                categoryStyle = res.css().category_new_type_video();
            } else if (resourceCategory.equalsIgnoreCase("interactive")) {
                resourceCategory = "webpage";
                categoryStyle = res.css().category_new_type_interactive();
            } else if (resourceCategory.equalsIgnoreCase("audio")) {
                resourceCategory = "audio";
                categoryStyle = res.css().category_new_type_audio();
            } else {
                categoryStyle = res.css().category_new_type_other();
            }
            Label categorylbl = new Label();
            categorylbl.addStyleName(categoryStyle);
            categorylbl.addStyleName(res.css().setMarginAuto());
            data.setValue(rowVal, 1, categorylbl.toString());

            //Set Question Title
            Label questionTitle = new Label(AnalyticsUtil.html2text(result.get(i).getTitle()));
            questionTitle.setStyleName(res.css().alignCenterAndBackground());
            questionTitle.addStyleName(res.css().alignLeft());
            data.setValue(rowVal, 2, questionTitle.toString());

            //Set time spent
            HorizontalPanel timeSpentpnl = new HorizontalPanel();
            timeSpentpnl.add(AnalyticsUtil.getTimeStampLabel(result.get(i).getAvgTimeSpent()));
            Label progressBar = new Label();
            progressBar.setStyleName(res.css().setProgressBar());
            timeSpentpnl.add(progressBar);
            double maxAvgVal = ((double) result.get(i).getAvgTimeSpent())
                    / ((double) maxAvgValue.getTimeSpent());
            progressBar.getElement().getStyle().setWidth(maxAvgVal * 100, Unit.PX);
            data.setValue(rowVal, 3, timeSpentpnl.toString());

            //set Views label
            //HorizontalPanel viewpnl=new HorizontalPanel();
            Label viewlbl = new Label(Integer.toString(result.get(i).getViews()));
            viewlbl.setStyleName(res.css().alignCenterAndBackground());
            /* viewpnl.add(viewlbl);
             Label viewProgressBar=new Label();
             viewProgressBar.setStyleName(res.css().setProgressBar());
             viewpnl.add(viewProgressBar);
             float maxViewVal = ((float) result.get(i).getViews())/((float) maxViews.getViews());
             viewProgressBar.getElement().getStyle().setWidth(maxViewVal*100, Unit.PX);*/
            data.setValue(rowVal, 4, viewlbl.toString());

            //Set reactions
            int reaction = result.get(i).getAvgReaction();
            HTMLPanel reactionpnl = new HTMLPanel("");
            reactionpnl.add(new AnalyticsReactionWidget(reaction));
            Label reactioncount = new Label();
            reactionpnl.add(reactioncount);
            reactioncount.setText(reaction + "/5");
            reactioncount.setStyleName(res.css().alignCenterAndBackground());
            data.setValue(rowVal, 5, reactionpnl.toString());
            rowVal++;
        }
        final Options options = Options.create();
        options.setAllowHtml(true);
        Table table = new Table(data, options);
        printResourceData.add(table);
        printWidget.add(printResourceData);
    } catch (Exception e) {
        AppClientFactory.printSevereLogger(
                "CollectionSummaryTeacherView : setCollectionBreakDownPrintData : " + e.getMessage());
    }
}

From source file:org.ednovo.gooru.client.mvp.analytics.collectionSummaryTeacher.CollectionSummaryTeacherView.java

License:Open Source License

/**
 * This method is used to display collection break down data.
 * @param result//ww  w.jav  a 2 s.c o  m
 * @param loadingImage
 */
void setCollectionBreakDown(ArrayList<UserDataDo> result, HTMLPanel loadingImage) {

    final int[] primitivesQuestions = AnalyticsUtil.toIntArray(questionRowIndex);
    final int[] primitivesResources = AnalyticsUtil.toIntArray(resourceRowIndex);

    UserDataDo maxAvgValue = Collections.max(result, new Comparator<UserDataDo>() {
        public int compare(UserDataDo o1, UserDataDo o2) {
            Long obj1 = new Long(o1.getTimeSpent());
            Long obj2 = new Long(o2.getTimeSpent());
            return obj1.compareTo(obj2);
        }
    });

    final DataTable data = DataTable.create();
    data.addColumn(ColumnType.NUMBER, i18n.GL3259());
    data.addColumn(ColumnType.STRING, i18n.GL3267());
    data.addColumn(ColumnType.STRING, i18n.GL3182());
    data.addColumn(ColumnType.STRING, i18n.GL3268());
    data.addColumn(ColumnType.STRING, i18n.GL0934());
    data.addColumn(ColumnType.STRING, i18n.GL3261());
    int rowCount = 0, rowVal = 0;
    for (int i = 0; i < result.size(); i++) {
        rowCount = rowCount + 1;
    }
    data.addRows(rowCount);
    for (int i = 0; i < result.size(); i++) {
        data.setCell(rowVal, 0, result.get(i).getItemSequence(), null, getPropertiesCell());
        //set Format
        String resourceCategory = result.get(i).getResourceFormat() != null
                ? result.get(i).getResourceFormat().trim()
                : "";
        String categoryStyle = "";
        if (resourceCategory.equalsIgnoreCase("website") || resourceCategory.equalsIgnoreCase("webpage")) {
            resourceCategory = "webpage";
            categoryStyle = res.css().category_new_type_webpage();
        } else if (resourceCategory.equalsIgnoreCase("slide") || resourceCategory.equalsIgnoreCase("image")) {
            resourceCategory = "image";
            categoryStyle = res.css().category_new_type_image();
        } else if (resourceCategory.equalsIgnoreCase("handout") || resourceCategory.equalsIgnoreCase("lesson")
                || resourceCategory.equalsIgnoreCase("textbook") || resourceCategory.equalsIgnoreCase("text")) {
            resourceCategory = "text";
            categoryStyle = res.css().category_new_type_text();
        } else if (resourceCategory.equalsIgnoreCase("exam")) {
            resourceCategory = "webpage";
            categoryStyle = res.css().category_new_type_webpage();
        } else if (resourceCategory.equalsIgnoreCase("video")) {
            resourceCategory = "video";
            categoryStyle = res.css().category_new_type_video();
        } else if (resourceCategory.equalsIgnoreCase("interactive")) {
            resourceCategory = "webpage";
            categoryStyle = res.css().category_new_type_interactive();
        } else if (resourceCategory.equalsIgnoreCase("audio")) {
            resourceCategory = "audio";
            categoryStyle = res.css().category_new_type_audio();
        } else {
            categoryStyle = res.css().category_new_type_other();
        }
        Label categorylbl = new Label();
        categorylbl.addStyleName(categoryStyle);
        categorylbl.addStyleName(res.css().setMarginAuto());
        data.setValue(rowVal, 1, categorylbl.toString());

        //Set Question Title
        Label questionTitle = new Label(
                AnalyticsUtil.html2text(result.get(i).getTitle() != null ? result.get(i).getTitle() : ""));
        questionTitle.setStyleName(res.css().alignCenterAndBackground());
        questionTitle.addStyleName(res.css().alignLeft());
        data.setValue(rowVal, 2, questionTitle.toString());

        //Set time spent
        HorizontalPanel timeSpentpnl = new HorizontalPanel();
        timeSpentpnl.add(AnalyticsUtil.getTimeStampLabel(result.get(i).getAvgTimeSpent()));
        Label progressBar = new Label();
        progressBar.setStyleName(res.css().setProgressBar());
        timeSpentpnl.add(progressBar);
        double maxAvgVal = ((double) result.get(i).getAvgTimeSpent()) / ((double) maxAvgValue.getTimeSpent());
        progressBar.getElement().getStyle().setWidth(maxAvgVal * 100, Unit.PX);
        data.setValue(rowVal, 3, timeSpentpnl.toString());

        //set Views label
        Label viewlbl = new Label(Integer.toString(result.get(i).getViews()));
        viewlbl.setStyleName(res.css().alignCenterAndBackground());

        data.setValue(rowVal, 4, viewlbl.toString());

        //Set reactions
        int reaction = result.get(i).getAvgReaction();
        HTMLPanel reactionpnl = new HTMLPanel("");
        reactionpnl.add(new AnalyticsReactionWidget(reaction));
        Label reactioncount = new Label();
        reactionpnl.add(reactioncount);
        reactioncount.setText(reaction + "/5");
        reactioncount.setStyleName(res.css().alignCenterAndBackground());
        data.setValue(rowVal, 5, reactionpnl.toString());
        rowVal++;
    }
    final Options options = Options.create();
    options.setAllowHtml(true);
    Table table = new Table(data, options);
    table.getElement().setId("collectionBreakDown");
    teacherResourceBreakdownData.add(table);
    table.getElement().getFirstChildElement().getFirstChildElement().getFirstChildElement().getStyle()
            .setProperty("width", "98% !important");
    filterDropDown.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            teacherResourceBreakdownData.clear();
            int selectedIndex = filterDropDown.getSelectedIndex();
            operationsView = DataView.create(data);
            Table table = new Table(operationsView, options);
            table.setStyleName("collectionProgressTable");
            table.getElement().setId("collectionBreakDown");
            if (selectedIndex == 1) {
                operationsView.hideRows(primitivesResources);
                teacherResourceBreakdownData.add(table);
                if (primitivesQuestions.length == 0) {
                    Label erroeMsg = new Label();
                    erroeMsg.setStyleName(res.css().displayMessageTextForOEQuestions());
                    erroeMsg.setText(i18n.GL3274());
                    teacherResourceBreakdownData.add(erroeMsg);
                }
            } else if (selectedIndex == 2) {
                operationsView.hideRows(primitivesQuestions);
                teacherResourceBreakdownData.add(table);
                if (primitivesResources.length == 0) {
                    Label erroeMsg = new Label();
                    erroeMsg.setStyleName(res.css().displayMessageTextForOEQuestions());
                    erroeMsg.setText(i18n.GL3275());
                    teacherResourceBreakdownData.add(erroeMsg);
                }
            } else {
                teacherResourceBreakdownData.add(table);
            }
            table.addDomHandler(new ClickOnTableCell(), ClickEvent.getType());
        }
    });
    loadingImage.setVisible(false);

}

From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.end.study.AssessmentsHomeMetadataView.java

License:Open Source License

public void setReplyLink() {
    Anchor resourceAnchor = new Anchor();
    resourceAnchor.setHref(getReplayLink());
    resourceAnchor.setStyleName("");
    HTMLPanel collectionHTMLPanel = new HTMLPanel("");
    resourceAnchor.addClickHandler(new ReplayCollectionEvent());
    collectionHTMLPanel.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().collectionreplay());
    Label collectionReplayButton = new Label(i18n.GL0632());
    collectionReplayButton.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().collectionreplayText());
    collectionHTMLPanel.add(collectionReplayButton);
    resourceAnchor.getElement().appendChild(collectionHTMLPanel.getElement());
}