List of usage examples for com.google.gwt.user.client.ui Widget addStyleName
public void addStyleName(String style)
From source file:org.ednovo.gooru.client.mvp.folders.edit.tab.content.SecondThirdLevelFoldersDropController.java
License:Open Source License
@Override protected Widget newPositioner(DragContext context) { Widget widget = super.newPositioner(context); widget.removeStyleName(DragClientBundle.INSTANCE.css().positioner()); widget.addStyleName(FolderItemCBundle.INSTANCE.css().myFolderDragdropPositioner()); positioner = widget;/*from ww w .j a v a 2 s . c om*/ return widget; }
From source file:org.ednovo.gooru.client.mvp.home.library.LibraryView.java
License:Open Source License
/** * @function setFeaturedCourseWidgets //from ww w .j a v a 2 s .c om * * @created_date : 14-Dec-2013 * * @description * * @parm(s) : @param courseDoList * @parm(s) : @param isFeaturedCourseSelected * * @return : void * * @throws : <Mentioned if any exceptions> * */ private void setFeaturedCourseWidgets(final ArrayList<CourseDo> courseDoList, boolean isFeaturedCourseSelected) { featuredCourses.clear(); String courseId = AppClientFactory.getPlaceManager().getRequestParameter(COURSE_ID); for (int i = 0; i < courseDoList.size(); i++) { featuredCourses.add(new FeaturedCourseListView(courseDoList.get(i))); if (!isFeaturedCourseSelected) { if (i == 0 && (courseId == null)) { featuredCourses.getWidget(i).addStyleName(ACTIVE_STYLE); defaultCourseId = "" + courseDoList.get(i).getCodeId(); if (getPlaceToken().equalsIgnoreCase(PlaceTokens.RUSD_LIBRARY)) { setUnitListData(courseDoList.get(i).getUnit()); } else { getPopularList(courseDoList.get(i).getUnit(), courseDoList.get(i).getCodeId(), true); } } } else if (isFeaturedCourseSelected && courseId == null) { if (i == 0) { featuredCourses.getWidget(i).addStyleName(ACTIVE_STYLE); if (getPlaceToken().equalsIgnoreCase(PlaceTokens.RUSD_LIBRARY)) { setUnitListData(courseDoList.get(i).getUnit()); } else { getPopularList(courseDoList.get(i).getUnit(), courseDoList.get(i).getCodeId(), true); } } else { featuredCourses.getWidget(i).removeStyleName(ACTIVE_STYLE); } } } final Iterator<Widget> widgets = featuredCourses.iterator(); int widgetCount = 0; while (widgets.hasNext()) { final Widget widget = widgets.next(); final int widgetCountTemp = widgetCount; FeaturedCourseListView featuredCourseListView = ((FeaturedCourseListView) widget); try { if (courseId.equals("" + featuredCourseListView.getCourseId())) { if (getPlaceToken().equalsIgnoreCase(PlaceTokens.RUSD_LIBRARY)) { setUnitListData(courseDoList.get(widgetCount).getUnit()); } else { getPopularList(courseDoList.get(widgetCount).getUnit(), courseDoList.get(widgetCount).getCodeId(), true); } widget.addStyleName(ACTIVE_STYLE); } } catch (Exception e) { } featuredCourseListView.getfeaturedCoursePanel().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { MixpanelUtil.mixpanelEvent("FeaturedCourse_SelectsCourse"); final Iterator<Widget> widgetsPanel = featuredCourses.iterator(); while (widgetsPanel.hasNext()) { widgetsPanel.next().removeStyleName(ACTIVE_STYLE); } widget.addStyleName(ACTIVE_STYLE); if (getPlaceToken().equalsIgnoreCase(PlaceTokens.RUSD_LIBRARY)) { setUnitListData(courseDoList.get(widgetCountTemp).getUnit()); } else { getPopularList(courseDoList.get(widgetCountTemp).getUnit(), courseDoList.get(widgetCountTemp).getCodeId(), false); } Map<String, String> params = new HashMap<String, String>(); params.put(LIBRARY_PAGE, FEATURED_COURSE_PAGE); params.put(COURSE_ID, "" + ((FeaturedCourseListView) widget).getCourseId()); AppClientFactory.getPlaceManager().revealPlace(getPlaceToken(), params); } }); widgetCount++; } }
From source file:org.ednovo.gooru.client.mvp.home.library.LibraryView.java
License:Open Source License
/** * @param unitDoList //from w w w . ja v a 2 s .co m * @function setUnitListData * * @created_date : 04-Dec-2013 * * @description * * @parm(s) : * * @return : void * * @throws : <Mentioned if any exceptions> * */ public void setUnitListData(final List<UnitDo> unitDoList) { String unitId = AppClientFactory.getPlaceManager().getRequestParameter(UNIT_ID); final String standardsId = AppClientFactory.getPlaceManager().getRequestParameter(STANDARD_ID); final String standardsLibraryType = AppClientFactory.getPlaceManager().getRequestParameter("libtype"); final String subjectId = AppClientFactory.getPlaceManager().getRequestParameter(SUBJECT_NAME, FEATURED_LABEL); leftNav.clear(); for (int i = 0; i < unitDoList.size(); i++) { leftNav.add(new LibraryUnitMenuView(unitDoList.get(i))); if (i == 0 && (unitId == null)) { leftNav.getWidget(i).addStyleName(libraryStyleUc.unitLiActive()); unitListId = unitDoList.get(i).getCodeId() + ""; if (unitDoList.get(i).getTopic() != null && unitDoList.get(i).getTopic().size() > 0) { setLibraryTopicListData(unitDoList.get(i).getTopic()); } else { setLibraryConceptOnlyData(unitDoList.get(i).getCollection(), unitDoList.get(i).getCount()); } } } int widgetCount = 0; final Iterator<Widget> widgets = leftNav.iterator(); while (widgets.hasNext()) { final Widget widget = widgets.next(); final int widgetCountTemp = widgetCount; final LibraryUnitMenuView libraryUnitMenuView = ((LibraryUnitMenuView) widget); try { if (unitId.equals(libraryUnitMenuView.getUnitId())) { widget.addStyleName(libraryStyleUc.unitLiActive()); if (widgetCountTemp == 0) { unitListId = unitDoList.get(widgetCountTemp).getCodeId() + ""; if (unitDoList.get(widgetCountTemp).getTopic() != null && unitDoList.get(widgetCountTemp).getTopic().size() > 0) { setLibraryTopicListData(unitDoList.get(widgetCountTemp).getTopic()); } else { setLibraryConceptOnlyData(unitDoList.get(widgetCountTemp).getCollection(), libraryUnitMenuView.getChildCount()); } } else { unitListId = unitDoList.get(widgetCountTemp).getCodeId() + ""; contentScroll.setVisible(false); loadingIconPanel.setVisible(true); getTopicsOnPagination(subjectId, libraryUnitMenuView.getUnitId(), INITIAL_OFFSET, libraryUnitMenuView.getChildCount(), standardsId); } } } catch (Exception e) { } libraryUnitMenuView.getUnitMenuItemPanel().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final Iterator<Widget> widgetsPanel = leftNav.iterator(); unitListId = unitDoList.get(widgetCountTemp).getCodeId() + ""; while (widgetsPanel.hasNext()) { widgetsPanel.next().removeStyleName(libraryStyleUc.unitLiActive()); } widget.addStyleName(libraryStyleUc.unitLiActive()); String callBack = AppClientFactory.getPlaceManager().getRequestParameter(LIBRARY_PAGE, FEATURED_COURSE_PAGE); String courseId = AppClientFactory.getPlaceManager().getRequestParameter(COURSE_ID, null); if (unitDoList.get(widgetCountTemp).getLabel().equalsIgnoreCase("Popular")) { MixpanelUtil.mixpanelEvent("library_clicks_popular"); if (widgetCountTemp == 0 || widgetCountTemp == 1) { if (unitDoList.get(widgetCountTemp).getTopic() != null && unitDoList.get(widgetCountTemp).getTopic().size() > 0) { setLibraryTopicListData(unitDoList.get(widgetCountTemp).getTopic()); } else { setLibraryConceptOnlyData(unitDoList.get(widgetCountTemp).getCollection(), libraryUnitMenuView.getChildCount()); } } else { contentScroll.setVisible(false); loadingIconPanel.setVisible(true); getTopicsOnPagination(subjectId, libraryUnitMenuView.getUnitId(), INITIAL_OFFSET, libraryUnitMenuView.getChildCount(), standardsId); } } else { if (widgetCountTemp == 0) { if (unitDoList.get(widgetCountTemp).getTopic() != null && unitDoList.get(widgetCountTemp).getTopic().size() > 0) { setLibraryTopicListData(unitDoList.get(widgetCountTemp).getTopic()); } else { setLibraryConceptOnlyData(unitDoList.get(widgetCountTemp).getCollection(), libraryUnitMenuView.getChildCount()); } } else { contentScroll.setVisible(false); loadingIconPanel.setVisible(true); getTopicsOnPagination(subjectId, libraryUnitMenuView.getUnitId(), INITIAL_OFFSET, libraryUnitMenuView.getChildCount(), standardsId); } } Map<String, String> params = new HashMap<String, String>(); params.put(LIBRARY_PAGE, callBack); if (courseId != null) { params.put(COURSE_ID, courseId); } else { params.put(COURSE_ID, defaultCourseId); } if (subjectId != null) { params.put(SUBJECT_NAME, subjectId); } if (standardsId != null) { params.put(STANDARD_ID, standardsId); if (standardsLibraryType != null) { params.put("libtype", standardsLibraryType); } } params.put(UNIT_ID, ((LibraryUnitMenuView) widget).getUnitId()); AppClientFactory.getPlaceManager().revealPlace(getPlaceToken(), params); } }); widgetCount++; } }
From source file:org.ednovo.gooru.client.mvp.library.partner.PartnerLibraryView.java
License:Open Source License
@Override public void setUnitList(final ArrayList<PartnerFolderDo> folderList) { setCourseImageData();//from w w w .j ava 2s . com libraryView.getLeftNav().clear(); libraryView.getContentScroll().clear(); String folderId = AppClientFactory.getPlaceManager().getRequestParameter(FOLDERID); int j = 0; for (int i = 0; i < folderList.size(); i++) { if (folderList.get(i).getType().equalsIgnoreCase("folder")) { LibraryUnitMenuView libraryUnitMenuView = new LibraryUnitMenuView(folderList.get(i)); libraryView.getLeftNav().add(libraryUnitMenuView); if (j == 0 && folderId == null) { j++; loadingPanel(true); libraryUnitMenuView.addStyleName(libraryStyleUc.unitLiActive()); unitListId = folderList.get(i).getGooruOid(); setTopicListData(folderList.get(i).getFolderItems(), unitListId); //getUiHandlers().getPartnerChildFolderItems(unitListId, 1); } } } final Iterator<Widget> widgets = libraryView.getLeftNav().iterator(); int widgetCount = 0; while (widgets.hasNext()) { final Widget widget = widgets.next(); final LibraryUnitMenuView libraryUnitMenuView = ((LibraryUnitMenuView) widget); final int finalWidgetCount = widgetCount; libraryUnitMenuView.getUnitMenuItemPanel().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { libraryView.getContentScroll().setVisible(false); loadingPanel(true); final Iterator<Widget> widgetsPanel = libraryView.getLeftNav().iterator(); while (widgetsPanel.hasNext()) { widgetsPanel.next().removeStyleName(libraryStyleUc.unitLiActive()); } widget.addStyleName(libraryStyleUc.unitLiActive()); unitListId = libraryUnitMenuView.getUnitId(); if (finalWidgetCount == 0) { setTopicListData(folderList.get(finalWidgetCount).getFolderItems(), unitListId); } else { getUiHandlers().getPartnerChildFolderItems(unitListId, 1); } } }); widgetCount++; } }
From source file:org.ednovo.gooru.client.mvp.play.collection.toc.CollectionPlayerTocView.java
License:Open Source License
@Override public void setResourceActive(String collectionId, String collectionItemid, boolean isCollectionHome) { if (selectedWidgetIndex != -1) { Widget widget = navgationTocContainer.getWidget(selectedWidgetIndex); widget.removeStyleName(PlayerBundle.INSTANCE.getPlayerStyle().tocResourceSelected()); }/* w w w . j a v a2 s . c om*/ if (collectionItemid != null) { int widgetCount = navgationTocContainer.getWidgetCount(); for (int i = 0; i < widgetCount; i++) { Widget widget = navgationTocContainer.getWidget(i); if (widget instanceof TocResourceView) { TocResourceView resourceView = (TocResourceView) widget; if (collectionItemid.equals(resourceView.getCollectionItemId())) { selectedWidgetIndex = i; resourceView.addStyleName(PlayerBundle.INSTANCE.getPlayerStyle().tocResourceSelected()); return; } } } } else if (isCollectionHome) { selectedWidgetIndex = 0; Widget widget = navgationTocContainer.getWidget(selectedWidgetIndex); widget.addStyleName(PlayerBundle.INSTANCE.getPlayerStyle().tocResourceSelected()); } else { int widgetCount = navgationTocContainer.getWidgetCount(); selectedWidgetIndex = widgetCount - 1; Widget widget = navgationTocContainer.getWidget(selectedWidgetIndex); widget.addStyleName(PlayerBundle.INSTANCE.getPlayerStyle().tocResourceSelected()); } }
From source file:org.ednovo.gooru.client.mvp.profilepage.data.ProfilePageLibraryView.java
License:Open Source License
@Override public void setUnitList(final ProfileLibraryListDo profileLibraryListDo) { totalLeftPanelCount = profileLibraryListDo.getCount(); String folderId = AppClientFactory.getPlaceManager().getRequestParameter(FOLDERID); int firstWidgetCount = leftNav.getWidgetCount(); final ArrayList<ProfileLibraryDo> folderList = profileLibraryListDo.getSearchResult(); for (int i = 0; i < folderList.size(); i++) { LeftMenuItemView leftMenuItemView = new LeftMenuItemView(folderList.get(i)); leftNav.add(leftMenuItemView);/*from w ww. j av a2 s . c o m*/ leftMenuItemView.setWidgetCount(leftNav.getWidgetCount() + 1); leftMenuItemView.setType(folderList.get(i).getType()); if (folderList.get(i).getType().equals("scollection")) { leftMenuItemView.addStyleName(style.collection()); } if (firstWidgetCount == 0 && folderId == null) { firstWidgetCount++; loadingPanel(true); leftMenuItemView.addStyleName(style.open()); leftMenuItemView.addStyleName(style.active()); unitListId = folderList.get(i).getGooruOid(); if (folderList.get(i).getType().equals("scollection")) { setTopicListData(folderList.get(i), unitListId); } else { setTopicListData(folderList.get(i).getCollectionItems(), unitListId); } } } final Iterator<Widget> widgets = leftNav.iterator(); while (widgets.hasNext()) { final Widget widget = widgets.next(); final LeftMenuItemView leftMenuItemView = ((LeftMenuItemView) widget); leftMenuItemView.getUnitMenuItemPanel().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (leftMenuItemView.getWidgetCount() > 10) { Window.scrollTo(0, 0); } loadingPanel(true); final Iterator<Widget> widgetsPanel = leftNav.iterator(); while (widgetsPanel.hasNext()) { final Widget widgetTxt = widgetsPanel.next(); widgetTxt.removeStyleName(style.active()); widgetTxt.removeStyleName(style.open()); } widget.addStyleName(style.open()); widget.addStyleName(style.active()); unitListId = leftMenuItemView.getUnitId(); if (leftMenuItemView.getType().equals("scollection")) { getPresenter().getProfileLibraryCollection(unitListId, false); } else { getPresenter().getPartnerChildFolderItems(unitListId, 1); } } }); } isApiProgress = true; }
From source file:org.ednovo.gooru.client.mvp.shelf.collection.tab.resource.ShelfCollectionResourceDropController.java
License:Open Source License
@Override protected Widget newPositioner(DragContext context) { Widget widget = super.newPositioner(context); widget.removeStyleName(DragClientBundle.INSTANCE.css().positioner()); widget.addStyleName(CollectionEditResourceCBundle.INSTANCE.css().shelfResourceDragdropPositioner()); positioner = widget;//w w w . ja v a2s .c o m return widget; }
From source file:org.ednovo.gooru.client.uc.CourseListUc.java
License:Open Source License
public void setCourseList(final List<LibraryCodeDo> libraryCode) { this.libraryCode = libraryCode; Map<String, Integer> subjectList = new HashMap<String, Integer>(); subjectPanel = new HTMLPanel(""); for (int i = 0; i < libraryCode.size(); i++) { String subjectName = libraryCode.get(i).getLabel(); subjectWidget = new HTMLEventPanel(subjectName); subjectWidget.setStyleName(res.css().buttonDeSelected()); subjectWidget.getElement().setId(subjectName); subjectList.put(subjectName, i); subjectPanel.add(subjectWidget); if (i == 0) { List<LibraryCodeDo> libraryCodeDo = libraryCode.get(i).getNode(); subjectWidget.addStyleName(res.css().collectionInfobuttonSelected()); setCourseData(libraryCodeDo); }/* w w w. j a v a2s. c o m*/ } addResourceTabContainer.add(subjectPanel); final Map<String, Integer> subjects = subjectList; Iterator<Widget> widgets = subjectPanel.iterator(); while (widgets.hasNext()) { final Widget widget = widgets.next(); if (widget instanceof HTMLEventPanel) { ((HTMLEventPanel) widget).addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { int subjectCode = subjects.get(widget.getElement().getId()); final Iterator<Widget> widgetsPanel = subjectPanel.iterator(); while (widgetsPanel.hasNext()) { widgetsPanel.next().removeStyleName(res.css().collectionInfobuttonSelected()); } if (subjectCode == 0) { widget.addStyleName(res.css().buttonDeSelected()); } widget.addStyleName(res.css().collectionInfobuttonSelected()); setCourseData(libraryCode.get(subjectCode).getNode()); } }); } } }
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();/* w w w. j a v a 2 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()); } }); } } }
From source file:org.eurekastreams.web.client.ui.common.dialog.lookup.EmployeeLookupViewModel.java
License:Apache License
/** * Updates the view to reflect the currently-selected person. *///from w w w. j av a2 s . c o m private void updateOnPersonSelected() { view.showSelectedPerson(selectedPerson); Widget select = view.getSelect(); if (selectedPerson != null) { select.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().lookupSelectButtonInactive()); select.addStyleName(StaticResourceBundle.INSTANCE.coreCss().lookupSelectButtonActive()); } else { select.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().lookupSelectButtonActive()); select.addStyleName(StaticResourceBundle.INSTANCE.coreCss().lookupSelectButtonInactive()); } }