+ protected void popupSort(final MyCheckbox check, final Hashtable minmax,
+ int x, int y)
+ {
+ final String type = check.type;
+ final Object typeCol = fr.getFeatureStyle(type);
+ java.awt.PopupMenu men = new PopupMenu("Settings for " + type);
+ java.awt.MenuItem scr = new MenuItem("Sort by Score");
+ men.add(scr);
+ final FeatureSettings me = this;
+ scr.addActionListener(new ActionListener()
+ {
+
+ public void actionPerformed(ActionEvent e)
+ {
+ me.sortByScore(new String[]
+ { type });
+ }
+
+ });
+ MenuItem dens = new MenuItem("Sort by Density");
+ dens.addActionListener(new ActionListener()
+ {
+
+ public void actionPerformed(ActionEvent e)
+ {
+ me.sortByDens(new String[]
+ { type });
+ }
+
+ });
+ men.add(dens);
+ if (minmax != null)
+ {
+ final Object typeMinMax = minmax.get(type);
+ /*
+ * final java.awt.CheckboxMenuItem chb = new
+ * java.awt.CheckboxMenuItem("Vary Height"); // this is broken at the
+ * moment chb.setState(minmax.get(type) != null);
+ * chb.addActionListener(new ActionListener() {
+ *
+ * public void actionPerformed(ActionEvent e) {
+ * chb.setState(chb.getState()); if (chb.getState()) { minmax.put(type,
+ * null); } else { minmax.put(type, typeMinMax); } }
+ *
+ * }); men.add(chb);
+ */
+ if (typeMinMax != null && ((float[][]) typeMinMax)[0] != null)
+ {
+ // graduated colourschemes for those where minmax exists for the
+ // positional features
+ MenuItem mxcol = new MenuItem(
+ (typeCol instanceof Color) ? "Graduated Colour"
+ : "Single Colour");
+ men.add(mxcol);
+ mxcol.addActionListener(new ActionListener()
+ {
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (typeCol instanceof Color)
+ {
+ new FeatureColourChooser(me, type);
+ // write back the current colour object to update the table
+ check.updateColor(fr.getFeatureStyle(type));
+ }
+ else
+ {
+ new UserDefinedColours(me, check.type,
+ ((GraduatedColor) typeCol));
+ }
+ }
+
+ });
+ }
+ }
+ this.featurePanel.add(men);
+ men.show(this.featurePanel, x, y);
+ }
+