/** * Returns the thumbnail of the gadget. * * @return the thumbnail of the gadget. */ public String getThumbnail() { return getProperty(THUMBNAIL); }
/** * Changes the author of the gadget to the given author. * * @param author the new gadget author. */ public void setAuthor(String author) { setProperty(AUTHOR, author); }
public void testUrlConstructor() { Gadget gadget = new Gadget(URL); assertEquals(ElementType.GADGET, gadget.getType()); assertEquals(URL, gadget.getProperty(URL)); assertEquals(URL, gadget.getUrl()); } }
newProperties.put(newPropertyName, newPropertyValue); newProperties.put(propertyNameToDelete, null); updatedElementsIn.add(new Gadget(newProperties)); assertEquals(gadgetUrl, gadget.getUrl()); assertEquals(ALEX.getAddress(), gadget.getAuthor()); assertEquals(updatedPropertyValue, gadget.getProperty(propertyName)); assertNotNull(gadget.getProperty(newPropertyName)); assertEquals(newPropertyValue, gadget.getProperty(newPropertyName)); assertNull(gadget.getProperty(propertyNameToDelete));
private Blip newBlip(String blipId, List<String> childBlipIds, String parentBlipId, List<Annotation> annotations, String content) { SortedMap<Integer, Element> elements = new TreeMap<Integer, Element>(); elements.put(14, new Gadget("http://a/b.xml")); Blip blip = new Blip(blipId, childBlipIds, content, Arrays.asList("robot@test.com", "user@test.com"), "user@test.com", 1000l, 123l, parentBlipId, null, annotations, elements, new ArrayList<String>(), wavelet); blips.put(blipId, blip); return blip; }
@Override public Element fromXml(Document doc, E element, Wavelet wavelet) { Gadget gadget = new Gadget(); gadget.setUrl(doc.getAttribute(element, "url")); String author = doc.getAttribute(element, "author"); if (author != null) { gadget.setAuthor(author); gadget.setIframe(ifr); while (child != null) { if (doc.getTagName(child).equals("name")) { gadget.setProperty("name", doc.getAttribute(child, "value")); } else if (doc.getTagName(child).equals("title")) { gadget.setProperty("title", doc.getAttribute(child, "value")); } else if (doc.getTagName(child).equals("thumbnail")) { gadget.setProperty("thumbnail", doc.getAttribute(child, "value")); } else if (doc.getTagName(child).equals("pref")) { gadget.setProperty("pref", doc.getAttribute(child, "value")); } else if (doc.getTagName(child).equals("state")) { gadget.setProperty(doc.getAttribute(child, "name"), doc.getAttribute(child, "value")); } else if (doc.getTagName(child).equals("category")) { gadget.setProperty("category", doc.getAttribute(child, "name"));
Gadget gadget = (Gadget) element; XmlStringBuilder xml = GadgetXmlUtil.constructXml(gadget.getUrl(), "", gadget.getAuthor(), null, gadget.getProperties());
public void testDefaultConstructor() { Gadget gadget = new Gadget(); assertEquals(ElementType.GADGET, gadget.getType()); assertEquals(EMPTY_STRING, gadget.getProperty(URL)); assertEquals(EMPTY_STRING, gadget.getUrl()); }
newProperties.put(newPropertyName, newPropertyValue); newProperties.put(propertyNameToDelete, null); updatedElementsIn.add(new Gadget(newProperties)); assertEquals(gadgetUrl, gadget.getUrl()); assertEquals(ALEX.getAddress(), gadget.getAuthor()); assertEquals(updatedPropertyValue, gadget.getProperty(propertyName)); assertNotNull(gadget.getProperty(newPropertyName)); assertEquals(newPropertyValue, gadget.getProperty(newPropertyName)); assertNull(gadget.getProperty(propertyNameToDelete));
@Override public void renderLogin(String userRecordKey, Wavelet wavelet) { // Clear login form. wavelet.getRootBlip().all().delete(); // TODO (elizabethford): Eventually have buildUrl from within gadget with gadget fetching // request key from datastore. // Add the gadget. String gadgetString = ""; try { String gadgetUrl = "http://" + remoteHost + GADGET_PATH; gadgetString = gadgetUrl + "?" + URLEncoder.encode("key", CHARACTER_ENCODING) + "=" + URLEncoder.encode(userRecordKey, CHARACTER_ENCODING); } catch (UnsupportedEncodingException e) { LOG.warning(e.toString()); } Gadget gadget = new Gadget(gadgetString); LOG.info(gadgetString); wavelet.getRootBlip().append(gadget); } }
public void testDefaultConstructor() { Gadget gadget = new Gadget(); assertEquals(ElementType.GADGET, gadget.getType()); assertEquals(EMPTY_STRING, gadget.getProperty(URL)); assertEquals(EMPTY_STRING, gadget.getUrl()); }
private Blip newBlip(String blipId, List<String> childBlipIds, String parentBlipId, List<Annotation> annotations, String content) { SortedMap<Integer, Element> elements = new TreeMap<Integer, Element>(); elements.put(14, new Gadget("http://a/b.xml")); Blip blip = new Blip(blipId, childBlipIds, content, Arrays.asList("robot@test.com", "user@test.com"), "user@test.com", 1000l, 123l, parentBlipId, null, annotations, elements, new ArrayList<String>(), wavelet); blips.put(blipId, blip); return blip; }
/** * Returns the category of the gadget. * * @return the category of the gadget. */ public String getCategory() { return getProperty(CATEGORY); }
/** * Changes the thumbnail of the gadget to the given thumbnail. * * @param thumbnail the new gadget thumbnail. */ public void setThumbnail(String thumbnail) { setProperty(THUMBNAIL, thumbnail); }
public void testUrlConstructor() { Gadget gadget = new Gadget(URL); assertEquals(ElementType.GADGET, gadget.getType()); assertEquals(URL, gadget.getProperty(URL)); assertEquals(URL, gadget.getUrl()); } }
result = new FormElement(type, properties); } else if (type == ElementType.GADGET) { result = new Gadget(properties); } else if (type == ElementType.IMAGE) { result = new Image(properties);
/** * Returns the cached iframe source of the gadget. * * @return the cached iframe source of the gadget. */ public String getIframe() { return getProperty(IFRAME); }
/** * Changes the category of the gadget to the given category. * * @param category the new gadget category. */ public void setCategory(String category) { setProperty(CATEGORY, category); }