From: jprocter Date: Tue, 30 Aug 2011 13:01:45 +0000 (+0100) Subject: JAL-715 JalviewDialog for RSBS service editing pane X-Git-Tag: Release_2_7~66 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ad4c49bfc69cf3f7d844c346aa01fbaceeef0ee0;p=jalview.git JAL-715 JalviewDialog for RSBS service editing pane --- diff --git a/src/jalview/gui/RestServiceEditorPane.java b/src/jalview/gui/RestServiceEditorPane.java index 4f9c13e..5174b7a 100644 --- a/src/jalview/gui/RestServiceEditorPane.java +++ b/src/jalview/gui/RestServiceEditorPane.java @@ -6,6 +6,7 @@ import jalview.ws.rest.InputType; import jalview.ws.rest.RestServiceDescription; import java.awt.BorderLayout; +import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; @@ -22,6 +23,7 @@ import java.util.regex.Pattern; import javax.swing.JFrame; import javax.swing.JMenuItem; +import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -64,6 +66,10 @@ public class RestServiceEditorPane extends GRestServiceEditorPane }); panels.addChangeListener(new ChangeListener() { + + /** + * last panel selected - used to decide whether the service or the GUI has the latest info + */ Object lastComp; @Override public void stateChanged(ChangeEvent e) @@ -86,7 +92,7 @@ public class RestServiceEditorPane extends GRestServiceEditorPane public RestServiceEditorPane(RestServiceDescription toedit) { - super(); + this(); oldservice = toedit; if (oldservice!=null) { currentservice = new RestServiceDescription(toedit); @@ -437,4 +443,47 @@ public class RestServiceEditorPane extends GRestServiceEditorPane } } + String finalService=null; + public void showDialog(String title) + { + if (oldservice!=null) + { + finalService = oldservice.toString(); + } + JalviewDialog jvd = new JalviewDialog() + { + + @Override + protected void raiseClosed() + { + // TODO Auto-generated method stub + + } + + @Override + protected void okPressed() + { + updateServiceFromGui(); + finalService = currentservice.toString(); + } + + @Override + protected void cancelPressed() + { + + } + }; + JPanel pane = new JPanel(new BorderLayout()),okcancel=new JPanel(new FlowLayout()); + pane.add(this,BorderLayout.CENTER); + okcancel.add(jvd.ok); + okcancel.add(jvd.cancel); + pane.add(okcancel, BorderLayout.SOUTH); + jvd.initDialogFrame(pane, true, true, title, 600,350); + jvd.waitForInput(); + } + + public String getEditedRestService() + { + return finalService; + } }