Example usage for com.google.gwt.user.client.ui Label setText

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

Introduction

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

Prototype

public void setText(String text) 

Source Link

Document

Sets the label's content to the given text.

Usage

From source file:org.ednovo.gooru.client.mvp.classpage.studentclassview.reports.assessmentreport.AssessmentProgressReportChildView.java

License:Open Source License

@Override
public void setQuestionsData(final ArrayList<UserDataDo> result, String contentType) {
    loadingImageLabel.setVisible(false);
    questionsTable.setVisible(true);/*from   w  w  w .  j a va2 s  . com*/
    questionsTable.clear();
    if (isTableToDestroy) {
        isTableToDestroy = false;
        destoryTables();
    }

    if (result.size() > 0) {
        final AdvancedFlexTable adTable = new AdvancedFlexTable();
        adTable.removeAllRows();
        adTable.getElement().setId("report-student-assessment-report");
        adTable.addStyleName("table table-bordered reportTableStyle");
        questionsTable.add(adTable);

        Label heading1 = new Label(i18n.GL3259());
        Label heading2 = new Label(i18n.GL0308());

        String heading3Str = i18n.GL0315();
        if (contentType.equalsIgnoreCase(OE)) {
            heading3Str = i18n.GL3262();
        }
        Label heading3 = new Label(heading3Str);

        String heading4Str = i18n.GL2288();
        if (contentType.equalsIgnoreCase(OE)) {
            heading4Str = i18n.GL3260();
        }
        Label heading4 = new Label(heading4Str);

        Label heading5 = new Label(i18n.GL2084());
        Label heading6 = new Label(i18n.GL3271());

        heading1.addStyleName("headingLabel");
        heading2.addStyleName("headingLabel");
        heading3.addStyleName("headingLabel");
        heading4.addStyleName("headingLabel");
        heading5.addStyleName("headingLabel");
        heading6.addStyleName("headingLabel");

        adTable.setHeaderWidget(0, heading1);
        adTable.setHeaderWidget(1, heading2);
        adTable.setHeaderWidget(2, heading3);
        adTable.setHeaderWidget(3, heading4);
        adTable.setHeaderWidget(4, heading5);
        adTable.setHeaderWidget(5, heading6);
        for (int i = 0; i < result.size(); i++) {
            Label questionTitle = new Label(AnalyticsUtil.html2text(result.get(i).getTitle()));
            questionTitle.setStyleName(STYLE_TABLE_CENTER);
            questionTitle.setStyleName(STYLE_TXTLEFT);
            adTable.setWidget(i, 0, new Label(String.valueOf(result.get(i).getSequence())));
            adTable.setWidget(i, 1, questionTitle);

            int noOfAttempts = result.get(i).getAttempts();
            String scoreStatus = result.get(i).getStatus();

            //Set Answer choices
            String questionType = result.get(i).getType();
            if (questionType.equalsIgnoreCase("HS")) {
                questionType = result.get(i).getQuestionType();
            }
            if (MC.equalsIgnoreCase(questionType) || TF.equalsIgnoreCase(questionType)
                    || TSLASHF.equalsIgnoreCase(questionType)) {
                Label anserlbl = new Label();
                if (result.get(i).getMetaData() != null && result.get(i).getOptions() != null) {
                    Map<String, Integer> authorObject = result.get(i).getOptions();

                    for (Map.Entry<String, Integer> entry : authorObject.entrySet()) {
                        String userSelectedOption = entry.getKey();
                        // int ansStatus=entry.getValue();
                        if (userSelectedOption != null) {
                            anserlbl.setText(userSelectedOption);
                            if (STATUS_CORRECT.equalsIgnoreCase(scoreStatus) && noOfAttempts == 1) {
                                anserlbl.getElement().getStyle().setColor(CORRECT);
                            } else if (STATUS_CORRECT.equalsIgnoreCase(scoreStatus) && noOfAttempts > 1) {
                                anserlbl.getElement().getStyle().setColor(ONMULTIPULEATTEMPTS);
                            } else {
                                anserlbl.getElement().getStyle().setColor(INCORRECT);
                            }
                        }
                    }
                }
                anserlbl.setStyleName(STYLE_TABLE_CENTER);
                adTable.setWidget(i, 2, anserlbl);
            } else if (FIB.equalsIgnoreCase(questionType)) {
                VerticalPanel answerspnl = new VerticalPanel();

                if (result.get(i).getAnswerObject() != null) {
                    JSONValue value = JSONParser.parseStrict(result.get(i).getAnswerObject());
                    JSONObject answerObject = value.isObject();
                    Set<String> keys = answerObject.keySet();
                    Iterator<String> itr = keys.iterator();
                    while (itr.hasNext()) {
                        answerspnl.clear();
                        JSONArray attemptsObj = (JSONArray) answerObject.get(itr.next().toString());
                        for (int j = 0; j < attemptsObj.size(); j++) {
                            Label answerChoice = new Label();
                            boolean skip = attemptsObj.get(j).isObject().get("skip").isBoolean().booleanValue();
                            String status = attemptsObj.get(j).isObject().get("status").isString()
                                    .stringValue();
                            String fibtext = attemptsObj.get(j).isObject().get("text").isString().stringValue();
                            if (skip == false) {
                                answerChoice.setText(fibtext);
                                if (ZERO_NUMERIC.equalsIgnoreCase(status)) {
                                    answerChoice.getElement().getStyle().setColor(INCORRECT);
                                } else if (ONE.equalsIgnoreCase(status) && (noOfAttempts == 1)) {
                                    answerChoice.getElement().getStyle().setColor(CORRECT);
                                } else if (ONE.equalsIgnoreCase(status) && (noOfAttempts > 1)) {
                                    answerChoice.getElement().getStyle().setColor(ONMULTIPULEATTEMPTS);
                                }
                            }
                            answerChoice.setStyleName(STYLE_TABLE_CENTER);
                            answerspnl.add(answerChoice);
                        }
                    }
                }
                answerspnl.setStyleName(STYLE_MARGIN_AUTO);
                adTable.setWidget(i, 2, answerspnl);
                //data.setValue(i, 2, answerspnl.toString());
            } else if (MA.equalsIgnoreCase(questionType)) {
                VerticalPanel answerspnl = new VerticalPanel();
                if (result.get(i).getAnswerObject() != null) {
                    JSONValue value = JSONParser.parseStrict(result.get(i).getAnswerObject());
                    JSONObject answerObject = value.isObject();
                    Set<String> keys = answerObject.keySet();
                    Iterator<String> itr = keys.iterator();
                    while (itr.hasNext()) {
                        answerspnl.clear();
                        JSONArray attemptsObj = (JSONArray) answerObject.get(itr.next().toString());
                        for (int j = 0; j < attemptsObj.size(); j++) {
                            Label answerChoice = new Label();
                            String showMessage = null;
                            boolean skip = attemptsObj.get(j).isObject().get("skip").isBoolean().booleanValue();
                            String status = attemptsObj.get(j).isObject().get("status").isString()
                                    .stringValue();
                            String matext = attemptsObj.get(j).isObject().get("text").isString().stringValue();
                            if (skip == false) {
                                if (ZERO_NUMERIC.equalsIgnoreCase(matext)) {
                                    showMessage = i18n.GL_GRR_NO();
                                } else if (ONE.equalsIgnoreCase(matext)) {
                                    showMessage = i18n.GL_GRR_YES();
                                }
                                answerChoice.setText(showMessage);
                                if (ZERO_NUMERIC.equalsIgnoreCase(status)) {
                                    answerChoice.getElement().getStyle().setColor(INCORRECT);
                                } else if (ONE.equalsIgnoreCase(status) && (noOfAttempts == 1)) {
                                    answerChoice.getElement().getStyle().setColor(CORRECT);
                                } else if (ONE.equalsIgnoreCase(status) && (noOfAttempts > 1)) {
                                    answerChoice.getElement().getStyle().setColor(ONMULTIPULEATTEMPTS);
                                }
                            }
                            answerChoice.setStyleName(STYLE_TABLE_CENTER);
                            answerspnl.add(answerChoice);
                        }
                    }
                }
                answerspnl.setStyleName(STYLE_MARGIN_AUTO);
                adTable.setWidget(i, 2, answerspnl);
            } else if (HT_RO.equalsIgnoreCase(questionType) || HT_HL.equalsIgnoreCase(questionType)
                    || HS_TXT.equalsIgnoreCase(questionType) || HS_IMG.equalsIgnoreCase(questionType)
                    || OE.equalsIgnoreCase(questionType)) {
                if (result.get(i).getAnswerObject() != null
                        && !result.get(i).getStatus().equalsIgnoreCase("skipped")) {
                    Label viewResponselbl = new Label(VIEWRESPONSE);
                    viewResponselbl.setStyleName("summaryViewResponse");
                    viewResponselbl.getElement().setAttribute("resourceGooruId",
                            result.get(i).getResourceGooruOId());
                    viewResponselbl.getElement().setAttribute("questionType", result.get(i).getType());
                    viewResponselbl.getElement().setAttribute("answerObj", result.get(i).getAnswerObject());
                    viewResponselbl.getElement().setAttribute("attempts", String.valueOf(noOfAttempts));
                    viewResponselbl.addClickHandler(new SummaryPopupClick(result.get(i)));
                    adTable.setWidget(i, 2, viewResponselbl);
                }
            }
            //Set attempts
            Label attempts = new Label(i18n.GL2269());
            attempts.setStyleName(STYLE_TABLE_CENTER);
            attempts.getElement().getStyle().setColor(ONMULTIPULEATTEMPTS);

            if (OE.equalsIgnoreCase(questionType)) {
                Label completion = new Label();
                completion.setStyleName("alignCenterAndBackground");
                if (noOfAttempts > 0) {
                    completion.setText(i18n.GL_GRR_YES());
                } else {
                    completion.setText(i18n.GL_GRR_NO());
                }
                adTable.setWidget(i, 3, completion);
            } else {
                if (STATUS_INCORRECT.equalsIgnoreCase(scoreStatus)) {
                    adTable.setWidget(i, 3, attempts);
                    adTable.getRowFormatter().addStyleName(i, STYLE_WHITE);
                } else if (STATUS_CORRECT.equalsIgnoreCase(scoreStatus)) {
                    Image correctImg = new Image();
                    correctImg.setUrl(urlDomain + "/images/analytics/tick.png");
                    adTable.setWidget(i, 3, correctImg);
                    adTable.getRowFormatter().addStyleName(i, STYLE_GREEN);
                }
            }

            //Set time spent
            adTable.setWidget(i, 4, AnalyticsUtil.getTimeStampLabel(result.get(i).getTimeSpent()));

            //Set reactions
            int reaction = result.get(i).getReaction();
            adTable.setWidget(i, 5, new AnalyticsReactionWidget(reaction));
        }
        //         sortAndFixed();
    } else {
        setErrorData(questionsTable);
    }
}

