MenuItem unGroupMenuItem = new MenuItem();
+ MenuItem createGroupMenuItem = new MenuItem();
+
MenuItem nucleotideMenuItem = new MenuItem();
Menu colourMenu = new Menu();
displayNonconserved.setState(sg.getShowNonconserved());
if (!ap.av.getAlignment().getGroups().contains(sg))
{
- menu1.remove(unGroupMenuItem);
+ menu1.setLabel("Edit New Group");
+ groupMenu.remove(unGroupMenuItem);
+ } else {
+ menu1.setLabel("Edit Group");
+ groupMenu.remove(createGroupMenuItem);
}
}
unGroupMenuItem_actionPerformed();
}
+ else if (source == createGroupMenuItem)
+ {
+ createGroupMenuItem_actionPerformed();
+ }
+
else if (source == sequenceName)
{
editName();
private void jbInit() throws Exception
{
- groupMenu.setLabel("Group");
groupMenu.setLabel("Selection");
sequenceFeature.addActionListener(this);
unGroupMenuItem.setLabel("Remove Group");
unGroupMenuItem.addActionListener(this);
+ createGroupMenuItem.setLabel("Create Group");
+ createGroupMenuItem.addActionListener(this);
+
nucleotideMenuItem.setLabel("Nucleotide");
nucleotideMenuItem.addActionListener(this);
conservationMenuItem.addItemListener(this);
this.add(revealSeq);
this.add(revealAll);
// groupMenu.add(selSeqDetails);
- groupMenu.add(editGroupName);
groupMenu.add(editMenu);
groupMenu.add(outputmenu);
groupMenu.add(sequenceFeature);
+ groupMenu.add(createGroupMenuItem);
+ groupMenu.add(unGroupMenuItem);
groupMenu.add(menu1);
colourMenu.add(noColourmenuItem);
seqMenu.add(pdb);
}
seqMenu.add(repGroup);
- menu1.add(unGroupMenuItem);
+ menu1.add(editGroupName);
menu1.add(colourMenu);
menu1.add(showBoxes);
menu1.add(showText);
ap.paintAlignment(true);
}
+ void createGroupMenuItem_actionPerformed()
+ {
+ getGroup(); // implicitly create group
+ refresh();
+ }
+
public void showColourText_itemStateChanged()
{
getGroup().setColourText(showColourText.getState());
JMenuItem sequenceSelDetails = new JMenuItem();
SequenceI sequence;
-
+ JMenuItem createGroupMenuItem = new JMenuItem();
JMenuItem unGroupMenuItem = new JMenuItem();
JMenuItem outline = new JMenuItem();
}
SequenceGroup sg = ap.av.getSelectionGroup();
+ boolean isDefinedGroup = (sg!=null) ? ap.av.getAlignment().getGroups().contains(sg) : false;
if (sg != null && sg.getSize() > 0)
- {
+ {
groupName.setText("Name: " + sg.getName());
groupName.setText("Edit name and description of current group.");
editMenu.setVisible(false);
}
- if (!ap.av.getAlignment().getGroups().contains(sg))
+ if (!isDefinedGroup)
{
+ createGroupMenuItem.setVisible(true);
unGroupMenuItem.setVisible(false);
+ jMenu1.setText("Edit New Group");
+ } else {
+ createGroupMenuItem.setVisible(false);
+ unGroupMenuItem.setVisible(true);
+ jMenu1.setText("Edit Group");
}
if (seq == null)
unGroupMenuItem_actionPerformed();
}
});
+ createGroupMenuItem.setText("Create Group");
+ createGroupMenuItem.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ createGroupMenuItem_actionPerformed();
+ }
+ });
outline.setText("Border colour");
outline.addActionListener(new java.awt.event.ActionListener()
groupMenu.add(editMenu);
groupMenu.add(outputMenu);
groupMenu.add(sequenceFeature);
+ groupMenu.add(createGroupMenuItem);
+ groupMenu.add(unGroupMenuItem);
groupMenu.add(jMenu1);
sequenceMenu.add(sequenceName);
sequenceMenu.add(sequenceDetails);
pdbMenu.add(enterPDB);
pdbMenu.add(discoverPDB);
jMenu1.add(groupName);
- jMenu1.add(unGroupMenuItem);
jMenu1.add(colourMenu);
jMenu1.add(showBoxes);
jMenu1.add(showText);
ap.av.setSelectionGroup(null);
refresh();
}
+ void createGroupMenuItem_actionPerformed()
+ {
+ getGroup(); // implicitly creates group - note - should apply defaults / use standard alignment window logic for this
+ refresh();
+ }
/**
* DOCUMENT ME!