X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FFeatureSettings.java;h=9fe2e92dc4afab8845901049cd1f1dd031165cea;hb=17e4ea278bc9a5fb280db1252ce78b7a295215f5;hp=77d562271eef83e33da2e03803c2ed51ded2893d;hpb=3f873f476a41c07e5c5b0ca2ac36e54411d07fe0;p=jalview.git diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 77d5622..9fe2e92 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -22,7 +22,6 @@ package jalview.gui; import jalview.api.FeatureColourI; import jalview.api.FeatureSettingsControllerI; -import jalview.bin.Jalview; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; import jalview.datamodel.features.FeatureMatcher; @@ -99,6 +98,7 @@ import javax.swing.border.Border; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.table.AbstractTableModel; +import javax.swing.table.JTableHeader; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; @@ -131,7 +131,8 @@ public class FeatureSettings extends JPanel private static final int MIN_HEIGHT = 400; - private final static String BASE_TOOLTIP = MessageManager.getString("label.click_to_edit"); + private final static String BASE_TOOLTIP = MessageManager + .getString("label.click_to_edit"); final FeatureRenderer fr; @@ -163,12 +164,6 @@ public class FeatureSettings extends JPanel int selectedRow = -1; - JButton fetchDAS = new JButton(); - - JButton saveDAS = new JButton(); - - JButton cancelDAS = new JButton(); - boolean resettingTable = false; /* @@ -208,33 +203,6 @@ public class FeatureSettings extends JPanel table = new JTable() { - -// @Override -// public void repaint() { -// System.out.println("FS repaint"); -// super.repaint(); -// -// } -// -// @Override -// public void repaint(long tm, int x, int y, int width, int height) { -// System.out.println("FS repaint " + x + " " + y + " " + width + " " + height); -// super.repaint(tm, x, y, width, height); -// -// } -// @Override -// public void invalidate() { -// if (isValid()) -// System.out.println("FS invalidating "); -// super.invalidate(); -// } -// -// @Override -// public void validate() { -// System.out.println("FS validating " + isValid()); -// super.validate(); -// } - @Override public String getToolTipText(MouseEvent e) { @@ -257,16 +225,16 @@ public class FeatureSettings extends JPanel FeatureMatcherSet o = (FeatureMatcherSet) table.getValueAt(row, column); tip = o.isEmpty() - ? MessageManager.getString("label.filters_tooltip") + ? MessageManager + .getString("label.configure_feature_tooltip") : o.toString(); break; default: break; } - + return tip; } - /** * Position the tooltip near the bottom edge of, and half way across, the @@ -283,21 +251,17 @@ public class FeatureSettings extends JPanel return loc; } }; - - // next line is needed to avoid (quiet) exceptions thrown - // when column ordering changes so that the above constants - // no longer apply. - table.getTableHeader().setReorderingAllowed(false); // BH 2018 - - table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12)); + JTableHeader tableHeader = table.getTableHeader(); + tableHeader.setFont(new Font("Verdana", Font.PLAIN, 12)); + tableHeader.setReorderingAllowed(false); + table.setFont(new Font("Verdana", Font.PLAIN, 12)); ToolTipManager.sharedInstance().registerComponent(table); - table.setDefaultEditor(FeatureColour.class, new ColorEditor()); table.setDefaultRenderer(FeatureColour.class, new ColorRenderer()); table.setDefaultEditor(FeatureMatcherSet.class, new FilterEditor()); table.setDefaultRenderer(FeatureMatcherSet.class, new FilterRenderer()); - + TableColumn colourColumn = new TableColumn(COLOUR_COLUMN, 75, new ColorRenderer(), new ColorEditor()); table.addColumn(colourColumn); @@ -402,18 +366,9 @@ public class FeatureSettings extends JPanel frame = new JInternalFrame(); frame.setContentPane(this); - if (Platform.isAMac()) - { - Desktop.addInternalFrame(frame, - MessageManager.getString("label.sequence_feature_settings"), - 600, 480); - } - else - { - Desktop.addInternalFrame(frame, - MessageManager.getString("label.sequence_feature_settings"), - 600, 450); - } + Desktop.addInternalFrame(frame, + MessageManager.getString("label.sequence_feature_settings"), + 600, Platform.isAMacAndNotJS() ? 480 : 450); frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); frame.addInternalFrameListener( @@ -430,15 +385,15 @@ public class FeatureSettings extends JPanel inConstruction = false; } - /** - * Constructs and shows a popup menu of possible actions on the selected row and - * feature type - * - * @param rowSelected - * @param type - * @param typeCol - * @param pt - */ + /** + * Constructs and shows a popup menu of possible actions on the selected row + * and feature type + * + * @param rowSelected + * @param type + * @param typeCol + * @param pt + */ protected void showPopupMenu(final int rowSelected, final String type, final Object typeCol, final Point pt) { @@ -454,7 +409,7 @@ public class FeatureSettings extends JPanel MessageManager.getString("label.variable_colour")); variableColourCB.setSelected(!featureColour.isSimpleColour()); men.add(variableColourCB); - + /* * checkbox action listener doubles up as listener to OK * from the variable colour / filters dialog @@ -466,8 +421,10 @@ public class FeatureSettings extends JPanel { if (e.getSource() == variableColourCB) { - men.setVisible(true); // BH 2018 for JavaScript because this is a checkbox - men.setVisible(false); // BH 2018 for JavaScript because this is a checkbox + men.setVisible(true); // BH 2018 for JavaScript because this is a + // checkbox + men.setVisible(false); // BH 2018 for JavaScript because this is a + // checkbox if (featureColour.isSimpleColour()) { /* @@ -481,7 +438,8 @@ public class FeatureSettings extends JPanel /* * toggle variable to simple colour - show colour chooser */ - String title = MessageManager.formatMessage("label.select_colour_for", type); + String title = MessageManager + .formatMessage("label.select_colour_for", type); ColourChooserListener listener = new ColourChooserListener() { @Override @@ -495,11 +453,11 @@ public class FeatureSettings extends JPanel false); } }; - JalviewColourChooser.showColourChooser(FeatureSettings.this, title, - featureColour.getMaxColour(), listener); + JalviewColourChooser.showColourChooser(FeatureSettings.this, + title, featureColour.getMaxColour(), listener); } } - else + else { if (e.getSource() instanceof FeatureTypeSettings) { @@ -510,13 +468,13 @@ public class FeatureSettings extends JPanel FeatureColourI fci = fr.getFeatureColours().get(type); table.setValueAt(fci, rowSelected, COLOUR_COLUMN); // BH 2018 setting a table value does not invalidate it. -// System.out.println("FeatureSettings is valied" + table.isValid()); -// table.validate(); + // System.out.println("FeatureSettings is valied" + + // table.validate(); } } } }); - + men.addSeparator(); JMenuItem scr = new JMenuItem( @@ -747,7 +705,7 @@ public class FeatureSettings extends JPanel data[dataIndex][FILTER_COLUMN] = featureFilter == null ? new FeatureMatcherSet() : featureFilter; - data[dataIndex][SHOW_COLUMN] = new Boolean( + data[dataIndex][SHOW_COLUMN] = Boolean.valueOf( af.getViewport().getFeaturesDisplayed().isVisible(type)); dataIndex++; displayableTypes.remove(type); @@ -774,7 +732,7 @@ public class FeatureSettings extends JPanel data[dataIndex][FILTER_COLUMN] = featureFilter == null ? new FeatureMatcherSet() : featureFilter; - data[dataIndex][SHOW_COLUMN] = new Boolean(true); + data[dataIndex][SHOW_COLUMN] = Boolean.valueOf(true); dataIndex++; displayableTypes.remove(type); } @@ -805,8 +763,8 @@ public class FeatureSettings extends JPanel } /** - * Updates 'originalData' (used for restore on Cancel) if we detect that changes - * have been made outwith this dialog + * Updates 'originalData' (used for restore on Cancel) if we detect that + * changes have been made outwith this dialog *