From source file:org.ednovo.gooru.client.mvp.classpage.studentclassview.reports.assessmentreport.AssessmentProgressReportChildView.java

License:Open Source License

private void setErrorData(HTMLPanel globalPanel) {
    if (!isExternalAssessment) {
        Label erroeMsg = new Label();
        erroeMsg.setStyleName(STYLE_ERROR_MSG);
        if (collectionOverviewPanel.isVisible()) {
            if (collectionOverviewBtn.getStyleName() != null
                    && collectionOverviewBtn.getStyleName().contains(CssTokens.ACTIVE)) {
                erroeMsg.setText(i18n.GL3467());
            }/*www.j ava 2s . c om*/
            if (questionsBtn.getStyleName() != null && questionsBtn.getStyleName().contains(CssTokens.ACTIVE)) {
                erroeMsg.setText(i18n.GL3264());
            }
            if (oeQuestionsBtn.getStyleName() != null
                    && oeQuestionsBtn.getStyleName().contains(CssTokens.ACTIVE)) {
                erroeMsg.setText(i18n.GL3265());
            }
        } else {
            erroeMsg.setText(i18n.GL3265());
        }
        globalPanel.add(erroeMsg);
    }
}

From source file:org.ednovo.gooru.client.mvp.classpage.teach.reports.unit.TeachUnitReportChildView.java

