X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FFeatureSettings.java;h=f81ecce0e7a85853f21a51aea64cc4d977fff019;hb=b1613533d44e86c95bb2ae1e1428330b314df1f6;hp=0cd86202fb563a9d58f692bf69f3e990508f84a5;hpb=d9f0a24d9662a0b530fd79b51108dd074d03d6e0;p=jalview.git
diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java
index 0cd8620..f81ecce 100644
--- a/src/jalview/gui/FeatureSettings.java
+++ b/src/jalview/gui/FeatureSettings.java
@@ -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;
@@ -231,10 +232,9 @@ public class FeatureSettings extends JPanel
default:
break;
}
-
+
return tip;
}
-
/**
* Position the tooltip near the bottom edge of, and half way across, the
@@ -261,7 +261,7 @@ public class FeatureSettings extends JPanel
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);
@@ -385,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)
{
@@ -409,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
@@ -421,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())
{
/*
@@ -436,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
@@ -450,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)
{
@@ -465,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(
@@ -760,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
*
* - a new feature type added (and made visible)
* - a feature colour changed (in the Amend Features dialog)
@@ -825,8 +828,8 @@ public class FeatureSettings extends JPanel
/**
* Remove from the groups panel any checkboxes for groups that are not in the
- * foundGroups set. This enables removing a group from the display when the last
- * feature in that group is deleted.
+ * foundGroups set. This enables removing a group from the display when the
+ * last feature in that group is deleted.
*
* @param foundGroups
*/
@@ -883,13 +886,13 @@ public class FeatureSettings extends JPanel
chooser.setToolTipText(MessageManager.getString("action.load"));
chooser.setResponseHandler(0, new Runnable()
{
- @Override
- public void run()
- {
- File file = chooser.getSelectedFile();
- load(file);
- }
- });
+ @Override
+ public void run()
+ {
+ File file = chooser.getSelectedFile();
+ load(file);
+ }
+ });
chooser.showOpenDialog(this);
}
@@ -950,8 +953,7 @@ public class FeatureSettings extends JPanel
if (table != null)
{
resetTable(null);
- Object[][] data = ((FeatureTableModel) table.getModel())
- .getData();
+ Object[][] data = ((FeatureTableModel) table.getModel()).getData();
ensureOrder(data);
updateFeatureRenderer(data, false);
table.repaint();
@@ -975,11 +977,11 @@ public class FeatureSettings extends JPanel
MessageManager.getString("label.save_feature_colours"));
chooser.setToolTipText(MessageManager.getString("action.save"));
int option = chooser.showSaveDialog(this);
- if (option == JalviewFileChooser.APPROVE_OPTION)
- {
- File file = chooser.getSelectedFile();
- save(file);
- }
+ if (option == JalviewFileChooser.APPROVE_OPTION)
+ {
+ File file = chooser.getSelectedFile();
+ save(file);
+ }
}
/**
@@ -993,8 +995,8 @@ public class FeatureSettings extends JPanel
ucs.setSchemeName("Sequence Features");
try
{
- PrintWriter out = new PrintWriter(new OutputStreamWriter(
- new FileOutputStream(file), "UTF-8"));
+ PrintWriter out = new PrintWriter(
+ new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
/*
* sort feature types by colour order, from 0 (highest)
@@ -1031,11 +1033,11 @@ public class FeatureSettings extends JPanel
FeatureMatcherSetI filter = fr.getFeatureFilter(featureType);
if (filter != null && !filter.isEmpty())
{
- Iterator iterator = filter.getMatchers().iterator();
+ Iterator iterator = filter.getMatchers()
+ .iterator();
FeatureMatcherI firstMatcher = iterator.next();
jalview.xml.binding.jalview.FeatureMatcherSet ms = jalview.project.Jalview2XML
- .marshalFilter(firstMatcher, iterator,
- filter.isAnded());
+ .marshalFilter(firstMatcher, iterator, filter.isAnded());
Filter filterModel = new Filter();
filterModel.setFeatureType(featureType);
filterModel.setMatcherSet(ms);
@@ -1117,7 +1119,8 @@ public class FeatureSettings extends JPanel
else
{
width[i] /= max; // normalize
- fr.setOrder(data[i][TYPE_COLUMN].toString(), width[i]); // store for later
+ fr.setOrder(data[i][TYPE_COLUMN].toString(), width[i]); // store for
+ // later
}
if (i > 0)
{
@@ -1151,8 +1154,8 @@ public class FeatureSettings extends JPanel
}
/**
- * Update the priority order of features; only repaint if this changed the order
- * of visible features
+ * Update the priority order of features; only repaint if this changed the
+ * order of visible features
*
* @param data
* @param visibleNew
@@ -1389,7 +1392,7 @@ public class FeatureSettings extends JPanel
{
boolean thr = false;
StringBuilder tx = new StringBuilder();
-
+
if (gcol.isColourByAttribute())
{
tx.append(FeatureMatcher
@@ -1647,7 +1650,7 @@ public class FeatureSettings extends JPanel
}
@SuppressWarnings("serial")
-class ColorEditor extends AbstractCellEditor
+ class ColorEditor extends AbstractCellEditor
implements TableCellEditor, ActionListener
{
FeatureColourI currentColor;
@@ -1688,8 +1691,9 @@ class ColorEditor extends AbstractCellEditor
/*
* simple colour chooser
*/
- String ttl = MessageManager.formatMessage("label.select_colour_for", type);
- ColourChooserListener listener = new ColourChooserListener()
+ String ttl = MessageManager
+ .formatMessage("label.select_colour_for", type);
+ ColourChooserListener listener = new ColourChooserListener()
{
@Override
public void colourSelected(Color c)
@@ -1698,13 +1702,15 @@ class ColorEditor extends AbstractCellEditor
table.setValueAt(currentColor, rowSelected, COLOUR_COLUMN);
fireEditingStopped();
}
- @Override
- public void cancel()
- {
- fireEditingStopped();
- }
+
+ @Override
+ public void cancel()
+ {
+ fireEditingStopped();
+ }
};
- JalviewColourChooser.showColourChooser(button, ttl, currentColor.getColour(), listener);
+ JalviewColourChooser.showColourChooser(button, ttl,
+ currentColor.getColour(), listener);
}
else
{
@@ -1716,7 +1722,7 @@ class ColorEditor extends AbstractCellEditor
/**
* Java only
*
- * @j2sNative
+ * @j2sIgnore
*/
{
chooser.setRequestFocusEnabled(true);
@@ -1744,7 +1750,7 @@ class ColorEditor extends AbstractCellEditor
data[COLOUR_COLUMN] = currentColor;
data[FILTER_COLUMN] = currentFilter;
fireEditingStopped();
- // SwingJS needs an explicit repaint() here,
+ // SwingJS needs an explicit repaint() here,
// rather than relying upon no validation having
// occurred since the stopEditing call was made.
// Its laying out has not been stopped by the modal frame
@@ -1754,15 +1760,15 @@ class ColorEditor extends AbstractCellEditor
}
/**
- * Override allows access to this method from anonymous inner classes
+ * Override allows access to this method from anonymous inner classes
*/
@Override
- protected void fireEditingStopped()
+ protected void fireEditingStopped()
{
- super.fireEditingStopped();
- }
+ super.fireEditingStopped();
+ }
- // Implement the one CellEditor method that AbstractCellEditor doesn't.
+ // Implement the one CellEditor method that AbstractCellEditor doesn't.
@Override
public Object getCellEditorValue()
{
@@ -1771,8 +1777,8 @@ class ColorEditor extends AbstractCellEditor
// Implement the one method defined by TableCellEditor.
@Override
- public Component getTableCellEditorComponent(JTable theTable, Object value,
- boolean isSelected, int row, int column)
+ public Component getTableCellEditorComponent(JTable theTable,
+ Object value, boolean isSelected, int row, int column)
{
currentColor = (FeatureColourI) value;
this.rowSelected = row;
@@ -1800,12 +1806,12 @@ class ColorEditor extends AbstractCellEditor
/**
* The cell editor for the Filter column. It displays the text of any filters
- * for the feature type in that row (in full as a tooltip, possible abbreviated
- * as display text). On click in the cell, opens the Feature Display Settings
- * dialog at the Filters tab.
+ * for the feature type in that row (in full as a tooltip, possible
+ * abbreviated as display text). On click in the cell, opens the Feature
+ * Display Settings dialog at the Filters tab.
*/
@SuppressWarnings("serial")
-class FilterEditor extends AbstractCellEditor
+ class FilterEditor extends AbstractCellEditor
implements TableCellEditor, ActionListener
{
@@ -1864,13 +1870,13 @@ class FilterEditor extends AbstractCellEditor
{
currentFilter = new FeatureMatcherSet();
}
-
+
Object[] data = ((FeatureTableModel) table.getModel())
.getData()[rowSelected];
data[COLOUR_COLUMN] = currentColor;
data[FILTER_COLUMN] = currentFilter;
fireEditingStopped();
- // SwingJS needs an explicit repaint() here,
+ // SwingJS needs an explicit repaint() here,
// rather than relying upon no validation having
// occurred since the stopEditing call was made.
// Its laying out has not been stopped by the modal frame
@@ -1886,8 +1892,8 @@ class FilterEditor extends AbstractCellEditor
}
@Override
- public Component getTableCellEditorComponent(JTable theTable, Object value,
- boolean isSelected, int row, int column)
+ public Component getTableCellEditorComponent(JTable theTable,
+ Object value, boolean isSelected, int row, int column)
{
currentFilter = (FeatureMatcherSetI) value;
this.rowSelected = row;
@@ -1978,7 +1984,7 @@ class FeatureIcon implements Icon
g.fillRect(s1, 0, e1 - s1, height);
}
g.setColor(gcol.getMaxColour());
-// g.fillRect(0, e1, width - e1, height); // BH 2018
+ // g.fillRect(0, e1, width - e1, height); // BH 2018
g.fillRect(e1, 0, width - e1, height);
}
}