You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by aj...@apache.org on 2005/06/06 18:26:56 UTC

svn commit: r180336 - in /webservices/axis/trunk/java/modules/samples: src/sample/google/search/GUIHandler.java src/sample/google/spellcheck/SuggestionForm.java xdocs/amazonQS/AmazonSimpleWebService.html xdocs/amazonQS/AmazonSimpleWebService_clip_image002.gif

Author: ajith
Date: Mon Jun  6 09:26:53 2005
New Revision: 180336

URL: http://svn.apache.org/viewcvs?rev=180336&view=rev
Log:
Making simple changes to the documentation and fixing the help screen in the samples

Added:
    webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService_clip_image002.gif   (with props)
Modified:
    webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java
    webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SuggestionForm.java
    webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService.html

Modified: webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java?rev=180336&r1=180335&r2=180336&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java Mon Jun  6 09:26:53 2005
@@ -269,7 +269,7 @@
         JEditorPane jep;
 
         jep = new JEditorPane();
-        //jep.addHyperlinkListener(new LinkFollower());
+        jep.addHyperlinkListener(new LinkFollower());
         jep.setEditable(false);
         jep.setContentType("text/html");
 

Modified: webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SuggestionForm.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SuggestionForm.java?rev=180336&r1=180335&r2=180336&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SuggestionForm.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SuggestionForm.java Mon Jun  6 09:26:53 2005
@@ -4,22 +4,26 @@
 import sample.google.common.util.PropertyLoader;
 
 import javax.swing.*;
+import javax.swing.event.HyperlinkListener;
+import javax.swing.event.HyperlinkEvent;
 import java.awt.*;
 import java.awt.event.KeyEvent;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.io.File;
 import java.io.IOException;
+import java.net.URL;
 
 /**
  * class sample.google.spellcheck.SuggestionForm
  * This is the implementation of the GUI
- * @author Nadana Gunarathna
  *
+ * @author Nadana Gunarathna
  */
-public class SuggestionForm extends javax.swing.JFrame {
+public class SuggestionForm extends javax.swing.JFrame implements HyperlinkListener {
     private AsyncPanel asyncPanel;
     private SyncPanel syncPanel;
+    private JEditorPane helpDisplayPane;
 
     private JMenuItem syncMenuItem;
     private JMenuItem asyncMenuItem;
@@ -38,14 +42,14 @@
         modeMenu.setMnemonic(KeyEvent.VK_M);
         syncMenuItem = new JMenuItem("Sync Mode", KeyEvent.VK_S);
         syncMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
-        syncMenuItem.addActionListener(new ActionListener(){
+        syncMenuItem.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 setSyncPanel();
             }
         });
         asyncMenuItem = new JMenuItem("ASync Mode", KeyEvent.VK_A);
         asyncMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));
-        asyncMenuItem.addActionListener(new ActionListener(){
+        asyncMenuItem.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 setAsyncPanel();
             }
@@ -53,11 +57,11 @@
         modeMenu.add(syncMenuItem);
         modeMenu.add(asyncMenuItem);
 
-        JMenu settingsMenu =  new JMenu("Settings");
+        JMenu settingsMenu = new JMenu("Settings");
         settingsMenu.setMnemonic(KeyEvent.VK_S);
-        JMenuItem googleKeyMenu = new JMenuItem("Set Google Key",KeyEvent.VK_G);
+        JMenuItem googleKeyMenu = new JMenuItem("Set Google Key", KeyEvent.VK_G);
         googleKeyMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, ActionEvent.CTRL_MASK));