License:Open Source License

@Override
public void setAssessmentTableData(ArrayList<PlanProgressDo> userList) {
    boolean isCollection = false;
    String contentView = AppClientFactory.getPlaceManager().getRequestParameter(
            UrlNavigationTokens.TEACHER_CLASSPAGE_CONTENT, UrlNavigationTokens.TEACHER_CLASSPAGE_ASSESSMENT);
    if (contentView.equalsIgnoreCase(UrlNavigationTokens.TEACHER_CLASSPAGE_COLLECTION)) {
        isCollection = true;/*from  w w w.j  ava  2  s. c om*/
    }

    unitTablePanel.clear();
    assessmentTableWidget.getElement().setId("unit-table-report-data-id");
    unitTablePanel.add(assessmentTableWidget);
    unitTablePanel.getElement().setId("courseTableID");
    unitTablePanel.getElement().setClassName("scrollTBL");
    assessmentTableWidget.addStyleName("table table-bordered tableStyle");

    int rowCount = userList.size();

    Label studentNameLbl = new Label("");
    studentNameLbl.setStyleName("");
    studentNameLbl.setWidth("100px");
    assessmentTableWidget.setWidget(0, 1, studentNameLbl);
    assessmentTableWidget.getWidget(0, 1).getElement().getParentElement().getStyle()
            .setBackgroundColor("#f8fafb");

    for (int rowWidgetCount = 0; rowWidgetCount < rowCount; rowWidgetCount++) {
        String color = "#fff";
        if (rowWidgetCount % 2 == 1) {
            color = "#f8fafb";
        }
        int columnWidgetCount = 0;
        if (columnWidgetCount == 0) {
            Anchor studentName = new Anchor(userList.get(rowWidgetCount).getUserName()); //
            studentName.setStyleName("myclasses-mastery-unit-cell-style");
            studentName.addClickHandler(new StudentUnitView(userList.get(rowWidgetCount).getUserName(),
                    userList.get(rowWidgetCount).getUserUId()));
            assessmentTableWidget.setWidget(rowWidgetCount + 2, columnWidgetCount, studentName);
            assessmentTableWidget.getWidget(rowWidgetCount + 2, columnWidgetCount).getElement()
                    .getParentElement().getStyle().setBackgroundColor(color);

            if (rowWidgetCount == 0) {
                HTML studentNameTitle = new HTML("Student");
                assessmentTableWidget.setWidget(rowWidgetCount + 1, columnWidgetCount, studentNameTitle);
                assessmentTableWidget.getWidget(rowWidgetCount + 1, columnWidgetCount).getElement()
                        .getParentElement().getStyle().setBackgroundColor("#f8fafb");
                assessmentTableWidget.getWidget(rowWidgetCount + 1, columnWidgetCount).getElement()
                        .getParentElement().getStyle().setFontWeight(FontWeight.BOLD);
            }
            columnWidgetCount++;
        }
        ArrayList<PlanProgressDo> lessonList = userList.get(rowWidgetCount).getUsageData();
        int lessonCount = lessonList.size();
        for (int lessonWidgetCount = 0; lessonWidgetCount < lessonCount; lessonWidgetCount++) {
            ArrayList<PlanProgressDo> collectionList = lessonList.get(lessonWidgetCount).getUsageData();
            int collectionCount = collectionList.size();
            for (int collectionWidgetCount = 0; collectionWidgetCount < collectionCount; collectionWidgetCount++) {
                if (rowWidgetCount == 0) {
                    String A_STRING = "A";
                    if (isCollection) {
                        A_STRING = "C";
                    }
                    Label scoreLblTitle = new Label(A_STRING + (collectionWidgetCount + 1));
                    scoreLblTitle.setWidth("80px");
                    String type = collectionList.get(collectionWidgetCount).getType();
                    if (type != null && type.equalsIgnoreCase("assessment/url")) {
                        scoreLblTitle
                                .addMouseOverHandler(new MouseOverShowClassCodeToolTip("External Assessment"));
                        scoreLblTitle.addMouseOutHandler(new MouseOutHideToolTip());
                    } else {
                        scoreLblTitle.addStyleName("myclasses-mastery-collection-cell-style");
                        scoreLblTitle.addClickHandler(
                                new CollectionAssessmentView(lessonList.get(lessonWidgetCount).getGooruOId(),
                                        collectionList.get(collectionWidgetCount).getGooruOId(), contentView,
                                        A_STRING + " " + (collectionWidgetCount + 1) + " "
                                                + collectionList.get(collectionWidgetCount).getTitle()));
                    }
                    assessmentTableWidget.setWidget(rowWidgetCount + 1, columnWidgetCount, scoreLblTitle);
                    assessmentTableWidget.getWidget(rowWidgetCount + 1, columnWidgetCount).getElement()
                            .getParentElement().getStyle().setBackgroundColor("#f8fafb");
                    assessmentTableWidget.getWidget(rowWidgetCount + 1, columnWidgetCount).getElement()
                            .getParentElement().getStyle().setFontWeight(FontWeight.BOLD);
                }
                final Label contentLabel = new Label("");
                if (isCollection) {
                    contentLabel.setText(StringUtil
                            .getFormattedDate(collectionList.get(collectionWidgetCount).getTimeSpent(), ""));
                    assessmentTableWidget.setWidget(rowWidgetCount + 2, columnWidgetCount, contentLabel);
                    assessmentTableWidget.getWidget(rowWidgetCount + 2, columnWidgetCount).getElement()
                            .getParentElement().getStyle().setBackgroundColor(color);
                } else {
                    int score = collectionList.get(collectionWidgetCount).getScoreInPercentage();
                    int views = collectionList.get(collectionWidgetCount).getViews();
                    String scoreStr = "--";
                    if (views > 0 && score >= 0) {
                        scoreStr = score + "%";
                    }
                    contentLabel.setText(scoreStr);
                    contentLabel.setWidth("80px");
                    if (!scoreStr.equalsIgnoreCase("--")) {
                        contentLabel.setStyleName("cursorPointer");
                        contentLabel.addClickHandler(
                                new StudentPlaySummary(userList.get(rowWidgetCount).getUserName(),
                                        userList.get(rowWidgetCount).getUserUId(),
                                        lessonList.get(lessonWidgetCount).getGooruOId(),
                                        collectionList.get(collectionWidgetCount).getGooruOId(),
                                        collectionList.get(collectionWidgetCount).getType()));
                    }
                    assessmentTableWidget.setWidget(rowWidgetCount + 2, columnWidgetCount, contentLabel);
                    if (score >= 0 && score <= 100) {
                        if (views > 0) {
                            assessmentTableWidget.getWidget(rowWidgetCount + 2, columnWidgetCount).getElement()
                                    .getParentElement().setClassName(StringUtil.getHighlightStyle(score));
                        } else {
                            assessmentTableWidget.getWidget(rowWidgetCount + 2, columnWidgetCount).getElement()
                                    .getParentElement().getStyle().setBackgroundColor(color);
                        }
                    } else {
                        assessmentTableWidget.getWidget(rowWidgetCount + 2, columnWidgetCount).getElement()
                                .getParentElement().getStyle().setBackgroundColor(color);
                    }
                }
                columnWidgetCount++;
            }
        }
    }
    if (userList != null && userList.size() > 0 && userList.get(0) != null) {
        int lessonSize = userList.get(0).getUsageData().size();

        for (int headerColumnCount = 0; headerColumnCount < lessonSize; headerColumnCount++) {
            int colSpan = 0;
            PlanProgressDo lessonDo = userList.get(0).getUsageData().get(headerColumnCount);
            if (lessonDo.getUsageData().size() > 0) {
                HTML unitName = new HTML("L" + (headerColumnCount + 1) + "&nbsp;" + lessonDo.getTitle());
                unitName.setStyleName("");
                assessmentTableWidget.setWidget(0, headerColumnCount + 1, unitName);
                assessmentTableWidget.getWidget(0, headerColumnCount + 1).getElement().getParentElement()
                        .getStyle().setBackgroundColor("#f8fafb");
                assessmentTableWidget.getWidget(0, headerColumnCount + 1).getElement().getParentElement()
                        .getStyle().setFontWeight(FontWeight.BOLD);
                colSpan = colSpan + lessonDo.getUsageData().size();
                assessmentTableWidget.getFlexCellFormatter().setColSpan(0, (headerColumnCount + 1), colSpan);
            }
        }
    }
}

