import jalview.fts.core.FTSDataColumnPreferences;
import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
import jalview.fts.service.pdb.PDBFTSRestClient;
+import jalview.gui.Desktop;
import jalview.gui.JalviewBooleanRadioButtons;
+import jalview.gui.JvOptionPane;
import jalview.gui.JvSwingUtils;
import jalview.gui.StructureViewer.ViewerType;
import jalview.io.BackupFilenameParts;
import jalview.io.BackupFiles;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import java.awt.BorderLayout;
import java.awt.Color;
* @author $author$
* @version $Revision$
*/
+@SuppressWarnings("serial")
public class GPreferences extends JPanel
{
private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
protected JComboBox<String> structViewer = new JComboBox<>();
+ protected JTextField structureDimensions = new JTextField();
+
protected JTextField chimeraPath = new JTextField();
protected ButtonGroup mappingMethod = new ButtonGroup();
/*
* Connections tab components
*/
- protected JTable linkUrlTable = new JTable();
+ public JTable linkUrlTable = new JTable();
- protected JButton editLink = new JButton();
+ public JButton editLink = new JButton();
- protected JButton deleteLink = new JButton();
+ public JButton deleteLink = new JButton();
- protected JTextField filterTB = new JTextField();
+ public JTextField filterTB = new JTextField();
protected JButton doReset = new JButton();
*/
protected JComboBox<Object> epsRendering = new JComboBox<>();
+ protected JComboBox<Object> htmlRendering = new JComboBox<>();
+
+ protected JComboBox<Object> svgRendering = new JComboBox<>();
+
protected JLabel userIdWidthlabel = new JLabel();
protected JCheckBox autoIdWidth = new JCheckBox();
protected JPanel presetsPanel = new JPanel();
+ protected JButton revertButton = new JButton();
+
protected JComboBox<IntKeyStringValueEntry> backupfilesPresetsCombo = new JComboBox<>();
protected JPanel suffixPanel = new JPanel();
tabbedPane.add(initConnectionsTab(),
MessageManager.getString("label.connections"));
- tabbedPane.add(initBackupsTab(),
- MessageManager.getString("label.backups"));
+ if (!Platform.isJS())
+ {
+ tabbedPane.add(initBackupsTab(),
+ MessageManager.getString("label.backups"));
+ }
tabbedPane.add(initLinksTab(),
MessageManager.getString("label.urllinks"));
/*
* See WsPreferences for the real work of configuring this tab.
*/
- wsTab.setLayout(new BorderLayout());
- tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
+ if (!Platform.isJS())
+ {
+ wsTab.setLayout(new BorderLayout());
+ tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
+ }
/*
* Handler to validate a tab before leaving it - currently only for
}
/**
- * Initialises the Output tabbed panel.
+ * Initialises the Output tab
*
* @return
*/
{
JPanel outputTab = new JPanel();
outputTab.setLayout(null);
- JLabel epsLabel = new JLabel();
+
+ JLabel epsLabel = new JLabel(
+ MessageManager.formatMessage("label.rendering_style", "EPS"));
epsLabel.setFont(LABEL_FONT);
epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
- epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
- epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
+ epsLabel.setBounds(new Rectangle(9, 31, 160, 24));
epsRendering.setFont(LABEL_FONT);
- epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
+ epsRendering.setBounds(new Rectangle(174, 34, 187, 21));
+ JLabel htmlLabel = new JLabel(
+ MessageManager.formatMessage("label.rendering_style", "HTML"));
+ htmlLabel.setFont(LABEL_FONT);
+ htmlLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ htmlLabel.setBounds(new Rectangle(9, 55, 160, 24));
+ htmlRendering.setFont(LABEL_FONT);
+ htmlRendering.setBounds(new Rectangle(174, 58, 187, 21));
+ JLabel svgLabel = new JLabel(
+ MessageManager.formatMessage("label.rendering_style", "SVG"));
+ svgLabel.setFont(LABEL_FONT);
+ svgLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ svgLabel.setBounds(new Rectangle(9, 79, 160, 24));
+ svgRendering.setFont(LABEL_FONT);
+ svgRendering.setBounds(new Rectangle(174, 82, 187, 21));
+
JLabel jLabel1 = new JLabel();
jLabel1.setFont(LABEL_FONT);
jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
jLabel1.setText(MessageManager.getString("label.append_start_end"));
jLabel1.setFont(LABEL_FONT);
+
fastajv.setFont(LABEL_FONT);
fastajv.setHorizontalAlignment(SwingConstants.LEFT);
clustaljv.setText(MessageManager.getString("label.clustal") + " ");
TitledBorder titledBorder2 = new TitledBorder(
MessageManager.getString("label.file_output"));
jPanel11.setBorder(titledBorder2);
- jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
+ jPanel11.setBounds(new Rectangle(30, 120, 196, 182));
GridLayout gridLayout3 = new GridLayout();
jPanel11.setLayout(gridLayout3);
gridLayout3.setRows(8);
MessageManager.getString("label.automatically_set_id_width"));
autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
.getString("label.adjusts_width_generated_eps_png")));
- autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
+ autoIdWidth.setBounds(new Rectangle(228, 144, 320, 23));
autoIdWidth.addActionListener(new ActionListener()
{
userIdWidthlabel.setToolTipText(
JvSwingUtils.wrapTooltip(true, MessageManager.getString(
"label.manually_specify_width_left_column")));
- userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
+ userIdWidthlabel.setBounds(new Rectangle(236, 168, 320, 23));
userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
userIdWidth.setText("");
- userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
+ userIdWidth.setBounds(new Rectangle(232, 192, 84, 23));
userIdWidth.addActionListener(new ActionListener()
{
modellerOutput.setFont(LABEL_FONT);
modellerOutput
.setText(MessageManager.getString("label.use_modeller_output"));
- modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
+ modellerOutput.setBounds(new Rectangle(228, 274, 320, 23));
embbedBioJSON.setFont(LABEL_FONT);
embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
- embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
-
- TitledBorder backupFilesBorder = new TitledBorder(
- MessageManager.getString("label.backup_files"));
+ embbedBioJSON.setBounds(new Rectangle(228, 248, 250, 23));
jPanel11.add(jLabel1);
jPanel11.add(blcjv);
outputTab.add(userIdWidth);
outputTab.add(userIdWidthlabel);
outputTab.add(modellerOutput);
- outputTab.add(embbedBioJSON);
- outputTab.add(epsLabel);
- outputTab.add(epsRendering);
+ if (!Platform.isJS())
+ {
+ /*
+ * JalviewJS doesn't support Lineart option or SVG output
+ */
+ outputTab.add(embbedBioJSON);
+ outputTab.add(epsLabel);
+ outputTab.add(epsRendering);
+ outputTab.add(htmlLabel);
+ outputTab.add(htmlRendering);
+ outputTab.add(svgLabel);
+ outputTab.add(svgRendering);
+ }
outputTab.add(jPanel11);
return outputTab;
}
linkTab.setLayout(new GridBagLayout());
// Set up table for Url links
+ linkUrlTable.getTableHeader().setReorderingAllowed(false);
linkUrlTable.setFillsViewportHeight(true);
linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
linkUrlTable.setAutoCreateRowSorter(true);
structViewer.addItem(ViewerType.JMOL.name());
structViewer.addItem(ViewerType.CHIMERA.name());
structViewer.addActionListener(new ActionListener()
+
{
@Override
public void actionPerformed(ActionEvent e)
});
structureTab.add(structViewer);
+ // BH 2019.07.12
+ ypos += lineSpacing;
+ JLabel dimLabel = new JLabel();
+ dimLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
+ dimLabel.setHorizontalAlignment(SwingConstants.LEFT);
+ dimLabel.setText(
+ MessageManager.getString("label.structure_dimensions"));
+ dimLabel.setBounds(new Rectangle(10, ypos, 140, height));
+ structureTab.add(dimLabel);
+
+ structureDimensions.setFont(LABEL_FONT);
+ structureDimensions.setBounds(new Rectangle(160, ypos, 120, height));
+ structureTab.add(structureDimensions);
+
ypos += lineSpacing;
JLabel pathLabel = new JLabel();
pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
structureTab.add(docFieldPref);
+ /*
+ * hide Chimera options in JalviewJS
+ */
+ if (Platform.isJS())
+ {
+ pathLabel.setVisible(false);
+ chimeraPath.setVisible(false);
+ viewerLabel.setVisible(false);
+ structViewer.setVisible(false);
+ }
+
return structureTab;
}
fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
fontLabel.setText(MessageManager.getString("label.font"));
fontSizeCB.setFont(LABEL_FONT);
- fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
+ fontSizeCB.setBounds(new Rectangle(320, 115, 65, 23)); // BH 2019.09.24 y
+ // added 3 pixels for
+ // Java/Windows
fontStyleCB.setFont(LABEL_FONT);
- fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
+ fontStyleCB.setBounds(new Rectangle(382, 115, 80, 23)); // BH 2019.09.24 y
+ // added 3 pixels
+ // for Java/Windows
fontNameCB.setFont(LABEL_FONT);
- fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
+ fontNameCB.setBounds(new Rectangle(172, 115, 147, 23)); // BH 2019.09.24 y
+ // added 3 pixels
+ // for Java/Windows
gapSymbolCB.setFont(LABEL_FONT);
gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
JPanel annsettingsPanel = new JPanel();
- annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
+ annsettingsPanel.setBounds(new Rectangle(173, 13, 330, 100)); // BH
+ // 2019.09.24
+ // SwingJS
+ // needs a few
+ // more
+ // pixels.
+ // Java needs
+ // a bit more
+ // in height
+ // on Windows
+ // OS
+ // Was 320
annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
annsettingsPanel.setBorder(new EtchedBorder());
visualTab.add(annsettingsPanel);
visualTab.add(fontNameCB);
visualTab.add(fontSizeCB);
visualTab.add(fontStyleCB);
+
+ if (Platform.isJS())
+ {
+ startupCheckbox.setVisible(false);
+ startupFileTextfield.setVisible(false);
+ }
+
return visualTab;
}
protected void loadLastSavedBackupsOptions()
{
enableBackupFiles
- .setSelected(Cache.getDefault(BackupFiles.ENABLED, true));
+ .setSelected(Cache.getDefault(BackupFiles.ENABLED, !Platform.isJS()));
setComboIntStringKey(backupfilesPresetsCombo,
Cache.getDefault(BackupFiles.NS + "_PRESET", 1));
suffixTemplate.setText(Cache.getDefault(BackupFiles.SUFFIX,
updateBackupFilesExampleLabel();
}
+ protected boolean warnAboutSuffixReverseChange()
+ {
+ boolean savedSuffixReverse = Cache.getDefault(BackupFiles.REVERSE_ORDER,
+ false);
+ int savedSuffixDigits = Cache.getDefault(BackupFiles.SUFFIX_DIGITS, 3);
+ String savedSuffixTemplate = Cache.getDefault(BackupFiles.SUFFIX,
+ ".bak" + BackupFiles.NUM_PLACEHOLDER);
+
+ boolean nowSuffixReverse = suffixReverse.isSelected();
+ int nowSuffixDigits = getSpinnerInt(suffixDigitsSpinner, 3);
+ String nowSuffixTemplate = suffixTemplate.getText();
+ return nowSuffixReverse != savedSuffixReverse
+ && nowSuffixDigits == savedSuffixDigits
+ && nowSuffixTemplate != null
+ && nowSuffixTemplate.equals(savedSuffixTemplate);
+ }
+
/**
* Initialises the Backups tabbed panel.
*
backupsTab.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
- gbc.weightx = 1.0;
+ gbc.weightx = 0.0;
gbc.weighty = 0.0;
- gbc.anchor = GridBagConstraints.NORTHWEST;
+ gbc.anchor = GridBagConstraints.FIRST_LINE_START;
gbc.fill = GridBagConstraints.NONE;
initBackupsTabPresetsPanel();
initBackupsTabKeepFilesPanel();
initBackupsTabFilenameExamplesPanel();
- gbc.weightx = 0.5;
enableBackupFiles.setFont(LABEL_FONT_BOLD);
enableBackupFiles
.setText(MessageManager.getString("label.enable_backupfiles"));
@Override
public void actionPerformed(ActionEvent e)
{
- boolean selected = enableBackupFiles.isSelected();
// enable other options only when the first is checked
backupsOptionsSetEnabled();
}
});
- // enable checkbox 1 row
+
+ // enable checkbox 1 col
gbc.gridwidth = 1;
+ gbc.gridheight = 1;
gbc.gridx = 0;
- gbc.gridy = 0;
+ gbc.gridy = 0; // row 0
backupsTab.add(enableBackupFiles, gbc);
+ // summary of scheme box (over two rows)
gbc.gridx = 1;
- gbc.weightx = 1.0;
+ gbc.weightx = 0.0;
gbc.gridheight = 2;
- // gbc.anchor = GridBagConstraints.NORTHEAST;
- // gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.anchor = GridBagConstraints.FIRST_LINE_END;
+ gbc.fill = GridBagConstraints.BOTH;
backupsTab.add(exampleFilesPanel, gbc);
+ gbc.gridheight = 1;
+ gbc.anchor = GridBagConstraints.FIRST_LINE_START;
+ gbc.fill = GridBagConstraints.NONE;
+
+ // fill empty space on right
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ backupsTab.add(new JPanel(), gbc);
+ // schemes box
+ gbc.weightx = 0.0;
gbc.gridx = 0;
- gbc.gridy = 1;
+ gbc.gridy++; // row 1
backupsTab.add(presetsPanel, gbc);
- gbc.anchor = GridBagConstraints.NORTHWEST;
- gbc.fill = GridBagConstraints.NONE;
+ // gbc.anchor = GridBagConstraints.NORTHWEST;
+ // now using whole row
gbc.gridwidth = 2;
gbc.gridheight = 1;
- // whole suffix panel next row
+ // keep files box
gbc.gridx = 0;
- gbc.gridy = 2;
+ gbc.gridy++; // row 2
backupsTab.add(keepfilesPanel, gbc);
- // keep files panel
- gbc.gridy = 3;
+ // filename strategy box
+ gbc.gridy++; // row 3
backupsTab.add(suffixPanel, gbc);
// fill empty space
- gbc.gridy = 4;
+ gbc.gridy++; // row 4
gbc.weighty = 1.0;
backupsTab.add(new JPanel(), gbc);
return backupsTab;
}
- private final IntKeyStringValueEntry[] backupfilesPresetEntries = {
+ protected static final int BACKUPFILESSCHEMECUSTOMISE = 0;
+
+ private static final IntKeyStringValueEntry[] backupfilesPresetEntries = {
new IntKeyStringValueEntry(1,
MessageManager.getString("label.default")),
new IntKeyStringValueEntry(2,
new IntKeyStringValueEntry(4,
MessageManager.getString("label.rolled_backups")),
// ...
- new IntKeyStringValueEntry(255,
- MessageManager.getString("label.previously_saved_scheme")),
// IMPORTANT, keep "Custom" entry with key 0 (even though it appears last)
- new IntKeyStringValueEntry(0,
+ new IntKeyStringValueEntry(BACKUPFILESSCHEMECUSTOMISE,
MessageManager.getString("label.customise")) };
- private final Map<Integer, BackupFilesPresetEntry> backupfilesPresetEntriesValues = new HashMap<Integer, BackupFilesPresetEntry>()
+ private static final Map<Integer, BackupFilesPresetEntry> backupfilesPresetEntriesValues = new HashMap<Integer, BackupFilesPresetEntry>()
{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 125L;
+
{
put(1, new BackupFilesPresetEntry(
".bak" + BackupFiles.NUM_PLACEHOLDER, 3, false, false, 3,
private JPanel initBackupsTabPresetsPanel()
{
- presetsPanel.setBorder(
- new TitledBorder(MessageManager.getString("label.schemes")));
+
+ String title = MessageManager.getString("label.schemes");
+ // TitledBorder tb = new TitledBorder(new EmptyBorder(0, 0, 0, 0), title);
+ // TitledBorder tb = new TitledBorder(title);
+ // tb.setTitleFont(LABEL_FONT);
+ // presetsPanel.setBorder(tb);
+
+ presetsPanel.setLayout(new GridBagLayout());
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.anchor = GridBagConstraints.BASELINE_LEADING;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.gridwidth = 1;
+ gbc.gridheight = 1;
+
+ // "Scheme: "
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ presetsPanel.add(new JLabel(title + ":"), gbc);
for (int i = 0; i < backupfilesPresetEntries.length; i++)
{
}
});
- presetsPanel.add(backupfilesPresetsCombo);
+ // dropdown list of preset schemes
+ gbc.gridx = 1;
+ presetsPanel.add(backupfilesPresetsCombo, gbc);
+
+ revertButton.setText(MessageManager.getString("label.cancel_changes"));
+ revertButton.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ loadLastSavedBackupsOptions();
+ }
+
+ });
+ revertButton.setFont(LABEL_FONT);
+
+ // "Cancel changes" button (aligned with combo box above)
+ gbc.gridx = 1;
+ gbc.gridy++;
+ presetsPanel.add(revertButton, gbc);
+
return presetsPanel;
}
- private void backupsTabUpdatePresets()
+ private JPanel initBackupsTabFilenameExamplesPanel()
+ {
+ String title = MessageManager
+ .getString("label.summary_of_backups_scheme");
+ TitledBorder tb = new TitledBorder(title);
+ exampleFilesPanel.setBorder(tb);
+ exampleFilesPanel.setLayout(new GridBagLayout());
+
+
+ backupfilesExampleLabel.setEditable(false);
+ backupfilesExampleLabel
+ .setBackground(exampleFilesPanel.getBackground());
+
+ updateBackupFilesExampleLabel();
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.anchor = GridBagConstraints.FIRST_LINE_START;
+
+ exampleFilesPanel.add(backupfilesExampleLabel, gbc);
+ return exampleFilesPanel;
+ }
+
+ protected void backupsTabUpdatePresets()
{
IntKeyStringValueEntry entry = (IntKeyStringValueEntry) backupfilesPresetsCombo
.getSelectedItem();
int key = entry.getKey();
String value = entry.getValue();
- // 0 reserved for "Custom" and 255 reserved or "Previously saved scheme"
- boolean special = key == 0 || key == 255;
- if (special)
- {
- if (key == 0)
- {
- // backupsSetCustomOptions();
- }
- else if (key == 255)
- {
- loadLastSavedBackupsOptions();
- // switch to "Customise" scheme? probably not
- // setComboIntStringKey(backupfilesPresetsCombo, 0);
- }
- }
- else
+ // BACKUPFILESSCHEMECUSTOMISE (==0) reserved for "Custom"
+ if (key != BACKUPFILESSCHEMECUSTOMISE)
{
if (backupfilesPresetEntriesValues.containsKey(key))
{
updateBackupFilesExampleLabel();
}
- protected int getComboIntStringKey(JComboBox c)
+ protected int getComboIntStringKey(JComboBox<IntKeyStringValueEntry> c)
{
IntKeyStringValueEntry e = (IntKeyStringValueEntry) c.getSelectedItem();
return e != null ? e.getKey() : 0;
for (int i = 0; i < c.getItemCount(); i++)
{
IntKeyStringValueEntry e = c.getItemAt(i);
- int k = e.getKey();
- String v = e.getValue();
if (e.getKey() == key)
{
c.setSelectedIndex(i);
@Override
public void actionPerformed(ActionEvent e)
{
- updateBackupFilesExampleLabel();
+ boolean okay = true;
+ if (warnAboutSuffixReverseChange())
+ {
+ // Warning popup
+ okay = confirmSuffixReverseChange();
+ }
+ if (okay)
+ {
+ updateBackupFilesExampleLabel();
+ }
+ else
+ {
+ boolean savedSuffixReverse = Cache
+ .getDefault(BackupFiles.REVERSE_ORDER, false);
+ suffixReverse.setSelected(savedSuffixReverse);
+ }
}
});
return suffixPanel;
}
+ protected boolean confirmSuffixReverseChange()
+ {
+ boolean ret = false;
+ String warningMessage = MessageManager
+ .getString("label.warning_confirm_change_reverse");
+ int confirm = JvOptionPane.showConfirmDialog(Desktop.getDesktopPane(),
+ warningMessage,
+ MessageManager.getString("label.change_increment_decrement"),
+ JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE);
+
+ ret = (confirm == JvOptionPane.YES_OPTION);
+ return ret;
+ }
+
private JPanel initBackupsTabKeepFilesPanel()
{
keepfilesPanel.setBorder(
@Override
public void actionPerformed(ActionEvent e)
{
- boolean selected = backupfilesKeepAll.isSelected();
keepRollMaxOptionsEnabled();
updateBackupFilesExampleLabel();
}
setIntegerSpinner(backupfilesRollMaxSpinner, 1, 999, 4, true, c);
backupfilesConfirmDelete.setLabels(
- MessageManager.getString("label.confirm_delete"),
+ MessageManager.getString("label.always_ask"),
MessageManager.getString("label.auto_delete"));
// update the enabled section
keepRollMaxOptionsEnabled();
return keepfilesPanel;
}
- private JPanel initBackupsTabFilenameExamplesPanel()
- {
- String title = MessageManager
- .getString("label.summary_of_backups_scheme");
- TitledBorder tb = new TitledBorder(new EmptyBorder(0, 0, 0, 0), title);
- // tb.setTitleFont(LABEL_FONT);
- exampleFilesPanel.setBorder(tb);
- exampleFilesPanel.setLayout(new GridBagLayout());
-
- // inordinately difficult to get this titledborder the right size for the
- // title
-
- backupfilesExampleLabel.setEditable(false);
- backupfilesExampleLabel.setPreferredSize(new Dimension(280, 85));
- backupfilesExampleLabel.setAlignmentX(LEFT_ALIGNMENT);
- backupfilesExampleLabel.setAlignmentY(TOP_ALIGNMENT);
-
- backupfilesExampleLabel.setFont(LABEL_FONT_ITALIC);
- backupfilesExampleLabel
- .setBackground(exampleFilesPanel.getBackground());
-
- updateBackupFilesExampleLabel();
- exampleFilesPanel.setMinimumSize(new Dimension(280, 85));
-
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.anchor = GridBagConstraints.EAST;
-
- gbc.gridy = 0;
- exampleFilesPanel.add(backupfilesExampleLabel, gbc);
- return exampleFilesPanel;
- }
-
protected void updateBackupFilesExampleLabel()
{
int exampleindex = 12;
return;
}
- try
- {
- backupfilesRollMaxSpinner.commitEdit();
- rollMax = (Integer) backupfilesRollMaxSpinner.getValue();
- rollMax = rollMax < 1 ? 1 : rollMax;
- } catch (Exception e)
- {
- System.out.println(
- "Failed casting (Integer) backupfilesRollMaxSpinner.getValue()");
- }
+ rollMax = getSpinnerInt(backupfilesRollMaxSpinner, 4);
+ rollMax = rollMax < 1 ? 1 : rollMax;
if (suffix.indexOf(BackupFiles.NUM_PLACEHOLDER) == -1)
{
rollMax = 1;
}
- try
- {
- suffixDigitsSpinner.commitEdit();
- digits = (Integer) suffixDigitsSpinner.getValue();
- digits = digits < 1 ? 1 : digits;
- } catch (Exception e)
- {
- System.out.println(
- "Failed casting (Integer) suffixTemplateSpinner.getValue()");
- }
+ digits = getSpinnerInt(suffixDigitsSpinner, 3);
+ digits = digits < 1 ? 1 : digits;
int lowersurround = 2;
int uppersurround = 0;
return i;
}
- private void keepRollMaxOptionsEnabled()
+ protected void keepRollMaxOptionsEnabled()
{
boolean enabled = backupfilesKeepAll.isEnabled()
&& !backupfilesKeepAll.isSelected();
backupfilesConfirmDelete.setEnabled(enabled);
}
- private void backupfilesKeepAllSetEnabled(boolean tryEnabled)
+ protected void backupfilesKeepAllSetEnabled(boolean tryEnabled)
{
boolean enabled = tryEnabled && enableBackupFiles.isSelected()
&& getComboIntStringKey(backupfilesPresetsCombo) == 0
button.setHorizontalAlignment(SwingConstants.CENTER);
this.button.addActionListener(new ActionListener()
{
+ @SuppressWarnings("synthetic-access")
@Override
public void actionPerformed(ActionEvent e)
{
class BackupFilesPresetsComboBoxRenderer extends DefaultListCellRenderer
{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 88L;
+
@Override
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+ public Component getListCellRendererComponent(JList<?> list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus)
+ {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
try {
IntKeyStringValueEntry e = (IntKeyStringValueEntry) value;
- if (e.getKey() == 255)
- {
- // "Previously saved scheme" item
- this.setFont(this.getFont().deriveFont(Font.ITALIC));
- }
- else if (e.getKey() == 0)
+ if (e.getKey() == GPreferences.BACKUPFILESSCHEMECUSTOMISE)
{
// "Customise" item
this.setFont(this.getFont().deriveFont(Font.BOLD));
return this;
}
-}
\ No newline at end of file
+}