You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by wi...@apache.org on 2005/06/16 16:20:05 UTC
svn commit: r190923 -
/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/common/LocationJPanel.java
Author: wire
Date: Thu Jun 16 07:20:04 2005
New Revision: 190923
URL: http://svn.apache.org/viewcvs?rev=190923&view=rev
Log:
New
Added:
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/common/LocationJPanel.java
- copied, changed from r189973, incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/LocationJPanel.java
Copied: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/common/LocationJPanel.java (from r189973, incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/LocationJPanel.java)
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/common/LocationJPanel.java?p2=incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/common/LocationJPanel.java&p1=incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/LocationJPanel.java&r1=189973&r2=190923&rev=190923&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/LocationJPanel.java (original)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/common/LocationJPanel.java Thu Jun 16 07:20:04 2005
@@ -1,8 +1,16 @@
-package org.apache.interop.wcdisplay;
+package org.apache.interop.common;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Properties;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
@@ -17,7 +25,17 @@
import javax.swing.JPanel;
import org.apache.interop.smgr.ConnectionListener;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
import org.apache.wsdm.interop.wcm.impl.ui.MessagesJPanel;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.GridBagConstraints;
+import java.awt.event.ContainerAdapter;
+import java.awt.event.ContainerEvent;
/**
* This code was generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
@@ -32,10 +50,8 @@
* for any corporate or commercial purpose.
* *************************************
*/
-public class LocationJPanel extends javax.swing.JPanel {
- private JTextField jTextFieldRid;
+public class LocationJPanel extends javax.swing.JPanel implements EprProvider {
private JToggleButton jToggleButtonGo;
- private JLabel jLabelRid;
private JTextField jTextFieldUrl;
private JLabel jLabelLocation;
private JLabel jLabelAniStatus;
@@ -60,6 +76,12 @@
public LocationJPanel() {
super();
initGUI();
+ try {
+ load();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
private void initGUI() {
@@ -70,8 +92,11 @@
}
FlowLayout jPanel1Layout = new FlowLayout();
this.setBackground(new java.awt.Color(239,239,239));
- FlowLayout thisLayout = new FlowLayout();
- thisLayout.setAlignment(FlowLayout.LEFT);
+ GridBagLayout thisLayout = new GridBagLayout();
+ thisLayout.columnWeights = new double[] {0.1,0.1,0.1,0.1};
+ thisLayout.columnWidths = new int[] {7,7,7,7};
+ thisLayout.rowWeights = new double[] {0.1};
+ thisLayout.rowHeights = new int[] {7};
this.setLayout(thisLayout);
this.setPreferredSize(new java.awt.Dimension(725, 61));
jPanel1Layout.setAlignment(FlowLayout.LEFT);
@@ -79,28 +104,40 @@
jPanel1Layout.setAlignment(FlowLayout.LEFT);
{
jLabelLocation = new JLabel();
- this.add(jLabelLocation);
+ this.add(jLabelLocation, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jLabelLocation.setText("Location:");
}
{
jTextFieldUrl = new JTextField();
- this.add(jTextFieldUrl);
- jTextFieldUrl
- .setText("http://12.35.246.160:8080/muse/services/WeatherClientConfig");
- }
- {
- jLabelRid = new JLabel();
- this.add(jLabelRid);
- jLabelRid.setText("RId:");
- }
- {
- jTextFieldRid = new JTextField();
- this.add(jTextFieldRid);
- jTextFieldRid.setText("weather-client-config-1");
+ this.add(jTextFieldUrl, new GridBagConstraints(
+ 1,
+ 0,
+ 1,
+ 1,
+ 0.75,
+ 0.0,
+ GridBagConstraints.WEST,
+ GridBagConstraints.HORIZONTAL,
+ new Insets(0, 0, 0, 0),
+ 0,
+ 0));
+ jTextFieldUrl.setText("http://12.35.246.160:8080/muse/epr");
+ jTextFieldUrl.setPreferredSize(new java.awt.Dimension(400, 22));
}
{
jToggleButtonGo = new JToggleButton();
- this.add(jToggleButtonGo);
+ this.add(jToggleButtonGo, new GridBagConstraints(
+ 2,
+ 0,
+ 1,
+ 1,
+ 0.0,
+ 0.0,
+ GridBagConstraints.WEST,
+ GridBagConstraints.NONE,
+ new Insets(0, 5, 0, 0),
+ 0,
+ 0));
jToggleButtonGo.setText("Connect");
jToggleButtonGo.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
@@ -113,7 +150,18 @@
}
{
jLabelAniStatus = new JLabel();
- this.add(jLabelAniStatus);
+ this.add(jLabelAniStatus, new GridBagConstraints(
+ 3,
+ 0,
+ 1,
+ 1,
+ 0.0,
+ 0.0,
+ GridBagConstraints.EAST,
+ GridBagConstraints.NONE,
+ new Insets(0, 0, 0, 7),
+ 0,
+ 0));
jLabelAniStatus.setIcon(new ImageIcon(getClass().getClassLoader().getResource("org/apache/interop/wcdisplay/hp-still.gif")));
jLabelAniStatus.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, null, null, null, null));
}
@@ -139,11 +187,45 @@
return jTextFieldUrl.getText();
}
- public String getRid(){
- return jTextFieldRid.getText();
- }
public void setConnectionListener(ConnectionListener listener){
this.listener=listener;
}
+ /* (non-Javadoc)
+ * @see org.apache.interop.common.EprProvider#getEpr()
+ */
+ public EndpointReference getEpr(String endpointName) throws XmlException, IOException {
+ URL eprURL = new URL(jTextFieldUrl.getText()+"/"+endpointName);
+ EndpointReferenceDocument eprDoc=getEndpointReference(eprURL);
+ XmlBeansEndpointReference epr=new XmlBeansEndpointReference(eprDoc.getEndpointReference());
+ return epr;
+ }
+
+ private static EndpointReferenceDocument getEndpointReference(URL url) throws XmlException, IOException
+ {
+ return (EndpointReferenceDocument) XmlObject.Factory.parse(url);
+ }
+ public void load() throws IOException{
+ Properties props = new Properties();
+ File confFile=new File("interop.prefs");
+ if(!confFile.exists())
+ return;
+ FileInputStream is=new FileInputStream(confFile);
+ props.load(is);
+ //JFrame parent=(JFrame)getParent().getParent().getParent();
+ String urlText=props.getProperty("app"+".URL");
+ if(urlText!=null){
+ jTextFieldUrl.setText(urlText);
+ }
+ }
+ public void save() throws IOException{
+ Properties props = new Properties();
+ File confFile=new File("interop.prefs");
+ //JFrame parent=(JFrame)getParent().getParent().getParent().getParent();
+ String urlText=jTextFieldUrl.getText();
+ props.setProperty("app.URL",urlText);
+ FileOutputStream is=new FileOutputStream(confFile);
+ props.save(is,"Prefs for interop");
+
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org