MCPcopy Index your code
hub / github.com/ArtifexSoftware/mupdf / loadOutline

Method loadOutline

platform/java/example/ViewerCore.java:264–298  ·  view source on GitHub ↗
(final OnException onException)

Source from the content-addressed store, hash-verified

262 }
263
264 protected void loadOutline(final OnException onException) {
265 worker.add(new Worker.Task() {
266 OutlineItem[] outline = null;
267 protected void flattenOutline(Outline[] rawOutline, String indent, Vector<OutlineItem> v) {
268 for (Outline node : rawOutline) {
269 if (node.title != null) {
270 Location loc = doc.resolveLink(node);
271 String title = indent + node.title;
272 v.add(new OutlineItem(title, node.uri, loc));
273 }
274 if (node.down != null)
275 flattenOutline(node.down, indent + " ", v);
276 }
277 }
278 public void work() {
279 Outline[] rawOutline = doc.loadOutline();
280 if (rawOutline != null) {
281 Vector<OutlineItem> v = new Vector<OutlineItem>();
282 flattenOutline(rawOutline, "", v);
283
284 outline = new OutlineItem[v.size()];
285 v.toArray(outline);
286 }
287 }
288 public void run() {
289 ViewerCore.this.outline = outline;
290 callback.onOutlineChange(outline);
291 }
292 public void exception(Throwable t) {
293 callback.onOutlineChange(null);
294 if (onException != null)
295 onException.run(t);
296 }
297 });
298 }
299
300 public void gotoLocation(final Location location, final OnException onException) {
301 worker.add(new Worker.Task() {

Callers 2

runMethod · 0.95
workMethod · 0.45

Calls 1

addMethod · 0.45

Tested by

no test coverage detected