oprava názvu balíčku
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon Dec 11 00:28:30 2023 +0100 (12 months ago)
changeset 281957b59c9349
parent 27 36cee2c8f5f8
child 29 68aa96eef859
oprava názvu balíčku
java/rozsirene-atributy/nbproject/project.properties
java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Atribut.java
java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Překlady.properties
java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Překlady_cs.properties
java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Překlady_en.properties
java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Startér.java
java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/gui/EditorNázvůAtributů.java
java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/gui/Model.java
java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/gui/Panel.form
java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/gui/Panel.java
java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/Atribut.java
java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/Překlady.properties
java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/Překlady_cs.properties
java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/Překlady_en.properties
java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/Startér.java
java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/EditorNázvůAtributů.java
java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/Model.java
java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/Panel.form
java/rozsirene-atributy/src/cz/frantovo/rozsireneatributy/gui/Panel.java
     1.1 --- a/java/rozsirene-atributy/nbproject/project.properties	Mon Dec 11 00:10:33 2023 +0100
     1.2 +++ b/java/rozsirene-atributy/nbproject/project.properties	Mon Dec 11 00:28:30 2023 +0100
     1.3 @@ -28,7 +28,7 @@
     1.4  jar.archive.disabled=${jnlp.enabled}
     1.5  javadoc.author=false
     1.6  endorsed.classpath=
     1.7 -main.class=cz.frantovo.rozsireneAtributy.Start\u00E9r
     1.8 +main.class=cz.frantovo.rozsireneatributy.Start\u00e9r
     1.9  junit.selected.version=4
    1.10  source.encoding=UTF-8
    1.11  javac.source=1.7
     2.1 --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Atribut.java	Mon Dec 11 00:10:33 2023 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,94 +0,0 @@
     2.4 -/**
     2.5 - * Rozšířené atributy – program na správu rozšířených atributů souborů
     2.6 - * Copyright © 2012 František Kučera (frantovo.cz)
     2.7 - * 
     2.8 - * This program is free software: you can redistribute it and/or modify
     2.9 - * it under the terms of the GNU General Public License as published by
    2.10 - * the Free Software Foundation, either version 3 of the License.
    2.11 - * 
    2.12 - * This program is distributed in the hope that it will be useful,
    2.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.15 - * GNU General Public License for more details.
    2.16 - * 
    2.17 - * You should have received a copy of the GNU General Public License
    2.18 - * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    2.19 - */
    2.20 -package cz.frantovo.rozsireneAtributy;
    2.21 -
    2.22 -import java.nio.ByteBuffer;
    2.23 -import java.nio.charset.Charset;
    2.24 -
    2.25 -public class Atribut {
    2.26 -
    2.27 -	private String klíč;
    2.28 -	private String hodnota;
    2.29 -
    2.30 -	public Atribut(String klíč, String hodnota) {
    2.31 -		this.klíč = klíč;
    2.32 -		this.hodnota = hodnota;
    2.33 -	}
    2.34 -
    2.35 -	public Atribut(String klíč, ByteBuffer hodnota) {
    2.36 -		this.klíč = klíč;
    2.37 -		setHodnota(hodnota);
    2.38 -	}
    2.39 -
    2.40 -	public Atribut() {
    2.41 -	}
    2.42 -
    2.43 -	public String getKlíč() {
    2.44 -		return klíč;
    2.45 -	}
    2.46 -
    2.47 -	public void setKlíč(String klíč) {
    2.48 -		this.klíč = klíč;
    2.49 -	}
    2.50 -
    2.51 -	/**
    2.52 -	 * Název atributu musí být nenulový a mít nějakou délku, aby šel uložit
    2.53 -	 * TODO: další kontroly?
    2.54 -	 * @return jestli je platný
    2.55 -	 */
    2.56 -	public boolean isPlatnýKlíč() {
    2.57 -		return klíč != null && klíč.length() > 0;
    2.58 -	}
    2.59 -
    2.60 -	/**
    2.61 -	 * nulová hodnota → smazání atributu
    2.62 -	 * (ale může být prázdný řetězec)
    2.63 -	 * @return jestli je platná
    2.64 -	 */
    2.65 -	public boolean isPlatnáHodnota() {
    2.66 -		return hodnota != null;
    2.67 -	}
    2.68 -
    2.69 -	public String getHodnota() {
    2.70 -		return hodnota;
    2.71 -	}
    2.72 -
    2.73 -	public final ByteBuffer getHodnotaBajty() {
    2.74 -		return zakóduj(getHodnota());
    2.75 -	}
    2.76 -
    2.77 -	public void setHodnota(String hodnota) {
    2.78 -		this.hodnota = hodnota;
    2.79 -	}
    2.80 -
    2.81 -	public final void setHodnota(ByteBuffer hodnota) {
    2.82 -		setHodnota(dekóduj(hodnota));
    2.83 -	}
    2.84 -
    2.85 -	private static String dekóduj(ByteBuffer bajty) {
    2.86 -		bajty.flip();
    2.87 -		return Charset.defaultCharset().decode(bajty).toString();
    2.88 -	}
    2.89 -
    2.90 -	private static ByteBuffer zakóduj(String text) {
    2.91 -		if (text == null) {
    2.92 -			return null;
    2.93 -		} else {
    2.94 -			return Charset.defaultCharset().encode(text);
    2.95 -		}
    2.96 -	}
    2.97 -}
     3.1 --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Překlady.properties	Mon Dec 11 00:10:33 2023 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,1 +0,0 @@
     3.4 -Překlady_cs.properties
     3.5 \ No newline at end of file
     4.1 --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Překlady_cs.properties	Mon Dec 11 00:10:33 2023 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,14 +0,0 @@
     4.4 -titulek=Roz\u0161\u00ed\u0159en\u00e9 stributy souboru: {0}
     4.5 -
     4.6 -chyba.titulek=Chyba
     4.7 -chyba.souborNeexistuje=Soubor neexistuje: {0}
     4.8 -chyba.chyb\u00edParametr=O\u010dek\u00e1v\u00e1m pr\u00e1v\u011b jeden parametr \u2013 n\u00e1zev souboru.
     4.9 -chyba.nepoda\u0159iloSeSmazat=Nepoda\u0159ilo se smazat atribut.
    4.10 -chyba.nepoda\u0159iloSeNa\u010d\u00edst=Nepoda\u0159ilo se na\u010d\u00edst atributy.
    4.11 -
    4.12 -tabulka.n\u00e1zev=N\u00e1zev
    4.13 -tabulka.hodnota=Hodnota
    4.14 -
    4.15 -p\u0159idatAtribut=P\u0159idat atribut
    4.16 -smazatAtribut=Smazat atribut
    4.17 -znovuNa\u010d\u00edst=Znovu na\u010d\u00edst
     5.1 --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Překlady_en.properties	Mon Dec 11 00:10:33 2023 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,14 +0,0 @@
     5.4 -titulek=Extended Attributes of file: {0}
     5.5 -
     5.6 -chyba.titulek=Error
     5.7 -chyba.souborNeexistuje=File does not exist: {0}
     5.8 -chyba.chyb\u00edParametr=Expecting one parameter \u2013 file name.
     5.9 -chyba.nepoda\u0159iloSeSmazat=Failed to delete the attribute.
    5.10 -chyba.nepoda\u0159iloSeNa\u010d\u00edst=Failed to load attributes.
    5.11 -
    5.12 -tabulka.n\u00e1zev=Name
    5.13 -tabulka.hodnota=Value
    5.14 -
    5.15 -p\u0159idatAtribut=Add attribute
    5.16 -smazatAtribut=Delete attribute
    5.17 -znovuNa\u010d\u00edst=Reload all
     6.1 --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Startér.java	Mon Dec 11 00:10:33 2023 +0100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,100 +0,0 @@
     6.4 -/**
     6.5 - * Rozšířené atributy – program na správu rozšířených atributů souborů
     6.6 - * Copyright © 2012 František Kučera (frantovo.cz)
     6.7 - * 
     6.8 - * This program is free software: you can redistribute it and/or modify
     6.9 - * it under the terms of the GNU General Public License as published by
    6.10 - * the Free Software Foundation, either version 3 of the License.
    6.11 - * 
    6.12 - * This program is distributed in the hope that it will be useful,
    6.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6.15 - * GNU General Public License for more details.
    6.16 - * 
    6.17 - * You should have received a copy of the GNU General Public License
    6.18 - * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    6.19 - */
    6.20 -package cz.frantovo.rozsireneAtributy;
    6.21 -
    6.22 -import cz.frantovo.rozsireneAtributy.gui.Model;
    6.23 -import cz.frantovo.rozsireneAtributy.gui.Panel;
    6.24 -import java.awt.BorderLayout;
    6.25 -import java.awt.event.ActionEvent;
    6.26 -import java.awt.event.ActionListener;
    6.27 -import java.awt.event.KeyEvent;
    6.28 -import java.io.File;
    6.29 -import java.io.IOException;
    6.30 -import java.text.MessageFormat;
    6.31 -import java.util.ResourceBundle;
    6.32 -import java.util.logging.Level;
    6.33 -import java.util.logging.Logger;
    6.34 -import javax.swing.JComponent;
    6.35 -import javax.swing.JFrame;
    6.36 -import javax.swing.JOptionPane;
    6.37 -import javax.swing.KeyStroke;
    6.38 -
    6.39 -/**
    6.40 - * Spouštěč programu
    6.41 - *
    6.42 - * http://freedesktop.org/wiki/CommonExtendedAttributes
    6.43 - * http://download.oracle.com/javase/tutorial/essential/io/fileAttr.html#user
    6.44 - * http://today.java.net/pub/a/today/2008/07/03/jsr-203-new-file-apis.html#so-what-is-a-path-really
    6.45 - *
    6.46 - * $ setfattr -n "user.fiki.pozdrav" -v 'Dobrý den!' pokus.txt
    6.47 - * (v javě pak pracujeme s klíči bez předpony „user.“)
    6.48 - *
    6.49 - * @author fiki
    6.50 - */
    6.51 -public class Startér {
    6.52 -
    6.53 -	private static final Logger log = Logger.getLogger(Startér.class.getSimpleName());
    6.54 -	private static final ResourceBundle překlady = ResourceBundle.getBundle("cz.frantovo.rozsireneAtributy.Překlady");
    6.55 -
    6.56 -	/**
    6.57 -	 * @param args název souboru
    6.58 -	 * @throws IOException TODO: ošetřit výjimku
    6.59 -	 */
    6.60 -	public static void main(String[] args) throws IOException {
    6.61 -
    6.62 -
    6.63 -		if (args.length == 1 && args[0].length() > 0) {
    6.64 -			File soubor = new File(args[0]);
    6.65 -
    6.66 -			if (soubor.exists()) {
    6.67 -				log.log(Level.INFO, "Pracuji se souborem: {0}", soubor);
    6.68 -
    6.69 -				Model model = new Model(soubor);
    6.70 -
    6.71 -				final JFrame f = new JFrame();
    6.72 -				Panel p = new Panel(model);
    6.73 -
    6.74 -				f.setLayout(new BorderLayout());
    6.75 -				f.add(p, BorderLayout.CENTER);
    6.76 -
    6.77 -				/** Ukončení programu klávesou Escape */
    6.78 -				f.getRootPane().registerKeyboardAction(new ActionListener() {
    6.79 -
    6.80 -					public void actionPerformed(ActionEvent ae) {
    6.81 -						f.dispose();
    6.82 -					}
    6.83 -				}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
    6.84 -
    6.85 -				f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    6.86 -				f.setTitle(MessageFormat.format(překlady.getString("titulek"), soubor));
    6.87 -				f.setSize(640, 240);
    6.88 -				f.setLocationRelativeTo(null);
    6.89 -				f.setVisible(true);
    6.90 -			} else {
    6.91 -				ukončiChybou(MessageFormat.format(překlady.getString("chyba.souborNeexistuje"), soubor));
    6.92 -			}
    6.93 -		} else {
    6.94 -			ukončiChybou(překlady.getString("chyba.chybíParametr"));
    6.95 -		}
    6.96 -	}
    6.97 -
    6.98 -	private static void ukončiChybou(String hláška) {
    6.99 -		log.log(Level.SEVERE, hláška);
   6.100 -		JOptionPane.showMessageDialog(null, hláška, překlady.getString("chyba.titulek"), JOptionPane.ERROR_MESSAGE);
   6.101 -		System.exit(1);
   6.102 -	}
   6.103 -}
     7.1 --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/gui/EditorNázvůAtributů.java	Mon Dec 11 00:10:33 2023 +0100
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,173 +0,0 @@
     7.4 -/**
     7.5 - * Rozšířené atributy – program na správu rozšířených atributů souborů
     7.6 - * Copyright © 2012 František Kučera (frantovo.cz)
     7.7 - *
     7.8 - * This program is free software: you can redistribute it and/or modify
     7.9 - * it under the terms of the GNU General Public License as published by
    7.10 - * the Free Software Foundation, either version 3 of the License.
    7.11 - *
    7.12 - * This program is distributed in the hope that it will be useful,
    7.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    7.15 - * GNU General Public License for more details.
    7.16 - *
    7.17 - * You should have received a copy of the GNU General Public License
    7.18 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
    7.19 - */
    7.20 -package cz.frantovo.rozsireneAtributy.gui;
    7.21 -
    7.22 -import java.awt.Component;
    7.23 -import java.awt.event.ActionEvent;
    7.24 -import java.awt.event.ActionListener;
    7.25 -import java.util.EventObject;
    7.26 -import javax.swing.JComboBox;
    7.27 -import javax.swing.JTable;
    7.28 -import javax.swing.event.CellEditorListener;
    7.29 -import javax.swing.event.ChangeEvent;
    7.30 -import javax.swing.event.EventListenerList;
    7.31 -import javax.swing.table.TableCellEditor;
    7.32 -
    7.33 -/**
    7.34 - * Umožňuje výběr názvu atributu z předvoleného seznamu (standardizované atributy).
    7.35 - *
    7.36 - * @author Ing. František Kučera (frantovo.cz)
    7.37 - */
    7.38 -public class EditorNázvůAtributů extends JComboBox<String> implements TableCellEditor {
    7.39 -
    7.40 -	protected EventListenerList posluchače = new EventListenerList();
    7.41 -	protected ChangeEvent událost = new ChangeEvent(this);
    7.42 -
    7.43 -	public EditorNázvůAtributů() {
    7.44 -		super();
    7.45 -		setEditable(true);
    7.46 -		addActionListener(new ActionListener() {
    7.47 -
    7.48 -			@Override
    7.49 -			public void actionPerformed(ActionEvent e) {
    7.50 -				fireEditiaceSkončila();
    7.51 -			}
    7.52 -		});
    7.53 -	}
    7.54 -
    7.55 -	protected void fireEditiaceSkončila() {
    7.56 -		for (Object posluchač : posluchače.getListenerList()) {
    7.57 -			if (posluchač instanceof CellEditorListener) {
    7.58 -				((CellEditorListener) posluchač).editingStopped(událost);
    7.59 -			}
    7.60 -		}
    7.61 -	}
    7.62 -
    7.63 -	protected void fireEditiaceZrušena() {
    7.64 -		for (Object posluchač : posluchače.getListenerList()) {
    7.65 -			if (posluchač instanceof CellEditorListener) {
    7.66 -				((CellEditorListener) posluchač).editingCanceled(událost);
    7.67 -			}
    7.68 -		}
    7.69 -	}
    7.70 -
    7.71 -	/**
    7.72 -	 * TODO:
    7.73 -	 * - další standardní atributy
    7.74 -	 * - konfigurovatelnost
    7.75 -	 *
    7.76 -	 * @see http://www.freedesktop.org/wiki/CommonExtendedAttributes
    7.77 -	 */
    7.78 -	private void obnovHodnoty(Object názevAtributu) {
    7.79 -		removeAllItems();
    7.80 -
    7.81 -		if (názevAtributu == null) {
    7.82 -			názevAtributu = "";
    7.83 -		} else if (!(názevAtributu instanceof String)) {
    7.84 -			názevAtributu = String.valueOf(názevAtributu);
    7.85 -		}
    7.86 -		addItem((String) názevAtributu);
    7.87 -		setSelectedItem(názevAtributu);
    7.88 -
    7.89 -
    7.90 -		// General attributes in current use
    7.91 -		addItem("mime_type");
    7.92 -		addItem("charset");
    7.93 -		addItem("creator");
    7.94 -
    7.95 -		// Proposed metadata attributes
    7.96 -		addItem("xdg.comment");
    7.97 -		addItem("xdg.origin.url");
    7.98 -		addItem("xdg.origin.email.subject");
    7.99 -		addItem("xdg.origin.email.from");
   7.100 -		addItem("xdg.origin.email.message-id");
   7.101 -		addItem("xdg.language");
   7.102 -		addItem("xdg.creator");
   7.103 -		addItem("xdg.publisher");
   7.104 -
   7.105 -		// Proposed control attributes
   7.106 -		addItem("xdg.robots.index");
   7.107 -		addItem("xdg.robots.backup");
   7.108 -
   7.109 -		// Dublin Core
   7.110 -		addItem("dublincore.title");
   7.111 -		addItem("dublincore.creator");
   7.112 -		addItem("dublincore.subject");
   7.113 -		addItem("dublincore.description");
   7.114 -		addItem("dublincore.publisher");
   7.115 -		addItem("dublincore.contributor");
   7.116 -		addItem("dublincore.date");
   7.117 -		addItem("dublincore.type");
   7.118 -		addItem("dublincore.format");
   7.119 -		addItem("dublincore.identifier");
   7.120 -		addItem("dublincore.source");
   7.121 -		addItem("dublincore.language");
   7.122 -		addItem("dublincore.relation");
   7.123 -		addItem("dublincore.coverage");
   7.124 -		addItem("dublincore.rights");
   7.125 -
   7.126 -		// Application-specific attributes in current use
   7.127 -		addItem("mime_encoding");
   7.128 -		addItem("apache_handler");
   7.129 -		addItem("Beagle.AttrTime");
   7.130 -		addItem("Beagle.Fingerprint");
   7.131 -		addItem("Beagle.MTime");
   7.132 -		addItem("Beagle.Uid");
   7.133 -	}
   7.134 -
   7.135 -	@Override
   7.136 -	public Component getTableCellEditorComponent(JTable tabulka, Object hodnota, boolean vybraná, int řádek, int sloupec) {
   7.137 -		obnovHodnoty(hodnota);
   7.138 -		return this;
   7.139 -	}
   7.140 -
   7.141 -	@Override
   7.142 -	public Object getCellEditorValue() {
   7.143 -		return getSelectedItem();
   7.144 -	}
   7.145 -
   7.146 -	@Override
   7.147 -	public boolean isCellEditable(EventObject anEvent) {
   7.148 -		return true;
   7.149 -	}
   7.150 -
   7.151 -	@Override
   7.152 -	public boolean shouldSelectCell(EventObject anEvent) {
   7.153 -		return true;
   7.154 -	}
   7.155 -
   7.156 -	@Override
   7.157 -	public boolean stopCellEditing() {
   7.158 -		fireEditiaceSkončila();
   7.159 -		return true;
   7.160 -	}
   7.161 -
   7.162 -	@Override
   7.163 -	public void cancelCellEditing() {
   7.164 -		fireEditiaceZrušena();
   7.165 -	}
   7.166 -
   7.167 -	@Override
   7.168 -	public void addCellEditorListener(CellEditorListener l) {
   7.169 -		posluchače.add(CellEditorListener.class, l);
   7.170 -	}
   7.171 -
   7.172 -	@Override
   7.173 -	public void removeCellEditorListener(CellEditorListener l) {
   7.174 -		posluchače.remove(CellEditorListener.class, l);
   7.175 -	}
   7.176 -}