MCPcopy Create free account
hub / github.com/ArtifexSoftware/mupdf / gotoLocation

Method gotoLocation

platform/java/example/ViewerCore.java:300–343  ·  view source on GitHub ↗
(final Location location, final OnException onException)

Source from the content-addressed store, hash-verified

298 }
299
300 public void gotoLocation(final Location location, final OnException onException) {
301 worker.add(new Worker.Task() {
302 int itemIndex = -1;
303 Page page = null;
304 Rect bbox = null;
305 int chapterNumber = 0;
306 int pageNumber = 0;
307 public void work() {
308 if (location == null)
309 return;
310
311 chapterNumber = location.chapter;
312 pageNumber = doc.pageNumberFromLocation(location);
313
314 if (outline != null) {
315 for (int i = 0; i < outline.length; ++i) {
316 Location loc = outline[i].location;
317 int outlinePageNumber = doc.pageNumberFromLocation(loc);
318 if (outlinePageNumber <= pageNumber)
319 itemIndex = i;
320 }
321 }
322
323 page = doc.loadPage(location);
324 bbox = page.getBounds();
325 }
326 public void run() {
327 ViewerCore.this.page = page;
328 ViewerCore.this.currentPage = location;
329 if (currentPage == null || !currentPage.equals(searchHitPage))
330 ViewerCore.this.searchHitPage = null;
331 callback.onOutlineItemChange(itemIndex);
332 callback.onPageChange(location, chapterNumber, pageNumber, bbox);
333 }
334 public void exception(Throwable t) {
335 ViewerCore.this.page = null;
336 ViewerCore.this.currentPage = null;
337 ViewerCore.this.searchHitPage = null;
338 callback.onOutlineItemChange(-1);
339 if (onException != null)
340 onException.run(t);
341 }
342 });
343 }
344
345 public void flipPages(final int flips, final OnException onException) {
346 worker.add(new Worker.Task() {

Callers 5

runMethod · 0.95
exceptionMethod · 0.95
restoreMarkMethod · 0.80
itemStateChangedMethod · 0.80
onSearchStopMethod · 0.80

Calls 1

addMethod · 0.45

Tested by

no test coverage detected