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)
{
table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12));
ToolTipManager.sharedInstance().registerComponent(table);
- table.setDefaultEditor(FeatureColour.class, new ColorEditor(this));
+ table.setDefaultEditor(FeatureColour.class, new ColorEditor());
table.setDefaultRenderer(FeatureColour.class, new ColorRenderer());
- table.setDefaultEditor(FeatureMatcherSet.class, new FilterEditor(this));
+ table.setDefaultEditor(FeatureMatcherSet.class, new FilterEditor());
table.setDefaultRenderer(FeatureMatcherSet.class, new FilterRenderer());
TableColumn colourColumn = new TableColumn(COLOUR_COLUMN, 75,
- new ColorRenderer(), new ColorEditor(this));
+ new ColorRenderer(), new ColorEditor());
table.addColumn(colourColumn);
TableColumn filterColumn = new TableColumn(FILTER_COLUMN, 75,
- new FilterRenderer(), new FilterEditor(this));
+ new FilterRenderer(), new FilterEditor());
table.addColumn(filterColumn);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
renderGraduatedColor(comp, gcol, w, h);
}
- class ColorEditor extends AbstractCellEditor
+ @SuppressWarnings("serial")
+class ColorEditor extends AbstractCellEditor
implements TableCellEditor, ActionListener
{
- FeatureSettings me;
+// FeatureSettings me;
FeatureColourI currentColor;
int rowSelected = 0;
- public ColorEditor(FeatureSettings fs)
+ public ColorEditor()
{
- this.me = fs;
// Set up the editor (from the table's point of view),
// which is a button.
// This button brings up the color chooser dialog,
public void colourSelected(Color c)
{
currentColor = new FeatureColour(c);
- me.table.setValueAt(currentColor, rowSelected, COLOUR_COLUMN);
+ table.setValueAt(currentColor, rowSelected, COLOUR_COLUMN);
fireEditingStopped();
}
@Override
/*
* variable colour and filters dialog
*/
- chooser = new FeatureTypeSettings(me.fr, type);
+ chooser = new FeatureTypeSettings(fr, type);
if (!Jalview.isJS())
{
chooser.setRequestFocusEnabled(true);
* update table data without triggering updateFeatureRenderer
*/
currentColor = fr.getFeatureColours().get(type);
- FeatureMatcherSetI currentFilter = me.fr.getFeatureFilter(type);
+ FeatureMatcherSetI currentFilter = fr.getFeatureFilter(type);
if (currentFilter == null)
{
currentFilter = new FeatureMatcherSet();
.getData()[rowSelected];
data[COLOUR_COLUMN] = currentColor;
data[FILTER_COLUMN] = currentFilter;
-
fireEditingStopped();
- me.table.validate();
+ // 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
+ table.validate();
+ table.repaint();
}
}
{
currentColor = (FeatureColourI) value;
this.rowSelected = row;
- type = me.table.getValueAt(row, TYPE_COLUMN).toString();
+ type = table.getValueAt(row, TYPE_COLUMN).toString();
button.setOpaque(true);
- button.setBackground(me.getBackground());
+ button.setBackground(getBackground());
if (!currentColor.isSimpleColour())
{
JLabel btn = new JLabel();
* as display text). On click in the cell, opens the Feature Display Settings
* dialog at the Filters tab.
*/
- class FilterEditor extends AbstractCellEditor
+ @SuppressWarnings("serial")
+class FilterEditor extends AbstractCellEditor
implements TableCellEditor, ActionListener
{
- FeatureSettings me;
FeatureMatcherSetI currentFilter;
int rowSelected = 0;
- public FilterEditor(FeatureSettings me)
+ public FilterEditor()
{
- this.me = me;
button = new JButton();
button.setActionCommand(EDIT);
button.addActionListener(this);
{
if (button == e.getSource())
{
- FeatureTypeSettings chooser = new FeatureTypeSettings(me.fr, type);
+ FeatureTypeSettings chooser = new FeatureTypeSettings(fr, type);
chooser.addActionListener(this);
chooser.setRequestFocusEnabled(true);
chooser.requestFocus();
* update table data without triggering updateFeatureRenderer
*/
FeatureColourI currentColor = fr.getFeatureColours().get(type);
- currentFilter = me.fr.getFeatureFilter(type);
+ currentFilter = fr.getFeatureFilter(type);
if (currentFilter == null)
{
currentFilter = new FeatureMatcherSet();
}
+
Object[] data = ((FeatureTableModel) table.getModel())
.getData()[rowSelected];
data[COLOUR_COLUMN] = currentColor;
data[FILTER_COLUMN] = currentFilter;
fireEditingStopped();
- me.table.validate();
+ // 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
+ table.validate();
+ table.repaint();
}
}
{
currentFilter = (FeatureMatcherSetI) value;
this.rowSelected = row;
- type = me.table.getValueAt(row, TYPE_COLUMN).toString();
+ type = table.getValueAt(row, TYPE_COLUMN).toString();
button.setOpaque(true);
- button.setBackground(me.getBackground());
+ button.setBackground(getBackground());
button.setText(currentFilter.toString());
button.setIcon(null);
return button;