List of usage examples for com.google.gwt.user.client.ui Label getText
public String getText()
From source file:next.celebs.page.SearchPage.java
License:Apache License
public SearchPage(Context ctx_) { this.ctx = ctx_; setStyleName("ySearchPage yPopupPage"); setWidth(WIDTH + "px"); setPopupPosition(336, 88);/*from w ww. jav a 2s . c o m*/ show(); FlowPanel content = new FlowPanel(); setWidget(content); FlexTable ft = new FlexTable(); ft.setWidth(WIDTH + "px"); final TextBox box = new TextBox(); ImageButton btnDone = new ImageButton(RES.btnDone()); final Label celebField = new Label(); celebField.setStyleName("ySearchName"); btnDone.addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { String celebName = MiscUtils.noNull(celebField.getText()); if (!MiscUtils.isEmpty(box.getText()) || celebName.length() > 1) { doHide(); ctx.getEventBus().fireEvent(new SearchEvent(box.getText() + " " + celebName)); } } }); FlowPanel scrNested = new FlowPanel(); ScrollPanel scrollPanel = new ScrollPanel(scrNested); init(scrollPanel, scrNested, celebField); ImageButton btnClear = new ImageButton(RES.btnClear()); btnClear.addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { box.setText(""); celebField.setText(""); } }); celebField.setWidth("240px"); ft.setWidget(0, 0, box); ft.setWidget(0, 1, celebField); ft.setWidget(0, 2, btnClear); ft.setWidget(1, 0, btnDone); ft.setWidget(1, 1, scrollPanel); ft.getRowFormatter().setStyleName(0, "ySearchRow"); FlexCellFormatter fcf = ft.getFlexCellFormatter(); fcf.setColSpan(1, 1, 2); fcf.setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_BOTTOM); content.add(ft); }
From source file:org.abondar.industrial.videorouterdemo.client.MainEntryPoint.java
public void showSourcesMonitors() { vp1 = new VerticalPanel(); vp.add(vp1);// ww w . j a v a 2 s . com vp.remove(update); for (int i = 0; i < monitorData.size(); i++) { //number of outputs loop; final Label out = new Label(monitorData.get(i)); hp1 = new HorizontalPanel(); hp1.add(out); for (final SourceBean sb : sourcesData) { vp1.add(hp1); final RadioButton rb = new RadioButton(sourcesData.get(i).getName(), sb.getName()); hp1.add(rb); if (rb.getText().equals("")) { hp1.remove(rb); } if (rb.getText().equals("Undefined Source")) { rb.setEnabled(false); } for (ConnectionBean cb : connections) { for (String s : cb.getSourceID()) { for (String ss : cb.getDestnation()) { if (out.getText().equals(ss) && sb.getId().equals(s)) { rb.setValue(true); prevSourceName = cb.getName().substring(7); monitor = new ArrayList<>(); monitor.add(ss); } } } } rb.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String sourceID = ""; if (sb.getName().equals(rb.getText())) { sourceID = sb.getId(); } if (monitor == null) { monitor = new ArrayList<>(); } else if (prevSourceName.equals(rb.getText()) == false) { monitor.clear(); } monitor.add(out.getText()); if (rb.getText().equals(prevSourceName)) { rb.setValue(Boolean.TRUE); } deleteConnection("Connect" + prevSourceName, sourceID, rb.getText()); prevSourceName = rb.getText(); } }); } } vp.add(update); }
From source file:org.cloudcoder.app.client.view.AccordionPanel.java
License:Open Source License
private void decorateLabel(Label label, String decoration) { String text = label.getText(); label.setText(decoration + " " + text.substring(4)); }
From source file:org.codehaus.enunciate.samples.petclinic.app.client.Owners.java
License:Apache License
public Owners() { final ClinicAsync clinic = ClinicAsync.Util.getInstance(); FlowPanel searchPanel = new FlowPanel(); final Grid grid = new Grid(); final VerticalPanel layout = new VerticalPanel(); final TextBox searchBox = new TextBox(); searchPanel.add(searchBox);/*from w w w . ja v a2 s. co m*/ searchPanel.add(new Button("find", new ClickListener() { public void onClick(Widget widget) { if (searchBox.getText().length() > 0) { clinic.findOwners(searchBox.getText(), new AsyncCallback<Collection<Owner>>() { public void onSuccess(Collection<Owner> collection) { if (collection.size() == 0) { grid.resize(1, 1); grid.setWidget(0, 0, new Label( "No owners of last name '" + searchBox.getText() + "' were found.")); } else { grid.resize(collection.size() + 1, 4); grid.setWidget(0, 0, new Label("name")); grid.setWidget(0, 1, new Label("phone")); grid.setWidget(0, 2, new Label("address")); grid.setWidget(0, 3, new Label("city")); grid.getCellFormatter().setWidth(0, 1, "12em"); grid.getCellFormatter().setHorizontalAlignment(0, 0, HasAlignment.ALIGN_CENTER); grid.getCellFormatter().setHorizontalAlignment(0, 1, HasAlignment.ALIGN_CENTER); grid.getCellFormatter().setHorizontalAlignment(0, 2, HasAlignment.ALIGN_CENTER); grid.getCellFormatter().setHorizontalAlignment(0, 3, HasAlignment.ALIGN_CENTER); grid.getRowFormatter().setStyleName(0, "clinic-tables-header"); int row = 1; Iterator<Owner> it = collection.iterator(); while (it.hasNext()) { final Owner owner = it.next(); final Label nameLabel = new Label( owner.getFirstName() + " " + owner.getLastName()); nameLabel.addStyleName("clinic-clickable"); nameLabel.addClickListener(new ClickListener() { public void onClick(Widget widget) { final DialogBox detailsPanel = new DialogBox(true); final VerticalPanel petList = new VerticalPanel(); petList.add(new Label("Pets of " + nameLabel.getText() + ":")); detailsPanel.setWidget(petList); detailsPanel.setPopupPositionAndShow(new PopupPanel.PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { detailsPanel.setPopupPosition(nameLabel.getAbsoluteLeft(), nameLabel.getAbsoluteTop()); } }); Iterator petsIt = owner.getPetIds().iterator(); while (petsIt.hasNext()) { final Integer petId = (Integer) petsIt.next(); clinic.loadPet(petId.intValue(), new AsyncCallback<Pet>() { public void onSuccess(Pet response) { petList.add(new Label("A " + response.getType().getName() + " named " + response.getName() + ".")); } public void onFailure(Throwable throwable) { petList.add(new Label("Error loading pet " + petId + ": " + throwable.getMessage())); } }); } } }); grid.setWidget(row, 0, nameLabel); grid.setWidget(row, 1, new Label(owner.getTelephone())); grid.setWidget(row, 2, new Label(owner.getAddress())); grid.setWidget(row, 3, new Label(owner.getCity())); row++; } } } public void onFailure(Throwable throwable) { grid.resize(1, 1); grid.setWidget(0, 0, new Label("ERROR: " + throwable.getMessage())); } }); } } })); layout.add(searchPanel); layout.add(grid); initWidget(layout); }
From source file:org.drools.brms.client.modeldriven.ui.DSLSentenceWidget.java
License:Apache License
/** * This will take a DSL line item, and split it into widget thingamies for displaying. * One day, if this is too complex, this will have to be done on the server side. *//* www .j a v a2 s. c om*/ public void makeWidgets(String dslLine) { char[] chars = dslLine.toCharArray(); FieldEditor currentBox = null; Label currentLabel = null; for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (c == '{') { currentLabel = null; currentBox = new FieldEditor(); addWidget(currentBox); } else if (c == '}') { currentBox.setVisibleLength(currentBox.getText().length() + 1); currentBox = null; } else { if (currentBox == null && currentLabel == null) { currentLabel = new Label(); addWidget(currentLabel); } if (currentLabel != null) { currentLabel.setText(currentLabel.getText() + c); } else if (currentBox != null) { currentBox.setText(currentBox.getText() + c); } } } }
From source file:org.drools.brms.client.packages.PackageSnapshotView.java
License:Apache License
/** * This will render the snapshot list.//from w w w. j a v a 2 s . c om */ protected void renderListOfSnapshots(String pkgName, SnapshotInfo[] list) { FormStyleLayout right = new FormStyleLayout("images/snapshot.png", "Labelled snapshots for package: " + pkgName); FlexTable table = new FlexTable(); table.setText(0, 1, "Name"); table.setText(0, 2, "Comment"); table.getRowFormatter().setStyleName(0, SortableTable.styleListHeader); for (int i = 0; i < list.length; i++) { int row = i + 1; Label name = new Label(list[i].name); table.setWidget(row, 0, new Image("images/package_snapshot_item.gif")); table.setWidget(row, 1, name); table.setWidget(row, 2, new Label(list[i].comment)); table.setWidget(row, 3, getOpenSnapshotButton(pkgName, name.getText(), list[i].uuid)); table.setWidget(row, 4, getCopyButton(pkgName, name.getText())); table.setWidget(row, 5, getDeleteButton(name.getText(), pkgName)); if (i % 2 == 0) { table.getRowFormatter().setStyleName(i + 1, SortableTable.styleEvenRow); } } right.setWidth("100%"); //right.setHeight( "100%" ); right.addRow(table); table.setWidth("100%"); right.setStyleName(SortableTable.styleList); layout.setWidget(0, 1, right); layout.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP); }
From source file:org.drools.guvnor.client.modeldriven.ui.EnumDropDownLabel.java
License:Apache License
private Label getTextLabel() { Label label = new Label(); label.setStyleName("x-form-field"); label.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showPopup();/*w ww . j a va2 s .co m*/ } }); if (label.getText() == null && "".equals(label.getText())) { label.setText(constants.Value()); } return label; }
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);/* ww w . ja v a2 s.c om*/ 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 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.classpages.tabitem.assignments.AssignmentsTabView.java
License:Open Source License
/** * This method is used to get the list of collection * /*from www.j a v a2 s . co m*/ */ @Override public void onPostUserCollections(List<CollectionDo> result) { totalSize = result.size(); totalSelfCollection = totalSelfCollection + result.size(); if (totalSelfCollection == 0) { addCollections.collectionFirstElement.setVisible(false); addCollections.loadingPanel.setVisible(false); addCollections.btnCancel.setVisible(true); addCollections.btnCancel.getElement().setAttribute("style", "margin-left:37px"); addCollections.nocollectionMsgLabel.setVisible(true); } if (totalSize == 0 && totalSelfCollection != 0) { addCollections.addLabel.setVisible(true); addCollections.btnCancel.setVisible(true); addCollections.loadingPanel.setVisible(false); } int count = 1; collectionItems = new ArrayList<Integer>(); collectionItems.add(-1); for (CollectionDo collection : result) { if (!collection.getCollectionType().toString().trim().equalsIgnoreCase("folder")) { final Label titleLabel = new Label(collection.getTitle()); titleLabel .setStyleName(CollectionEditResourceCBundle.INSTANCE.css().copyPopUpResourceListBoxText()); titleLabel.getElement().setAttribute("id", collection.getGooruOid()); addCollections.htmlScrollPanel.add(titleLabel); count++; addCollections.addLabel.setVisible(true); addCollections.btnCancel.setVisible(true); // addCollections.addLabel.getElement().getStyle().setVisibility(Visibility.VISIBLE); // addCollections.btnCancel.getElement().getStyle().setVisibility(Visibility.VISIBLE); addCollections.loadingPanel.setVisible(false); addCollections.nocollectionMsgLabel.setVisible(false); int collectionItemDoSize = collection.getCollectionItems().size(); collectionItems.add(collectionItemDoSize); addCollections.setCollectionItemDoSize(collectionItems); titleLabel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { addCollections.getMandatorySelectCollectionLbl().setVisible(false); if (titleLabel.getText().length() >= 40) { addCollections.collectionFirstElement .setText(titleLabel.getText().substring(0, 40) + "..."); addCollections.collectionFirstElement.getElement().setAttribute("id", titleLabel.getElement().getAttribute("id")); } else { addCollections.collectionFirstElement.setText(titleLabel.getText()); addCollections.collectionFirstElement.getElement().setAttribute("id", titleLabel.getElement().getAttribute("id")); } addCollections.copyPopUpScrollHtmlPanel.getElement().getStyle() .setVisibility(Visibility.HIDDEN); collId = addCollections.collectionFirstElement.getElement().getId(); } }); } } /** * to get more collection after scroll down, if collection item is more * than 20 */ addCollections.copyPopUpScrollHtmlPanel.addScrollHandler(new ScrollHandler() { @Override public void onScroll(ScrollEvent event) { if (addCollections.copyPopUpScrollHtmlPanel .getVerticalScrollPosition() == addCollections.copyPopUpScrollHtmlPanel .getMaximumVerticalScrollPosition() && totalSize >= 20) { addCollections.addLabel.getElement().setAttribute("style", "display:none"); addCollections.addLabel.setVisible(false); addCollections.btnCancel.setVisible(false); addCollections.loadingPanel.setVisible(true); addCollections.nocollectionMsgLabel.setVisible(false); addCollections.loadingPanel.getElement().setAttribute("style", "display:block"); addCollections.loadingPanel.getElement().setAttribute("style", "margin-top:18px"); pageNumber = pageNumber + 1; getPresenter().getUserColletionsList(pageSize, pageNumber); } } }); // Set current collection as selected // for (int i = 0; i < result.size(); i++) { // // if (addCollections.copyPopupListBox.getValue(i).equalsIgnoreCase( // collectionItemDo.getCollection().getGooruOid())) { // // addCollections.copyPopupListBox.setItemSelected(i, true); // collId = collectionItemDo.getCollection().getGooruOid(); // break; // // } // } }
From source file:org.ednovo.gooru.client.mvp.home.library.LibraryMenuNav.java
License:Open Source License
protected void setTaxonomyDataforStandards(String subjectname, final String subjectCode, String courseIdRefresh, ArrayList<StandardCourseDo> courseDoList) { if (courseDoList != null) { for (final StandardCourseDo standardsCourseDo : courseDoList) { if (subjectname.equalsIgnoreCase(STANDARDS)) { dynamicContainer.clear(); final Label courseTitle = new Label(standardsCourseDo.getLabel()); courseTitle.setStyleName(libraryStyleUc.courseOption()); courseTitle.getElement().setAttribute("style", "width: 50%;"); final String standardsId = standardsCourseDo.getCodeId().toString(); dynamicContainer.add(courseTitle); HTMLEventPanel panel = new HTMLEventPanel(dynamicContainer.getElement().getInnerHTML()); panel.setStyleName(libraryStyleUc.twoColumnContainer()); panel.getElement().setAttribute("style", "width: 200%;clear: both;height: 0px;"); final HTMLPanel subDropMenu = new HTMLPanel(""); subDropMenu.setStyleName(libraryStyleUc.subDropdown()); subDropMenu.getElement().setAttribute("style", "background: white;top: 0px;left: -1px;border: 1px solid #ddd;"); for (final CourseDo courseDo : standardsCourseDo.getCourse()) { Label unitsTitle = new Label(courseDo.getLabel()); unitsTitle.setStyleName(libraryStyleUc.unitOption()); final String courseId = courseDo.getCodeId().toString(); courseDoMap.put(courseId, courseDo); unitsTitle.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { setHeaderBrowserTitle(standardsCourseDo.getLabel()); //MixpanelUtil.mixpanelEvent("Library_"+STANDARDS+"_"+standardsCourseDo.getLabel()); MixpanelUtil.mixpanelEvent("standardlibrary_select_course"); Map<String, String> params = new HashMap<String, String>(); params.put(LIBRARY_PAGE, "course-page"); params.put(SUBJECT, STANDARDS); params.put("courseId", courseId); params.put("standardId", standardsId); if (courseTitle.getText().contains("Texas")) { params.put("libtype", "TEKS"); }/* w w w.j av a2 s . c o m*/ AppClientFactory.getPlaceManager().revealPlace(getPlaceToken(), params); } }); subDropMenu.add(unitsTitle); } subDropMenu.getElement().getStyle().setDisplay(Display.NONE); panel.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { subDropMenu.getElement().getStyle().setDisplay(Display.INLINE_BLOCK); } }); panel.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { subDropMenu.getElement().getStyle().setDisplay(Display.NONE); } }); panel.add(subDropMenu); standardData.add(panel); } } if (!AppClientFactory.isAnonymous()) { try { getStandardPrefCode( AppClientFactory.getLoggedInUser().getMeta().getTaxonomyPreference().getCode()); } catch (Exception e) { e.printStackTrace(); } } } if (courseIdRefresh != null) { if (subjectname.equals(SCIENCE)) { isScienceHovered = true; } else if (subjectname.equals(MATH)) { isMathHovered = true; } else if (subjectname.equals(SOCIAL)) { isSocialHovered = true; } else if (subjectname.equals(LANGUAGE)) { isLanguageHovered = true; } else if (subjectname.equals(STANDARDS)) { isStandatdHover = true; } setTabSelection(subjectname); AppClientFactory.fireEvent(new OpenSubjectCourseEvent(subjectname, courseDoMap.get(courseIdRefresh))); } }