# HG changeset patch # User František Kučera # Date 1702252199 -3600 # Node ID 8d42303538edd0a6e25ab2f9a3e44b6a49f0b28f # Parent c2ffda907125278a2dd77a6b64460fe6e3eb3b83 zalomení (editovatelného) kódu na 80 znaků diff -r c2ffda907125 -r 8d42303538ed java/rozsirene-atributy-jedit/src/cz/frantovo/rozsireneAtributy/jedit/DokovatelnyPanel.java --- a/java/rozsirene-atributy-jedit/src/cz/frantovo/rozsireneAtributy/jedit/DokovatelnyPanel.java Mon Dec 11 00:28:30 2023 +0100 +++ b/java/rozsirene-atributy-jedit/src/cz/frantovo/rozsireneAtributy/jedit/DokovatelnyPanel.java Mon Dec 11 00:49:59 2023 +0100 @@ -38,7 +38,8 @@ */ public class DokovatelnyPanel extends JPanel implements EBComponent { - private static final Logger log = Logger.getLogger(DokovatelnyPanel.class.getName()); + private static final Logger log = Logger + .getLogger(DokovatelnyPanel.class.getName()); private View view; private Panel panel; @@ -77,21 +78,23 @@ try { if (událost instanceof EditPaneUpdate) { EditPaneUpdate epu = (EditPaneUpdate) událost; - // Chodí nám všechny události – potřebujeme filtrovat jen ty pro naše okno. + // Chodí nám všechny události + // – potřebujeme filtrovat jen ty pro naše okno. if (view == epu.getEditPane().getView()) { // zajímá nás jen přepnutí souboru if (epu.getWhat() == EditPaneUpdate.BUFFER_CHANGED) { /** * TODO: je soubor nově otevřený? */ - změňSoubor(view.getBuffer(), epu.getWhat() == EditPaneUpdate.CREATED); + změňSoubor(view.getBuffer(), + epu.getWhat() == EditPaneUpdate.CREATED); } } } // událost instanceof BufferUpdate // událost instanceof PropertiesChanged } catch (Exception e) { - log.log(Level.WARNING, "Chyba při zpracování události: " + událost, e); + log.log(Level.WARNING, "Chyba při zpracování: " + událost, e); } } @@ -117,7 +120,8 @@ } else { // TODO: zobrazit chybu - log.log(Level.WARNING, "Soubor neexistuje nebo nemáme práva na čtení: {0}", s); + log.log(Level.WARNING, + "Soubor neexistuje nebo nemáme práva na čtení: {0}", s); } } catch (IOException e) { log.log(Level.WARNING, "Chyba při změně souboru.", e); diff -r c2ffda907125 -r 8d42303538ed java/rozsirene-atributy-jedit/src/dockables.xml --- a/java/rozsirene-atributy-jedit/src/dockables.xml Mon Dec 11 00:28:30 2023 +0100 +++ b/java/rozsirene-atributy-jedit/src/dockables.xml Mon Dec 11 00:49:59 2023 +0100 @@ -1,7 +1,7 @@ - - new cz.frantovo.rozsireneAtributy.jedit.DokovatelnyPanel(view, position); - - \ No newline at end of file + + new cz.frantovo.rozsireneAtributy.jedit.DokovatelnyPanel(view, position); + + diff -r c2ffda907125 -r 8d42303538ed java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/Startér.java --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/Startér.java Mon Dec 11 00:28:30 2023 +0100 +++ b/java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/Startér.java Mon Dec 11 00:49:59 2023 +0100 @@ -38,7 +38,8 @@ * * http://freedesktop.org/wiki/CommonExtendedAttributes * http://download.oracle.com/javase/tutorial/essential/io/fileAttr.html#user - * http://today.java.net/pub/a/today/2008/07/03/jsr-203-new-file-apis.html#so-what-is-a-path-really + * http://today.java.net/pub/a/today/2008/07/03/jsr-203-new-file-apis.html + * #so-what-is-a-path-really * * $ setfattr -n "user.fiki.pozdrav" -v 'Dobrý den!' pokus.txt * (v javě pak pracujeme s klíči bez předpony „user.“) @@ -47,8 +48,10 @@ */ public class Startér { - private static final Logger log = Logger.getLogger(Startér.class.getSimpleName()); - private static final ResourceBundle překlady = ResourceBundle.getBundle(Atribut.class.getPackageName() + ".Překlady"); + private static final Logger log = Logger + .getLogger(Startér.class.getSimpleName()); + private static final ResourceBundle překlady = ResourceBundle + .getBundle(Atribut.class.getPackageName() + ".Překlady"); /** * @param args název souboru @@ -77,15 +80,19 @@ public void actionPerformed(ActionEvent ae) { f.dispose(); } - }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); + }, + KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), + JComponent.WHEN_IN_FOCUSED_WINDOW); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - f.setTitle(MessageFormat.format(překlady.getString("titulek"), soubor)); + f.setTitle(MessageFormat + .format(překlady.getString("titulek"), soubor)); f.setSize(640, 240); f.setLocationRelativeTo(null); f.setVisible(true); } else { - ukončiChybou(MessageFormat.format(překlady.getString("chyba.souborNeexistuje"), soubor)); + ukončiChybou(MessageFormat.format(překlady + .getString("chyba.souborNeexistuje"), soubor)); } } else { ukončiChybou(překlady.getString("chyba.chybíParametr")); @@ -94,7 +101,8 @@ private static void ukončiChybou(String hláška) { log.log(Level.SEVERE, hláška); - JOptionPane.showMessageDialog(null, hláška, překlady.getString("chyba.titulek"), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, hláška, překlady + .getString("chyba.titulek"), JOptionPane.ERROR_MESSAGE); System.exit(1); } } diff -r c2ffda907125 -r 8d42303538ed java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/EditorNázvůAtributů.java --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/EditorNázvůAtributů.java Mon Dec 11 00:28:30 2023 +0100 +++ b/java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/EditorNázvůAtributů.java Mon Dec 11 00:49:59 2023 +0100 @@ -28,11 +28,14 @@ import javax.swing.table.TableCellEditor; /** - * Umožňuje výběr názvu atributu z předvoleného seznamu (standardizované atributy). + * Umožňuje výběr názvu atributu z předvoleného seznamu + * (standardizované atributy). * * @author Ing. František Kučera (frantovo.cz) */ -public class EditorNázvůAtributů extends JComboBox implements TableCellEditor { +public class EditorNázvůAtributů + extends JComboBox + implements TableCellEditor { protected EventListenerList posluchače = new EventListenerList(); protected ChangeEvent událost = new ChangeEvent(this); @@ -130,7 +133,12 @@ } @Override - public Component getTableCellEditorComponent(JTable tabulka, Object hodnota, boolean vybraná, int řádek, int sloupec) { + public Component getTableCellEditorComponent( + JTable tabulka, + Object hodnota, + boolean vybraná, + int řádek, + int sloupec) { obnovHodnoty(hodnota); return this; } diff -r c2ffda907125 -r 8d42303538ed java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/Model.java --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/Model.java Mon Dec 11 00:28:30 2023 +0100 +++ b/java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/Model.java Mon Dec 11 00:49:59 2023 +0100 @@ -40,9 +40,14 @@ */ public class Model implements TableModel { - private static final Logger log = Logger.getLogger(Model.class.getSimpleName()); - private static final ResourceBundle překlady = ResourceBundle.getBundle(Atribut.class.getPackageName() + ".Překlady"); - private String[] sloupečky = {překlady.getString("tabulka.název"), překlady.getString("tabulka.hodnota")}; + private static final Logger log = Logger + .getLogger(Model.class.getSimpleName()); + private static final ResourceBundle překlady = ResourceBundle + .getBundle(Atribut.class.getPackageName() + ".Překlady"); + private String[] sloupečky = { + překlady.getString("tabulka.název"), + překlady.getString("tabulka.hodnota") + }; private Set posluchače = new HashSet<>(); private UserDefinedFileAttributeView souborovýSystém; private List atributy = new ArrayList<>(); @@ -50,7 +55,8 @@ public Model(File soubor) throws IOException { Path cesta = soubor.toPath(); FileSystemProvider posyktovatelFS = cesta.getFileSystem().provider(); - souborovýSystém = posyktovatelFS.getFileAttributeView(cesta, UserDefinedFileAttributeView.class); + souborovýSystém = posyktovatelFS + .getFileAttributeView(cesta, UserDefinedFileAttributeView.class); načtiAtributy(); } @@ -114,7 +120,7 @@ } } } catch (IOException e) { - log.log(Level.SEVERE, "Selhalo ukládání atributu na souborový systém", e); + log.log(Level.SEVERE, "Selhalo ukládání atributu na FS", e); } } @@ -153,7 +159,8 @@ List jménaAtributů = souborovýSystém.list(); atributy.clear(); for (String jménoAtributu : jménaAtributů) { - ByteBuffer hodnotaAtributu = ByteBuffer.allocate(souborovýSystém.size(jménoAtributu)); + ByteBuffer hodnotaAtributu = ByteBuffer + .allocate(souborovýSystém.size(jménoAtributu)); souborovýSystém.read(jménoAtributu, hodnotaAtributu); atributy.add(new Atribut(jménoAtributu, hodnotaAtributu)); } diff -r c2ffda907125 -r 8d42303538ed java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/Panel.java --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/Panel.java Mon Dec 11 00:28:30 2023 +0100 +++ b/java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/Panel.java Mon Dec 11 00:49:59 2023 +0100 @@ -34,8 +34,10 @@ public class Panel extends javax.swing.JPanel { private static final int SLOUPEC_NÁZVU = 0; - private static final Logger log = Logger.getLogger(Panel.class.getSimpleName()); - private static final ResourceBundle překlady = ResourceBundle.getBundle(Atribut.class.getPackageName() + ".Překlady"); + private static final Logger log = Logger + .getLogger(Panel.class.getSimpleName()); + private static final ResourceBundle překlady = ResourceBundle + .getBundle(Atribut.class.getPackageName() + ".Překlady"); private Model model; private Atribut vybranýAtribut; private JTable tabulka; @@ -50,7 +52,8 @@ posuvnýPanel.setViewportView(tabulka); /** Výběr aktuálního atributu v tabulce */ - tabulka.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + tabulka.getSelectionModel().addListSelectionListener( + new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { @@ -67,7 +70,8 @@ } private void nastavEditor() { - tabulka.getColumnModel().getColumn(SLOUPEC_NÁZVU).setCellEditor(new EditorNázvůAtributů()); + tabulka.getColumnModel().getColumn(SLOUPEC_NÁZVU) + .setCellEditor(new EditorNázvůAtributů()); } private Model getModel() { @@ -81,7 +85,8 @@ } private void zobrazChybovouHlášku(String hláška, Throwable chyba) { - JOptionPane.showMessageDialog(this, hláška, překlady.getString("chyba"), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, hláška, + překlady.getString("chyba"), JOptionPane.ERROR_MESSAGE); log.log(Level.WARNING, hláška, chyba); } @@ -155,7 +160,8 @@ try { model.odeberAtribut(vybranýAtribut); } catch (IOException e) { - zobrazChybovouHlášku(překlady.getString("chyba.nepodařiloSeSmazat"), e); + zobrazChybovouHlášku(překlady + .getString("chyba.nepodařiloSeSmazat"), e); } }//GEN-LAST:event_tlačítkoSmazatActionPerformed @@ -163,7 +169,8 @@ try { model.načtiAtributy(); } catch (IOException e) { - zobrazChybovouHlášku(překlady.getString("chyba.nepodařiloSeNačíst"), e); + zobrazChybovouHlášku(překlady + .getString("chyba.nepodařiloSeNačíst"), e); } }//GEN-LAST:event_tlačítkoZnovuNačístActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables