void reset() { Hashes.setValue(Collections.<String>emptyList()); Title.setValue(""); DownloadUrl.setValue(""); Mimetype.setValue(""); ThumbnailUrl.setValue(""); Size.setValue(0); }
public Map<String, Object> data(IBookCollection<Book> collection) { final Map<String, Object> map = new HashMap<String, Object>(); map.put("generation", myGeneration.getValue()); map.put("timestamp", System.currentTimeMillis()); final Book currentBook = collection.getRecentBook(0); if (currentBook != null) { final String oldHash = myCurrentBookHash.getValue(); final String newHash = collection.getHash(currentBook, true); if (newHash != null && !newHash.equals(oldHash)) { myCurrentBookHash.setValue(newHash); if (oldHash.length() != 0) { myCurrentBookTimestamp.setValue(String.valueOf(System.currentTimeMillis())); myServerBook.reset(); } } final String currentBookHash = newHash != null ? newHash : oldHash; final Map<String, Object> currentBookMap = new HashMap<String, Object>(); currentBookMap.put("hash", currentBookHash); currentBookMap.put("title", currentBook.getTitle()); try { currentBookMap.put("timestamp", Long.parseLong(myCurrentBookTimestamp.getValue())); } catch (Exception e) { } map.put("currentbook", currentBookMap); final List<Map<String, Object>> lst = new ArrayList<Map<String, Object>>(); if (positionOption(currentBookHash).getValue().length() == 0) { final Map<String, Object> posMap = positionMap(collection, currentBook); if (posMap != null) { posMap.put("hash", currentBookHash); lst.add(posMap); } } if (!currentBookHash.equals(oldHash) && positionOption(oldHash).getValue().length() == 0) { final Map<String, Object> posMap = positionMap(collection, collection.getBookByHash(oldHash)); if (posMap != null) { posMap.put("hash", oldHash); lst.add(posMap); } } if (lst.size() > 0) { map.put("positions", lst); } } System.err.println("DATA = " + map); return map; }
void init(Map<String, Object> book) { if (book == null) { reset(); } else { Hashes.setValue((List<String>) book.get("all_hashes")); Title.setValue((String) book.get("title")); final String downloadUrl = (String) book.get("download_url"); DownloadUrl.setValue(downloadUrl != null ? downloadUrl : ""); final String mimetype = (String) book.get("mimetype"); Mimetype.setValue(mimetype != null ? mimetype : ""); final String thumbnailUrl = (String) book.get("thumbnail_url"); ThumbnailUrl.setValue(thumbnailUrl != null ? thumbnailUrl : ""); final Long size = (Long) book.get("size"); Size.setValue(size != null ? (int) (long) size : 0); } }
public ZLTextFixedPosition.WithTimestamp getAndCleanPosition(String hash) { final ZLStringOption option = positionOption(hash); try { return map2Position((Map) JSONValue.parse(option.getValue())); } catch (Throwable t) { return null; } finally { option.setValue(""); } }
private ColorProfile(String name, ColorProfile base) { this(name); WallpaperOption.setValue(base.WallpaperOption.getValue()); FillModeOption.setValue(base.FillModeOption.getValue()); BackgroundOption.setValue(base.BackgroundOption.getValue()); SelectionBackgroundOption.setValue(base.SelectionBackgroundOption.getValue()); SelectionForegroundOption.setValue(base.SelectionForegroundOption.getValue()); HighlightingOption.setValue(base.HighlightingOption.getValue()); RegularTextOption.setValue(base.RegularTextOption.getValue()); HyperlinkTextOption.setValue(base.HyperlinkTextOption.getValue()); VisitedHyperlinkTextOption.setValue(base.VisitedHyperlinkTextOption.getValue()); FooterFillOption.setValue(base.FooterFillOption.getValue()); }
public void setColorProfileName(String name) { ColorProfileOption.setValue(name); myColorProfile = null; }