1 package cz.frantovo.rozsireneAtributy;
3 import cz.frantovo.rozsireneAtributy.gui.Panel;
4 import java.awt.BorderLayout;
6 import java.io.IOException;
7 import java.util.logging.Level;
8 import java.util.logging.Logger;
9 import javax.swing.JFrame;
10 import javax.swing.JOptionPane;
15 * http://freedesktop.org/wiki/CommonExtendedAttributes
16 * http://download.oracle.com/javase/tutorial/essential/io/fileAttr.html#user
17 * http://today.java.net/pub/a/today/2008/07/03/jsr-203-new-file-apis.html#so-what-is-a-path-really
19 * $ setfattr -n "user.fiki.pozdrav" -v 'Dobrý den!' pokus.txt
20 * (v javě pak pracujeme s klíči bez předpony „user.“)
24 public class Startér {
26 private static final Logger log = Logger.getLogger(Startér.class.getSimpleName());
29 * @param args název souboru
30 * @throws IOException TODO: ošetřit výjimku
32 public static void main(String[] args) throws IOException {
34 if (args.length == 1 && args[0].length() > 0) {
35 File soubor = new File(args[0]);
37 if (soubor.exists()) {
38 log.log(Level.INFO, "Pracuji se souborem: {0}", soubor);
40 Model model = new Model(soubor);
42 JFrame f = new JFrame();
43 Panel p = new Panel(model);
45 f.setLayout(new BorderLayout());
46 f.add(p, BorderLayout.CENTER);
48 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
49 f.setTitle("Rozšířené stributy souboru: " + soubor);
51 f.setLocationRelativeTo(null);
54 ukončiChybou("Soubor neexistuje: " + soubor);
57 ukončiChybou("Očekávám právě jeden parametr – název souboru.");
61 private static void ukončiChybou(String hláška) {
62 log.log(Level.SEVERE, hláška);
63 JOptionPane.showMessageDialog(null, hláška, "Chyba", JOptionPane.ERROR_MESSAGE);