From source file:org.ednovo.gooru.client.mvp.classpages.edit.AssignmentProgressVc.java

License:Open Source License

public Label createLabel(String title) {
    Label lblLabel = new Label();
    lblLabel.setText(title);
    lblLabel.getElement().addClassName(res.css().myFolderCollectionFolderDropdown());
    lblLabel.getElement().addClassName(res.css().myFolderCollectionFolderVideoTitle());
    lblLabel.getElement().setAttribute("alt", title);
    lblLabel.getElement().setAttribute("title", title);
    lblLabel.getElement().setAttribute("id", title);
    lblLabel.addClickHandler(new ClickHandler() {

        @Override/* w  w  w  .  jav a 2s . c  om*/
        public void onClick(ClickEvent event) {
            Label lbl = (Label) event.getSource();
            resourceCategoryLabel.setText(lbl.getText());
            resourceCategoryLabel.getElement().setAttribute("alt", lbl.getText());
            resourceCategoryLabel.getElement().setAttribute("title", lbl.getText());

            AppClientFactory.getInjector().getClasspageService().v2ChangeAssignmentSequence("",
                    classpageItemDo.getCollectionItemId(), Integer.parseInt(lbl.getText()),
                    new SimpleAsyncCallback<Void>() {

                        @Override
                        public void onSuccess(Void result) {
                            resourceTypePanel.setVisible(resourceTypePanel.isVisible() ? false : true);
                            AppClientFactory.fireEvent(new ResetProgressEvent());
                        }
                    });
        }
    });
    return lblLabel;
}

