{
private static final int MAX_TOOLTIP_LENGTH = 50;
+ private static int NO_COLOUR_OPTION = 0;
+
+ private static int MIN_COLOUR_OPTION = 1;
+
+ private static int MAX_COLOUR_OPTION = 2;
+
private FeatureRenderer fr;
private FeatureColourI cs;
}
});
+ // todo move all threshold setup inside a method
float mm[] = fr.getMinMax().get(theType)[0];
min = mm[0];
max = mm[1];
}
minColour.setBackground(oldminColour = cs.getMinColour());
maxColour.setBackground(oldmaxColour = cs.getMaxColour());
+ noColour = cs.getNoColour();
+
adjusting = true;
try
/*
* set the initial state of options on screen
*/
- thresholdIsMin.setSelected(!cs.isAutoScaled());
-
if (cs.isColourByLabel())
{
if (cs.isColourByAttribute())
}
}
+ if (noColour == null)
+ {
+ noValueCombo.setSelectedIndex(NO_COLOUR_OPTION);
+ }
+ else if (noColour.equals(oldminColour))
+ {
+ noValueCombo.setSelectedIndex(MIN_COLOUR_OPTION);
+ }
+ else if (noColour.equals(oldmaxColour))
+ {
+ noValueCombo.setSelectedIndex(MAX_COLOUR_OPTION);
+ }
+
threshline = new GraphLine((max - min) / 2f, "Threshold", Color.black);
threshline.value = cs.getThreshold();
}
/**
- * Action on user choice of no / min / max colour when there is no value to
- * colour by
+ * Action on user choice of no / min / max colour to use when there is no
+ * value to colour by
*/
protected void setNoValueColour()
{
int i = noValueCombo.getSelectedIndex();
- if (i == 0)
+ if (i == NO_COLOUR_OPTION)
{
noColour = null;
}
- else if (i == 1)
+ else if (i == MIN_COLOUR_OPTION)
{
noColour = minColour.getBackground();
}
- else if (i == 2)
+ else if (i == MAX_COLOUR_OPTION)
{
noColour = maxColour.getBackground();
}
maxColour.setForeground(oldmaxColour);
minColour.setBackground(oldminColour);
minColour.setForeground(oldminColour);
+ noColour = oldNoColour;
}
/*
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
+import java.awt.LayoutManager;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
private JTextArea filtersAsText;
+ // set white normally, black to debug layout
+ private Color debugBorderColour = Color.white;
+
/**
* Constructor
*
*/
JPanel andOrPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
andOrPanel.setBackground(Color.white);
+ andOrPanel.setBorder(BorderFactory.createLineBorder(debugBorderColour));
andFilters = new JRadioButton("And");
orFilters = new JRadioButton("Or");
ActionListener actionListener = new ActionListener()
* panel with filters - populated by refreshFiltersDisplay
*/
chooseFiltersPanel = new JPanel();
- chooseFiltersPanel.setLayout(new BoxLayout(chooseFiltersPanel,
- BoxLayout.Y_AXIS));
+ LayoutManager box = new BoxLayout(chooseFiltersPanel,
+ BoxLayout.Y_AXIS);
+ chooseFiltersPanel.setLayout(box);
filtersPanel.add(chooseFiltersPanel);
/*
}
if (!found)
{
- filteredFeatureChoice // todo i18n
- .addItem("No filterable feature attributes known");
+ filteredFeatureChoice.addItem(MessageManager
+ .getString("label.no_feature_attributes"));
+ filteredFeatureChoice.setEnabled(false);
}
filteredFeatureChoice.addItemListener(listener);
-
}
/**
.getCondition();
String pattern = filter.getMatcher().getPattern();
JPanel row = addFilter(key, attNames, condition, pattern, filterIndex);
+ row.setBorder(BorderFactory.createLineBorder(debugBorderColour));
chooseFiltersPanel.add(row);
filterIndex++;
}
+ // chooseFiltersPanel.add(Box.createVerticalGlue());
filtersPane.validate();
filtersPane.repaint();
filterRow.setBackground(Color.white);
/*
- * inputs for attribute, condition, pattern
- */
- /*
* drop-down choice of attribute, with description as a tooltip
* if we can obtain it
*/
*/
if (pattern != null && pattern.trim().length() > 0)
{
- // todo: gif for - button
+ // todo: gif for button drawing '-' or 'x'
JButton removeCondition = new BasicArrowButton(SwingConstants.WEST);
removeCondition.setToolTipText(MessageManager
.getString("label.delete_row"));