-
- featureIndex = 0;
-
- final JPanel bigPanel = new JPanel(new BorderLayout());
- final JComboBox overlaps;
- final JTextField name = new JTextField(25);
- final JTextField source = new JTextField(25);
- final JTextArea description = new JTextArea(3, 25);
- final JSpinner start = new JSpinner();
- final JSpinner end = new JSpinner();
- start.setPreferredSize(new Dimension(80, 20));
- end.setPreferredSize(new Dimension(80, 20));
- final FeatureRenderer me = this;
- final JLabel colour = new JLabel();
- colour.setOpaque(true);
- // colour.setBorder(BorderFactory.createEtchedBorder());
- colour.setMaximumSize(new Dimension(30, 16));
- colour.addMouseListener(new MouseAdapter()
- {
- FeatureColourChooser fcc = null;
-
- @Override
- public void mousePressed(MouseEvent evt)
- {
- if (fcol instanceof Color)
- {
- Color col = JColorChooser.showDialog(Desktop.desktop,
- MessageManager.getString("label.select_feature_colour"),
- ((Color) fcol));
- if (col != null)
- {
- fcol = col;
- updateColourButton(bigPanel, colour, col);
- }
- }
- else
- {
-
- if (fcc == null)
- {
- final String type = features[featureIndex].getType();
- fcc = new FeatureColourChooser(me, type);
- fcc.setRequestFocusEnabled(true);
- fcc.requestFocus();
-
- fcc.addActionListener(new ActionListener()
- {
-
- @Override
- public void actionPerformed(ActionEvent e)
- {
- fcol = fcc.getLastColour();
- fcc = null;
- setColour(type, fcol);
- updateColourButton(bigPanel, colour, fcol);
- }
- });
-
- }
- }
- }
- });
- JPanel tmp = new JPanel();
- JPanel panel = new JPanel(new GridLayout(3, 1));
-
- // /////////////////////////////////////
- // /MULTIPLE FEATURES AT SELECTED RESIDUE
- if (!newFeatures && features.length > 1)
- {
- panel = new JPanel(new GridLayout(4, 1));
- tmp = new JPanel();
- tmp.add(new JLabel(MessageManager.getString("label.select_feature")));
- overlaps = new JComboBox();
- for (int i = 0; i < features.length; i++)
- {
- overlaps.addItem(features[i].getType() + "/"
- + features[i].getBegin() + "-" + features[i].getEnd()
- + " (" + features[i].getFeatureGroup() + ")");
- }
-
- tmp.add(overlaps);
-
- overlaps.addItemListener(new ItemListener()
- {
- @Override
- public void itemStateChanged(ItemEvent e)
- {
- int index = overlaps.getSelectedIndex();
- if (index != -1)
- {
- featureIndex = index;
- name.setText(features[index].getType());
- description.setText(features[index].getDescription());
- source.setText(features[index].getFeatureGroup());
- start.setValue(new Integer(features[index].getBegin()));
- end.setValue(new Integer(features[index].getEnd()));
-
- SearchResults highlight = new SearchResults();
- highlight.addResult(sequences[0], features[index].getBegin(),
- features[index].getEnd());
-
- ap.getSeqPanel().seqCanvas.highlightSearchResults(highlight);
-
- }
- Object col = getFeatureStyle(name.getText());
- if (col == null)
- {
- col = new jalview.schemes.UserColourScheme()
- .createColourFromName(name.getText());
- }
- oldcol = fcol = col;
- updateColourButton(bigPanel, colour, col);
- }
- });
-
- panel.add(tmp);
- }
- // ////////
- // ////////////////////////////////////
-
- tmp = new JPanel();
- panel.add(tmp);
- tmp.add(new JLabel(MessageManager.getString("label.name"), JLabel.RIGHT));
- tmp.add(name);
-
- tmp = new JPanel();
- panel.add(tmp);
- tmp.add(new JLabel(MessageManager.getString("label.group") + ":",
- JLabel.RIGHT));
- tmp.add(source);
-
- tmp = new JPanel();
- panel.add(tmp);
- tmp.add(new JLabel(MessageManager.getString("label.colour"),
- JLabel.RIGHT));
- tmp.add(colour);
- colour.setPreferredSize(new Dimension(150, 15));
- colour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 9));
- colour.setForeground(Color.black);
- colour.setHorizontalAlignment(SwingConstants.CENTER);
- colour.setVerticalAlignment(SwingConstants.CENTER);
- colour.setHorizontalTextPosition(SwingConstants.CENTER);
- colour.setVerticalTextPosition(SwingConstants.CENTER);
- bigPanel.add(panel, BorderLayout.NORTH);
-
- panel = new JPanel();
- panel.add(new JLabel(MessageManager.getString("label.description"),
- JLabel.RIGHT));
- description.setFont(JvSwingUtils.getTextAreaFont());
- description.setLineWrap(true);
- panel.add(new JScrollPane(description));
-
- if (!newFeatures)
- {
- bigPanel.add(panel, BorderLayout.SOUTH);
-
- panel = new JPanel();
- panel.add(new JLabel(MessageManager.getString("label.start"),
- JLabel.RIGHT));
- panel.add(start);
- panel.add(new JLabel(MessageManager.getString("label.end"),
- JLabel.RIGHT));
- panel.add(end);
- bigPanel.add(panel, BorderLayout.CENTER);
- }
- else
- {
- bigPanel.add(panel, BorderLayout.CENTER);
- }
-
- if (lastFeatureAdded == null)
- {
- if (features[0].type != null)
- {
- lastFeatureAdded = features[0].type;
- }
- else
- {
- lastFeatureAdded = "feature_1";
- }
- }
-
- if (lastFeatureGroupAdded == null)