From source file:org.ednovo.gooru.client.mvp.folder.toc.FolderTocView.java

License:Open Source License

@Override
public void setFolderItems(FolderTocDo foldersTocObj) {
    folderTocTree.clear();//from   w  w w  .  ja  v a  2  s. co m
    showPageNotFound(false);
    setFolderMetaData(foldersTocObj);
    if (foldersTocObj != null) {
        List<FolderDo> foldersArrayList = foldersTocObj.getCollectionItems();
        if (foldersArrayList.size() > 0) {
            for (int i = 0; i < foldersArrayList.size(); i++) {
                FolderDo floderDo = foldersArrayList.get(i);
                if (FOLDER.equalsIgnoreCase(floderDo.getType())) {
                    TreeItem folderItem = new TreeItem(
                            new FolderTreeItem(null, floderDo.getTitle(), floderDo.getGooruOid()));
                    folderTocTree.addItem(folderItem);
                    adjustTreeItemStyle(folderItem, floderDo.getType(), 0);
                } else if (COLLECTION.equalsIgnoreCase(floderDo.getType())
                        || SCOLLECTION.equalsIgnoreCase(floderDo.getType())) {
                    TreeItem folderItem = new TreeItem(new FolderCollectionView(null, floderDo, null));
                    folderTocTree.addItem(folderItem);
                    adjustTreeItemStyle(folderItem, floderDo.getType(), 0);
                }
            }
            floderTreeContainer.clear();
            floderTreeContainer.add(folderTocTree);
        } else {
            Label emptyLbl = new Label();
            emptyLbl.setText(EMPTY_FOLDER);
            emptyLbl.setStyleName(FolderContainerCBundle.INSTANCE.css().emptyFolderStyle());
            floderTreeContainer.clear();
            floderTreeContainer.add(emptyLbl);
        }
    }

}

