X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGPreferences.java;h=d9a6ceab312a2111fa6bb4db5eb47650066b9478;hb=1648150f514f5286051abdc1787009e1ec374154;hp=87cc87b3dab038c031763bc1414a2a61461eb463;hpb=470b622223b227bdbd4af3151f9d002a95bb1f52;p=jalview.git diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 87cc87b..d9a6cea 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -32,6 +32,7 @@ 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; @@ -91,6 +92,7 @@ import javax.swing.table.TableCellRenderer; * @author $author$ * @version $Revision$ */ +@SuppressWarnings("serial") public class GPreferences extends JPanel { private static final Font LABEL_FONT = JvSwingUtils.getLabelFont(); @@ -178,6 +180,8 @@ public class GPreferences extends JPanel protected JComboBox structViewer = new JComboBox<>(); + protected JTextField structureDimensions = new JTextField(); + protected JTextField chimeraPath = new JTextField(); protected ButtonGroup mappingMethod = new ButtonGroup(); @@ -213,13 +217,13 @@ public class GPreferences extends JPanel /* * 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(); @@ -248,6 +252,10 @@ public class GPreferences extends JPanel */ protected JComboBox epsRendering = new JComboBox<>(); + protected JComboBox htmlRendering = new JComboBox<>(); + + protected JComboBox svgRendering = new JComboBox<>(); + protected JLabel userIdWidthlabel = new JLabel(); protected JCheckBox autoIdWidth = new JCheckBox(); @@ -368,8 +376,11 @@ public class GPreferences extends 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")); @@ -383,8 +394,11 @@ public class GPreferences extends JPanel /* * 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 @@ -442,7 +456,7 @@ public class GPreferences extends JPanel } /** - * Initialises the Output tabbed panel. + * Initialises the Output tab * * @return */ @@ -450,18 +464,35 @@ public class GPreferences extends JPanel { 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") + " "); @@ -478,7 +509,7 @@ public class GPreferences extends JPanel 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); @@ -497,7 +528,7 @@ public class GPreferences extends JPanel 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() { @@ -515,10 +546,10 @@ public class GPreferences extends JPanel 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() { @@ -531,10 +562,10 @@ public class GPreferences extends JPanel 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)); + embbedBioJSON.setBounds(new Rectangle(228, 248, 250, 23)); jPanel11.add(jLabel1); jPanel11.add(blcjv); @@ -548,9 +579,19 @@ public class GPreferences extends JPanel 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; } @@ -1242,6 +1283,7 @@ public class GPreferences extends JPanel structViewer.addItem(ViewerType.JMOL.name()); structViewer.addItem(ViewerType.CHIMERA.name()); structViewer.addActionListener(new ActionListener() + { @Override public void actionPerformed(ActionEvent e) @@ -1252,6 +1294,20 @@ public class GPreferences extends JPanel }); 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)); @@ -1310,6 +1366,17 @@ public class GPreferences extends JPanel 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; } @@ -1545,11 +1612,17 @@ public class GPreferences extends JPanel 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(); @@ -1594,7 +1667,18 @@ public class GPreferences extends JPanel 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); @@ -1686,6 +1770,13 @@ public class GPreferences extends JPanel visualTab.add(fontNameCB); visualTab.add(fontSizeCB); visualTab.add(fontStyleCB); + + if (Platform.isJS()) + { + startupCheckbox.setVisible(false); + startupFileTextfield.setVisible(false); + } + return visualTab; } @@ -1696,7 +1787,7 @@ public class GPreferences extends JPanel 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, @@ -1716,7 +1807,7 @@ public class GPreferences extends JPanel updateBackupFilesExampleLabel(); } - private boolean warnAboutSuffixReverseChange() + protected boolean warnAboutSuffixReverseChange() { boolean savedSuffixReverse = Cache.getDefault(BackupFiles.REVERSE_ORDER, false); @@ -1949,7 +2040,7 @@ public class GPreferences extends JPanel return exampleFilesPanel; } - private void backupsTabUpdatePresets() + protected void backupsTabUpdatePresets() { IntKeyStringValueEntry entry = (IntKeyStringValueEntry) backupfilesPresetsCombo .getSelectedItem(); @@ -2132,12 +2223,12 @@ public class GPreferences extends JPanel return suffixPanel; } - private boolean confirmSuffixReverseChange() + protected boolean confirmSuffixReverseChange() { boolean ret = false; String warningMessage = MessageManager .getString("label.warning_confirm_change_reverse"); - int confirm = JvOptionPane.showConfirmDialog(Desktop.desktop, + int confirm = JvOptionPane.showConfirmDialog(Desktop.getDesktopPane(), warningMessage, MessageManager.getString("label.change_increment_decrement"), JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE); @@ -2441,7 +2532,7 @@ public class GPreferences extends JPanel return i; } - private void keepRollMaxOptionsEnabled() + protected void keepRollMaxOptionsEnabled() { boolean enabled = backupfilesKeepAll.isEnabled() && !backupfilesKeepAll.isSelected(); @@ -2450,7 +2541,7 @@ public class GPreferences extends JPanel backupfilesConfirmDelete.setEnabled(enabled); } - private void backupfilesKeepAllSetEnabled(boolean tryEnabled) + protected void backupfilesKeepAllSetEnabled(boolean tryEnabled) { boolean enabled = tryEnabled && enableBackupFiles.isSelected() && getComboIntStringKey(backupfilesPresetsCombo) == 0 @@ -2690,6 +2781,7 @@ public class GPreferences extends JPanel button.setHorizontalAlignment(SwingConstants.CENTER); this.button.addActionListener(new ActionListener() { + @SuppressWarnings("synthetic-access") @Override public void actionPerformed(ActionEvent e) { @@ -2778,7 +2870,7 @@ class BackupFilesPresetsComboBoxRenderer extends DefaultListCellRenderer private static final long serialVersionUID = 88L; @Override - public Component getListCellRendererComponent(JList list, Object value, + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);