-        googleKeyMenu.addActionListener(new ActionListener(){
+        googleKeyMenu.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 setKey();
             }
@@ -68,7 +72,7 @@
         clearMenu.setMnemonic(KeyEvent.VK_C);
         JMenuItem clearMenuItem = new JMenuItem("Clear text boxes");
         clearMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
-        clearMenuItem.addActionListener(new ActionListener(){
+        clearMenuItem.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 asyncPanel.clear();
                 syncPanel.clear();
@@ -93,26 +97,25 @@
 
         this.setJMenuBar(menuBar);
 
-        this.getContentPane().setLayout(new GridLayout(1,1));
+        this.getContentPane().setLayout(new GridLayout(1, 1));
         setAsyncPanel();
 
 
-
     }
 
     public static void main(String[] args) {
         SuggestionForm form = new SuggestionForm();
         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
-        form.setLocation(screenSize.width/4,
-                screenSize.height/4);
-        form.setSize(screenSize.width/2,screenSize.height/2);
+        form.setLocation(screenSize.width / 4,
+                screenSize.height / 4);
+        form.setSize(screenSize.width / 2, screenSize.height / 2);
         form.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
         //form.setResizable(false);
         //form.pack();
         form.show();
     }
 
-    private void setAsyncPanel(){
+    private void setAsyncPanel() {
         this.getContentPane().removeAll();
         this.getContentPane().add(asyncPanel);
         this.syncMenuItem.setEnabled(true);
@@ -123,7 +126,7 @@
 
     }
 
-    private void setSyncPanel(){
+    private void setSyncPanel() {
         this.getContentPane().removeAll();
         this.getContentPane().add(syncPanel);
         this.syncMenuItem.setEnabled(false);
@@ -133,9 +136,10 @@
         this.show();
     }
 
-    private void setKey(){
-        String key = JOptionPane.showInputDialog(this,"Set the Google Key",PropertyLoader.getGoogleKey());
-        if (key!=null && !key.trim().equals("")){
+    private void setKey() {
+        String key = JOptionPane.showInputDialog(this, "Set the Google Key",
+                PropertyLoader.getGoogleKey());
+        if (key != null && !key.trim().equals("")) {
             PropertyLoader.setGoogleKey(key);
         }
     }
@@ -145,37 +149,52 @@
      */
     private void showHelp() {
 
-        JFrame frame= new JFrame();
+        JFrame frame = new JFrame();
         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
-        frame.setLocation(screenSize.width/5,
-                screenSize.height/5);
-        frame.setSize(screenSize.width/2,screenSize.height/2);
+        frame.setLocation(screenSize.width / 5,
+                screenSize.height / 5);
+        frame.setSize(screenSize.width / 2, screenSize.height / 2);
 
         BorderLayout layout = new BorderLayout();
 
-        JScrollPane jsp ;
-        JEditorPane jep;
+        JScrollPane jsp;
+
 
-        jep = new JEditorPane();
-        //jep.addHyperlinkListener(new LinkFollower());
-        jep.setEditable(false);
-        jep.setContentType("text/html");
+        helpDisplayPane = new JEditorPane();
+        helpDisplayPane.addHyperlinkListener(this);
+        helpDisplayPane.setEditable(false);
+        helpDisplayPane.setContentType("text/html");
 
-        jsp = new JScrollPane(jep);
+        jsp = new JScrollPane(helpDisplayPane);
 
         Container contentPane = frame.getContentPane();
         contentPane.setLayout(layout);
         contentPane.add(jsp, BorderLayout.CENTER);
-        String helpDoc = System.getProperty("user.dir")+HELP_FILE_NAME;
+        String helpDoc = System.getProperty("user.dir") + HELP_FILE_NAME;
 
         try {
-            jep.setPage(new File(helpDoc).toURL());
+            helpDisplayPane.setPage(new File(helpDoc).toURL());
         } catch (IOException e) {
-           JOptionPane.showMessageDialog(this,"Help file not detected","Help file error",JOptionPane.ERROR_MESSAGE);
+            JOptionPane.showMessageDialog(this, "Help file not detected", "Help file error",
+                    JOptionPane.ERROR_MESSAGE);
             return;
         }
         frame.setVisible(true);
     }
 
 
+    public void hyperlinkUpdate(HyperlinkEvent e) {
+        if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+            try {
+                String url = e.getURL().toString();
+                helpDisplayPane.setPage(url);
+//                
+            } catch (Exception err) {
+                JOptionPane.showMessageDialog(this, "Help file not detected", err.getMessage(),
+                        JOptionPane.ERROR_MESSAGE);
+                return;
+            }
+
+        }
+    }
 }

Modified: webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService.html
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService.html?rev=180336&r1=180335&r2=180336&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService.html (original)
+++ webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService.html Mon Jun  6 09:26:53 2005
@@ -45,7 +45,8 @@
   Separate threads are created by RunnableXXX classes. Extended classes from Callback handled by SimpleQueueXXXCallbackHandler classes.</p>
 <p>Once a event is generted by AmazonSimpleQueueServiceXX class, the event is handled by ListnersXX class. The listener classs has references to RunnableXXX class, which is carried out the Axis2-M2 exceution code. </p>
 <p> Once an event is generated by AmazonSimpleQueueServiceXX class, the event is handled by ListnersXX class. The listener class has a reference to RunnableXXX class, which contains the Axis2-M2 execution code. RunnableXXX class has references to classes that support OMElement, which is needed as references to invokeNonBlocking(String, OMElement,Callback) method and SimpleQueueXXXCallbackHandler classes. Once the onComplete() method executes, the response is send back to GUI's response handling components. Figure below shows the schematic architecture of the sample. </p>
-<p> <img src="Architecture.JPG" width="578" height="322"><br>
+<p> 
+<img src="AmazonSimpleWebService_clip_image002.gif" width="579" height="321"><br>
 All the web services are available as rpc-literal encoded style. Thus, OMElemnts adheres to this requirement.</p>
 <p class="style3">Running the Samples</p>
 <ol>

Added: webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService_clip_image002.gif
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService_clip_image002.gif?rev=180336&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService_clip_image002.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream