From b65098dab713d64d03675742e3f5b7250ada3b88 Mon Sep 17 00:00:00 2001 From: sjPlot Date: Wed, 14 Oct 2015 12:33:08 +0200 Subject: [PATCH] code-style --- .../zettelkasten/CAutoKorrekturEdit.java | 87 +++--- .../zettelkasten/CBiggerEditField.java | 50 ++-- .../zettelkasten/CDesktopDisplayItems.java | 77 ++--- .../zettelkasten/CImportBibTex.java | 2 +- .../zettelkasten/CSetBibKey.java | 274 ++++++++++-------- .../zettelkasten/ZettelkastenView.form | 14 +- .../zettelkasten/ZettelkastenView.java | 164 +++++------ .../ZettelkastenView_en_GB.properties | 26 +- .../zettelkasten/util/ColorUtil.java | 11 +- .../zettelkasten/util/Constants.java | 2 +- .../zettelkasten/util/PlatformUtil.java | 23 +- 11 files changed, 395 insertions(+), 335 deletions(-) diff --git a/src/de/danielluedecke/zettelkasten/CAutoKorrekturEdit.java b/src/de/danielluedecke/zettelkasten/CAutoKorrekturEdit.java index d918b47e..6189dfa6 100644 --- a/src/de/danielluedecke/zettelkasten/CAutoKorrekturEdit.java +++ b/src/de/danielluedecke/zettelkasten/CAutoKorrekturEdit.java @@ -30,7 +30,6 @@ * Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem Programm * erhalten haben. Falls nicht, siehe . */ - package de.danielluedecke.zettelkasten; import de.danielluedecke.zettelkasten.database.Settings; @@ -57,7 +56,7 @@ /** * - * @author danielludecke + * @author danielludecke */ public class CAutoKorrekturEdit extends javax.swing.JDialog { @@ -66,7 +65,7 @@ public class CAutoKorrekturEdit extends javax.swing.JDialog { */ private final AutoKorrektur autoKorrekt; /** - * + * */ private final Settings settingsObj; /** @@ -80,16 +79,15 @@ public class CAutoKorrekturEdit extends javax.swing.JDialog { /** * get the strings for file descriptions from the resource map */ - private final org.jdesktop.application.ResourceMap resourceMap = - org.jdesktop.application.Application.getInstance(de.danielluedecke.zettelkasten.ZettelkastenApp.class). - getContext().getResourceMap(CAutoKorrekturEdit.class); + private final org.jdesktop.application.ResourceMap resourceMap + = org.jdesktop.application.Application.getInstance(de.danielluedecke.zettelkasten.ZettelkastenApp.class). + getContext().getResourceMap(CAutoKorrekturEdit.class); - /** - * + * * @param parent * @param ac - * @param st + * @param st */ public CAutoKorrekturEdit(java.awt.Frame parent, AutoKorrektur ac, Settings st) { super(parent); @@ -99,13 +97,12 @@ public CAutoKorrekturEdit(java.awt.Frame parent, AutoKorrektur ac, Settings st) initTheRest(null); } - /** - * + * * @param parent * @param ac * @param st - * @param wrongspelling + * @param wrongspelling */ public CAutoKorrekturEdit(java.awt.Frame parent, AutoKorrektur ac, Settings st, String wrongspelling) { super(parent); @@ -115,7 +112,6 @@ public CAutoKorrekturEdit(java.awt.Frame parent, AutoKorrektur ac, Settings st, initTheRest(wrongspelling); } - private void initTheRest(String initvalue) { /* * Constructor for Matte Border @@ -140,11 +136,11 @@ public void actionPerformed(ActionEvent evt) { // get the default fontsize for tables and lists int defaultsize = settingsObj.getTableFontSize(); // only set new fonts, when fontsize differs from the initial value - if (defaultsize>0) { + if (defaultsize > 0) { // get current font Font f = jTableAutoKorrektur.getFont(); // create new font, add fontsize-value - f = new Font(f.getName(), f.getStyle(), f.getSize()+defaultsize); + f = new Font(f.getName(), f.getStyle(), f.getSize() + defaultsize); // set new font jTableAutoKorrektur.setFont(f); } @@ -152,7 +148,7 @@ public void actionPerformed(ActionEvent evt) { jTableAutoKorrektur.setAutoCreateRowSorter(true); jTableAutoKorrektur.setGridColor(settingsObj.getTableGridColor()); // make extra table-sorter for itunes-tables - if (settingsObj.isMacStyle()) { + if (settingsObj.isMacAqua()) { TableUtils.SortDelegate sortDelegate = new TableUtils.SortDelegate() { @Override public void sort(int columnModelIndex, TableUtils.SortDirection sortDirection) { @@ -164,21 +160,23 @@ public void sort(int columnModelIndex, TableUtils.SortDirection sortDirection) { jTableAutoKorrektur.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); } // init the table, i.e. fill it with all existing data - tm = (DefaultTableModel)jTableAutoKorrektur.getModel(); + tm = (DefaultTableModel) jTableAutoKorrektur.getModel(); tm.setRowCount(0); // add all spellchecking-entries to linked list - for (int cnt=0; cnt=tm.getRowCount()) row--; + if (row >= tm.getRowCount()) { + row--; + } // select new cell jTableAutoKorrektur.setColumnSelectionInterval(col, col); jTableAutoKorrektur.setRowSelectionInterval(row, row); @@ -218,15 +222,14 @@ public void sort(int columnModelIndex, TableUtils.SortDirection sortDirection) { jButtonApply.setEnabled(true); } }; - jTableAutoKorrektur.getActionMap().put("DeleteKeyPressed",a_delete); + jTableAutoKorrektur.getActionMap().put("DeleteKeyPressed", a_delete); // check for os, and use appropriate controlKey - KeyStroke ks = KeyStroke.getKeyStroke((System.getProperty("os.name").toLowerCase().startsWith("mac os"))?"meta BACK_SPACE":"ctrl DELETE"); + KeyStroke ks = KeyStroke.getKeyStroke((System.getProperty("os.name").toLowerCase().startsWith("mac os")) ? "meta BACK_SPACE" : "ctrl DELETE"); jTableAutoKorrektur.getInputMap().put(ks, "DeleteKeyPressed"); // disable reordering of columns jTableAutoKorrektur.getTableHeader().setReorderingAllowed(false); } - @Action public void cancel() { modified = false; @@ -239,43 +242,43 @@ public void applyChanges() { // clear all synonyms autoKorrekt.clear(); // retrieve all table rows - for (int row=0; row. */ - package de.danielluedecke.zettelkasten; import de.danielluedecke.zettelkasten.database.Settings; @@ -46,11 +45,12 @@ import java.util.Set; import javax.swing.BorderFactory; import javax.swing.JComponent; -import javax.swing.KeyStroke;import org.jdesktop.application.Action; +import javax.swing.KeyStroke; +import org.jdesktop.application.Action; /** * - * @author danielludecke + * @author danielludecke */ public class CBiggerEditField extends javax.swing.JDialog { @@ -65,13 +65,14 @@ public class CBiggerEditField extends javax.swing.JDialog { /** * Create a new bigger input dialog for editing new authors etc. - * + * * @param parent the parent window * @param settings a reference to the settings class * @param title the dialog's title * @param val a default value which should be set to the textfield - * @param textfieldval an optional value that should be set to the bibkey-textfield. Usually only used - * when a new author is added / edited and the bibkey is set or changed + * @param textfieldval an optional value that should be set to the + * bibkey-textfield. Usually only used when a new author is added / edited + * and the bibkey is set or changed * @param edittype indicates which kind of data is being edited. */ public CBiggerEditField(java.awt.Frame parent, Settings settings, String title, String val, String textfieldval, int edittype) { @@ -89,12 +90,12 @@ public CBiggerEditField(java.awt.Frame parent, Settings settings, String title, } // bind our new forward focus traversal keys Set newForwardKeys = new HashSet<>(1); - newForwardKeys.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,0)); - jTextAreaBigEdit.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,Collections.unmodifiableSet(newForwardKeys)); + newForwardKeys.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0)); + jTextAreaBigEdit.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.unmodifiableSet(newForwardKeys)); // bind our new backward focus traversal keys Set newBackwardKeys = new HashSet<>(1); - newBackwardKeys.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,KeyEvent.SHIFT_MASK+KeyEvent.SHIFT_DOWN_MASK)); - jTextAreaBigEdit.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,Collections.unmodifiableSet(newBackwardKeys)); + newBackwardKeys.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, KeyEvent.SHIFT_MASK + KeyEvent.SHIFT_DOWN_MASK)); + jTextAreaBigEdit.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.unmodifiableSet(newBackwardKeys)); // these codelines add an escape-listener to the dialog. so, when the user // presses the escape-key, the same action is performed as if the user // presses the cancel button... @@ -107,21 +108,20 @@ public void actionPerformed(ActionEvent evt) { }; getRootPane().registerKeyboardAction(cancelAction, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW); // reset return value - newValue=null; - newBibKey=null; + newValue = null; + newBibKey = null; // set dialog's title setTitle(title); // fill textarea with default value - if (val!=null) { + if (val != null) { jTextAreaBigEdit.setText(val); } switch (edittype) { case Constants.EDIT_AUTHOR: jPanel1.setVisible(true); - if (textfieldval !=null) { + if (textfieldval != null) { jTextFieldBibKey.setText(textfieldval); - } - else { + } else { jTextFieldBibKey.setText(""); } break; @@ -130,7 +130,7 @@ public void actionPerformed(ActionEvent evt) { jTextFieldBibKey.setText(""); break; } - + } private void initBorders(Settings settingsObj) { @@ -140,7 +140,7 @@ private void initBorders(Settings settingsObj) { */ jScrollPane1.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, ColorUtil.getBorderGray(settingsObj))); } - + @Action public void okButton() { // get the text and leave the dialog @@ -149,24 +149,24 @@ public void okButton() { setVisible(false); dispose(); } - + @Action public void cancelButton() { // reset the value and leave dialog - newValue=null; - newBibKey=null; + newValue = null; + newBibKey = null; setVisible(false); dispose(); } - - + /** - * - * @return + * + * @return */ public String getNewValue() { return newValue; } + public String getNewBibKey() { return newBibKey; } diff --git a/src/de/danielluedecke/zettelkasten/CDesktopDisplayItems.java b/src/de/danielluedecke/zettelkasten/CDesktopDisplayItems.java index e85bbbf1..94d0add6 100644 --- a/src/de/danielluedecke/zettelkasten/CDesktopDisplayItems.java +++ b/src/de/danielluedecke/zettelkasten/CDesktopDisplayItems.java @@ -30,8 +30,6 @@ * Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem Programm * erhalten haben. Falls nicht, siehe . */ - - package de.danielluedecke.zettelkasten; import de.danielluedecke.zettelkasten.database.Settings; @@ -45,17 +43,19 @@ /** * - * @author danielludecke + * @author danielludecke */ public class CDesktopDisplayItems extends javax.swing.JDialog { /** - * return value for the main window so we know whether we have to update the display + * return value for the main window so we know whether we have to update the + * display */ private boolean needsupdate = false; + /** - * - * @return + * + * @return */ public boolean isNeedsUpdate() { return needsupdate; @@ -64,9 +64,10 @@ public boolean isNeedsUpdate() { * */ private boolean savesettingok = true; + /** - * - * @return + * + * @return */ public boolean isSaveSettingsOk() { return savesettingok; @@ -75,18 +76,19 @@ public boolean isSaveSettingsOk() { * Reference to the settings class */ private final Settings settingsObj; - + /** - * wm, + * wm, + * * @param parent - * @param s + * @param s */ public CDesktopDisplayItems(java.awt.Frame parent, Settings s) { super(parent); initComponents(); // set application icon setIconImage(Constants.zknicon.getImage()); - + settingsObj = s; if (settingsObj.isSeaGlass()) { jButtonApply.putClientProperty("JComponent.sizeVariant", "small"); @@ -102,30 +104,38 @@ public void actionPerformed(ActionEvent evt) { cancelWindow(); } }; - getRootPane().registerKeyboardAction(cancelAction, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW); - + getRootPane().registerKeyboardAction(cancelAction, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW); + // init option-checkboxes int items = settingsObj.getDesktopDisplayItems(); - jCheckBoxRemarks.setSelected((items&Constants.DESKTOP_SHOW_REMARKS)!=0); - jCheckBoxAuthors.setSelected((items&Constants.DESKTOP_SHOW_AUTHORS)!=0); - jCheckBoxAttachments.setSelected((items&Constants.DESKTOP_SHOW_ATTACHMENTS)!=0); - jCheckBoxKeywords.setSelected((items&Constants.DESKTOP_SHOW_KEYWORDS)!=0); + jCheckBoxRemarks.setSelected((items & Constants.DESKTOP_SHOW_REMARKS) != 0); + jCheckBoxAuthors.setSelected((items & Constants.DESKTOP_SHOW_AUTHORS) != 0); + jCheckBoxAttachments.setSelected((items & Constants.DESKTOP_SHOW_ATTACHMENTS) != 0); + jCheckBoxKeywords.setSelected((items & Constants.DESKTOP_SHOW_KEYWORDS) != 0); } - /** - * Finally, when the user presses the apply-button, all settings are saved. this is done - * in this method. when all changes have been saved, the window will be closed and disposed. + * Finally, when the user presses the apply-button, all settings are saved. + * this is done in this method. when all changes have been saved, the window + * will be closed and disposed. */ @Action(enabledProperty = "modified") public void applyChanges() { // reset indicator int items = 0; // check which items should be displayed - if (jCheckBoxRemarks.isSelected()) items = items | Constants.DESKTOP_SHOW_REMARKS; - if (jCheckBoxAuthors.isSelected()) items = items | Constants.DESKTOP_SHOW_AUTHORS; - if (jCheckBoxAttachments.isSelected()) items = items | Constants.DESKTOP_SHOW_ATTACHMENTS; - if (jCheckBoxKeywords.isSelected()) items = items | Constants.DESKTOP_SHOW_KEYWORDS; + if (jCheckBoxRemarks.isSelected()) { + items = items | Constants.DESKTOP_SHOW_REMARKS; + } + if (jCheckBoxAuthors.isSelected()) { + items = items | Constants.DESKTOP_SHOW_AUTHORS; + } + if (jCheckBoxAttachments.isSelected()) { + items = items | Constants.DESKTOP_SHOW_ATTACHMENTS; + } + if (jCheckBoxKeywords.isSelected()) { + items = items | Constants.DESKTOP_SHOW_KEYWORDS; + } // save user settings settingsObj.setDesktopDisplayItems(items); // save the changes to the settings-file @@ -134,30 +144,27 @@ public void applyChanges() { needsupdate = true; // close window closeWindow(); - } - - + } + /** * When the user presses the cancel button, no update needed, close window */ @Action public void cancelWindow() { - needsupdate=false; + needsupdate = false; closeWindow(); } - - + /** - * Occurs when the user closes the window or presses the - * ok button. the settings-file is then saved and the window - * disposed. + * Occurs when the user closes the window or presses the ok button. the + * settings-file is then saved and the window disposed. */ private void closeWindow() { dispose(); setVisible(false); } - + /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is diff --git a/src/de/danielluedecke/zettelkasten/CImportBibTex.java b/src/de/danielluedecke/zettelkasten/CImportBibTex.java index 9e15d667..a647496c 100644 --- a/src/de/danielluedecke/zettelkasten/CImportBibTex.java +++ b/src/de/danielluedecke/zettelkasten/CImportBibTex.java @@ -276,7 +276,7 @@ private void initTable() { jTableBibEntries.setFont(f); } // make extra table-sorter for itunes-tables - if (settingsObj.isMacStyle()) { + if (settingsObj.isMacAqua()) { // make extra table-sorter for itunes-tables TableUtils.SortDelegate sortDelegate = new TableUtils.SortDelegate() { @Override diff --git a/src/de/danielluedecke/zettelkasten/CSetBibKey.java b/src/de/danielluedecke/zettelkasten/CSetBibKey.java index da80e8fe..ece536b9 100644 --- a/src/de/danielluedecke/zettelkasten/CSetBibKey.java +++ b/src/de/danielluedecke/zettelkasten/CSetBibKey.java @@ -30,7 +30,6 @@ * Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem Programm * erhalten haben. Falls nicht, siehe . */ - package de.danielluedecke.zettelkasten; import de.danielluedecke.zettelkasten.database.Settings; @@ -77,7 +76,7 @@ public class CSetBibKey extends javax.swing.JDialog { private BibTex bibtexObj; private Settings settingsObj; private Daten dataObj; - + private String currentAuthor = ""; private LinkedList selectedAuthors; private ZettelkastenView mainframe; @@ -100,20 +99,22 @@ public class CSetBibKey extends javax.swing.JDialog { /** * get the strings for file descriptions from the resource map */ - private org.jdesktop.application.ResourceMap resourceMap = - org.jdesktop.application.Application.getInstance(de.danielluedecke.zettelkasten.ZettelkastenApp.class). - getContext().getResourceMap(CSetBibKey.class); + private org.jdesktop.application.ResourceMap resourceMap + = org.jdesktop.application.Application.getInstance(de.danielluedecke.zettelkasten.ZettelkastenApp.class). + getContext().getResourceMap(CSetBibKey.class); /** - * This dialog sets or changed the bibkey of existing author-values. It is called from the mainframe's - * tabbed pane, the jTableAuthors. When one or more authors are selected, they can be passed to this - * dialog where the user has the chance to change or set a new bibkey-value for each of the selected - * authors. + * This dialog sets or changed the bibkey of existing author-values. It is + * called from the mainframe's tabbed pane, the jTableAuthors. When one or + * more authors are selected, they can be passed to this dialog where the + * user has the chance to change or set a new bibkey-value for each of the + * selected authors. * * @param parent dialog's parent * @param mf * @param d a reference to the {@code CDaten}-class, the main dataclass - * @param bt a reference to the {@code CBibTex}-class that handles the import/export of bibtex-files + * @param bt a reference to the {@code CBibTex}-class that handles the + * import/export of bibtex-files * @param s a reference to the {@code CSettings}-class */ public CSetBibKey(java.awt.Frame parent, ZettelkastenView mf, Daten d, BibTex bt, Settings s) { @@ -183,12 +184,12 @@ private void initBorders(Settings settingsObj) { public void initTitleAndBibkey() { initTitleAndBibkey(true); } - - + /** - * Since we probably have more that one value to change, this method sets the current author-value - * to a jLabel, so the user knows which author-value is currently being edited. furthermore, - * any existing bibkey of the current authorvalue is set to the textfield. + * Since we probably have more that one value to change, this method sets + * the current author-value to a jLabel, so the user knows which + * author-value is currently being edited. furthermore, any existing bibkey + * of the current authorvalue is set to the textfield. */ private void initTitleAndBibkey(boolean resetAuthors) { // get currently edited author @@ -196,52 +197,53 @@ private void initTitleAndBibkey(boolean resetAuthors) { selectedAuthors = mainframe.getSelectedAuthors(); } // check for valid value - if (selectedAuthors!=null && selectedAuthors.size()>0) { + if (selectedAuthors != null && selectedAuthors.size() > 0) { String author = currentAuthor = selectedAuthors.get(0); // if the string is too long, truncate it. - if (author.length()>50) author = author.substring(0, 50)+"..."; + if (author.length() > 50) { + author = author.substring(0, 50) + "..."; + } // set title, so the user knows which author-value is currently being set... jLabelTitle.setText(resourceMap.getString("authorTitle", author)); // retrieve authors bibkey, if any. since this attribute is optional, // null might be returned String bibkey = dataObj.getAuthorBibKey(currentAuthor); // either set bibkey-value or empty string to textfield - jTextFieldManualBibkey.setText((bibkey!=null)?bibkey:""); + jTextFieldManualBibkey.setText((bibkey != null) ? bibkey : ""); // en- or disable apply-button if (jRadioButtonManualBibkey.isSelected()) { // when manual option is selected, en- or disable depending on textinput jButtonApply.setEnabled(!jTextFieldManualBibkey.getText().isEmpty()); - } - else { + } else { // else when file-option is selected, en- or disable depending on table-selection - jButtonApply.setEnabled(jTablePreview.getSelectedRow()!=-1); + jButtonApply.setEnabled(jTablePreview.getSelectedRow() != -1); } - } - else { + } else { jLabelTitle.setText(resourceMap.getString("noAuthorValues")); jTextFieldManualBibkey.setText(""); jButtonApply.setEnabled(false); } } - private void deleteBibtexEntry() { // get the selected rows int[] rows = jTablePreview.getSelectedRows(); // if we have no selected values, leave method - if (rows.length<1) return; + if (rows.length < 1) { + return; + } // ask whether bibtex entries really should be removed int option = JOptionPane.showConfirmDialog(null, resourceMap.getString("removeBibtexEntryMsg"), resourceMap.getString("removeBibtexEntryTitle"), JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE); // the user chose to cancel the operation, so return "null" - if (JOptionPane.YES_OPTION==option) { + if (JOptionPane.YES_OPTION == option) { // iterate all selected values - for (int cnt=0; cnt0) { + if (linkedtablelist != null && linkedtablelist.size() > 0) { // init the object-variable Object[] o = new Object[2]; // fill object with values @@ -252,15 +254,13 @@ private void deleteBibtexEntry() { } } // check for filtered list - if (linkedtablelist!=null && linkedtablelist.size()>0) { + if (linkedtablelist != null && linkedtablelist.size() > 0) { refreshList(); - } - else { + } else { fillBibtexTable(); } } } - /** * Init several listeners for the components. @@ -271,7 +271,8 @@ private void initListeners() { // presses the cancel button... KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); ActionListener cancelAction = new java.awt.event.ActionListener() { - @Override public void actionPerformed(ActionEvent evt) { + @Override + public void actionPerformed(ActionEvent evt) { cancel(); } }; @@ -279,7 +280,8 @@ private void initListeners() { // when the radio.button for manual input is selected, we want to enable its related // components and disable all the stuff for the file-selection-radio-button jRadioButtonManualBibkey.addActionListener(new java.awt.event.ActionListener() { - @Override public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { // disable all file-options toggleOptions(false); // set keyboard-focus to textfield @@ -291,81 +293,100 @@ private void initListeners() { // whenever the user changes the text of the textfield, en- or disable apply-button // depending on whether we already have textinput or not jTextFieldManualBibkey.getDocument().addDocumentListener(new DocumentListener() { - @Override public void changedUpdate(DocumentEvent e) { jButtonApply.setEnabled(!jTextFieldManualBibkey.getText().isEmpty()); } - @Override public void insertUpdate(DocumentEvent e) { jButtonApply.setEnabled(!jTextFieldManualBibkey.getText().isEmpty()); } - @Override public void removeUpdate(DocumentEvent e) { jButtonApply.setEnabled(!jTextFieldManualBibkey.getText().isEmpty()); } + @Override + public void changedUpdate(DocumentEvent e) { + jButtonApply.setEnabled(!jTextFieldManualBibkey.getText().isEmpty()); + } + + @Override + public void insertUpdate(DocumentEvent e) { + jButtonApply.setEnabled(!jTextFieldManualBibkey.getText().isEmpty()); + } + + @Override + public void removeUpdate(DocumentEvent e) { + jButtonApply.setEnabled(!jTextFieldManualBibkey.getText().isEmpty()); + } }); // when the radio-button for file-input is selected, we want to enable its related // components and disable all the stuff for the manual-selection-radio-button jRadioButtonFileBibkey.addActionListener(new java.awt.event.ActionListener() { - @Override public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { // disable all manual-options toggleOptions(true); // en- or disable apply-button depending on whether we have a selection or not - jButtonApply.setEnabled(jTablePreview.getSelectedRow()!=1); + jButtonApply.setEnabled(jTablePreview.getSelectedRow() != 1); // set keyboard-focus to the encoding-combobox, so the user can choose // the input-format jTablePreview.requestFocusInWindow(); } }); jComboBoxShowBibTex.addActionListener(new java.awt.event.ActionListener() { - @Override public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { fillBibtexTable(); } }); jTextFieldFilterTable.addKeyListener(new java.awt.event.KeyAdapter() { - @Override public void keyReleased(java.awt.event.KeyEvent evt) { + @Override + public void keyReleased(java.awt.event.KeyEvent evt) { if (Tools.isNavigationKey(evt.getKeyCode())) { // if user pressed navigation key, select next table entry de.danielluedecke.zettelkasten.util.TableUtils.navigateThroughList(jTablePreview, evt.getKeyCode()); - } - else { + } else { // select table-entry live, while the user is typing... - de.danielluedecke.zettelkasten.util.TableUtils.selectByTyping(jTablePreview,jTextFieldFilterTable,1); + de.danielluedecke.zettelkasten.util.TableUtils.selectByTyping(jTablePreview, jTextFieldFilterTable, 1); } } }); // create action which should be executed when the user presses // the enter-key - AbstractAction a_enter = new AbstractAction(){ - @Override public void actionPerformed(ActionEvent e) { - if (jTextFieldFilterTable==e.getSource()) filterList(false); + AbstractAction a_enter = new AbstractAction() { + @Override + public void actionPerformed(ActionEvent e) { + if (jTextFieldFilterTable == e.getSource()) { + filterList(false); + } } }; // put action to the textfield's actionmaps - jTextFieldFilterTable.getActionMap().put("EnterKeyPressed",a_enter); + jTextFieldFilterTable.getActionMap().put("EnterKeyPressed", a_enter); // associate enter-keystroke with that action KeyStroke ks = KeyStroke.getKeyStroke("ENTER"); jTextFieldFilterTable.getInputMap().put(ks, "EnterKeyPressed"); // create action which should be executed when the user presses // the alt+enter-key (reg ex filter) - AbstractAction a_regex_enter = new AbstractAction(){ - @Override public void actionPerformed(ActionEvent e) { - if (jTextFieldFilterTable==e.getSource()) filterList(true); + AbstractAction a_regex_enter = new AbstractAction() { + @Override + public void actionPerformed(ActionEvent e) { + if (jTextFieldFilterTable == e.getSource()) { + filterList(true); + } } }; // put action to the textfield's actionmaps - jTextFieldFilterTable.getActionMap().put("RegExEnterKeyPressed",a_regex_enter); + jTextFieldFilterTable.getActionMap().put("RegExEnterKeyPressed", a_regex_enter); // associate enter-keystroke with that action ks = KeyStroke.getKeyStroke("alt ENTER"); jTextFieldFilterTable.getInputMap().put(ks, "RegExEnterKeyPressed"); // create action which should be executed when the user presses // the delete/backspace-key - AbstractAction a_delete = new AbstractAction(){ - @Override public void actionPerformed(ActionEvent e) { - if (jTablePreview==e.getSource()) { + AbstractAction a_delete = new AbstractAction() { + @Override + public void actionPerformed(ActionEvent e) { + if (jTablePreview == e.getSource()) { deleteBibtexEntry(); } } }; // put action to the tables' actionmaps - jTablePreview.getActionMap().put("DeleteKeyPressed",a_delete); + jTablePreview.getActionMap().put("DeleteKeyPressed", a_delete); // check for os, and use appropriate controlKey - ks = KeyStroke.getKeyStroke((PlatformUtil.isMacOS())?"BACK_SPACE":"DELETE"); + ks = KeyStroke.getKeyStroke((PlatformUtil.isMacOS()) ? "BACK_SPACE" : "DELETE"); jTablePreview.getInputMap().put(ks, "DeleteKeyPressed"); } - private void filterList(boolean regEx) { // when we filter the table and want to restore it, we don't need to run the // time-consuming task that creates the author-list and related author-frequencies. @@ -377,15 +398,17 @@ private void filterList(boolean regEx) { // convert to lowercase, we don't want case-sensitive search String text = jTextFieldFilterTable.getText().toLowerCase(); // when we have no text, do nothing - if (text.isEmpty()) return; + if (text.isEmpty()) { + return; + } // get table model - DefaultTableModel dtm = (DefaultTableModel)jTablePreview.getModel(); + DefaultTableModel dtm = (DefaultTableModel) jTablePreview.getModel(); // if we haven't already stored the current complete table data, do this now - if (null==linkedtablelist) { + if (null == linkedtablelist) { // create new instance of list linkedtablelist = new LinkedList<>(); // go through all table-data - for (int cnt=0; cnt0); + jTextFieldFilterTable.setEnabled(jTablePreview.getRowCount() > 0); // enable refresh button jButtonRefreshView.setEnabled(true); } - /** - * Inits the jTable, i.e. sets up comparers, sorters, and selection listeners. + * Inits the jTable, i.e. sets up comparers, sorters, and selection + * listeners. */ private void initTable() { // create new table sorter @@ -415,14 +438,13 @@ private void initTable() { // tell tgis jtable that it has an own sorter jTablePreview.setRowSorter(sorter); // and tell the sorter, which table model to sort. - sorter.setModel((DefaultTableModel)jTablePreview.getModel()); + sorter.setModel((DefaultTableModel) jTablePreview.getModel()); // in this table, the first column needs a custom comparator. try { - sorter.setComparator(0,new Comparer()); - sorter.setComparator(1,new Comparer()); - } - catch (IndexOutOfBoundsException e) { - Constants.zknlogger.log(Level.WARNING,e.getLocalizedMessage()); + sorter.setComparator(0, new Comparer()); + sorter.setComparator(1, new Comparer()); + } catch (IndexOutOfBoundsException e) { + Constants.zknlogger.log(Level.WARNING, e.getLocalizedMessage()); } // noe header re-ordering jTablePreview.getTableHeader().setReorderingAllowed(false); @@ -432,16 +454,16 @@ private void initTable() { jTablePreview.setShowVerticalLines(settingsObj.getShowGridVertical()); jTablePreview.setIntercellSpacing(settingsObj.getCellSpacing()); // clear table - DefaultTableModel dtm = (DefaultTableModel)jTablePreview.getModel(); + DefaultTableModel dtm = (DefaultTableModel) jTablePreview.getModel(); dtm.setRowCount(0); // get the default fontsize for tables and lists int defaultsize = settingsObj.getTableFontSize(); // only set new fonts, when fontsize differs from the initial value - if (defaultsize>0) { + if (defaultsize > 0) { // get current font Font f = jTablePreview.getFont(); // create new font, add fontsize-value - f = new Font(f.getName(), f.getStyle(), f.getSize()+defaultsize); + f = new Font(f.getName(), f.getStyle(), f.getSize() + defaultsize); // set new font jTablePreview.setFont(f); } @@ -452,9 +474,9 @@ private void initTable() { jTablePreview.getColumnModel().getSelectionModel().addListSelectionListener(listener); } - /** * En- or disables the components that are related to the choice of bibkeys + * * @param value */ private void toggleOptions(boolean value) { @@ -462,14 +484,13 @@ private void toggleOptions(boolean value) { jTablePreview.setEnabled(value); jComboBoxShowBibTex.setEnabled(value); jLabel1.setEnabled(value); - jButtonRefreshView.setEnabled((value)?linkedtablelist!=null:false); - jTextFieldFilterTable.setEnabled((value)?jTablePreview.getRowCount()>0:false); + jButtonRefreshView.setEnabled((value) ? linkedtablelist != null : false); + jTextFieldFilterTable.setEnabled((value) ? jTablePreview.getRowCount() > 0 : false); // toggle manual options jTextFieldManualBibkey.setEnabled(!value); jLabelManualBibkey.setEnabled(!value); } - /** * Closes the window */ @@ -481,7 +502,6 @@ public void cancel() { setVisible(false); } - @Action public void applyChanges() { settingsObj.setLastUsedSetBibyKeyChoice((jRadioButtonFileBibkey.isSelected()) ? CHOOSE_BIBKEY_FROM_DB : CHOOSE_BIBKEY_MANUAL); @@ -493,14 +513,13 @@ public void applyChanges() { if (jRadioButtonManualBibkey.isSelected()) { // select user-input from textfield selectedbibkey = jTextFieldManualBibkey.getText(); - } - else { + } else { // else retrieve selected row int row = jTablePreview.getSelectedRow(); // if we have any valid selection... - if (row!=-1) { + if (row != -1) { // get table model - DefaultTableModel dtm = (DefaultTableModel)jTablePreview.getModel(); + DefaultTableModel dtm = (DefaultTableModel) jTablePreview.getModel(); // retrieve row-index from the model int rowindex = jTablePreview.convertRowIndexToModel(row); // retrieve bibkey-value and author from row @@ -509,7 +528,7 @@ public void applyChanges() { // and delete table-row, so already used values don't appear anymore dtm.removeRow(rowindex); // check whether to delete from filtered table list - if (linkedtablelist!=null) { + if (linkedtablelist != null) { try { Iterator i = linkedtablelist.iterator(); // iterate linked list @@ -522,17 +541,16 @@ public void applyChanges() { i.remove(); } } - } - catch (ClassCastException | NullPointerException | UnsupportedOperationException | IllegalStateException ex) { - Constants.zknlogger.log(Level.WARNING,ex.getLocalizedMessage()); + } catch (ClassCastException | NullPointerException | UnsupportedOperationException | IllegalStateException ex) { + Constants.zknlogger.log(Level.WARNING, ex.getLocalizedMessage()); } } } } // if no input made or the input was empty, show message dialog // and tell user, he has to make a selection or an input... - if (null==selectedbibkey || selectedbibkey.isEmpty()) { - JOptionPane.showMessageDialog(null,resourceMap.getString("noBibkeyMsg"),resourceMap.getString("noBibkeyTitle"),JOptionPane.PLAIN_MESSAGE); + if (null == selectedbibkey || selectedbibkey.isEmpty()) { + JOptionPane.showMessageDialog(null, resourceMap.getString("noBibkeyMsg"), resourceMap.getString("noBibkeyTitle"), JOptionPane.PLAIN_MESSAGE); return; } // if everything is ok, get the authorposition of that author-value where the new bibkey @@ -542,18 +560,22 @@ public void applyChanges() { // else the authorposition of that author-value that contains that bibkey will be returned int bibkeypos = dataObj.getBibkeyPosition(selectedbibkey); // check whether the bibkey already exists (bibkey!=-1) in another author-value - if (authorpos!=bibkeypos && bibkeypos!=-1) { + if (authorpos != bibkeypos && bibkeypos != -1) { // retrieve author-value of existing bibkey String author = dataObj.getAuthor(bibkeypos); // if the string is too long, truncate it. - if (author.length()>80) author = author.substring(0, 80)+"..."; + if (author.length() > 80) { + author = author.substring(0, 80) + "..."; + } // if so, ask user whether to take the same bibkey anyway - int option = JOptionPane.showConfirmDialog(null, resourceMap.getString("bibkeyExistsMsg",author), resourceMap.getString("bibkeyExistsTitle"), JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE); + int option = JOptionPane.showConfirmDialog(null, resourceMap.getString("bibkeyExistsMsg", author), resourceMap.getString("bibkeyExistsTitle"), JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE); // if not, return and do nothing - if (JOptionPane.NO_OPTION==option) return; + if (JOptionPane.NO_OPTION == option) { + return; + } } // else set new author-bibkey - dataObj.setAuthorBibKey(authorpos,selectedbibkey); + dataObj.setAuthorBibKey(authorpos, selectedbibkey); // update bibkey in author preview mainframe.showAuthorText(); // remove author @@ -563,44 +585,43 @@ public void applyChanges() { rowcounter--; // set label text jLabel1.setText(resourceMap.getString("entryTxt", String.valueOf(rowcounter))); - } - catch (NoSuchElementException ex) { - Constants.zknlogger.log(Level.WARNING,ex.getLocalizedMessage()); + } catch (NoSuchElementException ex) { + Constants.zknlogger.log(Level.WARNING, ex.getLocalizedMessage()); } // init next author (title in label and bibkey in textfield) initTitleAndBibkey(false); } - @Action public void refreshList() { // first check whether we have any saved values at all - if (linkedtablelist!=null) { + if (linkedtablelist != null) { // get table model - DefaultTableModel dtm = (DefaultTableModel)jTablePreview.getModel(); + DefaultTableModel dtm = (DefaultTableModel) jTablePreview.getModel(); // delete all data from the author-table dtm.setRowCount(0); // create an iterator for the linked list ListIterator iterator = linkedtablelist.listIterator(); // go through complete linked list and add each element to the table(model) - while (iterator.hasNext()) dtm.addRow(iterator.next()); + while (iterator.hasNext()) { + dtm.addRow(iterator.next()); + } // enable filter field jTextFieldFilterTable.setEnabled(true); // disable refresh button jButtonRefreshView.setEnabled(false); } - linkedtablelist=null; + linkedtablelist = null; } - private void fillBibtexTable() { // reset linked list linkedtablelist = null; // get table model - DefaultTableModel dtm = (DefaultTableModel)jTablePreview.getModel(); + DefaultTableModel dtm = (DefaultTableModel) jTablePreview.getModel(); dtm.setRowCount(0); // go through all found entries... - for (int cnt=0; cnt - + @@ -423,7 +423,7 @@ - + @@ -713,7 +713,7 @@ - + @@ -853,7 +853,7 @@ - + @@ -1035,7 +1035,7 @@ - + @@ -1327,7 +1327,7 @@ - + @@ -1460,7 +1460,7 @@ - + diff --git a/src/de/danielluedecke/zettelkasten/ZettelkastenView.java b/src/de/danielluedecke/zettelkasten/ZettelkastenView.java index a5b68bc4..65dbc56e 100644 --- a/src/de/danielluedecke/zettelkasten/ZettelkastenView.java +++ b/src/de/danielluedecke/zettelkasten/ZettelkastenView.java @@ -1,33 +1,33 @@ /* * Zettelkasten - nach Luhmann * Copyright (C) 2001-2015 by Daniel Lüdecke (http://www.danielluedecke.de) - * + * * Homepage: http://zettelkasten.danielluedecke.de - * - * + * + * * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 3 of + * GNU General Public License as published by the Free Software Foundation; either version 3 of * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with this program; * if not, see . - * - * + * + * * Dieses Programm ist freie Software. Sie können es unter den Bedingungen der GNU * General Public License, wie von der Free Software Foundation veröffentlicht, weitergeben * und/oder modifizieren, entweder gemäß Version 3 der Lizenz oder (wenn Sie möchten) * jeder späteren Version. - * - * Die Veröffentlichung dieses Programms erfolgt in der Hoffnung, daß es Ihnen von Nutzen sein - * wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die implizite Garantie der MARKTREIFE oder - * der VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. Details finden Sie in der + * + * Die Veröffentlichung dieses Programms erfolgt in der Hoffnung, daß es Ihnen von Nutzen sein + * wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die implizite Garantie der MARKTREIFE oder + * der VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. Details finden Sie in der * GNU General Public License. - * - * Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem Programm + * + * Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem Programm * erhalten haben. Falls nicht, siehe . */ /** @@ -191,7 +191,7 @@ /* * To-Do-Sammlung - * + * */ // TODO beim majorbackup optional auch attachments/img? /** @@ -1363,7 +1363,7 @@ public void valueChanged(TreeSelectionEvent e) { public void treeExpanded(javax.swing.event.TreeExpansionEvent evt) { // retrieve path of value that was expanded TreePath tp = evt.getPath(); - // check whether root was expanded or not. therefore, retrieve + // check whether root was expanded or not. therefore, retrieve // last node of the treepath, i.e. the node which was expanded DefaultMutableTreeNode expandednode = (DefaultMutableTreeNode) tp.getLastPathComponent(); // if they equal, do nothing @@ -1375,7 +1375,7 @@ public void treeExpanded(javax.swing.event.TreeExpansionEvent evt) { public void treeCollapsed(javax.swing.event.TreeExpansionEvent evt) { // retrieve path of value that was expanded TreePath tp = evt.getPath(); - // check whether root was expanded or not. therefore, retrieve + // check whether root was expanded or not. therefore, retrieve // last node of the treepath, i.e. the node which was expanded DefaultMutableTreeNode expandednode = (DefaultMutableTreeNode) tp.getLastPathComponent(); // if they equal, do nothing @@ -3684,10 +3684,10 @@ private void showKeywords() { // if dialog window isn't already created, do this now if (null == taskDlg) { // get parent und init window - taskDlg = new TaskProgressDialog(getFrame(), - TaskProgressDialog.TASK_SHOWKEYWORDS, - data, - synonyms, + taskDlg = new TaskProgressDialog(getFrame(), + TaskProgressDialog.TASK_SHOWKEYWORDS, + data, + synonyms, null, /*only needed for authors*/ null, /*only needed for attachments*/ settings.getShowSynonymsInTable(), @@ -5617,12 +5617,12 @@ private void showAttachments() { // if dialog window isn't already created, do this now if (null == taskDlg) { // get parent und init window - taskDlg = new TaskProgressDialog(getFrame(), - TaskProgressDialog.TASK_SHOWATTACHMENTS, - data, + taskDlg = new TaskProgressDialog(getFrame(), + TaskProgressDialog.TASK_SHOWATTACHMENTS, + data, null, /*only needed for authors*/ null, /*only needed for authors*/ - settings, + settings, false, /*only need for keywords*/ 0, /*only need for authors*/ (DefaultTableModel) jTableAttachments.getModel(), @@ -5752,14 +5752,14 @@ private void showAuthors() { // if dialog window isn't already created, do this now if (null == taskDlg) { // get parent und init window - taskDlg = new TaskProgressDialog(getFrame(), - TaskProgressDialog.TASK_SHOWAUTHORS, - data, + taskDlg = new TaskProgressDialog(getFrame(), + TaskProgressDialog.TASK_SHOWAUTHORS, + data, null, /*only needed for keywords*/ - bibtex, + bibtex, null, /*only needed for attachments*/ false, /*only needed for keywords*/ - jComboBoxAuthorType.getSelectedIndex(), + jComboBoxAuthorType.getSelectedIndex(), (DefaultTableModel) jTableAuthors.getModel(), settings.getMakeLuhmannColumnSortable()); // center window @@ -6089,7 +6089,7 @@ private void showClusterRelations() { TreePath tp = jTreeCluster.getLeadSelectionPath(); // disable tree, showing that the program works... jTreeCluster.setEnabled(false); - // create a linked list. here we will add all keywords from the selection to the + // create a linked list. here we will add all keywords from the selection to the // first level paremt LinkedList kws = new LinkedList<>(); // start from the second element, since we don't want the root-element @@ -6198,9 +6198,9 @@ private void showTitles() { // if dialog window isn't already created, do this now if (null == taskDlg) { // get parent und init window - taskDlg = new TaskProgressDialog(getFrame(), - TaskProgressDialog.TASK_SHOWTITLES, - data, + taskDlg = new TaskProgressDialog(getFrame(), + TaskProgressDialog.TASK_SHOWTITLES, + data, null, /*only needed for keywords*/ null, /*only needed for authors*/ null, /*only needed for attachments*/ @@ -7970,7 +7970,7 @@ else if (taskinfo.showExportOkMessage()) { @Action public void showAboutBox() { if (null == zknAboutBox) { - zknAboutBox = new AboutBox(getFrame(), settings.isMacAqua() | settings.isMacStyle()); + zknAboutBox = new AboutBox(getFrame(), settings.isMacAqua() | settings.isMacAqua()); zknAboutBox.setLocationRelativeTo(getFrame()); } ZettelkastenApp.getApplication().show(zknAboutBox); @@ -9653,7 +9653,7 @@ public void showSearchResultWindow() { } ZettelkastenApp.getApplication().show(searchResultsDlg); } - + @Action public void showNewEntryWindow() { @@ -9661,11 +9661,11 @@ public void showNewEntryWindow() { newEntryDlg.setAlwaysOnTop(true); newEntryDlg.toFront(); newEntryDlg.requestFocus(); - newEntryDlg.setAlwaysOnTop(false); + newEntryDlg.setAlwaysOnTop(false); } } - - + + /** * Shows the desktop/outliner window. If it hasn't been created yet, a new instance will be created. *

@@ -9677,7 +9677,7 @@ public void showDesktopWindow() { ZettelkastenApp.getApplication().show(desktopDlg); } - + /** * Shows the desktop/outliner window. If it hasn't been created yet, a new instance will be created. *

@@ -10008,7 +10008,7 @@ public void findLuhmannAny() { public void findLuhmannParent() { findEntryWithout(Constants.SEARCH_TOP_LEVEL_LUHMANN); } - + /** * Starts a search request and finds entries not according to a certain find term, @@ -10195,8 +10195,8 @@ public void findLive() { // indicate that live search is active isLiveSearchActive = true; } - - + + /** * Cancels the live-search by simply hiding the panel */ @@ -10211,8 +10211,8 @@ public void findLiveCancel() { // update display, i.e. remove highlighted search terms updateDisplayParts(displayedZettel); } - - + + /** * Opens the search dialog. This method can deal several search requests.

For instance, we * can have a usual search where the user wants to have search results displayed in a new frame @@ -10236,7 +10236,7 @@ public void findLiveCancel() { * When we have searchterms from the search-dialog, the user also can search for parts inside * a keyword-string, so here the whole-word-parameter is relevant, since we then don't compare by index- * numbers, but by the string-value of the keywords/authors. - * + * * @param searchterms string-array with search terms * @param where the type of search, i.e. where to look, e.g. searching for keywords, authors, text etc. * @param logical @@ -10343,11 +10343,11 @@ public void startSearch(String[] searchterms, int where, int logical, boolean wh System.gc(); } - + /** * This method gets all selected elements of the jListEntryKeywords * and returns them in an array. - * + * * @return a string-array containing all selected entries, or null if no selection made */ private String[] retrieveSelectedKeywordsFromList() { @@ -10363,8 +10363,8 @@ private String[] retrieveSelectedKeywordsFromList() { // ...or null, if error occured. return null; } - - + + /** * Depending on the selected tabbed pane, this method retrieves the wither selected authors * from the jTableAuthors or the selected keywords from the jTableKeywords and starts a search @@ -10411,7 +10411,7 @@ public void searchLogAnd() { } } - + /** * Depending on the selected tabbed pane, this method retrieves the wither selected authors * from the jTableAuthors or the selected keywords from the jTableKeywords and starts a search @@ -10529,8 +10529,8 @@ public void searchKeywordsFromListLogAnd() { Constants.STARTSEARCH_USUAL, // whether we have a usual search, or a search for entries without remarks or keywords and so on - see related method findEntryWithout Constants.SEARCH_USUAL); } - - + + /** * Retrieves the selected keywords from the jListEntryKeywords and starts a search * for those entries, that contain none of the selected entries. @@ -10554,8 +10554,8 @@ public void searchKeywordsFromListLogNot() { Constants.STARTSEARCH_USUAL, // whether we have a usual search, or a search for entries without remarks or keywords and so on - see related method findEntryWithout Constants.SEARCH_USUAL); } - - + + /** * Retrieves the selected keywords from the jTableKeywords and starts a search * for those entries, that contain at least one of the selected entries. @@ -10579,8 +10579,8 @@ public void searchKeywordsFromListLogOr() { Constants.STARTSEARCH_USUAL, // whether we have a usual search, or a search for entries without remarks or keywords and so on - see related method findEntryWithout Constants.SEARCH_USUAL); } - - + + /** * Here we place the typical steps we have to do after a file was opened * or imported. typical tasks are for instance setting certain state-variables @@ -10691,7 +10691,7 @@ private synchronized void filterLinks() { // with these we can execute the task and bring it to the foreground // i.e. making the animated progressbar and busy icon visible tS.execute(cflT); - tM.setForegroundTask(cflT); + tM.setForegroundTask(cflT); } @@ -10719,8 +10719,8 @@ private void saveSettings() { showErrorIcon(); } } - - + + /** * This method is called when a user selects an entry from the jTableLinks. Whenever a * "linked" entry is selected in this table, we want to
@@ -10762,7 +10762,7 @@ private void showRelatedKeywords() { Arrays.sort(kws_current, new Comparer()); } // go through both array and count the matches - // after that, we can create an integer-array with the necessary amount of elements + // after that, we can create an integer-array with the necessary amount of elements // init counter int count=0; // go through outer array and compare for matching keywords @@ -10812,7 +10812,7 @@ public void setBackupNecessary() { } public void resetBackupNecessary() { backupNecessary(false); - } + } /** * This method checks whether there are unsaved changes in the data-files (maindata, bookmarks, @@ -10875,11 +10875,11 @@ private boolean askForSaveChanges(String title) { // no changes, so everything is ok return true; } - - + + /** * This is the Exit-Listener. Here we put in all the things which should be done - * before closing the window and exiting the program + * before closing the window and exiting the program */ private class ConfirmExit implements Application.ExitListener { @Override @@ -11057,7 +11057,7 @@ private void setupSeaGlassStyle() { jEditorPaneClusterEntries.setBackground(Color.white); jEditorPaneIsFollower.setBackground(Color.white); } - + private void searchTextFieldVariants() { if (settings.isMacAqua() || settings.isSeaGlass()) { jTextFieldLiveSearch.putClientProperty("JTextField.variant", "search"); @@ -11106,7 +11106,7 @@ private void makeSeaGlassToolbar() { toolBar.add(new javax.swing.JToolBar.Separator(), 0); } /** - * + * * @param bottomBarNeedsUdpate if {@code true}, the bottom bar on mac aqua style will also be * re-initialized. Use {@code true} only the first time the bottom bar is initialized. For further * GUI-updates, e.g. from settings window, use {@code false} as parameter. @@ -11156,10 +11156,10 @@ private void makeMacToolbar() { mactoolbar.addComponentToLeft(MacToolbarButton.makeTexturedToolBarButton(tb_prev, MacToolbarButton.SEGMENT_POSITION_MIDDLE)); mactoolbar.addComponentToLeft(MacToolbarButton.makeTexturedToolBarButton(tb_next, MacToolbarButton.SEGMENT_POSITION_MIDDLE)); mactoolbar.addComponentToLeft(MacToolbarButton.makeTexturedToolBarButton(tb_last, MacToolbarButton.SEGMENT_POSITION_LAST)); - + mactoolbar.addComponentToLeft(MacWidgetFactory.createSpacer(32, 1)); mactoolbar.addComponentToLeft(tb_searchTextfield); - + mactoolbar.installWindowDraggerOnWindow(ZettelkastenView.super.getFrame()); mainPanel.add(mactoolbar.getComponent(),BorderLayout.PAGE_START); } @@ -11421,7 +11421,7 @@ public void setSaveEnabled(boolean b) { } /** * This variable indicates whether the current entry ist displayed, or if - * e.g. a selected other entry is shown - so we can "reset" the display by + * e.g. a selected other entry is shown - so we can "reset" the display by * showing the current entry again */ private boolean currentEntryShown = false; @@ -11457,8 +11457,8 @@ public void setHistoryBackAvailable(boolean b) { this.historyBackAvailable = b; firePropertyChange("historyBackAvailable", old, isHistoryBackAvailable()); } - - + + /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is @@ -11485,10 +11485,10 @@ private void initComponents() { jSplitPaneLinks = new javax.swing.JSplitPane(); jPanel14 = new javax.swing.JPanel(); jScrollPane4 = new javax.swing.JScrollPane(); - jTableLinks = (settings.isMacStyle()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); + jTableLinks = (settings.isMacAqua()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); jPanelManLinks = new javax.swing.JPanel(); jScrollPane15 = new javax.swing.JScrollPane(); - jTableManLinks = (settings.isMacStyle()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); + jTableManLinks = (settings.isMacAqua()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); jPanel10 = new javax.swing.JPanel(); jSplitPane2 = new javax.swing.JSplitPane(); jScrollPane10 = new javax.swing.JScrollPane(); @@ -11523,13 +11523,13 @@ public String getToolTipText(MouseEvent evt) { jScrollPane17 = new javax.swing.JScrollPane(); jTreeKeywords = new javax.swing.JTree(); jScrollPane6 = new javax.swing.JScrollPane(); - jTableKeywords = (settings.isMacStyle()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); + jTableKeywords = (settings.isMacAqua()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); jPanel7 = new javax.swing.JPanel(); jTextFieldFilterAuthors = new javax.swing.JTextField(); jSplitPaneAuthors = new javax.swing.JSplitPane(); jPanel15 = new javax.swing.JPanel(); jScrollPane7 = new javax.swing.JScrollPane(); - jTableAuthors = (settings.isMacStyle()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); + jTableAuthors = (settings.isMacAqua()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); jComboBoxAuthorType = new javax.swing.JComboBox(); jPanelDispAuthor = new javax.swing.JPanel(); jScrollPane16 = new javax.swing.JScrollPane(); @@ -11537,7 +11537,7 @@ public String getToolTipText(MouseEvent evt) { jButtonRefreshAuthors = new javax.swing.JButton(); jPanel8 = new javax.swing.JPanel(); jScrollPane8 = new javax.swing.JScrollPane(); - jTableTitles = (settings.isMacStyle()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); + jTableTitles = (settings.isMacAqua()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); jTextFieldFilterTitles = new javax.swing.JTextField(); jButtonRefreshTitles = new javax.swing.JButton(); jPanel11 = new javax.swing.JPanel(); @@ -11554,12 +11554,12 @@ public String getToolTipText(MouseEvent evt) { jComboBoxBookmarkCategory = new javax.swing.JComboBox(); jSplitPane3 = new javax.swing.JSplitPane(); jScrollPane9 = new javax.swing.JScrollPane(); - jTableBookmarks = (settings.isMacStyle()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); + jTableBookmarks = (settings.isMacAqua()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); jScrollPane14 = new javax.swing.JScrollPane(); jEditorPaneBookmarkComment = new javax.swing.JEditorPane(); jPanel13 = new javax.swing.JPanel(); jScrollPane13 = new javax.swing.JScrollPane(); - jTableAttachments = (settings.isMacStyle()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); + jTableAttachments = (settings.isMacAqua()) ? MacWidgetFactory.createITunesTable(null) : new javax.swing.JTable(); jTextFieldFilterAttachments = new javax.swing.JTextField(); jButtonRefreshAttachments = new javax.swing.JButton(); menuBar = new javax.swing.JMenuBar(); @@ -14627,7 +14627,7 @@ public boolean isCellEditable(int rowIndex, int columnIndex) { * was an web-url or links to a local file. Then the url or file will be opened * * @param evt - */ + */ /** * Enables and disables the menu items for the popupMenuKeywordList and viewMenuLinks @@ -14655,7 +14655,7 @@ private void initViewMenuLinks() { popupKwListRefresh.setEnabled(TAB_LINKS==jTabbedPaneMain.getSelectedIndex()); } - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JMenu aboutMenu; private javax.swing.JMenuItem aboutMenuItem; diff --git a/src/de/danielluedecke/zettelkasten/resources/ZettelkastenView_en_GB.properties b/src/de/danielluedecke/zettelkasten/resources/ZettelkastenView_en_GB.properties index 7a36b2da..60b91d31 100644 --- a/src/de/danielluedecke/zettelkasten/resources/ZettelkastenView_en_GB.properties +++ b/src/de/danielluedecke/zettelkasten/resources/ZettelkastenView_en_GB.properties @@ -234,8 +234,8 @@ refreshClusterList.Action.shortDescription=Refresh cluster-list addKeywordToList.Action.text=Add keywords addKeywordToList.Action.shortDescription=Adds selected keywords to the current note's keyword-list -editKeyword.Action.text=Rename keyword ... -editKeyword.Action.shortDescription=Opens an input-dialog to rename the selected keyword +editKeyword.Action.text=Edit keyword ... +editKeyword.Action.shortDescription=Opens an input-dialog to edit the selected keyword deleteKeyword.Action.text=Remove keyword deleteKeyword.Action.shortDescription=Completely deletes the keyword and removes it from all notes that contain this keyword @@ -249,8 +249,8 @@ copyKeywordToClip.Action.shortDescription=Copies the selected notes to the clipb newAuthor.Action.text=New author ... newAuthor.Action.shortDescription=Opens an input-dialog to edit a new author -editAuthor.Action.text=Rename author ... -editAuthor.Action.shortDescription=Opens an input-dialog to rename the selected author +editAuthor.Action.text=Edit author ... +editAuthor.Action.shortDescription=Opens an input-dialog to edit the selected author deleteAuthor.Action.text=Remove author deleteAuthor.Action.shortDescription=Completely deletes the author and removes it from all notes that contain this author @@ -273,8 +273,8 @@ deleteLuhmannFromEntry.Action.text=Remove copyTitlesToClip.Action.text=Copy copyTitlesToClip.Action.shortDescription=Copies the selected titles to the clipboard -editTitle.Action.text=Rename title ... -editTitle.Action.shortDescription=Renames the selected note's title +editTitle.Action.text=Edit title ... +editTitle.Action.shortDescription=Edit the selected note's title deleteEntry.Action.text=Remove note deleteEntry.Action.shortDescription=Removes the shown note @@ -287,8 +287,8 @@ editBookmark.Action.shortDescription=Edit comment or category of the selected bo deleteBookmark.Action.shortDescription=Removes the selected bookmarks deleteBookmark.Action.text=Remove bookmark -editBookmarkCategory.Action.text=Rename category ... -editBookmarkCategory.Action.shortDescription=Opens an edit-dialog to rename the category +editBookmarkCategory.Action.text=Edit category ... +editBookmarkCategory.Action.shortDescription=Opens a dialog to edit the category deleteBookmarkCategory.Action.shortDescription=Removes the bookmarks-category and all bookmarks that are assigned to that category deleteBookmarkCategory.Action.text=Remove category @@ -404,12 +404,12 @@ statusTextTitles=notes statusTextAttachments=attachments editKeywordMsg=New keyword: -editKeywordTitle=Rename keyword -editAuthorTitle=Rename author +editKeywordTitle=Edit keyword +editAuthorTitle=Edit author editTitleMsg=New title: -editTitleTitle=Rename title +editTitleTitle=Edit title editBookmarkCategoryMsg=New category: -editBookmarkCategoryTitle=Rename bookmark-category +editBookmarkCategoryTitle=Edit bookmark-category editAttachmentMsg=Enter new value: editAttachmentTitle=Edit attachment @@ -516,7 +516,7 @@ deleteNotPossibleTitle=Remove note importedTypesMsg=Following data could be successfully imported: importedTypesTitle=Imported data -replaceKeywordsInSynonymsMsg=The keyword %s you renamed also exists as synonym.

Do you want to rename the synonym to %s as well, so the new
keyord remains assigned to that synonym (recommended)? +replaceKeywordsInSynonymsMsg=The keyword %s you edited also exists as synonym.

Do you want to rename the synonym to %s as well, so the new
keyord remains assigned to that synonym (recommended)? replaceKeywordsInSynonymsTitle=Rename synonym exportListFormatMsg=Please choose an export-format: diff --git a/src/de/danielluedecke/zettelkasten/util/ColorUtil.java b/src/de/danielluedecke/zettelkasten/util/ColorUtil.java index 0f08237f..24f4d8ae 100644 --- a/src/de/danielluedecke/zettelkasten/util/ColorUtil.java +++ b/src/de/danielluedecke/zettelkasten/util/ColorUtil.java @@ -69,7 +69,12 @@ public class ColorUtil { * Color value, needed for setting the snow-leopard-style on mac os x * new Color(218,218,218) */ - public static final Color colorNormalsSowGray = new Color(218, 218, 218); //MacColorUtils.EMPTY_COLOR + public static final Color colorNormalSnowGray = new Color(218, 218, 218); //MacColorUtils.EMPTY_COLOR + /** + * Color value, needed for setting the snow-leopard-style on mac os x + * new Color(218,218,218) + */ + public static final Color colorNormalElCapitanGray = new Color(236, 236, 236); //MacColorUtils.EMPTY_COLOR /** * Color value, needed for setting border-color of the matte-top and -bottom-border * Color(64,64,64); @@ -161,8 +166,10 @@ public static Color getBorderGray(Settings settings) { public static Color getMacBackgroundColor() { if (PlatformUtil.isLeopard()) { return colorNormalGray; +// } else if (PlatformUtil.isElCapitan() || PlatformUtil.isYosemite()) { +// return colorNormalElCapitanGray; } else if (PlatformUtil.isJava6OnMac()) { - return colorNormalsSowGray; + return colorNormalSnowGray; } return colorNormalJava7Gray; } diff --git a/src/de/danielluedecke/zettelkasten/util/Constants.java b/src/de/danielluedecke/zettelkasten/util/Constants.java index 4151a27e..518c4410 100644 --- a/src/de/danielluedecke/zettelkasten/util/Constants.java +++ b/src/de/danielluedecke/zettelkasten/util/Constants.java @@ -50,7 +50,7 @@ public class Constants { /** * This variable stores the current programme and build version number */ - public static final String BUILD_VERSION = "3.2.6.1 (Build 20151014)"; + public static final String BUILD_VERSION = "3.2.6.1 (Build 20151015)"; /** * This constants stores the website-address where the Zettelkasten can be * downloaded:

diff --git a/src/de/danielluedecke/zettelkasten/util/PlatformUtil.java b/src/de/danielluedecke/zettelkasten/util/PlatformUtil.java index fca52385..7712df33 100644 --- a/src/de/danielluedecke/zettelkasten/util/PlatformUtil.java +++ b/src/de/danielluedecke/zettelkasten/util/PlatformUtil.java @@ -83,9 +83,30 @@ public static boolean isLion() { * Indicates whether Mac OS X 10.8 (Mountain LION) is running... * @return {@code true} if current OS is mac os 10.8 (mountain lion) */ - public boolean isMountainLion() { + public static boolean isMountainLion() { return isMacOS() & System.getProperty("os.version").startsWith("10.8"); } + /** + * Indicates whether Mac OS X 10.9 (Mavericks) is running... + * @return {@code true} if current OS is mac os 10.8 (mountain lion) + */ + public static boolean isMavericks() { + return isMacOS() & System.getProperty("os.version").startsWith("10.9"); + } + /** + * Indicates whether Mac OS X 10.10 (Yosemite) is running... + * @return {@code true} if current OS is mac os 10.8 (mountain lion) + */ + public static boolean isYosemite() { + return isMacOS() & System.getProperty("os.version").startsWith("10.10"); + } + /** + * Indicates whether Mac OS X 10.10 (El Capitan) is running... + * @return {@code true} if current OS is mac os 10.8 (mountain lion) + */ + public static boolean isElCapitan() { + return isMacOS() & System.getProperty("os.version").startsWith("10.11"); + } /** * Indicates whether the OS is a windows OS * @return {@code true} if current OS is a windows system