/*
* only update default type and group if we used defaults
*/
- String enteredType = name.getText().trim();
+ final String enteredType = name.getText().trim();
+ final String enteredGroup = group.getText().trim();
+ final String enteredDesc = description.getText().replace('\n', ' ');
+
if (dialog.accept && useLastDefaults)
{
lastFeatureAdded = enteredType;
- lastFeatureGroupAdded = group.getText().trim();
+ lastFeatureGroupAdded = enteredGroup;
}
if (!create)
SequenceFeature sf = features[featureIndex];
if (dialog.accept)
{
- sf.type = enteredType;
- sf.featureGroup = group.getText().trim();
- if (sf.featureGroup != null && sf.featureGroup.length() < 1)
- {
- sf.featureGroup = null;
- }
- sf.description = description.getText().replace('\n', ' ');
if (!colourPanel.isGcol)
{
// update colour - otherwise its already done.
setColour(sf.type, new FeatureColour(colourPanel.getBackground()));
}
+ int newBegin = sf.begin;
+ int newEnd = sf.end;
try
{
- sf.begin = Integer.parseInt(start.getText());
- sf.end = Integer.parseInt(end.getText());
+ newBegin = Integer.parseInt(start.getText());
+ newEnd = Integer.parseInt(end.getText());
} catch (NumberFormatException ex)
{
- //
+ //
}
+
+ /*
+ * replace the feature by deleting it and adding a new one
+ * (to ensure integrity of SequenceFeatures data store)
+ */
+ sequences[0].deleteFeature(sf);
+ SequenceFeature newSf = new SequenceFeature(sf, newBegin, newEnd,
+ enteredGroup);
+ newSf.setDescription(enteredDesc);
+ ffile.parseDescriptionHTML(newSf, false);
+ // amend features dialog only updates one sequence at a time
+ sequences[0].addSequenceFeature(newSf);
boolean typeOrGroupChanged = (!featureType.equals(sf.type) || !featureGroup
.equals(sf.featureGroup));
{
for (int i = 0; i < sequences.length; i++)
{
- features[i].type = enteredType;
- features[i].featureGroup = group.getText().trim();
- features[i].description = description.getText()
- .replace('\n', ' ');
- sequences[i].addSequenceFeature(features[i]);
- ffile.parseDescriptionHTML(features[i], false);
+ SequenceFeature sf = features[i];
+ SequenceFeature sf2 = new SequenceFeature(enteredType,
+ enteredDesc, sf.getBegin(), sf.getEnd(), Float.NaN,
+ enteredGroup);
+ ffile.parseDescriptionHTML(sf2, false);
+ sequences[i].addSequenceFeature(sf2);
}
Color newColour = colourPanel.getBackground();
import java.awt.event.MouseEvent;
import java.util.Arrays;
import java.util.Comparator;
-import java.util.HashMap;
import java.util.List;
import javax.swing.JColorChooser;
* (to ensure integrity of SequenceFeatures data store)
*/
sequences.get(0).deleteFeature(sf);
- SequenceFeature newSf = new SequenceFeature(enteredType,
- enteredDescription, newBegin, newEnd, sf.getScore(),
+ SequenceFeature newSf = new SequenceFeature(sf, newBegin, newEnd,
enteredGroup);
- // ensure any additional properties are copied
- if (sf.otherDetails != null)
- {
- newSf.otherDetails = new HashMap<String, Object>(sf.otherDetails);
- }
+ sf.setDescription(enteredDescription);
ffile.parseDescriptionHTML(newSf, false);
- // add any additional links not parsed from description
- if (sf.links != null)
- {
- for (String link : sf.links)
- {
- newSf.addLink(link);
- }
- }
- // amend features only gets one sequence to act on
+ // amend features dialog only updates one sequence at a time
sequences.get(0).addSequenceFeature(newSf);
if (refreshSettings)
SequenceFeature sf2 = new SequenceFeature(enteredType,
enteredDescription, sf.getBegin(), sf.getEnd(),
Float.NaN, enteredGroup);
- sequences.get(i).addSequenceFeature(sf2);
ffile.parseDescriptionHTML(sf2, false);
+ sequences.get(i).addSequenceFeature(sf2);
}
setColour(enteredType, fcol);