private void turnNameFieldIntoLabel() { String name = patternNameField.getText(); if (name.equalsIgnoreCase(DEFAULT_PATTERN_NAME)) { name = ""; } arrowImage.setVisible(true); patternNameField.setVisible(false); if (name.equals("")) { GWTServiceLookup.getSearchService().deleteSavedSearch(currentSearchId, blackHoleCallback); currentSearchId = 0; starImage.setUrl(STAR_OFF_URL); } else { // NOTE: currently do not support updated a saved search pattern if (currentSearchId == 0) { String pattern = autoCompletePatternField.getText(); createSavedSearch(name, pattern); } else { updateSavedSearchName(currentSearchId, name); } patternNameLabel.setText(elipse(name)); patternNameLabel.setVisible(true); starImage.setUrl(STAR_ON_URL); } }
@UiHandler("categoryImage") public void setDefaultImage(ErrorEvent event) { if (category.equalsIgnoreCase("collection")) { categoryImage.setUrl(DEFULT_IMAGE); } else if (category.equalsIgnoreCase("video")) { categoryImage.setUrl(DEFULT_VIMAGE); } else if (category.equalsIgnoreCase("question")) { categoryImage.setUrl(DEFULT_QIMAGE); } else if (category.equalsIgnoreCase("interactive")) { categoryImage.setUrl(DEFULT_IIMAGE); } else if (category.equalsIgnoreCase("website") || category.equalsIgnoreCase("exam") || category.equalsIgnoreCase("webpage")) { categoryImage.setUrl(DEFULT_WIMAGE); } else if (category.equalsIgnoreCase("slide") || category.equalsIgnoreCase("image")) { categoryImage.setUrl(DEFULT_ITYPEIMAGE); } else if (category.equalsIgnoreCase("textbook") || category.equalsIgnoreCase("handout") || category.equalsIgnoreCase("lesson") || category.equalsIgnoreCase("text")) { categoryImage.setUrl(DEFULT_TEXTIMAGE); } else if (category.equalsIgnoreCase("audio")) { categoryImage.setUrl(DEFULT_AIMAGE); } else if (category.equalsIgnoreCase("other")) { categoryImage.setUrl(DEFULT_OIMAGE); } else if (category.equalsIgnoreCase("profile")) { categoryImage.setUrl(DEFAULT_PROFILEIMAGE); } }
public void onStateChange() { if (uiSwitch.canUseImage()) { if (isOn) { isOn = false; image.setUrl(uiSwitch.getOffImage().getSrc()); } else { isOn = true; image.setUrl(uiSwitch.getOnImage().getSrc()); } } }
/** * Gets fired off when the resize panel being shown is changed. * * @param value the value. */ public void onResizePanelShownChanged(final boolean value) { // Since the size of the image is required before we can correctly show the // resize dialog, this method determines the avatar url and sets image url. // The load event of that image being loaded will kick off the resize modal. AvatarUrlGenerator urlGenerator = new AvatarUrlGenerator(EntityType.PERSON); hiddenImage.setUrl(urlGenerator.getOriginalAvatarUrl(strategy.getId(), avatarId)); }
public void updateSummary() { resource.setHref(c.getResourceUrl()); lblQuery.setText(c.getQueryString()); if (c.getImageUrl() != null) { imgResource.setUrl(c.getImageUrl()); } }
public void removeIcon() { center = new Text("Switch"); switchTable.setWidget(1, 1, center); switchTable.addStyleName("screen-btn-cont"); image.setUrl(""); isOn = true; }
private void addFileUploadWidget() { final FileUpload upload = new FileUpload(); upload.setWidth("200px"); upload.setName(getUniqueId()); uploadForms.add(upload); final HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setHeight("30px"); hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); // Don't display ability to remove form if expecting exactly 1 upload or if this is the first // upload element if (isMultiple() && uploadForms.size() > 1) { com.google.gwt.user.client.ui.Image crossImage = new com.google.gwt.user.client.ui.Image(); crossImage.setUrl(Resources.CROSS); crossImage.addClickHandler( new com.google.gwt.event.dom.client.ClickHandler() { public void onClick(final com.google.gwt.event.dom.client.ClickEvent clickEvent) { panel.remove(hPanel); uploadForms.remove(hPanel.getWidget(1)); } }); hPanel.add(crossImage); } else { com.google.gwt.user.client.ui.VerticalPanel space = new com.google.gwt.user.client.ui.VerticalPanel(); space.setSize("16px", "1px"); hPanel.add(space); } hPanel.add(upload); panel.add(hPanel); if (get() != null) { get().markForRedraw(); } }
@UiHandler("resourceThumbnail") public void onErrorResourceImage(ErrorEvent errorEvent) { resourceThumbnail.setUrl("images/resource_trans.png"); if (collectionItemDo.getResource().getResourceFormat() != null) { String resourceType = collectionItemDo.getResource().getResourceFormat().getDisplayName(); resourceType = resourceType.toLowerCase(); if (resourceType.equalsIgnoreCase("lesson") || resourceType.equalsIgnoreCase("textbook") || resourceType.equalsIgnoreCase("handout")) { resourceType = resourceType .replaceAll("lesson", "text") .replaceAll("textbook", "text") .replaceAll("handout", "text"); } if (resourceType.equalsIgnoreCase("slide")) { resourceType = resourceType.replaceAll("slide", "image"); } if (resourceType.equalsIgnoreCase("exam") || resourceType.equalsIgnoreCase("website") || resourceType.equalsIgnoreCase("challenge")) { resourceType = resourceType .replaceAll("exam", "webpage") .replaceAll("website", "webpage") .replaceAll("challenge", "webpage"); } resourceThumbnail.setStyleName(getResourceDefaultImage(resourceType)); } }
public PlaceBookEntryPreview(final Entry entry) { initWidget(uiBinder.createAndBindUi(this)); container .getElement() .getStyle() .setBackgroundImage( "url(" + Resources.IMAGES.placebook_open().getSafeUri().asString() + ")"); title.setText(entry.getTitle()); description.setText(entry.getDescription()); author.setText(entry.getOwnerName()); if (entry.getPreviewImage() != null) { image.setUrl( PlaceBooks.getServer().getHostURL() + "media?hash=" + entry.getPreviewImage() + "&type=imageitem"); } else { image.setVisible(false); } container.addDomHandler( new ClickHandler() { @Override public void onClick(final ClickEvent event) { PlaceBooks.goTo(new PlaceBookPage(entry.getKey())); } }, ClickEvent.getType()); }
/** * @function setLabelsAndIds * @created_date : Jan 2, 2014 * @description To set Labels and Id for buttons. * @parm(s) : * @return : void * @throws : <Mentioned if any exceptions> */ private void setLabelsAndIds() { btnResourceLink.setText(i18n.GL0548()); btnResourceLink.getElement().setId("btnResourceLink"); btnResourceLink.getElement().setAttribute("alt", i18n.GL0548()); btnResourceLink.getElement().setAttribute("title", i18n.GL0548()); lblGooruFieldTrip.setText(i18n.GL0549()); lblGooruFieldTrip.getElement().setId("lblGooruFieldTrip"); lblGooruFieldTrip.getElement().setAttribute("alt", i18n.GL0549()); lblGooruFieldTrip.getElement().setAttribute("title", i18n.GL0549()); // lblGooruFieldTripDescUnforseen.setText(i18n.GL0550); // lblGooruFieldTripDescOriginal.setText(i18n.GL0552); lblGooruFieldTripDescOriginal.setText(""); lblGooruFieldTripDescOriginal.getElement().setId("lblGooruFieldTripDescOriginal"); lblGooruFieldTripDescOriginal.getElement().setAttribute("alt", ""); lblGooruFieldTripDescOriginal.getElement().setAttribute("title", ""); lblDontForget.setText(i18n.GL0551()); lblDontForget.getElement().setId("lblDontForget"); lblDontForget.getElement().setAttribute("alt", i18n.GL0551()); lblDontForget.getElement().setAttribute("title", i18n.GL0551()); imgFieldTrip.getElement().setId("imgFieldTrip"); imgFieldTrip.setUrl("images/framebraker/field-trip.png"); resoruceFrameBrakerContainer.getElement().setId("fpnlResoruceFrameBrakerContainer"); resourceCategory.getElement().setId("pnlResourceCategory"); lblGooruFieldTripDescUnforseen.getElement().setId("lblGooruFieldTripDescUnforseen"); supportTip.getElement().setId("lblSupportTip"); // learnMoreLbl.setText("Learn more."); }
private void addAssignmentRow(final Assignment assignment, int insertrow) { int j = 0; int row = (insertrow <= assignmentsTable.getRowCount()) ? assignmentsTable.insertRow(insertrow) : insertrow; Image delIcon = getDeleteIcon(assignment); // assignment assignmentsTable.setWidget(row, j++, delIcon); Image icon = new Image(); icon.setUrl(getIconFile(assignment.getIconFileName())); assignmentsTable.setWidget(row, j++, icon); assignmentsTable.setWidget(row, j++, new Label(assignment.getToolName())); final TextBox textForSolvedAssignment = getHintTextBox(assignment, Result.CORRECT); assignmentsTable.setWidget(row, j++, textForSolvedAssignment); final ListBox fractions = getFractionsLB(assignment, Result.CORRECT); assignmentsTable.setWidget(row, j++, fractions); Image editIcon = new Image(GuiResources.INSTANCE.menu_icon_edit()); editIcon.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { handleEditClick(assignment); } }); assignmentsTable.setWidget(row, j++, editIcon); }
@Override protected void resetImpl() { targetPlatformPanel.clear(); featuresPanel.clear(); descriptionLabel.setText(""); projectDetailsPanel.setHTML(""); projectTitleLabel.setText(""); applicationImage.setUrl(""); }
public void setData(String[] data) { final int baseName = 12; final int basePrice = baseName + Constants.NO_OF_EXTRAS_IN_UI; final int basePriceValue = basePrice + Constants.NO_OF_EXTRAS_IN_UI; tbKeyId.setText(data[0]); String imageKey = data[1]; if (imageKey != null) { imgItem.setUrl(GWT.getHostPageBaseURL() + "serveBlob?id=" + data[1]); imgItem.setVisible(true); } tbName.setText(data[2]); taDescription.setText(data[3]); editingExistingData = true; if (data[4] != null) { rbSinglePrice.setValue(true); rbSinglePrice.setFormValue("single"); dbSinglePrice.setValue(Double.parseDouble(data[basePriceValue])); } else { rbMultiplePrice.setValue(true); rbMultiplePrice.setFormValue("multiple"); if (data[5] != null) { cbSmall.setValue(true); dbSmallPrice.setValue(Double.parseDouble(data[basePriceValue + 1])); } if (data[6] != null) { cbMedium.setValue(true); dbMediumPrice.setValue(Double.parseDouble(data[basePriceValue + 2])); } if (data[7] != null) { cbLarge.setValue(true); dbLargePrice.setValue(Double.parseDouble(data[basePriceValue + 3])); } if (data[8] != null) { cbTapa.setValue(true); dbTapaPrice.setValue(Double.parseDouble(data[basePriceValue + 4])); } if (data[9] != null) { cbHalf.setValue(true); dbHalfPrice.setValue(Double.parseDouble(data[basePriceValue + 5])); } if (data[10] != null) { cbFull.setValue(true); dbFullPrice.setValue(Double.parseDouble(data[basePriceValue + 6])); } } if (data[11] != null) { tbExtrasName.setText(data[11]); } for (int i = 0; i < Constants.NO_OF_EXTRAS_IN_UI; i++) { String name = data[baseName + i]; if (name != null) { tbExtras[i].setText(name); tbExtrasPrices[i].setText(data[basePrice + i]); } } }
@Test public void checkURL() { Image i = new Image("http://my-url"); Assert.assertEquals("http://my-url", i.getUrl()); i.setUrl("newURL"); Assert.assertEquals("newURL", i.getUrl()); }
private void init() { setHTML("Mensaje Error"); setWidget(flexTable); flexTable.setSize("88px", "102px"); imgIcono.setUrl("botones/mensajes/Error.png"); flexTable.setWidget(0, 0, imgIcono); flexTable.setWidget(1, 0, lblMensaje); flexTable.setWidget(2, 0, btnAceptar); this.lblMensaje.setText(this.mensaje); }
/* (non-Javadoc) * @see com.google.gwt.user.client.ui.Widget#onBrowserEvent(com.google.gwt.user.client.Event) */ public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: case Event.ONMOUSEUP: case Event.ONMOUSEMOVE: case Event.ONMOUSEOVER: if (!super.getUrl().equals(urlHover)) { super.setUrl(urlHover); } break; case Event.ONMOUSEOUT: { if (!super.getUrl().equals(url)) { super.setUrl(url); } break; } } super.onBrowserEvent(event); }
public void clearAll() { profileThumbnailImage.setUrl(""); userNameLabel.setText(""); userNameLabel.getElement().setAttribute("alt", ""); userNameLabel.getElement().setAttribute("title", ""); userCollections.setText(""); userCollections.getElement().setAttribute("alt", ""); userCollections.getElement().setAttribute("title", ""); userFollowDetails.setText(""); userFollowDetails.getElement().setAttribute("alt", ""); userFollowDetails.getElement().setAttribute("title", ""); }
@Override public void onLoad() { if (collectionItemDo .getResource() .getResourceType() .getName() .equalsIgnoreCase("assessment-question")) { resourceThumbnail.setUrl(getQuestionImage()); } else if (collectionItemDo .getResource() .getResourceType() .getName() .equalsIgnoreCase("video/youtube")) { resourceThumbnail.setUrl( ResourceImageUtil.youtubeImageLink( ResourceImageUtil.getYoutubeVideoId(collectionItemDo.getResource().getUrl()), Window.Location.getProtocol())); } else { resourceThumbnail.setUrl(collectionItemDo.getResource().getThumbnails().getUrl()); } }
private void check() { exercise.checkExercise(); int k = 1; int i = 0; // keep track of the row we're in checkAssignmentsTable.setWidget(i, k++, new Label(app.getMenu("Tool"))); checkAssignmentsTable.setWidget(i, k++, new Label(app.getPlain("Result"))); checkAssignmentsTable.setWidget(i, k++, new Label(app.getPlain("HintForResult"))); checkAssignmentsTable.setWidget(i, k++, new Label(app.getPlain("Fraction"))); i++; ArrayList<Assignment> parts = exercise.getParts(); for (int j = 0; j < parts.size(); j++, i++) { final Assignment assignment = parts.get(j); Image icon = new Image(); icon.setUrl(getIconFile(assignment.getIconFileName())); k = 0; checkAssignmentsTable.setWidget(i, k++, icon); checkAssignmentsTable.setWidget(i, k++, new Label(assignment.getToolName())); checkAssignmentsTable.setWidget(i, k++, new Label(assignment.getResult().name())); checkAssignmentsTable.setWidget(i, k++, new Label(assignment.getHint())); checkAssignmentsTable.setWidget( i, k++, new Label( app.getKernel() .format(assignment.getFraction() * 100, StringTemplate.defaultTemplate))); } checkAssignmentsTable.setWidget(i, k = 0, new Label(app.getPlain("FractionTotal"))); checkAssignmentsTable.setWidget( i, k++, new Label( app.getKernel().format(exercise.getFraction() * 100, StringTemplate.defaultTemplate))); }
public void update(Friend friend) { this.f = friend; name.setText(f.getJabberId()); if (f.getJabberId().equals("*****@*****.**")) { status.setText(I18N.strings.jabberSylvain()); icon.setUrl(icons.sylvain().getURL()); return; } switch (f.getStatus()) { case away: status.setText(I18N.strings.jabberAway()); icon.setUrl(icons.away().getURL()); break; case chat: status.setText(I18N.strings.jabberChat()); icon.setUrl(icons.chat().getURL()); break; case dnd: status.setText(I18N.strings.jabberDnd()); icon.setUrl(icons.dnd().getURL()); break; case notSpecified: status.setText(I18N.strings.jabberOnline()); icon.setUrl(icons.online().getURL()); break; case unknown: status.setText(I18N.strings.jabberUnknown()); icon.setUrl(icons.unknown().getURL()); break; case xa: status.setText(I18N.strings.jabberXa()); icon.setUrl(icons.xa().getURL()); break; } }
/** @param collectionItemDo */ @UiConstructor public ResourceFrameBreakerView(final CollectionItemDo collectionItemDo, boolean isGoogleFile) { initWidget(uiBinder.createAndBindUi(this)); PlayerBundle.INSTANCE.getPlayerStyle().ensureInjected(); this.collectionItemDo = collectionItemDo; if (!isGoogleFile) { setLabelsAndIds(); supportTip.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().supportTip()); supportTip.setText(i18n.GL1453()); supportTip.getElement().setId("lblSupportTip"); supportTip.getElement().setAttribute("alt", i18n.GL1453()); supportTip.getElement().setAttribute("title", i18n.GL1453()); btnResourceLink.addStyleName(PlayerBundle.INSTANCE.getPlayerStyle().btnResourceLink()); } else { btnResourceLink.removeFromParent(); } imgFieldTrip.setUrl(collectionItemDo.getResource().getThumbnailUrl()); if (collectionItemDo.getResource().getResourceFormat() != null) { defaultResourceCategory = collectionItemDo.getResource().getResourceFormat().getDisplayName(); } if (defaultResourceCategory != null) { if (defaultResourceCategory.equalsIgnoreCase("Lesson") || defaultResourceCategory.equalsIgnoreCase("Textbook") || defaultResourceCategory.equalsIgnoreCase("Handout")) { defaultResourceCategory = defaultResourceCategory .replaceAll("Lesson", "Text") .replaceAll("Textbook", "Text") .replaceAll("Handout", "Text") .replaceAll("lesson", "Text") .replaceAll("textbook", "Text") .replaceAll("handout", "Text"); } if (defaultResourceCategory.equalsIgnoreCase("Slide")) { defaultResourceCategory = defaultResourceCategory.replaceAll("Slide", "Image").replaceAll("slide", "Image"); } if (defaultResourceCategory.equalsIgnoreCase("Exam") || defaultResourceCategory.equalsIgnoreCase("Challenge") || defaultResourceCategory.equalsIgnoreCase("Website")) { defaultResourceCategory = defaultResourceCategory .replaceAll("Exam", "Webpage") .replaceAll("Challenge", "Webpage") .replaceAll("exam", "Webpage") .replaceAll("challenge", "Webpage"); } } imgFieldTrip.addErrorHandler( new ErrorHandler() { @Override public void onError(ErrorEvent event) { imgFieldTrip.setUrl(DEFULT_IMAGE_PREFIX + defaultResourceCategory.toLowerCase() + PNG); } }); if (collectionItemDo.getResource().getResourceFormat() != null) { resourceCategory.addStyleName( getResourceTypeImage( collectionItemDo.getResource().getResourceFormat().getDisplayName())); } }
public void refresh() { Resources _resources = Domeo.resources; try { init(); uriField.setValue(_resource.getUrl()); // sourceField.add(new HTML("<img src='" + Domeo.resources.externalLinkIcon().getURL() + "'/> // <a href='" + // _resource.getSource().getHomepage() + "' target='_blank'>"+_resource.getSource().getName() // + "</a> ")); String synonyms = _resource.getIsAbout().getSynonyms(); aboutField.add( new HTML( _resource.getIsAbout().getLabel() + " " + (_resource.getIsAbout().getSynonyms() != null ? synonyms : ""))); if (_domeo.getExtractorsManager().isExtractorDefined()) { urlImage.setResource(_resources.checkIcon()); urlImage.setTitle( "Known resource, executed extractor '" + _domeo.getExtractorsManager().getExtractorLabel() + "'"); urlImage.setVisible(true); } else { urlImage.setVisible(false); } if (_resource != null) { extractionProvenanceImage.setUrl( Domeo.resources.pluginsGrayLittleIcon().getSafeUri().asString()); extractionProvenanceImage.setTitle(_resource.getCreator().getName()); extractorProvenanceDetails.setText("Extracted by " + _resource.getCreator().getName()); extractionSourceDetails.setHTML( "Source <a href='" + _resource.getSource().getHomepage() + "' target='_blank'> <img src='" + Domeo.resources.externalLinkIcon().getSafeUri().asString() + "'/> " + _resource.getSource().getName() + "</a>"); extractionDateDetails.setText("On " + _resource.getFormattedCreationDate()); } } catch (Exception e) { _domeo .getLogger() .exception(this, "Exception while rendering OpenTrials resource info " + e.getMessage()); body.clear(); body.add( new HTML( "<img src='" + _resources.crossLittleIcon().getSafeUri().asString() + "'/> Exception while rendering OpenTrials resource info " + e.getMessage())); } // References try { CitationReferencesPanel p = new CitationReferencesPanel(_domeo, false); referencesPanel.clear(); referencesPanel.add(p); } catch (Exception e) { _domeo .getLogger() .exception(this, "Exception while rendering resource info " + e.getMessage()); referencesPanel.clear(); referencesPanel.add( new HTML( "<img src='" + _resources.crossLittleIcon().getSafeUri().asString() + "'/> Exception while rendering PubMed resource info " + e.getMessage())); } // Generic Document Resource try { LDocumentResourceCardPanel d = new LDocumentResourceCardPanel(_domeo); d.initializeLens(_resource, _parameters); contentPanel.clear(); contentPanel.add(d); } catch (Exception e) { _domeo .getLogger() .exception(this, "Exception while rendering resource info " + e.getMessage()); body.clear(); body.add( new HTML( "<img src='" + _resources.crossLittleIcon().getSafeUri().asString() + "'/> Exception while rendering OpenTrials resource info " + e.getMessage())); } }
public void setLogoUrl(String logoUrl) { this.logoUrl = logoUrl; imgLogo.setUrl(logoUrl); lblLogo.removeFromParent(); }
/** * Constructor. Displays the upload pane, with an upload widget and a next button. * * @param wys Entrypoint */ public UploadTab(WYSIWYMinterface wys) { super(); parent = wys; setStyleName("ks-Sink"); setSpacing(15); message1 = new Label("Welcome to the PolicyGrid Data Archive."); message1.setStyleName("wysiwym-label-xlarge"); message2 = new Label("Please upload your resource."); message2.setStyleName("wysiwym-label-large"); VerticalPanel vp = new VerticalPanel(); vp.add(message1); vp.add(message2); Image image = new Image(); image.setUrl("http://www.csd.abdn.ac.uk/~fhielkem/logo.jpg"); DockPanel top = new DockPanel(); top.setWidth("100%"); top.add(vp, DockPanel.WEST); top.add(image, DockPanel.EAST); add(top); form = new FormPanel(); form.setAction(GWT.getModuleBaseURL() + "/postings?action=upload"); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); form.setWidget(this); upload = new FileUpload(); upload.setName("upload"); add(upload); Hidden hid = new Hidden("user", parent.getUser()); add(hid); add( new Button( "Next >>", new ClickListener() { // if user clicks next, submit the uploaded file public void onClick(Widget sender) { form.submit(); } })); form.addFormHandler( new FormHandler() { // check whether resource was uploaded and stored in Fedora. If not, // display error message. public void onSubmitComplete( FormSubmitCompleteEvent event) { // tell the parent to create the initial description if (event.getResults().indexOf("ERROR!!") >= 0) Window.alert( "There was an error uploading your file. " + "It may be because your filename is too long, or contains special characters. " + "Please rename your file with a shorter name, using only letters and numbers, and try to upload it again."); else { RootPanel.get().remove(form); parent.startDescription(event.getResults()); } } public void onSubmit( FormSubmitEvent event) { // check whether user has uploaded a resource; if not, display warning if (upload.getFilename().length() == 0) { Window.alert("Please upload a document first."); event.setCancelled(true); } } }); RootPanel.get().add(form); }
/** @param url of the image */ public void setUrl(String url) { categoryImage.setUrl(StringUtil.formThumbnailName(url, ".")); categoryImage.setAltText(socialDo.getTitle()); categoryImage.setTitle(socialDo.getTitle()); }
public void setIcon(String icon) { image.setUrl(icon); switchTable.removeStyleName("screen-btn-cont"); switchTable.setWidget(1, 1, image); }
public void ajouterElement(JSONArray parametres, final int x, final int y, final String type) { final FormulaireController gc = FormulaireController.getInstance(); FormulaireBoard cb = gc.getCheckerBoard(); Widget element = null; TextBox label = new TextBox(); label.addStyleName("inputLabel"); JSONValue paramAsJSONValue; if (type.equals("text") || type.equals("date") || type.equals("time") || type.equals("chiffre")) paramAsJSONValue = parametres.get(0); else { JSONValue parametresValue = parametres.get(0); JSONObject parametresObject = parametresValue.isObject(); if (parametresObject.get("nom").isString().stringValue().equals("titre")) paramAsJSONValue = parametres.get(0); else paramAsJSONValue = parametres.get(1); } JSONObject paramAsJSONObject = paramAsJSONValue.isObject(); label.setText(paramAsJSONObject.get("valeur").isString().stringValue()); TextBox choix = null; final DroppableElement cellule = (DroppableElement) cb.getCell(x, y); cellule.type = type; Element elem = new Element(new Position(y, x), "deplace"); elem.getElement().setClassName(elem.getType() + "Style"); Image suppression = new Image(); suppression.setUrl("images/formulaire/delete.png"); suppression.addStyleName("deleteForm"); String id = Utils.generateId(); ; // Création de l'element selon le type if (type.equals("text")) { element = new TextBox(); } if (type.equals("image")) { element = new Image("../images/formulaire/Photo.png"); } else if (type.equals("checkbox")) { CheckBox c = new CheckBox(); // Ajout de l'attribut name pour les champs checkbox et radio cellule.name = "" + CHOICE; element = c; // Ajout du label de choix pour les champs de type checkbox et radio choix = new TextBox(); choix.addStyleName("inputLabel"); choix.getElement().setAttribute("placeholder", "Choix"); } else if (type.equals("radio")) { RadioButton r = new RadioButton("Choix"); cellule.name = "" + CHOICE; element = r; choix = new TextBox(); choix.addStyleName("inputLabel"); choix.getElement().setAttribute("placeholder", "Choix"); } else if (type.equals("combobox")) { OPTION++; // Ajout de l'option pour les champs de type combobox cellule.option = "" + OPTION; element = new ListBox(); } else if (type.equals("chiffre")) { element = new HTML( "<input type='text' class='gwt-TextBox' onkeypress=\"if((event.keyCode < 48 || event.keyCode > 57) && event.keyCode != 46){ event.returnValue=false;}else if(event.keyCode == 46 && (this.value == '' || this.value.indexOf('.') != -1)){ event.returnValue =false;} \" />"); } else if (type.equals("date")) { element = new HTML("<input type='text' id='date" + id + "' class='gwt-TextBox' />"); } else { element = new HTML("<input type='text' id='time" + id + "' class='gwt-TextBox' />"); } HorizontalPanel hp = cellule.getWidgetElement(); hp.add(label); hp.add(element); cellule.choix = false; if (type.equals("checkbox") || type.equals("radio") || type.equals("combobox")) { JSONValue parametresValue = parametres.get(0); JSONObject parametresObject = parametresValue.isObject(); if (parametresObject.get("nom").isString().stringValue().equals("titre")) paramAsJSONValue = parametres.get(1); else paramAsJSONValue = parametres.get(0); paramAsJSONObject = paramAsJSONValue.isObject(); String ch[] = paramAsJSONObject.get("valeur").isString().stringValue().split("\\*_\\*"); if (type.equals("checkbox") || type.equals("radio")) { choix.setText(ch[0]); for (int i = 1; i < ch.length; i++) { DroppableElement.ajouterChoix(x + i, y, type, ch[i]); } CHOICE++; } else { for (int i = 0; i < ch.length; i++) { ((ListBox) element).addItem(ch[i], ch[i]); } } } if (choix != null) hp.add(choix); hp.add(elem); hp.add(suppression); cellule.lock(); if (type.equals("date") || type.equals("time")) FormulaireController.nativeMethod(type + id, type); // Action de la suppression suppression.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // Vider la cellule cellule.clear(); // Si le champs est de type checkbox ou radio, il faix vider les // champs de choix également if (type.equals("checkbox") || type.equals("radio")) { final FormulaireController gc = FormulaireController.getInstance(); FormulaireBoard c = gc.getCheckerBoard(); boolean end = false; int ligne = x + 1; while (!end) { DroppableElement cellule_choix = (DroppableElement) c.getCell(ligne, y); if (cellule_choix.choix) { cellule_choix.clear(); cellule_choix.type = null; cellule_choix.choix = false; cellule_choix.name = null; cellule_choix.enable(); ligne++; } else end = true; } } // Rendre le champs capable de recevoir des elements puisqu'on // l'a vidé cellule.enable(); cellule.type = null; } }); }
/** * Sets the thumb url. * * @param url the new thumb url */ public void setThumbUrl(final String url) { image.setUrl(url); }
public void setImageUrl(String url) { image.setUrl(url); }
public void setView(UserFollowDo userFollowDo) { profileThumbnailImage.setUrl(userFollowDo.getProfileImageUrl()); profileThumbnailImage.addErrorHandler( new ErrorHandler() { @Override public void onError(ErrorEvent event) { profileThumbnailImage.setUrl("images/settings/setting-user-image.png"); } }); // userNameLabel.setText(userFollowDo.getUsername()); userNameLabel.getElement().setId(userFollowDo.getGooruUid()); int collectionCount = userFollowDo.getSummary().getCollection(); userCollections.setText( collectionCount + (collectionCount == 1 ? " Collection" : " Collections")); userCollections .getElement() .setAttribute( "alt", collectionCount + (collectionCount == 1 ? " Collection" : " Collections")); userCollections .getElement() .setAttribute( "title", collectionCount + (collectionCount == 1 ? " Collection" : " Collections")); userFollowDetails.setText( userFollowDo.getSummary().getFollowers() + (userFollowDo.getSummary().getFollowers() == 1 ? " Follower" : " Followers") + " | " + userFollowDo.getSummary().getFollowing() + " Following"); userFollowDetails .getElement() .setAttribute( "alt", userFollowDo.getSummary().getFollowers() + (userFollowDo.getSummary().getFollowers() == 1 ? " Follower" : " Followers") + " | " + userFollowDo.getSummary().getFollowing() + " Following"); userFollowDetails .getElement() .setAttribute( "title", userFollowDo.getSummary().getFollowers() + (userFollowDo.getSummary().getFollowers() == 1 ? " Follower" : " Followers") + " | " + userFollowDo.getSummary().getFollowing() + " Following"); String gooruUid = userNameLabel.getElement().getId(); Anchor anchor = new Anchor(); String userName = userFollowDo.getUsername(); String token = "#" + PlaceTokens.PROFILE_PAGE + "&id=" + gooruUid + "&user="******"style", "font-size: 18px !important"); anchor.setTarget("_blank"); userNameLabel.setText(""); userNameLabel.getElement().setAttribute("alt", ""); userNameLabel.getElement().setAttribute("title", ""); // boolean isEnabled = userFollowDo.getCustomFields() != null && // userFollowDo.getCustomFields().get(0).getOptionalValue() != null && // userFollowDo.getCustomFields().get(0).getOptionalValue().equalsIgnoreCase("true") ? true : // false; boolean isEnabled = false; if (userFollowDo.getCustomFields() != null) { for (int i = 0; i < userFollowDo.getCustomFields().size(); i++) if (userFollowDo .getCustomFields() .get(i) .getOptionalKey() .equalsIgnoreCase("show_profile_page")) { isEnabled = userFollowDo.getCustomFields().get(i).getOptionalValue().equalsIgnoreCase("true") ? true : false; } } if (isEnabled) { userNameLabel.getElement().appendChild(anchor.getElement()); } else { userNameLabel.setText(userFollowDo.getUsername()); userNameLabel.getElement().setAttribute("alt", userFollowDo.getUsername()); userNameLabel.getElement().setAttribute("title", userFollowDo.getUsername()); userNameLabel.getElement().getStyle().setCursor(Cursor.DEFAULT); } }