CheckboxMenuItem showText = new CheckboxMenuItem();\r
CheckboxMenuItem showColourText = new CheckboxMenuItem();\r
\r
- public APopupMenu(AlignmentPanel apanel, Sequence seq, Vector links)\r
+ public APopupMenu(AlignmentPanel apanel, final Sequence seq, Vector links)\r
{\r
///////////////////////////////////////////////////////////\r
// If this is activated from the sequence panel, the user may want to\r
linkMenu.add(item);\r
}\r
add(linkMenu);\r
+\r
+ item = new MenuItem("Show PDB Structure");\r
+ item.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ addPDB(seq);\r
+ }\r
+ });\r
+\r
+ add(item);\r
+\r
+\r
}\r
}\r
\r
+ void addPDB(Sequence seq)\r
+ {\r
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(true, ap.alignFrame.applet);\r
+ cap.setText("Paste your PDB file here.");\r
+ cap.setPDBImport(seq, ap.seqPanel.seqCanvas);\r
+ Frame frame = new Frame();\r
+ frame.add(cap);\r
+ jalview.bin.JalviewLite.addFrame(frame, "Paste PDB file ", 400, 300);\r
+ }\r
+\r
private void jbInit()\r
throws Exception\r
{\r
refresh();\r
}\r
\r
- protected void analyze_actionPerformed(ActionEvent e)\r
- {\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame.applet);\r
- Frame frame = new Frame();\r
- frame.add(cap);\r
- jalview.bin.JalviewLite.addFrame(frame, "Analyze this - ", 400, 300);\r
- SequenceGroup sg = getGroup();\r
- StringBuffer sb = new StringBuffer();\r
-\r
- for (int i = 0; i < sg.sequences.size(); i++)\r
- {\r
- Sequence tmp = (Sequence) sg.sequences.elementAt(i);\r
- sb.append(tmp.getSequence(sg.getStartRes(), sg.getEndRes() + 1));\r
- sb.append("\n");\r
- }\r
-\r
- sb.append("Something amazing will happen soon");\r
- cap.setText(sb.toString());\r
-\r
- }\r
\r
SequenceGroup getGroup()\r
{\r
extends GAlignFrame\r
{\r
final AlignmentPanel alignPanel;\r
- final AlignViewport viewport;\r
+ public final AlignViewport viewport;\r
int NEW_WINDOW_WIDTH = 700;\r
int NEW_WINDOW_HEIGHT = 500;\r
jalview.bin.JalviewLite applet;\r
public void closeMenuItem_actionPerformed(ActionEvent e)\r
{\r
PaintRefresher.components.remove(viewport.alignment);\r
- dispose();\r
if(PaintRefresher.components.size()==0 && applet==null)\r
System.exit(0);\r
}\r
extends GCutAndPasteTransfer\r
{\r
jalview.bin.JalviewLite applet;\r
+\r
+ boolean pdbImport = false;\r
+ Sequence seq;\r
+ SeqCanvas seqcanvas;\r
+\r
public CutAndPasteTransfer(boolean forImport, jalview.bin.JalviewLite mainApplet)\r
{\r
super();\r
}\r
}\r
\r
+ public void setPDBImport(Sequence seq, SeqCanvas seqcanvas)\r
+ {\r
+ this.seq = seq;\r
+ this.seqcanvas = seqcanvas;\r
+ pdbImport = true;\r
+ }\r
+\r
+\r
public String getText()\r
{\r
return textarea.getText();\r
return;\r
}\r
\r
- SequenceI[] sequences = null;\r
-\r
- String format = IdentifyFile.Identify(text, "Paste");\r
- sequences = new AppletFormatAdapter().readFile(text, "Paste", format);\r
-\r
- if (sequences != null)\r
+ if(pdbImport)\r
{\r
- AlignFrame af = new AlignFrame(new Alignment(sequences), applet,\r
- "Cut & Paste input - " + format);\r
- af.statusBar.setText("Successfully pasted alignment file");\r
+ new MCview.AppletPDBViewer(text, seq, seqcanvas);\r
}\r
+ else\r
+ {\r
+ SequenceI[] sequences = null;\r
\r
+ String format = IdentifyFile.Identify(text, "Paste");\r
+ sequences = new AppletFormatAdapter().readFile(text, "Paste", format);\r
+\r
+ if (sequences != null)\r
+ {\r
+ AlignFrame af = new AlignFrame(new Alignment(sequences), applet,\r
+ "Cut & Paste input - " + format);\r
+ af.statusBar.setText("Successfully pasted alignment file");\r
+ }\r
+ }\r
Frame frame = (Frame)this.getParent();\r
frame.setVisible(false);\r
}\r
{\r
public static void AntiAlias(Graphics g)\r
{\r
- Graphics2D g2 = (Graphics2D)g;\r
- g2.setRenderingHint( RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
+ // Graphics2D g2 = (Graphics2D)g;\r
+ // g2.setRenderingHint( RenderingHints.KEY_ANTIALIASING,\r
+ // RenderingHints.VALUE_ANTIALIAS_ON);\r
}\r
\r
\r
public static void SetTransparency(Graphics g, float transparency)\r
{\r
- Graphics2D g2 = (Graphics2D) g;\r
- g2.setComposite(\r
- AlphaComposite.getInstance(\r
- AlphaComposite.SRC_OVER, transparency));\r
+ // Graphics2D g2 = (Graphics2D) g;\r
+ // g2.setComposite(\r
+ // AlphaComposite.getInstance(\r
+ // AlphaComposite.SRC_OVER, transparency));\r
}\r
}\r
fr = new FeatureRenderer(av);\r
sr = new SequenceRenderer(av);\r
PaintRefresher.Register(this, av.alignment);\r
+ }\r
\r
+ public AlignViewport getViewport()\r
+ {\r
+ return av;\r
}\r
\r
public FeatureRenderer getFeatureRenderer()\r
return fr;\r
}\r
\r
+ MCview.AppletPDBCanvas pdbViewer;\r
+ public SequenceRenderer getSequenceRenderer()\r
+ {\r
+ return sr;\r
+ }\r
+\r
+ public void setPDBViewer(MCview.AppletPDBCanvas pc)\r
+ {\r
+ pdbViewer = pc;\r
+ }\r
+\r
+\r
void drawNorthScale(Graphics g, int startx, int endx, int ypos)\r
{\r
int scalestartx = startx - startx % 10 + 10;\r
\r
g.drawImage(img, 0, 0, this);\r
\r
+ if (pdbViewer != null)\r
+ {\r
+ pdbViewer.updateSeqColours();\r
+ }\r
}\r
\r
int LABEL_WEST, LABEL_EAST;\r
}\r
}\r
\r
+ public Color findSequenceColour(SequenceI seq, int i)\r
+ {\r
+ drawBoxes(seq, i,i, 0, 0, 1,1);\r
+ return resBoxColour;\r
+ }\r
+\r
public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
int start, int end, int x1, int y1, int width,\r
int height)\r