From source file:org.ednovo.gooru.client.mvp.folder.toc.FolderTocView.java

License:Open Source License

/**
 * This method is used to set folders and collections for selected tree item.
 * @param item//from w w  w . jav  a2 s.  com
 * @param folderListDo
 */
private void displayWorkspaceData(TreeItem item, FolderTocDo foldersTocObj, String parentId) {
    //This will remove the loading text for the child items.
    if (item.getChildCount() > 0) {
        item.getChild(0).remove();
    }
    //This will set the data to the selected tree item.
    if (foldersTocObj != null) {
        List<FolderDo> foldersArrayList = foldersTocObj.getCollectionItems();
        if (foldersArrayList != null && foldersArrayList.size() > 0) {
            FolderTreeItem folderTreeItemWidget = (FolderTreeItem) item.getWidget();
            int folderLevel = folderTreeItemWidget.getFolerLevel();
            for (int i = 0; i < foldersArrayList.size(); i++) {
                FolderDo floderDo = foldersArrayList.get(i);
                if (FOLDER.equalsIgnoreCase(floderDo.getType())) {
                    String styleName = FolderContainerCBundle.INSTANCE.css().child();
                    FolderTreeItem innerFolderTreeItem = new FolderTreeItem(styleName, floderDo.getTitle(),
                            floderDo.getGooruOid());
                    innerFolderTreeItem.setFolerLevel(folderLevel + 1);
                    TreeItem folderItem = new TreeItem(innerFolderTreeItem);
                    item.addItem(folderItem);
                    adjustTreeItemStyle(folderItem, floderDo.getType(), folderLevel);
                } else if (COLLECTION.equalsIgnoreCase(floderDo.getType())
                        || SCOLLECTION.equalsIgnoreCase(floderDo.getType())) {
                    TreeItem folderItem = new TreeItem(new FolderCollectionView(null, floderDo, parentId));
                    folderItem.getElement().removeAttribute("style");
                    item.addItem(folderItem);
                    adjustTreeItemStyle(folderItem, floderDo.getType(), folderLevel);
                }
            }
            item.setState(folderTreeItemWidget.isOpen());
        } else {
            Label emptyLbl = new Label();
            emptyLbl.setText(EMPTY_FOLDER);
            emptyLbl.setStyleName(FolderContainerCBundle.INSTANCE.css().emptySubFolderStyle());
            item.addItem(emptyLbl);
        }
    }
}

