javax.swing.event.InternalFrameEvent evt)
{
fr.removePropertyChangeListener(change);
- };
+ }
});
frame.setLayer(JLayeredPane.PALETTE_LAYER);
inConstruction = false;
}
- public void updateFeatureRenderer(Object[][] data)
+ /**
+ * Update the priority order of features; only repaint if this changed the
+ * order of visible features. Any newly discovered feature types are set to
+ * visible. Returns true if repaint was requested, false if not.
+ *
+ * @param data
+ * @return
+ */
+ public boolean updateFeatureRenderer(Object[][] data)
{
- updateFeatureRenderer(data, true);
+ return updateFeatureRenderer(data, true);
}
/**
* Update the priority order of features; only repaint if this changed the
- * order of visible features
+ * order of visible features. Returns true if repaint was requested, false if
+ * not.
*
* @param data
* @param visibleNew
+ * @return
*/
- void updateFeatureRenderer(Object[][] data, boolean visibleNew)
+ boolean updateFeatureRenderer(Object[][] data, boolean visibleNew)
{
FeatureSettingsBean[] rowData = getTableAsBeans(data);
if (fr.setFeaturePriority(rowData, visibleNew))
{
af.alignPanel.paintAlignment(true, true);
+ return true;
}
+ return false;
}
/**
@Override
public void actionPerformed(ActionEvent e)
{
- fr.setTransparency(originalTransparency);
- fr.setFeatureFilters(originalFilters);
- updateFeatureRenderer(originalData);
- close();
+ cancel();
}
});
}
/**
+ * On Cancel, restore settings as they were when the dialog was opened (or
+ * possibly with any new features added while the dialog was open)
+ */
+ void cancel()
+ {
+ fr.setTransparency(originalTransparency);
+ fr.setFeatureFilters(originalFilters);
+ boolean repainted = updateFeatureRenderer(originalData);
+
+ /*
+ * ensure alignment (and Overview if visible) are redrawn
+ */
+ if (!repainted)
+ {
+ af.alignPanel.paintAlignment(true, true);
+ }
+
+ close();
+ }
+
+ /**
* Answers a suitable tooltip to show on the colour cell of the table
*
* @param fcol