section=Box.createVerticalBox();
section.setBorder(BorderFactory.createTitledBorder(resources.getString("Series")));
Box box = Box.createHorizontalBox();
box.add(pcbxcurves = new JComboBox());
box.add(pcurvecolor = new JButton(" "));
box.add(pcurvedelete = new JButton(resources.getString("Delete")));
section.add(box);
box = Box.createHorizontalBox();
box.add(new JLabel(resources.getString("Orientation")));
box.add(Box.createHorizontalGlue());
box.add(hSeriesOrientation = new JRadioButton(resources.getString("Horizontal")));
box.add(vSeriesOrientation = new JRadioButton(resources.getString("Vertical")));
hSeriesOrientation.setSelected(plot.getOrientation() == PlotOrientation.HORIZONTAL);
vSeriesOrientation.setSelected(plot.getOrientation() == PlotOrientation.VERTICAL);
ButtonGroup bg = new ButtonGroup();
bg.add(hSeriesOrientation);
bg.add(vSeriesOrientation);
section.add(box);
content.add(section);
pcbxcurves.setEditable(true);
Color noCurveColor = pcurvecolor.getBackground();
pcurvecolor.setFocusPainted(false);
CategoryItemRenderer renderer = plot.getRenderer();
int n = dst.getRowCount();
for (int i=0; i<n; ++i) {
DataSource ds = (DataSource)mapperSources.get(i);
if (ds==null) ds = dst.getSource(i); // take the datasource associated with this series by default
pcbxcurves.addItem(new CbxEntry(i,dst.getName(i),(Color)renderer.getSeriesPaint(i),ds,(ColorMapper)mappers.get(i)));
}
pcbxeditortf = (JTextField)pcbxcurves.getEditor().getEditorComponent();
pupdateForEntry(pcbxcurves.getSelectedItem());
pcbxcurves.addPopupMenuListener(new PopupMenuListener() {
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
peditLocked = true;
}
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
peditLocked = false;
}
public void popupMenuCanceled(PopupMenuEvent e) {
peditLocked = false;
}
});
pcbxcurves.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange()==ItemEvent.DESELECTED) pactiveEntry = null;
else pupdateForEntry(e.getItem());
}
});
pcbxeditortf.getDocument().addDocumentListener(new DocumentListener() {
public void insertUpdate(DocumentEvent e) {
updateName();
}
public void removeUpdate(DocumentEvent e) {
updateName();
}
public void changedUpdate(DocumentEvent e) {
updateName();
}
public void updateName() {
if ((peditLocked) || (pactiveEntry == null)) return;
pactiveEntry.name = pcbxeditortf.getText();
}
});
pcurvecolor.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (pactiveEntry==null) return;
DynamicColorChooser dialog = new DynamicColorChooser(
null, resources.getString("ChooseAColor"),null ,pactiveEntry.color,pactiveEntry.source,pactiveEntry.mapper);
dialog.pack();
dialog.setVisible(true);
if (dialog.isOk()){
pactiveEntry.color = dialog.getColor();
pactiveEntry.source = dialog.getSource();
pactiveEntry.mapper = dialog.getMapper();
pupdateForEntry(pactiveEntry);
}
}
});
pcurvedelete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (pactiveEntry==null) return;
pcbxcurves.removeItem(pactiveEntry);
}
});
section=Box.createVerticalBox();
section.setBorder(BorderFactory.createTitledBorder(resources.getString("Categories")));
box = Box.createHorizontalBox();
box.add(new JLabel(resources.getString("LabelsOrientation")));
box.add(Box.createHorizontalGlue());
box.add(hLabelOrientation = new JRadioButton(resources.getString("Horizontal")));
box.add(vLabelOrientation = new JRadioButton(resources.getString("Vertical")));
CategoryLabelPosition clp = vSeriesOrientation.isSelected() ? plot.getDomainAxis().getCategoryLabelPositions().getLabelPosition(RectangleEdge.BOTTOM) : plot.getDomainAxis().getCategoryLabelPositions().getLabelPosition(RectangleEdge.LEFT);
boolean vertical = clp.getAngle() != 0;
hLabelOrientation.setSelected(!vertical);
vLabelOrientation.setSelected(vertical);
bg = new ButtonGroup();
bg.add(hLabelOrientation);
bg.add(vLabelOrientation);
section.add(box);
mapper = (dst.getClassifier()==null) ? null : dst.getClassifier().getMapper();
box = Box.createHorizontalBox();
box.add(new JLabel(resources.getString("Mapper")));
box.add(Box.createHorizontalGlue());
box.add(cbxmapper = new JComboBox());
cbxmapper.addItem(resources.getString("=======NONE======="));
int idx = 0;
if (TextMapper.textMappers!=null) for (int i =0; i<TextMapper.textMappers.size(); ++i) {
TextMapper tm = (TextMapper)TextMapper.textMappers.get(i);
if (tm.equals(mapper)) idx = i +1;