Skip to content
Snippets Groups Projects
Commit ec2cb8d6 authored by tcarver's avatar tcarver
Browse files

changed for GFF properties panel

parent 68cb311d
No related branches found
No related tags found
No related merge requests found
......@@ -1228,8 +1228,10 @@ public class ChadoTransactionManager
{
if(synonym_tags == null)
{
if(GeneUtils.isDatabaseEntry(feature))
synonym_tags = DatabaseDocument.getSynonymTypeNames(
SYNONYM_TAG_CVNAME, feature);
if(synonym_tags == null || synonym_tags.length < 1)
{
logger4j.debug("Using default synonym names");
......@@ -1250,6 +1252,12 @@ public class ChadoTransactionManager
return false;
}
public static String[] getSynonymTags()
{
return synonym_tags;
}
/**
* Compare the old and new keys and qualifiers and find the qualifiers
* that have changed or been added and UPDATE, INSERT or DELETE accordingly.
......
......@@ -76,7 +76,6 @@ import java.util.Comparator;
import javax.swing.*;
/**
* FeatureEdit class
*
......@@ -860,7 +859,6 @@ public class FeatureEdit extends JPanel
}
});
final JCheckBox oneView = new JCheckBox("Overview", false);
oneView.addItemListener(new ItemListener()
{
......@@ -887,6 +885,12 @@ public class FeatureEdit extends JPanel
fillerBox.add(Box.createHorizontalStrut(
tabbedView.getPreferredSize().width ));
}
else if(getFeature().getEmblFeature() instanceof GFFStreamFeature)
{
propertiesPanel = new PropertiesPanel(getFeature());
addGffAnnotationView(lower_panel);
}
else
lower_panel.add(new JScrollPane(qualifier_text_area), "Center");
......@@ -1438,7 +1442,7 @@ public class FeatureEdit extends JPanel
qualifier_text_area.setText(getQualifierString());
if(GeneUtils.isDatabaseEntry(getFeature().getEmblFeature()))
if(getFeature().getEmblFeature() instanceof GFFStreamFeature)
{
// load synonym
if(cvForm != null)
......@@ -1542,8 +1546,6 @@ public class FeatureEdit extends JPanel
qualifiers =
qualifier_text_area.getParsedQualifiers(getEntryInformation ());
updateGffIds(qualifiers);
// if using controlled vocab form
if(cvForm != null)
{
......@@ -1569,6 +1571,7 @@ public class FeatureEdit extends JPanel
if(mapQualifiers != null && mapQualifiers.size() > 0)
qualifiers.addAll(mapQualifiers);
}
updateGffIds(qualifiers);
if(matchForm != null)
{
......@@ -1704,7 +1707,7 @@ public class FeatureEdit extends JPanel
}
}
}
catch(Exception e){ }
catch(Exception e){ e.printStackTrace(); }
}
}
}
......
......@@ -40,7 +40,6 @@ import uk.ac.sanger.artemis.components.genebuilder.cv.CVPanel;
import uk.ac.sanger.artemis.components.genebuilder.gff.PropertiesPanel;
import uk.ac.sanger.artemis.components.genebuilder.ortholog.MatchPanel;
/**
* Panel for display controlled vocabulary terms for Chado
*/
......@@ -92,23 +91,33 @@ public class GeneEditorPanel extends JPanel
coreButton = addOpenClosePanel("Core",qualifier_text_area, this, null);
add(qualifier_text_area);
if(refPanel != null)
{
addDarkSeparator(this);
refButton = addOpenClosePanel("References",refPanel, this, null);
add(refPanel);
}
if(cvForm != null)
{
addDarkSeparator(this);
cvButton = addOpenClosePanel("Controlled Vocabulary", cvForm, this,
CVPanel.getDescription());
add(cvForm);
}
if(matchForm != null)
{
addDarkSeparator(this);
matchButton = addOpenClosePanel("Match", matchForm, this,
MatchPanel.getDescription());
add(matchForm);
}
add(Box.createVerticalGlue());
}
/**
* Open/close the sections if they contain elements or
* are empty.
......@@ -116,8 +125,11 @@ public class GeneEditorPanel extends JPanel
public void updatePanelState()
{
coreButton.setOpen(!qualifier_text_area.getText().equals(""));
if(cvForm != null)
cvButton.setOpen(!cvForm.isEmpty());
if(refPanel != null)
refButton.setOpen(!refPanel.isEmpty());
if(matchForm != null)
matchButton.setOpen(!matchForm.isEmpty());
propertiesButton.setOpen(!propertiesPanel.isEmpty());
}
......
......@@ -34,7 +34,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Iterator;
import java.util.Set;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.Box;
......@@ -185,6 +184,8 @@ public class PropertiesPanel extends JPanel
Qualifier idQualifier = gffQualifiers.getQualifierByName("ID");
Qualifier nameQualifier = gffQualifiers.getQualifierByName("Name");
if(idQualifier == null)
return;
final String uniquename = idQualifier.getValues().get(0);
uniquenameTextField = new JTextField(uniquename);
uniquenameTextField.setPreferredSize(calcPreferredMaxTextFieldWidth());
......@@ -780,9 +781,13 @@ public class PropertiesPanel extends JPanel
private void addSynonym()
{
final Vector<CvTerm> synonyms = DatabaseDocument.getCvterms("",
ChadoTransactionManager.SYNONYM_TAG_CVNAME, false);
final JExtendedComboBox list = new JExtendedComboBox(synonyms);
final JExtendedComboBox list;
if(GeneUtils.isDatabaseEntry(feature.getEmblFeature()))
list = new JExtendedComboBox(DatabaseDocument.getCvterms("",
ChadoTransactionManager.SYNONYM_TAG_CVNAME, false));
else
list = new JExtendedComboBox(ChadoTransactionManager.getSynonymTags());
final String options[] = { "CANCEL", "NEXT>"};
int select = JOptionPane.showOptionDialog(null, list,
......@@ -790,12 +795,15 @@ public class PropertiesPanel extends JPanel
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, options, options[1]);
if(select == 0)
return;
Box xBox = Box.createHorizontalBox();
final String synonymName = ((CvTerm)list.getSelectedItem()).getName();
final String synonymName;
if(list.getSelectedItem() instanceof CvTerm)
synonymName = ((CvTerm)list.getSelectedItem()).getName();
else
synonymName = (String) list.getSelectedItem();
final JLabel name = new JLabel( synonymName );
xBox.add(name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment