From 9b45126bbb2cc4ecdada6e4bd291b60bf441f01f Mon Sep 17 00:00:00 2001 From: janengelhardt Date: Tue, 12 Jul 2011 10:28:19 +0200 Subject: [PATCH] JAL-842; Added the TextField to edit structure in VARNA Change-Id: I93a90da2468c4c6b69570aac9741b286300b6430 --- src/jalview/gui/AppVarna.java | 2 +- src/jalview/gui/AppVarnaBinding.java | 43 +++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/jalview/gui/AppVarna.java b/src/jalview/gui/AppVarna.java index 5dd65c4..bc83400 100644 --- a/src/jalview/gui/AppVarna.java +++ b/src/jalview/gui/AppVarna.java @@ -86,7 +86,7 @@ public class AppVarna extends JInternalFrame implements InterfaceVARNAListener// JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,vab.getListPanel(),varnaPanel); getContentPane().setLayout(new BorderLayout()); getContentPane().add(split, BorderLayout.CENTER); - //getContentPane().add(vab.getTools(), BorderLayout.NORTH); + getContentPane().add(vab.getTools(), BorderLayout.NORTH); varnaPanel.addVARNAListener(this); jalview.gui.Desktop.addInternalFrame(this,"VARNA -"+name,getBounds().width, getBounds().height); this.pack(); diff --git a/src/jalview/gui/AppVarnaBinding.java b/src/jalview/gui/AppVarnaBinding.java index 1d2d8fd..493e4a7 100644 --- a/src/jalview/gui/AppVarnaBinding.java +++ b/src/jalview/gui/AppVarnaBinding.java @@ -96,6 +96,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding imple private JLabel _strLabel = new JLabel(" Str:"); private JLabel _seqLabel = new JLabel(" Seq:"); private JButton _createButton = new JButton("Create"); + private JButton _updateButton = new JButton("Update"); private JButton _deleteButton = new JButton("Delete"); private JButton _duplicateButton = new JButton("Snapshot"); @@ -195,7 +196,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding imple DefaultListModel dlm = new DefaultListModel(); - //int marginTools = 40; + int marginTools = 40; DefaultListSelectionModel m = new DefaultListSelectionModel(); m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); @@ -216,7 +217,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding imple Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA().getSize(), sel.rna.getSize()); vp.showRNAInterpolated(sel.rna,sel.config,map); //_seq.setText(sel.rna.getSeq()); - //_str.setText(sel.rna.getStructDBN()); + _str.setText(sel.rna.getStructDBN()); } } }); @@ -248,17 +249,19 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding imple vp.setBackground(_backgroundColor); - /* + Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12"); - _seqLabel.setHorizontalTextPosition(JLabel.LEFT); - _seqLabel.setPreferredSize(new Dimension(marginTools, 15)); + //_seqLabel.setHorizontalTextPosition(JLabel.LEFT); + //_seqLabel.setPreferredSize(new Dimension(marginTools, 15)); _seq.setFont(textFieldsFont); _seq.setText(rnaInList.get(0).getSeq()); - - _createButton.addActionListener(new ActionListener() { + + _updateButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - try { + FullBackup sel = (FullBackup) _sideList.getSelectedValue(); + sel.rna.setSequence("A"); + /*try { RNA nRNA = new RNA(generateDefaultName()); nRNA.setRNA(_seq.getText(), _str.getText()); nRNA.drawRNARadiate(vp.getConfig()); @@ -267,13 +270,13 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding imple JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error", JOptionPane.ERROR_MESSAGE); } catch (ExceptionFileFormatOrSyntax e1) { JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error", JOptionPane.ERROR_MESSAGE); - } + }*/ } }); - _seqPanel.setLayout(new BorderLayout()); - _seqPanel.add(_seqLabel, BorderLayout.WEST); - _seqPanel.add(_seq, BorderLayout.CENTER); + //_seqPanel.setLayout(new BorderLayout()); + //_seqPanel.add(_seqLabel, BorderLayout.WEST); + //_seqPanel.add(_seq, BorderLayout.CENTER); _strLabel.setPreferredSize(new Dimension(marginTools, 15)); _strLabel.setHorizontalTextPosition(JLabel.LEFT); @@ -282,8 +285,8 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding imple _strPanel.add(_strLabel, BorderLayout.WEST); _strPanel.add(_str, BorderLayout.CENTER); - _input.setLayout(new GridLayout(2, 0)); - _input.add(_seqPanel); + _input.setLayout(new GridLayout(1, 0)); + //_input.add(_seqPanel); _input.add(_strPanel); JPanel goPanel = new JPanel(); @@ -291,10 +294,10 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding imple _tools.setLayout(new BorderLayout()); _tools.add(_input, BorderLayout.CENTER); - _tools.add(_info, BorderLayout.SOUTH); + //_tools.add(_info, BorderLayout.SOUTH); _tools.add(goPanel, BorderLayout.EAST); - _deleteButton.addActionListener(new ActionListener() { + /*_deleteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } @@ -303,20 +306,22 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding imple public void actionPerformed(ActionEvent e) { _rnaList.add((VARNAConfig)vp.getConfig().clone(),vp.getRNA().clone(),vp.getRNA().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new Date()),true); }}); - goPanel.add(_createButton, BorderLayout.CENTER); */ + goPanel.add(_updateButton, BorderLayout.CENTER); + + JPanel ops = new JPanel(); ops.setLayout(new GridLayout(1,2)); ops.add(_deleteButton); ops.add(_duplicateButton); - + JLabel j = new JLabel("Structures Manager",JLabel.CENTER); _listPanel.setLayout(new BorderLayout()); _listPanel.add(ops,BorderLayout.SOUTH); _listPanel.add(j,BorderLayout.NORTH); _listPanel.add(listScroller,BorderLayout.CENTER); - + //JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp); -- 1.7.10.2