More work on TUI (can now browse a text story)
[nikiroo-utils.git] / src / be / nikiroo / fanfix / reader / TuiReader.java
1 package be.nikiroo.fanfix.reader;
2
3 import java.io.IOException;
4 import java.util.List;
5
6 import be.nikiroo.fanfix.Instance;
7 import be.nikiroo.fanfix.data.MetaData;
8
9 class TuiReader extends BasicReader {
10 @Override
11 public void read() throws IOException {
12 if (getStory() == null) {
13 throw new IOException("No story to read");
14 }
15
16 open(getStory().getMeta().getLuid());
17 }
18
19 @Override
20 public void read(int chapter) throws IOException {
21 // TODO: show a special page?
22 read();
23 }
24
25 @Override
26 public void start(String type) {
27 List<MetaData> stories = Instance.getLibrary().getListByType(type);
28 try {
29 TuiReaderApplication app = new TuiReaderApplication(stories, this);
30 new Thread(app).start();
31 } catch (Exception e) {
32 Instance.syserr(e);
33 }
34 }
35 }