class GuiReaderFrame extends JFrame implements FrameHelper {
private static final long serialVersionUID = 1L;
private GuiReader reader;
- private GuiReaderMainPanel helpee;
+ private GuiReaderMainPanel mainPanel;
private enum MoveAction {
SOURCE, TITLE, AUTHOR
this.reader = reader;
- // TODO: should we still have that??
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- helpee = new GuiReaderMainPanel(this, type);
+ mainPanel = new GuiReaderMainPanel(this, type);
setSize(800, 600);
setLayout(new BorderLayout());
- add(helpee);
-
- setVisible(true);
+ add(mainPanel);
}
@Override
imprt.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- helpee.imprt(true);
+ mainPanel.imprt(true);
}
});
JMenuItem imprtF = new JMenuItem("Import File...", KeyEvent.VK_F);
imprtF.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- helpee.imprt(false);
+ mainPanel.imprt(false);
}
});
JMenuItem exit = new JMenuItem("Exit", KeyEvent.VK_X);
vauthors.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- helpee.setWords(false);
- helpee.refreshBooks();
+ mainPanel.setWords(false);
+ mainPanel.refreshBooks();
}
});
view.add(vauthors);
vwords.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- helpee.setWords(true);
- helpee.refreshBooks();
+ mainPanel.setWords(true);
+ mainPanel.refreshBooks();
}
});
view.add(vwords);
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- helpee.removeBookPanes();
- helpee.addBookPane(source, type);
- helpee.refreshBooks();
+ mainPanel.removeBookPanes();
+ mainPanel.addBookPane(source, type);
+ mainPanel.refreshBooks();
}
};
}
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- helpee.removeBookPanes();
- helpee.addBookPane(type, listMode);
- helpee.refreshBooks();
+ mainPanel.removeBookPanes();
+ mainPanel.addBookPane(type, listMode);
+ mainPanel.refreshBooks();
}
};
}
export.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- final GuiReaderBook selectedBook = helpee.getSelectedBook();
+ final GuiReaderBook selectedBook = mainPanel.getSelectedBook();
if (selectedBook != null) {
fc.showDialog(GuiReaderFrame.this, "Save");
if (fc.getSelectedFile() != null) {
.getAbsolutePath()
+ type.getDefaultExtension(false);
final Progress pg = new Progress();
- helpee.outOfUi(pg, new Runnable() {
+ mainPanel.outOfUi(pg, new Runnable() {
@Override
public void run() {
try {
refresh.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- final GuiReaderBook selectedBook = helpee.getSelectedBook();
+ final GuiReaderBook selectedBook = mainPanel.getSelectedBook();
if (selectedBook != null) {
- helpee.outOfUi(null, new Runnable() {
+ mainPanel.outOfUi(null, new Runnable() {
@Override
public void run() {
reader.clearLocalReaderCache(selectedBook.getMeta()
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- final GuiReaderBook selectedBook = helpee.getSelectedBook();
+ final GuiReaderBook selectedBook = mainPanel.getSelectedBook();
if (selectedBook != null) {
String changeTo = type;
if (type == null) {
}
final String fChangeTo = changeTo;
- helpee.outOfUi(null, new Runnable() {
+ mainPanel.outOfUi(null, new Runnable() {
@Override
public void run() {
if (what.equals("SOURCE")) {
.getLuid(), fChangeTo);
}
- helpee.unsetSelectedBook();
+ mainPanel.unsetSelectedBook();
SwingUtilities.invokeLater(new Runnable() {
@Override
refresh.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- final GuiReaderBook selectedBook = helpee.getSelectedBook();
+ final GuiReaderBook selectedBook = mainPanel.getSelectedBook();
if (selectedBook != null) {
final MetaData meta = selectedBook.getMeta();
- helpee.imprt(meta.getUrl(), new StoryRunnable() {
+ mainPanel.imprt(meta.getUrl(), new StoryRunnable() {
@Override
public void run(Story story) {
reader.delete(meta.getLuid());
- helpee.unsetSelectedBook();
+ mainPanel.unsetSelectedBook();
MetaData newMeta = story.getMeta();
if (!newMeta.getSource().equals(meta.getSource())) {
reader.changeSource(newMeta.getLuid(),
delete.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- final GuiReaderBook selectedBook = helpee.getSelectedBook();
+ final GuiReaderBook selectedBook = mainPanel.getSelectedBook();
if (selectedBook != null) {
- helpee.outOfUi(null, new Runnable() {
+ mainPanel.outOfUi(null, new Runnable() {
@Override
public void run() {
reader.delete(selectedBook.getMeta().getLuid());
- helpee.unsetSelectedBook();
+ mainPanel.unsetSelectedBook();
}
});
}
delete.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- final GuiReaderBook selectedBook = helpee.getSelectedBook();
+ final GuiReaderBook selectedBook = mainPanel.getSelectedBook();
if (selectedBook != null) {
- helpee.outOfUi(null, new Runnable() {
+ mainPanel.outOfUi(null, new Runnable() {
@Override
public void run() {
new GuiReaderPropertiesFrame(reader, selectedBook
open.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- final GuiReaderBook selectedBook = helpee.getSelectedBook();
+ final GuiReaderBook selectedBook = mainPanel.getSelectedBook();
if (selectedBook != null) {
if (selectedBook.getMeta().getLuid() == null) {
- helpee.removeBookPanes();
- helpee.addBookPane(selectedBook.getMeta().getSource(),
- true);
- helpee.refreshBooks();
+ mainPanel.removeBookPanes();
+ mainPanel.addBookPane(selectedBook.getMeta()
+ .getSource(), true);
+ mainPanel.refreshBooks();
} else {
- helpee.openBook(selectedBook);
+ mainPanel.openBook(selectedBook);
}
}
}
open.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- final GuiReaderBook selectedBook = helpee.getSelectedBook();
+ final GuiReaderBook selectedBook = mainPanel.getSelectedBook();
if (selectedBook != null) {
reader.getLibrary().setSourceCover(
selectedBook.getMeta().getSource(),