From source file:org.ednovo.gooru.client.mvp.folder.toc.FolderTocView.java

License:Open Source License

@Override
public void setBreadCrumbs(final String key, String value, String separator) {
    Label routeLbl = new Label();
    routeLbl.setStyleName(FolderContainerCBundle.INSTANCE.css().breadCrumbsStyle());
    routeLbl.setText(" " + value + " " + separator);
    routeLbl.addClickHandler(new ClickHandler() {
        @Override/*from  w ww.  j a  va2  s. com*/
        public void onClick(ClickEvent event) {
            getUiHandlers().getTocFolders(key);
            String libName = AppClientFactory.getPlaceManager().getRequestParameter(LIBRARY_NAME, null);
            String parentId = AppClientFactory.getPlaceManager().getRequestParameter(PARENT_ID, null);
            if (libName != null && parentId != null) {
                getUiHandlers().getFolderMetaData(key);
            }
        }
    });
    breadCrumbsPanel.add(routeLbl);
}

From source file:org.ednovo.gooru.client.mvp.folder.toc.FolderTocView.java

License:Open Source License

@Override
public void setBreadCrumbs(Map<String, String> result) {
    breadCrumbsPanel.clear();//from  www  .  j a v a  2s  .co m
    int size = 0;
    boolean haveBreadCrumbs = false;
    for (Map.Entry<String, String> entry : result.entrySet()) {
        if (!entry.getValue().equals(FEATURED)) {
            setBreadCrumbs(entry.getKey(), entry.getValue(), "> ");
        }
        size++;
        haveBreadCrumbs = true;
    }
    if (size == result.size() && haveBreadCrumbs) {
        Label presentTile = new Label();
        presentTile.setStyleName(FolderContainerCBundle.INSTANCE.css().displayInlineStyle());
        presentTile.setText(lblFolderTitle.getText());
        breadCrumbsPanel.add(presentTile);
    }

}

