Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2338 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: plugins ui/actions ui/panels

Subject: perfsonar development work

List archive

perfsonar: r2338 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: plugins ui/actions ui/panels


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2338 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: plugins ui/actions ui/panels
  • Date: Thu, 19 Apr 2007 16:50:55 -0400

Author: nina
Date: 2007-04-19 16:50:55 -0400 (Thu, 19 Apr 2007)
New Revision: 2338

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MAEndpoint.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MAEndpointList.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ShowEndpointsAction.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/MAEndpointsPanel.java
Log:
UI allowing to load, edit and save MA.conf entries

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MAEndpoint.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MAEndpoint.java
2007-04-19 09:16:07 UTC (rev 2337)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MAEndpoint.java
2007-04-19 20:50:55 UTC (rev 2338)
@@ -23,10 +23,6 @@

import org.perfsonar.perfsonarui.AbstractUserData;
import org.perfsonar.perfsonarui.SmartMARequest;
-import org.perfsonar.perfsonarui.ippm.IPPMRequest;
-import org.perfsonar.perfsonarui.ma.MARequest;
-import org.perfsonar.perfsonarui.ma.MARequest_NMWG2;
-import org.perfsonar.perfsonarui.ma.MARequest_NMWG2_Netutil;
import org.perfsonar.perfsonarui.ui.PerfsonarModel;


@@ -147,8 +143,20 @@
}

