List of usage examples for com.google.gwt.user.client.ui Label addClickHandler
public HandlerRegistration addClickHandler(ClickHandler handler)
From source file:org.ednovo.gooru.client.mvp.profilepage.ProfilePageView.java
License:Open Source License
private void setUserCourseList(Set<ProfileCodeDo> codeList) { profileDo.setCourses(codeList);//from ww w .ja va 2 s.c om userCourseList.clear(); for (ProfileCodeDo profileCodeDo : codeList) { Label courseLabel = new Label(profileCodeDo.getCode().getLabel()); courseLabel.addClickHandler(new OnGradeEditImageClick()); courseLabel.setStyleName(CollectionCBundle.INSTANCE.css().userCourseName()); userGradeList.add(courseLabel); } }
From source file:org.ednovo.gooru.client.mvp.profilepage.ProfilePageView.java
License:Open Source License
private void setUserGradeList(String grade) { profileDo.setGrade(grade);/* w w w . ja v a2 s. c o m*/ userGradeList.clear(); if (grade != null && !grade.isEmpty()) { boolean isHigherEducation = false; if (grade.contains("Kindergarten")) { Label gradeLabel = new Label(GL0850); grade = grade.replaceAll("Kindergarten", ""); gradeLabel.setStyleName(CollectionCBundle.INSTANCE.css().userNumber()); gradeLabel.addClickHandler(new OnGradeEditImageClick()); userGradeList.add(gradeLabel); } if (grade.contains("Higher Education")) { isHigherEducation = true; grade = grade.replaceAll("Higher Education", ""); } String[] grades = grade.split(","); Set set = new HashSet(); for (int i = 0; i < grades.length; i++) { if (!grades[i].isEmpty()) { set.add(Integer.parseInt(grades[i])); } } Iterator gradeLbl = set.iterator(); while (gradeLbl.hasNext()) { Label gradeLabel = new Label(gradeLbl.next().toString()); gradeLabel.setStyleName(CollectionCBundle.INSTANCE.css().userNumber()); gradeLabel.addClickHandler(new OnGradeEditImageClick()); userGradeList.add(gradeLabel); } if (isHigherEducation == true) { Label gradeLabel = new Label(GL0169); gradeLabel.setStyleName(CollectionCBundle.INSTANCE.css().userNumber()); gradeLabel.addClickHandler(new OnGradeEditImageClick()); userGradeList.add(gradeLabel); } } }
From source file:org.ednovo.gooru.client.mvp.shelf.collection.tab.assign.CollectionAssignTabView.java
License:Open Source License
/** * // w w w . j a v a 2 s. c om * @function setClasspageData * * @created_date : Jul 31, 2013 * * @description * Create Classpage (title) label and set to Classpage list box * * @parm(s) : @param classpageListDo * * @return : void * * @throws : <Mentioned if any exceptions> * * * * */ @Override public void setClasspageData(ClasspageListDo classpageListDo) { panelLoading.setVisible(false); int resultSize = classpageListDo.getSearchResults().size(); if (resultSize > 0) { htmlEvenPanelContainer.setVisible(true); if (toClear) { htmlClasspagesListContainer.clear(); toClear = false; } for (int i = 0; i < resultSize; i++) { String classpageTitle = classpageListDo.getSearchResults().get(i).getTitle(); classpageId = classpageListDo.getSearchResults().get(i).getGooruOid(); final Label titleLabel = new Label(classpageTitle); titleLabel.setStyleName(CollectionAssignCBundle.INSTANCE.css().classpageTitleText()); titleLabel.getElement().setAttribute("id", classpageId); //Set Click event for title titleLabel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { lblClasspagePlaceHolder.setText(titleLabel.getText()); lblClasspagePlaceHolder.getElement().setId(titleLabel.getElement().getId()); lblClasspagePlaceHolder .setStyleName(CollectionAssignCBundle.INSTANCE.css().selectedClasspageText()); classpageId = titleLabel.getElement().getId(); btnAssign.setEnabled(true); btnAssign.setStyleName(CollectionAssignCBundle.INSTANCE.css().activeAssignButton()); //btnAssign.setStyleName(AssignPopUpCBundle.INSTANCE.css().activeAssignButton()); //Hide the scroll container spanelClasspagesPanel.setVisible(false); } }); htmlClasspagesListContainer.add(titleLabel); } } else { //Set if there are not classpages. if (toClear) { panelNoClasspages.setVisible(true); } } }
From source file:org.ednovo.gooru.client.uc.tooltip.StudyNowToolTip.java
License:Open Source License
/** * //from www. ja v a 2 s .c om * @function createClasspageTitleLabel * * @created_date : Aug 15, 2013 * * @description * * * @parm(s) : @param classpageTitle * @parm(s) : @param classpageId * @parm(s) : @return * * @return : Label * * @throws : <Mentioned if any exceptions> * * * * */ private Label createClasspageTitleLabel(String classpageTitle, final String classpageId, boolean isStatic) { Label titleLabel = null; if (classpageTitle.length() >= 30) { titleLabel = new Label(classpageTitle.substring(0, 30)); } else { titleLabel = new Label(classpageTitle); } titleLabel.getElement().setAttribute("id", classpageId); if (!isStatic) { titleLabel.setStyleName(ClasspageListPopupViewCBundle.INSTANCE.css().classpageTitleStudyHeader()); } else { titleLabel.setStyleName(ClasspageListPopupViewCBundle.INSTANCE.css().classpageLoadingOnPagination()); } // Set Click event for title titleLabel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { OpenClasspageEdit(classpageId); hide(); } }); return titleLabel; }
From source file:org.eurekastreams.web.client.ui.common.dialog.Dialog.java
License:Apache License
/** * Default constructor.//from ww w. ja v a 2 s . co m * * @param inDialogContent * The content of the dialog. */ public Dialog(final DialogContent inDialogContent) { dialogContent = inDialogContent; final Dialog thisBuffered = this; popupPanel = new PopupPanel(false, false) { @Override protected void onPreviewNativeEvent(final com.google.gwt.user.client.Event.NativePreviewEvent event) { if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) { thisBuffered.hide(); } super.onPreviewNativeEvent(event); }; }; popupPanel.setGlassEnabled(true); popupPanel.setGlassStyleName(StaticResourceBundle.INSTANCE.coreCss().modalBg()); FlowPanel modalPanel = new FlowPanel(); final String cssName = dialogContent.getCssName(); if (cssName != null && !cssName.isEmpty()) { modalPanel.addStyleName(cssName); } modalPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().modal()); // title panel FlowPanel titlePanel = new FlowPanel(); titlePanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().modalTitle()); Label closeButton = new Label("Close"); closeButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().modalClose()); titlePanel.add(closeButton); closeButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent inEvent) { hide(); } }); Label title = new Label(dialogContent.getTitle()); title.addStyleName(StaticResourceBundle.INSTANCE.coreCss().modalTitleText()); titlePanel.add(title); modalPanel.add(titlePanel); // Content Panel FlowPanel bodyContainer = new FlowPanel(); bodyContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().modalContentPanel()); bodyContainer.add(dialogContent.getBody()); modalPanel.add(bodyContainer); popupPanel.setWidget(modalPanel); dialogContent.setHost(this); }
From source file:org.eurekastreams.web.client.ui.common.form.elements.MultiOrgLookupFormElement.java
License:Apache License
/** * Constructor./*from w ww. j a v a 2s . c o m*/ * * @param inTitle * the title. * @param subTitle * a sub title. * @param inInstructions * the instructions. * @param inKey * the key. * @param inSelectedLabelText * the text of the label that will be put next to the org once it is selected * @param inRequired * if it is required. * @param relatedOrganizations * related orgs. */ public MultiOrgLookupFormElement(final String inTitle, final String subTitle, final String inInstructions, final String inKey, final String inSelectedLabelText, final boolean inRequired, final List<Organization> relatedOrganizations) { this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().orgLookupFormElement()); key = inKey; Label title = new Label(inTitle); title.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel()); Label subTitleLabel = new Label(subTitle); subTitleLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formSubTitle()); Label instructions = new Label(inInstructions); instructions.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formInstructions()); this.add(title); this.add(subTitleLabel); this.add(instructions); this.add(selectedOrgs); Label select = new Label("Add Organization"); select.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formButton()); select.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLookupButton()); final Label selectedOrgName = new Label(); selectedOrgName.addStyleName(StaticResourceBundle.INSTANCE.coreCss().selectedOrgName()); final Label selectedLabel = new Label(inSelectedLabelText); selectedLabel.setVisible(false); select.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { orgLookupContent = new OrgLookupContent(getSaveCommand(selectedOrgName, selectedLabel)); Dialog.showCentered(orgLookupContent); } }); this.add(select); if (inRequired) { Label requiredLabel = new Label("(required)"); requiredLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().requiredFormLabel()); this.add(requiredLabel); } this.add(selectedOrgName); this.add(selectedLabel); for (Organization org : relatedOrganizations) { final OrganizationTreeDTO treeItem = new OrganizationTreeDTO(); treeItem.setDisplayName(org.getName()); treeItem.setOrgId(org.getId()); treeItem.setShortName(org.getShortName()); addRelatedOrg(treeItem); } }
From source file:org.eurekastreams.web.client.ui.common.form.elements.MultiOrgLookupFormElement.java
License:Apache License
/** * Constructor./*from ww w. j a va 2s . co m*/ * * @param inTitle * the title. * @param subTitle * a sub title. * @param inInstructions * the instructions. * @param inKey * the key. * @param inSelectedLabelText * the text of the label that will be put next to the org once it is selected * @param inRequired * if it is required. * @param relatedOrganizations * related orgs. * @param doNothing * temporary until we remove Organization */ public MultiOrgLookupFormElement(final String inTitle, final String subTitle, final String inInstructions, final String inKey, final String inSelectedLabelText, final boolean inRequired, final List<OrganizationModelView> relatedOrganizations, final boolean doNothing) { this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().orgLookupFormElement()); key = inKey; Label title = new Label(inTitle); title.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel()); Label subTitleLabel = new Label(subTitle); subTitleLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formSubTitle()); Label instructions = new Label(inInstructions); instructions.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formInstructions()); this.add(title); this.add(subTitleLabel); this.add(instructions); this.add(selectedOrgs); Label select = new Label("Add Organization"); select.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formButton()); select.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLookupButton()); final Label selectedOrgName = new Label(); selectedOrgName.addStyleName(StaticResourceBundle.INSTANCE.coreCss().selectedOrgName()); final Label selectedLabel = new Label(inSelectedLabelText); selectedLabel.setVisible(false); select.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { orgLookupContent = new OrgLookupContent(getSaveCommand(selectedOrgName, selectedLabel)); Dialog newDialog = new Dialog(orgLookupContent); newDialog.showCentered(); } }); this.add(select); if (inRequired) { Label requiredLabel = new Label("(required)"); requiredLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().requiredFormLabel()); this.add(requiredLabel); } this.add(selectedOrgName); this.add(selectedLabel); for (OrganizationModelView org : relatedOrganizations) { final OrganizationTreeDTO treeItem = new OrganizationTreeDTO(); treeItem.setDisplayName(org.getName()); treeItem.setOrgId(org.getId()); treeItem.setShortName(org.getShortName()); addRelatedOrg(treeItem); } }
From source file:org.eurekastreams.web.client.ui.common.notification.dialog.NotificationsDialogContent.java
License:Apache License
/** * Creates and adds the widget for a source filter. * * @param source/*from w ww . j a va 2s.c o m*/ * Source data. * @param indent * If the label should be indented. */ private void addSourceFilter(final Source source, final boolean indent) { int count = source.getUnreadCount(); String text = count > 0 ? source.getDisplayName() + " (" + count + ")" : source.getDisplayName(); final Label label = new Label(text); label.addStyleName(style.sourceFilter()); label.addStyleName(StaticResourceBundle.INSTANCE.coreCss().buttonLabel()); label.addStyleName(StaticResourceBundle.INSTANCE.coreCss().ellipsis()); if (count == 0 && source != rootSource) { label.addStyleName(style.sourceFilterAllRead()); } if (indent) { label.addStyleName(style.sourceFilterIndented()); } label.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent inEvent) { selectSource(source); } }); sourceFiltersPanel.add(label); source.setWidget(label); }
From source file:org.eurekastreams.web.client.ui.common.pagedlist.PendingGroupRenderer.java
License:Apache License
/** * {@inheritDoc}// w w w . j a v a 2 s . co m */ public Panel render(final DomainGroupModelView group) { final FlowPanel groupPanel = new FlowPanel(); groupPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().group()); groupPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().directoryItem()); groupPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().listItem()); groupPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().pendingGroup()); // -- buttons panel (left side) -- final Panel buttonsPanel = new FlowPanel(); buttonsPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().pendingGroupButtons()); groupPanel.add(buttonsPanel); final Label confirmButton = new Label("Confirm"); confirmButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().approveButton()); buttonsPanel.add(confirmButton); final Label denyButton = new Label("Deny"); denyButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().denyButton()); buttonsPanel.add(denyButton); // -- group info (right side) -- FlowPanel groupAbout = new FlowPanel(); groupAbout.addStyleName(StaticResourceBundle.INSTANCE.coreCss().description()); groupPanel.add(groupAbout); Label groupName = new Label(group.getName()); groupName.addStyleName(StaticResourceBundle.INSTANCE.coreCss().displayName()); groupAbout.add(groupName); Label groupDescription = new Label(group.getDescription()); groupDescription.addStyleName(StaticResourceBundle.INSTANCE.coreCss().pendingGroupDescription()); groupAbout.add(groupDescription); FlowPanel groupMetaData = new FlowPanel(); groupMetaData.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionItemFollowers()); groupMetaData.add(new InlineLabel(new DateFormatter().timeAgo(group.getDateAdded(), true))); insertActionSeparator(groupMetaData); groupMetaData.add(new InlineLabel("By: ")); String url = Session.getInstance() .generateUrl(new CreateUrlRequest(Page.PEOPLE, group.getPersonCreatedByAccountId())); groupMetaData.add(new InlineHyperlink(group.getPersonCreatedByDisplayName(), url)); // Display Business Area (BA) information insertActionSeparator(groupMetaData); groupMetaData.add(new InlineLabel("BA: ")); Label baLabel = new InlineLabel(group.getPersonCreatedByCompanyName()); baLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionItemFollowersData()); groupMetaData.add(baLabel); insertActionSeparator(groupMetaData); groupMetaData.add(new InlineLabel("Privacy Setting: ")); Label label = new InlineLabel(group.isPublic() ? "Public" : "Private"); label.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionItemFollowersData()); groupMetaData.add(label); groupAbout.add(groupMetaData); // -- actions -- confirmButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { buttonsPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().waitActive()); PendingGroupsModel.getInstance().update(new ReviewPendingGroupRequest(group.getShortName(), true)); } }); denyButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { if (new WidgetJSNIFacadeImpl().confirm("Are you sure you want to deny creation of this group?")) { buttonsPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().waitActive()); PendingGroupsModel.getInstance() .update(new ReviewPendingGroupRequest(group.getShortName(), false)); } } }); final EventBus eventBus = Session.getInstance().getEventBus(); eventBus.addObserver(UpdatedReviewPendingGroupResponseEvent.class, new Observer<UpdatedReviewPendingGroupResponseEvent>() { public void update(final UpdatedReviewPendingGroupResponseEvent ev) { if (ev.getResponse().getGroupShortName().equals(group.getShortName())) { eventBus.removeObserver(ev, this); String msg = ev.getResponse().getApproved() ? "The " + group.getName() + " group has been approved" : "The request to create the " + group.getName() + " group has been denied"; eventBus.notifyObservers(new ShowNotificationEvent(new Notification(msg))); } } }); return groupPanel; }
From source file:org.eurekastreams.web.client.ui.common.pagedlist.PersonRequestingGroupMembershipRenderer.java
License:Apache License
/** * {@inheritDoc}//from w w w . j a v a2 s . c o m */ public Panel render(final PersonModelView item) { Panel panel = new FlowPanel(); panel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().pendingGroupMembershipItem()); // -- build UI -- // buttons panel (left side) final Panel buttonsPanel = new FlowPanel(); buttonsPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().pendingButtons()); final Label approveButton = new Label("Approve"); approveButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().approveButton()); buttonsPanel.add(approveButton); final Label denyButton = new Label("Deny"); denyButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().denyButton()); buttonsPanel.add(denyButton); // person panel (right side) panel.add(new PersonPanel(item, false, true)); panel.add(buttonsPanel); // -- wire events -- approveButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { buttonsPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().waitActive()); GroupMembersModel.getInstance().insert(new SetFollowingStatusRequest(item.getAccountId(), groupShortname, EntityType.GROUP, false, Follower.FollowerStatus.FOLLOWING)); } }); denyButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { if (new WidgetJSNIFacadeImpl().confirm("Are you sure you want to deny this user membership?")) { buttonsPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().waitActive()); GroupMembershipRequestModel.getInstance() .delete(new RequestForGroupMembershipRequest(groupId, item.getEntityId())); } } }); return panel; }