From c625d77ee8d2118cf4b412178f68b5952a50a1f0 Mon Sep 17 00:00:00 2001 From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04> Date: Fri, 9 Apr 2010 10:07:32 +0000 Subject: [PATCH] use ReferencePanel form git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@13649 ee4ac58c-ac51-4696-9907-e4b3aa274f04 --- .../genebuilder/GeneBuilderFrame.java | 4 +++- .../genebuilder/GeneEditorPanel.java | 23 +++++++++++++++---- .../genebuilder/ReferencesPanel.java | 20 +++++++++++----- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/uk/ac/sanger/artemis/components/genebuilder/GeneBuilderFrame.java b/uk/ac/sanger/artemis/components/genebuilder/GeneBuilderFrame.java index a7ea0646f..847710b30 100644 --- a/uk/ac/sanger/artemis/components/genebuilder/GeneBuilderFrame.java +++ b/uk/ac/sanger/artemis/components/genebuilder/GeneBuilderFrame.java @@ -216,7 +216,9 @@ public class GeneBuilderFrame extends JFrame feature_editor = new FeatureEdit(feature, entry_group, selection, goto_event_source, this); - + feature_editor.getQualifierTextArea().getDocument().addDocumentListener( + new TextAreaDocumentListener(feature_editor.getQualifierTextArea())); + tabpane = new JTabbedPane(); tabpane.addTab("Annotation", feature_editor); setTabTitle(); diff --git a/uk/ac/sanger/artemis/components/genebuilder/GeneEditorPanel.java b/uk/ac/sanger/artemis/components/genebuilder/GeneEditorPanel.java index 1c5680fd1..9939010fb 100644 --- a/uk/ac/sanger/artemis/components/genebuilder/GeneEditorPanel.java +++ b/uk/ac/sanger/artemis/components/genebuilder/GeneEditorPanel.java @@ -57,11 +57,13 @@ public class GeneEditorPanel extends JPanel private OpenSectionButton cvButton; private OpenSectionButton matchButton; private OpenSectionButton propertiesButton; + private OpenSectionButton refButton; private QualifierTextArea qualifier_text_area; private CVPanel cvForm; private MatchPanel matchForm; private PropertiesPanel propertiesPanel; + private ReferencesPanel refPanel; /** * Gene editor panel - showing annotation in a single panel. @@ -71,7 +73,8 @@ public class GeneEditorPanel extends JPanel * @param propertiesPanel */ public GeneEditorPanel(final QualifierTextArea qualifier_text_area, - final CVPanel cvForm, + final CVPanel cvForm, + final ReferencesPanel refPanel, final MatchPanel matchForm, final PropertiesPanel propertiesPanel) { @@ -79,19 +82,24 @@ public class GeneEditorPanel extends JPanel this.cvForm = cvForm; this.matchForm = matchForm; this.propertiesPanel = propertiesPanel; + this.refPanel = refPanel; setLayout( new BoxLayout(this, BoxLayout.PAGE_AXIS) ); setBackground(Color.WHITE); - JScrollPane jspCore = new JScrollPane(qualifier_text_area); - jspCore.setPreferredSize(new Dimension(jspCore.getPreferredSize().width, 100)); + //JScrollPane jspCore = new JScrollPane(qualifier_text_area); + //jspCore.setPreferredSize(new Dimension(jspCore.getPreferredSize().width, 100)); addDarkSeparator(this); propertiesButton = addOpenClosePanel("Properties", propertiesPanel, this, null); add(propertiesPanel); addDarkSeparator(this); - coreButton = addOpenClosePanel("Core",jspCore, this, null); - add(jspCore); + coreButton = addOpenClosePanel("Core",qualifier_text_area, this, null); + add(qualifier_text_area); + + addDarkSeparator(this); + refButton = addOpenClosePanel("References",refPanel, this, null); + add(refPanel); addDarkSeparator(this); cvButton = addOpenClosePanel("Controlled Vocabulary", cvForm, this, @@ -122,6 +130,11 @@ public class GeneEditorPanel extends JPanel else cvButton.setOpen(true); + if(refPanel.isEmpty()) + refButton.setOpen(false); + else + refButton.setOpen(true); + if(matchForm.isEmpty()) matchButton.setOpen(false); else diff --git a/uk/ac/sanger/artemis/components/genebuilder/ReferencesPanel.java b/uk/ac/sanger/artemis/components/genebuilder/ReferencesPanel.java index e32b06973..92dc9b373 100644 --- a/uk/ac/sanger/artemis/components/genebuilder/ReferencesPanel.java +++ b/uk/ac/sanger/artemis/components/genebuilder/ReferencesPanel.java @@ -62,8 +62,9 @@ public class ReferencesPanel extends JPanel return false; } - private void updateFromFeature(Feature feature) + public void updateFromFeature(Feature feature) { + super.removeAll(); GridBagConstraints c = new GridBagConstraints(); JPanel gridPanel = new JPanel(new GridBagLayout()); gridPanel.setBackground(Color.white); @@ -98,20 +99,27 @@ public class ReferencesPanel extends JPanel c.gridy = 0; c.ipadx = 5; c.ipady = 5; - c.anchor = GridBagConstraints.NORTHWEST; + c.anchor = GridBagConstraints.NORTHEAST; c.fill = GridBagConstraints.NONE; - gridPanel.add(new JLabel("Literature"),c); + JLabel litLab = new JLabel("Literature"); + litLab.setToolTipText("Comma separated list, e.g. PMID:12345, PMID:56789..."); + gridPanel.add(litLab,c); c.gridx = 1; + c.anchor = GridBagConstraints.NORTHWEST; gridPanel.add(literatureTextArea,c); c.gridx = 0; c.gridy = 1; - gridPanel.add(new JLabel("Dbxref"),c); + c.anchor = GridBagConstraints.NORTHEAST; + JLabel dbLab = new JLabel("Dbxref"); + dbLab.setToolTipText("Comma separated list, e.g. UniProtKB:Q9NFB6, ..."); + gridPanel.add(dbLab,c); c.gridx = 1; + c.anchor = GridBagConstraints.NORTHWEST; gridPanel.add(dbxrefTextArea,c); - + add(gridPanel); - + literatureTextArea.setText(litBuffer.toString()+"\n"); dbxrefTextArea.setText(dbxrefBuffer.toString()+"\n"); } -- GitLab