private void processHistoryChange(String token) { if (GWTUtils.isEmpty(token)) { loadWelcomeScreen(); } else { String folderId = token; String imageId = null; int idx = token.indexOf("/"); if (idx > 0) { folderId = token.substring(0, idx); imageId = token.substring(idx + 1); } boolean folderDataLoaded = selectedFolder != null && selectedFolder.getId().equals(folderId); boolean imageToSelectLoaded = false; if (imageId != null && !GWTUtils.isEmpty(loadedImages)) { for (ClientImage im : loadedImages) { if (im.getId().equals(imageId)) { imageToSelectLoaded = true; break; } } } if (!folderDataLoaded || !imageToSelectLoaded) { loadSmallImages(folderId, imageId, true); } else { showImages(selectedFolder, imageId, loadedImages, false); } } }
private void updateImageAsSelected(String imageToSelect) { for (ClientImage im : loadedImages) { if (im.getId().equals(imageToSelect)) { markImageAsSelected(im.getId(), true); } else { markImageAsSelected(im.getId(), false); } } }
private String genSmallImageHtml( String folderId, ClientImage image, boolean last, boolean navigateLeft, boolean navigateRight) { String dq = new DataQueryJsonBuilder() .add("imageId", image.getId()) .add("folderId", folderId) .toDataQuery(); String uidAndDq = GWTUtils.genUid(UID_SMALL_IMAGE_CLICK) + " " + dq; String navigateCustomCss = navigateLeft ? "arrow-left" : "arrow-right"; String navigateUid = navigateLeft ? UID_SMALL_LEFT : UID_SMALL_RIGHT; String navigateId = navigateLeft ? ID_PREV_SMALL : ID_NEXT_SMALL; String id = genSmallImageWrapperId(image.getId()); String itemCustomCss = last ? "sf-item-last" : ""; String html = ""; html += "<li class='sf-item " + itemCustomCss + "' " + uidAndDq + ">"; html += "<div id='" + id + "' class='sf-img-w'>"; if (navigateLeft || navigateRight) { html += "<div id='" + navigateId + "' class='arrow " + navigateCustomCss + "' " + GWTUtils.genUid(navigateUid) + ">"; html += "<div class='arrow-point arrow-point-1'></div>"; html += "<div class='arrow-point arrow-point-2'></div>"; html += "<div class='arrow-point arrow-point-3'></div>"; html += "<div class='arrow-point arrow-point-4'></div>"; html += "<div class='arrow-point arrow-point-5'></div>"; html += "<div class='arrow-point arrow-point-6'></div>"; html += "<div class='arrow-point arrow-point-7'></div>"; html += "<div class='arrow-point arrow-point-8'></div>"; html += "<div class='arrow-point arrow-point-9'></div>"; html += "</div>"; } html += "<img id='" + "small-" + image.getId() + "' src='" + GalleryClientUtils.genSmallImageSrc(folderId, image.getId()) + "'></img>"; html += "</div>"; html += "</li>"; return html; }