public String toString() {
- //return title + "," +endpoint + "," + versions[schema];
- return title + "," +endpoint + "," + type;
+ StringBuffer b = new StringBuffer();
+ if (!enabled) b.append(';');
+ b.append(title);
+ b.append(',');
+ b.append(endpoint);
+ b.append(',');
+ b.append(type);
+ b.append(',');
+ b.append(authRealm);
+ b.append(',');
+ b.append(event[0]);
+ b.append(',');
+ b.append(event[1]);
+ return b.toString();
}
public synchronized String getTitle() {
return title;

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MAEndpointList.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MAEndpointList.java
2007-04-19 09:16:07 UTC (rev 2337)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MAEndpointList.java
2007-04-19 20:50:55 UTC (rev 2338)
@@ -20,10 +20,14 @@
package org.perfsonar.perfsonarui.plugins;

import java.io.BufferedReader;
+import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.Writer;
import java.net.URL;
import java.util.List;
import java.util.Observable;
@@ -84,6 +88,16 @@
} catch (Exception x) {
logger.error(x);
}
+ }
+ public boolean saveEndpoints(File file) throws Exception {
+ BufferedWriter w = new BufferedWriter(new FileWriter(file));
+ for (int i=0; i < size(); i++) {
+ w.write(get(i).toString());
+ w.newLine();
+ }
+ w.flush();
+ w.close();
+ return true;
}
/**
* Reads endpoints from file.

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ShowEndpointsAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ShowEndpointsAction.java
2007-04-19 09:16:07 UTC (rev 2337)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ShowEndpointsAction.java
2007-04-19 20:50:55 UTC (rev 2338)
@@ -84,7 +84,7 @@
*/
public void actionPerformed(ActionEvent arg0) {

- PSUIAction[] actions = new PSUIAction[3];
+ PSUIAction[] actions = new PSUIAction[5];
PSActionMap allActions = new PSActionMap();
PSUIAction a = new SelectAllEndpointsAction(endpoints,true,"Select
all");
allActions.put("1", a);
@@ -103,9 +103,18 @@
allActions.put("3", a);
actions[0] = a;

+ a = new FileEndpointsAction(endpoints,true);
+ allActions.put("4", a);
+ actions[3] = a;
+ a = new FileEndpointsAction(endpoints,false);
+ allActions.put("5", a);
+ actions[4] = a;
+
actions[0].setActions(allActions);
actions[1].setActions(allActions);
actions[2].setActions(allActions);
+ actions[3].setActions(allActions);
+ actions[4].setActions(allActions);

MAEndpointsPanel endpointsPanel = new
MAEndpointsPanel(endpoints,actions);
a.setFrame(endpointsPanel);

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/MAEndpointsPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/MAEndpointsPanel.java
2007-04-19 09:16:07 UTC (rev 2337)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/MAEndpointsPanel.java
2007-04-19 20:50:55 UTC (rev 2338)
@@ -28,12 +28,20 @@
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComponent;
+import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
@@ -51,6 +59,7 @@
import org.apache.axis.AxisFault;
import org.apache.axis.utils.XMLUtils;
import org.perfsonar.perfsonarui.RequestInterruptedException;
+import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
import org.perfsonar.perfsonarui.ui.actions.PSUIAction;
import org.w3c.dom.Element;
@@ -64,6 +73,8 @@
JTable dataTable;
JScrollPane scrollPane;
JComponent toolbar;
+
+ MAEndpointPanel detailsPanel;
/**
* Comment for <code>serialVersionUID</code>
*/
@@ -87,7 +98,7 @@
addWidgets(endpoints,actions,statusColumn);
}

- public void addWidgets(MAEndpointList endpoints,PSUIAction[] actions,
boolean statusColumn) {
+ public void addWidgets(final MAEndpointList endpoints,PSUIAction[]
actions, boolean statusColumn) {
setMinimumSize(minDimension);
JPanel p = new JPanel(new BorderLayout());
TitledBorder b = BorderFactory.createTitledBorder("Select MA(s)");
@@ -112,6 +123,8 @@

setLayout(new BorderLayout());
p.add(scrollPane,BorderLayout.CENTER);
+ detailsPanel = new MAEndpointPanel();
+ p.add(detailsPanel,BorderLayout.SOUTH);
add(p,BorderLayout.CENTER);

if (actions != null) {
@@ -130,9 +143,15 @@
dataTable.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent evt) {
+
if (evt.isPopupTrigger()) {
menu.show(evt.getComponent(), evt.getX(),
evt.getY());
- }
+ } else {
+ int row = dataTable.rowAtPoint(evt.getPoint());
+ if (row >=0) {
+ detailsPanel.setEndpoint(endpoints.get(row));
+ }
+ }
}
@Override
public void mouseReleased(MouseEvent evt) {
@@ -278,5 +297,95 @@
}
}

+class MAEndpointPanel extends JPanel implements PropertyChangeListener {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8792150901064071740L;
+ protected MAEndpoint endpoint;
+
+ protected JFormattedTextField field_url;
+ protected JFormattedTextField field_name;
+ protected JFormattedTextField field_schema;
+
+ public MAEndpointPanel() {
+ this(null);
+ }
+ public MAEndpointPanel(MAEndpoint endpoint) {
+ super();
+ GridBagLayout l = new GridBagLayout();
+ GridBagConstraints c = new GridBagConstraints();
+ c.fill = GridBagConstraints.HORIZONTAL;
+
+ setLayout(l);

+ field_url = new JFormattedTextField();
+ field_url.addPropertyChangeListener("value",this);

+ field_name = new JFormattedTextField();
+ field_name.addPropertyChangeListener("value",this);
+ field_schema = new JFormattedTextField();
+ field_schema.addPropertyChangeListener("value",this);
+
+ c.weightx = 0.25;
+ c.gridwidth = GridBagConstraints.RELATIVE;
+ add( new JLabel("URL"),c);
+
+ c.weightx = 1.25;
+ c.gridwidth = GridBagConstraints.REMAINDER;
+ add(field_url,c);
+
+ c.weightx = 0.5;
+ c.gridwidth = GridBagConstraints.RELATIVE;
+ add( new JLabel("Name"),c);
+
+ c.weightx = 1.0;
+ c.gridwidth = GridBagConstraints.REMAINDER;
+ add(field_name,c);
+
+ c.weightx = 0.5;
+ c.gridwidth = GridBagConstraints.RELATIVE;
+ add( new JLabel("Schema"),c);
+
+ c.weightx = 1.0;
+ c.gridwidth = GridBagConstraints.REMAINDER;
+ add(field_schema,c);
+ setEndpoint(endpoint);
+ }
+ public synchronized MAEndpoint getEndpoint() {
+ return endpoint;
+ }
+ public synchronized void setEndpoint(MAEndpoint endpoint) {
+ if (this.endpoint != null) {
+ this.endpoint.setEndpoint(field_url.getText());
+ this.endpoint.setTitle(field_name.getText());
+ this.endpoint.setSchema(field_schema.getText());
+ }
+ this.endpoint = endpoint;
+ if (endpoint != null) {
+ field_url.setText(endpoint.getEndpoint());
+ field_name.setText(endpoint.getTitle());
+ field_schema.setText(endpoint.getSchema());
+ } else {
+ field_url.setText("");
+ field_name.setText("");
+ field_schema.setText("");
+ }
+ }
+ public void propertyChange(PropertyChangeEvent evt) {
+ Object src = evt.getSource();
+ if (endpoint == null) return;
+ if (src.equals(field_url))
+ endpoint.setEndpoint(field_url.getText());
+ else if (src.equals(field_name))
+ endpoint.setTitle(field_name.getText());
+ else if (src.equals(field_schema))
+ endpoint.setSchema(field_schema.getText());
+
+ }
+ public void focusGained(FocusEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+}
+



  • perfsonar: r2338 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: plugins ui/actions ui/panels, svnlog, 04/19/2007

Archive powered by MHonArc 2.6.16.

Top of Page