From: kiramt Date: Mon, 28 Aug 2017 15:38:03 +0000 (+0100) Subject: JAL-2527 Started adding overview preferences X-Git-Tag: Release_2_10_3b1~142^2~2^2~12 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=75d0279984e769ace9e422376b4104a4522cf0c3;ds=sidebyside JAL-2527 Started adding overview preferences --- diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 162f10f..9c6f75b 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1311,3 +1311,10 @@ label.occupancy_descr = Number of aligned positions label.show_experimental = Enable experimental features label.show_experimental_tip = Enable any new and currently 'experimental' features (see Latest Release Notes for details) label.warning_hidden = Warning: {0} {1} is currently hidden +label.overview_settings = Overview settings +label.ov_legacy_gap = Use legacy gap colouring (gaps are white) +label.gap_colour = Gap colour +label.ov_show_hide_default = Show hidden regions when opening overview +label.hidden_colour = Hidden colour +label.select_gap_colour = Gap colour +label.select_hidden_colour = Hidden colour diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index 8385142..9fb2fc5 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -1311,3 +1311,10 @@ label.togglehidden = Mostrar regiones ocultas label.show_experimental = Habilitar funciones experimentales label.show_experimental_tip = Habilitar funciones nuevas y experimentales (ver Latest Release Notes para más detalles) label.warning_hidden = Advertencia: {0} {1} está actualmente oculto +label.overview_settings = Overview settings +label.ov_legacy_gap = Use legacy gap colouring (gaps are white) +label.gap_colour = Gap colour +label.ov_show_hide_default = Show hidden regions when opening overview +label.hidden_colour = Hidden colour +label.select_gap_colour = Gap colour +label.select_hidden_colour = Hidden colour \ No newline at end of file diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index c3c9239..6fdaa0d 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -54,6 +54,7 @@ import java.util.ArrayList; import java.util.List; import javax.help.HelpSetException; +import javax.swing.JButton; import javax.swing.JColorChooser; import javax.swing.JFileChooser; import javax.swing.JInternalFrame; @@ -155,7 +156,7 @@ public class Preferences extends GPreferences * .properties file as '|' separated strings */ - groupURLLinks = new ArrayList(); + groupURLLinks = new ArrayList<>(); } JInternalFrame frame; @@ -307,6 +308,10 @@ public class Preferences extends GPreferences Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange)); maxColour.setBackground( Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red)); + gapColour.setBackground( + Cache.getDefaultColour("GAP_COLOUR", Color.lightGray)); + hiddenColour.setBackground( + Cache.getDefaultColour("HIDDEN_COLOUR", Color.darkGray)); /* * Set Structure tab defaults. @@ -1035,6 +1040,32 @@ public class Preferences extends GPreferences } @Override + public void gapColour_actionPerformed(JButton btn) + { + Color col = JColorChooser.showDialog(this, + MessageManager.getString("label.select_gap_colour"), + gapColour.getForeground()); + if (col != null) + { + btn.setForeground(col); + } + btn.repaint(); + } + + @Override + public void hiddenColour_actionPerformed(JButton btn) + { + Color col = JColorChooser.showDialog(this, + MessageManager.getString("label.select_hidden_colour"), + hiddenColour.getForeground()); + if (col != null) + { + btn.setForeground(col); + } + btn.repaint(); + } + + @Override protected void userIdWidth_actionPerformed() { try diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 633d2b8..a58569a 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -95,11 +95,11 @@ public class GPreferences extends JPanel protected JCheckBox rightAlign = new JCheckBox(); - protected JComboBox fontSizeCB = new JComboBox(); + protected JComboBox fontSizeCB = new JComboBox<>(); - protected JComboBox fontStyleCB = new JComboBox(); + protected JComboBox fontStyleCB = new JComboBox<>(); - protected JComboBox fontNameCB = new JComboBox(); + protected JComboBox fontNameCB = new JComboBox<>(); protected JCheckBox showOccupancy = new JCheckBox(); @@ -111,15 +111,15 @@ public class GPreferences extends JPanel protected JCheckBox scaleProteinToCdna = new JCheckBox(); - protected JComboBox gapSymbolCB = new JComboBox(); + protected JComboBox gapSymbolCB = new JComboBox<>(); protected JCheckBox wrap = new JCheckBox(); - protected JComboBox sortby = new JComboBox(); + protected JComboBox sortby = new JComboBox<>(); - protected JComboBox sortAnnBy = new JComboBox(); + protected JComboBox sortAnnBy = new JComboBox<>(); - protected JComboBox sortAutocalc = new JComboBox(); + protected JComboBox sortAutocalc = new JComboBox<>(); protected JCheckBox startupCheckbox = new JCheckBox(); @@ -159,7 +159,7 @@ public class GPreferences extends JPanel protected JCheckBox addTempFactor = new JCheckBox(); - protected JComboBox structViewer = new JComboBox(); + protected JComboBox structViewer = new JComboBox<>(); protected JTextField chimeraPath = new JTextField(); @@ -176,9 +176,13 @@ public class GPreferences extends JPanel protected JPanel maxColour = new JPanel(); - protected JComboBox protColour = new JComboBox(); + protected JComboBox protColour = new JComboBox<>(); - protected JComboBox nucColour = new JComboBox(); + protected JComboBox nucColour = new JComboBox<>(); + + protected JButton gapColour = new JButton(); + + protected JButton hiddenColour = new JButton(); /* * Connections tab components @@ -216,7 +220,7 @@ public class GPreferences extends JPanel /* * Output tab components */ - protected JComboBox epsRendering = new JComboBox(); + protected JComboBox epsRendering = new JComboBox<>(); protected JLabel userIdWidthlabel = new JLabel(); @@ -888,9 +892,10 @@ public class GPreferences extends JPanel private JPanel initColoursTab() { JPanel coloursTab = new JPanel(); - coloursTab.setBorder(new TitledBorder( + JPanel alignmentPanel = new JPanel(); + alignmentPanel.setBorder(new TitledBorder( MessageManager.getString("action.open_new_alignment"))); - coloursTab.setLayout(new FlowLayout()); + alignmentPanel.setLayout(new FlowLayout()); JLabel mincolourLabel = new JLabel(); mincolourLabel.setFont(LABEL_FONT); mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT); @@ -929,7 +934,7 @@ public class GPreferences extends JPanel protColourLabel.setHorizontalAlignment(SwingConstants.LEFT); protColourLabel.setText( MessageManager.getString("label.prot_alignment_colour") + " "); - JvSwingUtils.addtoLayout(coloursTab, + JvSwingUtils.addtoLayout(alignmentPanel, MessageManager .getString("label.default_colour_scheme_for_alignment"), protColourLabel, protColour); @@ -941,7 +946,7 @@ public class GPreferences extends JPanel nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT); nucColourLabel.setText( MessageManager.getString("label.nuc_alignment_colour") + " "); - JvSwingUtils.addtoLayout(coloursTab, + JvSwingUtils.addtoLayout(alignmentPanel, MessageManager .getString("label.default_colour_scheme_for_alignment"), nucColourLabel, nucColour); @@ -958,7 +963,107 @@ public class GPreferences extends JPanel MessageManager.getString( "label.default_maximum_colour_annotation_shading"), maxcolourLabel, maxColour); - coloursTab.add(annotationShding); // , FlowLayout.LEFT); + alignmentPanel.add(annotationShding); // , FlowLayout.LEFT); + + JPanel overviewPanel = new JPanel(); + overviewPanel.setBorder(new TitledBorder( + MessageManager.getString("label.overview_settings"))); + overviewPanel.setLayout(new FlowLayout()); + + gapColour.setFont(LABEL_FONT); + gapColour.setBorder(BorderFactory.createEtchedBorder()); + gapColour.setPreferredSize(new Dimension(40, 20)); + gapColour.addMouseListener(new MouseAdapter() + { + @Override + public void mousePressed(MouseEvent e) + { + gapColour_actionPerformed(gapColour); + } + }); + + hiddenColour.setFont(LABEL_FONT); + hiddenColour.setBorder(BorderFactory.createEtchedBorder()); + hiddenColour.setPreferredSize(new Dimension(40, 20)); + hiddenColour.addMouseListener(new MouseAdapter() + { + @Override + public void mousePressed(MouseEvent e) + { + hiddenColour_actionPerformed(hiddenColour); + } + }); + + JCheckBox gapSetting = new JCheckBox( + MessageManager.getString("label.ov_legacy_gap")); + gapSetting.setFont(LABEL_FONT); + gapSetting.setHorizontalAlignment(SwingConstants.LEFT); + JLabel gapLabel = new JLabel( + MessageManager.getString("label.gap_colour")); + gapLabel.setFont(LABEL_FONT); + gapLabel.setHorizontalAlignment(SwingConstants.LEFT); + JCheckBox hiddenSetting = new JCheckBox( + MessageManager.getString("label.ov_show_hide_default")); + hiddenSetting.setFont(LABEL_FONT); + hiddenSetting.setHorizontalAlignment(SwingConstants.LEFT); + JLabel hiddenLabel = new JLabel( + MessageManager.getString("label.hidden_colour")); + hiddenLabel.setFont(LABEL_FONT); + hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT); + + overviewPanel.setLayout(new GridBagLayout()); + GridBagConstraints c1 = new GridBagConstraints(); + + c1.fill = GridBagConstraints.HORIZONTAL; + c1.gridx = 0; + c1.gridy = 0; + c1.weightx = 1; + c1.anchor = GridBagConstraints.FIRST_LINE_START; + overviewPanel.add(gapSetting, c1); + + GridBagConstraints c2 = new GridBagConstraints(); + c2.fill = GridBagConstraints.HORIZONTAL; + c2.gridx = 1; + c2.gridy = 0; + c2.insets = new Insets(0, 5, 0, 5); + overviewPanel.add(gapLabel, c2); + + GridBagConstraints c3 = new GridBagConstraints(); + c3.fill = GridBagConstraints.HORIZONTAL; + c3.gridx = 2; + c3.gridy = 0; + overviewPanel.add(gapColour, c3); + + GridBagConstraints c4 = new GridBagConstraints(); + c4.fill = GridBagConstraints.HORIZONTAL; + c4.gridx = 0; + c4.gridy = 1; + c4.weightx = 1; + overviewPanel.add(hiddenSetting, c4); + + GridBagConstraints c5 = new GridBagConstraints(); + c5.fill = GridBagConstraints.HORIZONTAL; + c5.gridx = 1; + c5.gridy = 1; + c5.insets = new Insets(0, 5, 0, 5); + overviewPanel.add(hiddenLabel, c5); + + GridBagConstraints c6 = new GridBagConstraints(); + c6.fill = GridBagConstraints.HORIZONTAL; + c6.gridx = 2; + c6.gridy = 1; + overviewPanel.add(hiddenColour, c6); + + // Add padding so the panel doesn't look ridiculous + JPanel spacePanel = new JPanel(); + overviewPanel.add(spacePanel, + new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, + GridBagConstraints.WEST, GridBagConstraints.BOTH, + new Insets(0, 0, 0, 5), 0, 0)); + + coloursTab.setLayout(new GridLayout(2, 1)); + coloursTab.add(alignmentPanel); + coloursTab.add(overviewPanel); return coloursTab; } @@ -1494,6 +1599,14 @@ public class GPreferences extends JPanel { } + protected void gapColour_actionPerformed(JButton btn) + { + } + + protected void hiddenColour_actionPerformed(JButton btn) + { + } + protected void showunconserved_actionPerformed(ActionEvent e) { // TODO Auto-generated method stub