From source file:org.ednovo.gooru.client.mvp.gshelf.collectiondetails.CollectionInfoView.java

License:Open Source License

private void restrictKeyLimit(KeyDownEvent event, TextArea textArea, String text, Label errorLabelToDisplay) {
    if (text.trim().length() <= 999) {
        errorLabelToDisplay.setVisible(false);
    } else if (text.trim().length() > 998) {
        if (event == null) {
            textArea.cancelKey();/*from   w  w w  .j  a v a2s . c o  m*/
            errorLabelToDisplay.setVisible(true);
            errorLabelToDisplay.setText(i18n.GL0143());
            errorLabelToDisplay.getElement().setAttribute("alt", i18n.GL0143());
            errorLabelToDisplay.getElement().setAttribute("title", i18n.GL0143());
        } else {
            if (event.isControlKeyDown() || event.isShiftKeyDown()
                    || ((event.getNativeEvent().getKeyCode() == KeyCodes.KEY_UP))
                    || ((event.getNativeEvent().getKeyCode() == KeyCodes.KEY_LEFT))
                    || ((event.getNativeEvent().getKeyCode() == KeyCodes.KEY_DOWN))
                    || ((event.getNativeEvent().getKeyCode() == KeyCodes.KEY_RIGHT))
                    || ((event.getNativeEvent().getKeyCode() == KeyCodes.KEY_BACKSPACE))
                    || ((event.getNativeEvent().getKeyCode() == KeyCodes.KEY_DELETE))) {
                if (text.trim().length() <= 1000) {
                    errorLabelToDisplay.setVisible(false);
                }
            } else {
                textArea.cancelKey();
                errorLabelToDisplay.setVisible(true);
                errorLabelToDisplay.setText(i18n.GL0143());
                errorLabelToDisplay.getElement().setAttribute("alt", i18n.GL0143());
                errorLabelToDisplay.getElement().setAttribute("title", i18n.GL0143());
            }
        }
    }
}

From source file:org.ednovo.gooru.client.mvp.play.resource.add.AddResourceCollectionView.java

License:Open Source License

public void updateWorkSpaceLink(String collectionId) {
    showSuccessWidget(true);//from  w w w  . j  a v  a2  s .  c o m
    addingLabel.setVisible(false);
    addResourceToCollectionButton.setVisible(true);
    if (getAddResourceToCollectionButton().getText().equalsIgnoreCase("Add Again")) {
        successMessageLabelText.setText(GL0699);
    } else {
        successMessageLabelText.setText(GL0663);
        addResourceToCollectionButton.setText(GL0691);
    }
    workSpaceBtn.setText(GL1630);
    //      workSpaceLink.setText(GL0589);
    //workSpaceLink.setHref("#organize&id="+collectionId+"&eventType=refresh");
    this.collectionId = collectionId;
    addCollectionInsteadLabelContainer.clear();
    Label colletionIsteadButton = getAddCollectionViewButton();
    colletionIsteadButton.setText(GL0664);
    colletionIsteadButton.getElement().getStyle().setMarginRight(138, Unit.PX);
    //colletionIsteadButton.getElement().getStyle().setMarginTop(-15, Unit.PX);
    addCollectionInsteadLabelContainer.add(colletionIsteadButton);

}