perfsonar-dev - perfsonar: r5204 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass: . model
Subject: perfsonar development work
List archive
perfsonar: r5204 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass: . model
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5204 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass: . model
- Date: Thu, 25 Jun 2009 11:35:35 -0400
Author: rade
Date: 2009-06-25 11:35:34 -0400 (Thu, 25 Jun 2009)
New Revision: 5204
Removed:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/InfiniteProgressPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGShowEndpointsAction.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/LinkedWebserviceComboboxModel.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGRequest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassMainPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassTab.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/MetadataKeyRequestAction.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/WebservicesModel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/WebservicesTableModel.java
Log:
Related to bug 746 (https://bugzilla.perfsonar.net/show_bug.cgi?id=746)
+ added load/store functionality for MPs using default MA dialog
* many more bugfixes and improvements to UI
* removed classes that are not instantionated anywhere (there may be more)
Deleted:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/InfiniteProgressPanel.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGRequest.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGRequest.java
2009-06-24 09:06:43 UTC (rev 5203)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGRequest.java
2009-06-25 15:35:34 UTC (rev 5204)
@@ -19,14 +19,11 @@
*/
package org.perfsonar.perfsonarui.lookingglass;
-import java.io.StringWriter;
-
import java.util.StringTokenizer;
+
import javax.xml.soap.SOAPEnvelope;
-import org.apache.axis.Message;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
+import org.apache.axis.Message;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.Namespace;
Deleted:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGShowEndpointsAction.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassMainPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassMainPanel.java
2009-06-24 09:06:43 UTC (rev 5203)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassMainPanel.java
2009-06-25 15:35:34 UTC (rev 5204)
@@ -19,6 +19,7 @@
*/
package org.perfsonar.perfsonarui.lookingglass;
+import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.io.File;
@@ -112,7 +113,6 @@
private LookingGlassClientModel model;
private WebserviceComboboxModel webserviceComboboxModel;
private boolean busy = false;
- private InfiniteProgressPanel infiniteProgressPanel;
private ChangeEvent changeEvent;
private DeviceComboboxModel deviceComboboxModel;
private FunctionComboboxModel functionComboboxModel;
@@ -123,8 +123,6 @@
private WebservicesModel webservicesModel;
- private boolean and = false;
-
private static final boolean importExportEnabled = true;
private static final boolean searchEnabled = true;
private static final boolean andOrEnabled = true;
@@ -149,7 +147,6 @@
model = new LookingGlassClientModel();
model.addChangeListener(this);
- infiniteProgressPanel = new InfiniteProgressPanel();
listenerList = new EventListenerList();
changeEvent = new ChangeEvent("webservicesAlteration");
@@ -164,6 +161,7 @@
latestResultListModel = new LatestResultListModel(model);
addChangeListener(webserviceComboboxModel);
+ //addChangeListener(this); //XXX
JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
addTopPane(), addBottomPane());
@@ -266,6 +264,7 @@
});
clearButton.setText("Clear");
+ clearButton.setEnabled(false);
clearButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -274,6 +273,7 @@
});
addAllButton.setText("Add All MP's/Devices");
+ addAllButton.setEnabled(false);
addAllButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -293,9 +293,11 @@
parameterStringTextField.setEnabled(false);
webserviceCombobox.setModel(webserviceComboboxModel);
+ webserviceCombobox.setEnabled(false);
webserviceCombobox.setToolTipText("Select the desired configured
webserver");
webserviceCombobox.setAction(super.model.getActions().get("0")); //
this should be the LGMetadataKeyRequestAction
((MetadataKeyRequestAction)
super.model.getActions().get("0")).setParent(this);
+ webserviceCombobox.setEnabled(webserviceCombobox.getItemCount() > 0);
//also add this class to the SetupDataRequestAction as parent
PSActionMap map = super.model.getActions();
@@ -651,12 +653,14 @@
functionCombobox.setEnabled(true);
functionCombobox.setSelectedIndex(0);
addDeviceButton.setEnabled(true);
+ addAllDevicesButton.setEnabled(true);
} else {
this.parameterStringTextField.setEnabled(false);
functionComboboxModel.removeAllElements();
functionCombobox.setEnabled(false);
addDeviceButton.setEnabled(false);
+ addAllDevicesButton.setEnabled(false);
}
@@ -721,6 +725,7 @@
if (importExportEnabled)
exportButton.setEnabled(true);
removeDeviceButton.setEnabled(true);
+ clearButton.setEnabled(true);
}
}
@@ -737,6 +742,7 @@
if (importExportEnabled)
exportButton.setEnabled(false);
removeDeviceButton.setEnabled(false);
+ clearButton.setEnabled(false);
resultTextArea.setText(null);
functionComboboxModel.initComboBox(deviceComboboxModel.getAllElements());
//statusTextField.setText(null);
@@ -848,6 +854,7 @@
addDeviceButton.setEnabled(false);
removeDeviceButton.setEnabled(false);
+ clearButton.setEnabled(false);
parameterStringTextField.setEnabled(false);
parameterStringTextField.setText("");
@@ -938,52 +945,55 @@
}
removeDeviceButton.setEnabled(true);
+ clearButton.setEnabled(true);
if (importExportEnabled)
exportButton.setEnabled(true);
}
public void
addAllDevicesAndMPsActionPerformed(java.awt.event.ActionEvent evt){
- //System.out.println("[LookingGlassMainPanel] Number of MPs to
contact: " + webserviceCombobox.getItemCount());
- for (int j = 0; j < webserviceCombobox.getItemCount(); j++) {
- busy = true;
- //System.out.println("[LookingGlassMainPanel] Selecting next
MP...");
-
- webserviceCombobox.setSelectedItem(null); //if this isn't there,
it
- // will not trigger a new MetadataKeyRequest for an but the first
MP
- webserviceCombobox.setSelectedIndex(j);
- /*try {
- Thread.sleep(1000);
- } catch (InterruptedException interruptedException) {
- }*/
-
- //System.out.println("[LookingGlassMainPanel] Next MP Selected.
MP: " + webserviceCombobox.getSelectedItem());
-
- while (busy) {
- try {
- //System.out.println("[LookingGlassMainPanel] Still busy
updating the metadata for this MP");
- Thread.sleep(1000);
- } catch (InterruptedException interruptedException) {
+ //System.out.println("[LookingGlassMainPanel] Number of MPs
to contact: " + webserviceCombobox.getItemCount());
+ for (int j = 0; j < webserviceCombobox.getItemCount(); j++) {
+ busy = true;
+ //System.out.println("[LookingGlassMainPanel] Selecting
next MP...");
+
+ //webserviceCombobox.setSelectedItem(null); //if this
isn't there, it
+ // will not trigger a new MetadataKeyRequest for an but
the first MP
+
webserviceCombobox.setSelectedIndex(-1);webserviceCombobox.setSelectedIndex(j);
+ /*try {
+ Thread.sleep(1000);
+ } catch (InterruptedException interruptedException) {
+ }*/
+
+ //System.out.println("[LookingGlassMainPanel] Next MP
Selected. MP: " + webserviceCombobox.getSelectedItem());
+
+ while (busy) {
+ try {
+ //System.out.println("[LookingGlassMainPanel]
Still busy updating the metadata for this MP");
+ Thread.sleep(1000);
+ } catch (InterruptedException interruptedException) {
+ }
+ }
+
+ //System.out.println("[LookingGlassMainPanel] Number of
devices for this MP: " + deviceCombobox.getItemCount());
+
+ for (int i = 0; i < deviceCombobox.getItemCount(); i++) {
+ if (!deviceListModel.contains(new
MPDevicePair((LGEndpoint) webserviceCombobox.getSelectedItem(), (String)
deviceCombobox.getItemAt(i)))) {
+ MPDevicePair endpoint = new
MPDevicePair((LGEndpoint) webserviceCombobox.getSelectedItem(), (String)
deviceCombobox.getItemAt(i));
+ deviceListModel.addElement(endpoint);
+ //model.addSelectedEndpoint(endpoint);
+ }
+ }
+
+ //System.out.println("[LookingGlassMainPanel] Device
Added.");
+
}
- }
-
- //System.out.println("[LookingGlassMainPanel] Number of devices
for this MP: " + deviceCombobox.getItemCount());
-
- for (int i = 0; i < deviceCombobox.getItemCount(); i++) {
- if (!deviceListModel.contains(new MPDevicePair((LGEndpoint)
webserviceCombobox.getSelectedItem(), (String) deviceCombobox.getItemAt(i))))
{
- MPDevicePair endpoint = new MPDevicePair((LGEndpoint)
webserviceCombobox.getSelectedItem(), (String) deviceCombobox.getItemAt(i));
- deviceListModel.addElement(endpoint);
- //model.addSelectedEndpoint(endpoint);
- }
- }
-
- //System.out.println("[LookingGlassMainPanel] Device Added.");
-
- }
-
- deviceCombobox.setSelectedIndex(0);
- removeDeviceButton.setEnabled(true);
- if (importExportEnabled)
- exportButton.setEnabled(true);
+
+ deviceCombobox.setSelectedIndex(0);
+ removeDeviceButton.setEnabled(true);
+ clearButton.setEnabled(true);
+ if (importExportEnabled)
+ exportButton.setEnabled(true);
+
}
public void addAllDevicesActionPerformed(java.awt.event.ActionEvent evt)
{
@@ -996,16 +1006,16 @@
}
deviceCombobox.setSelectedIndex(0);
removeDeviceButton.setEnabled(true);
+ clearButton.setEnabled(true);
if (importExportEnabled)
exportButton.setEnabled(true);
+
}
public void radiobuttonClicked(boolean and) {
System.out.println(and ? "Enabling AND mode" : "Enabling OR mode");
functionComboboxModel.setAnd(and);
- this.and = and;
-
//if (deviceListModel.getAllElements() == null ||
deviceListModel.getAllElements().size() == 0)
functionComboboxModel.initComboBox(deviceComboboxModel.getAllElements());
//else
@@ -1021,6 +1031,7 @@
//model.clearSelectedEndpoints();
removeDeviceButton.setEnabled(false);
+ clearButton.setEnabled(false);
if (importExportEnabled)
exportButton.setEnabled(false);
}
@@ -1056,6 +1067,23 @@
}
}
+
+ public void fireMPModelChanged() {
+
+ addAllButton.setEnabled(webserviceCombobox.getItemCount() >
0);
+ addAllDevicesButton.setEnabled(false);
+
webserviceCombobox.setEnabled(webserviceCombobox.getItemCount() > 0);
+ webserviceCombobox.setSelectedIndex(-1);
+ //webserviceComboboxModel.removeAllElements();
+/* deviceComboboxModel.removeAllElements();
+ deviceListModel.clear();
+ functionComboboxModel.removeAllElements();*/
+
+ //da li je ovo dovoljno?
+ clear();
+
+ repaint();
+ }
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassTab.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassTab.java
2009-06-24 09:06:43 UTC (rev 5203)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassTab.java
2009-06-25 15:35:34 UTC (rev 5204)
@@ -26,17 +26,21 @@
import java.awt.Component;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.Vector;
import javax.swing.JComponent;
+import javax.swing.JDialog;
import org.perfsonar.perfsonarui.IPerfsonarSchema;
import org.perfsonar.perfsonarui.PSException;
import org.perfsonar.perfsonarui.PerfsonarSchema;
import org.perfsonar.perfsonarui.SmartMARequest;
import org.perfsonar.perfsonarui.lookingglass.model.WebservicesModel;
+import org.perfsonar.perfsonarui.lookingglass.model.WebservicesTableModel;
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
import org.perfsonar.perfsonarui.plugins.ITimeValueResponse;
@@ -46,6 +50,7 @@
import org.perfsonar.perfsonarui.ui.PluginMainPanel;
import org.perfsonar.perfsonarui.ui.actions.PSUIAction;
import org.perfsonar.perfsonarui.ui.actions.PerfsonarRequestAction;
+import org.perfsonar.perfsonarui.ui.actions.ShowEndpointsAction;
import org.perfsonar.perfsonarui.util.Collections;
@@ -56,13 +61,15 @@
public class LookingGlassTab extends PerfsonarModel {
private LookingGlassMainPanel panel;
+ private WebservicesTableModel tableModel;
- @Override
+
+ @Override
protected PerfsonarRequestAction createMetadataRequestAction() {
//the idea is to fill in dataList with entries coming from the
response. MetadataListResponseListener is responsible for processing the
request
- System.out.println("Endpoints: " + endpointList);
+
metadataRequestAction = new
MetadataKeyRequestAction(request,userData,dataList,null,"Meta data request");
metadataRequestAction.setGroup(IPerfsonarTab.defaultGroupHidden);
return metadataRequestAction;
@@ -77,10 +84,39 @@
}
@Override
- public PSUIAction createEndpointsAction(Set<String> eventTypes,
MAEndpointList endpointList) {
-
- return new LGShowEndpointsAction(endpointList, this);
- }
+ public PSUIAction createEndpointsAction(Set<String> eventTypes,
MAEndpointList endpointList) {
+
+// return new LGShowEndpointsAction(endpointList, this);
+ ShowEndpointsAction action = new
ShowEndpointsAction(eventTypes, endpointList, "LG Measurement Points");
+
+
action.putValue(ShowEndpointsAction.SHORT_DESCRIPTION,"Add/Remove Measurement
Points to be queried");
+
+ action.addListener(new ShowEndpointsAction.Listener() {
+
+ public void selectionChanged(Collection<MAEndpoint>
selected) {
+ //clear model
+/* tableModel.setRowCount(0);
+ for(int i = 0; i <
WebservicesModel.getNumberOfMPs(); i ++)
+ tableModel.removeRow(i);
+
+
+ for (MAEndpoint endpoint : selected) {
+ //System.out.println(endpoint);
+
+ Vector<String> data = new
Vector<String>();
+ data.add(endpoint.getTitle());
+ data.add(endpoint.getEndpoint());
+ tableModel.addRow(data);
+ }*/
+
+ //Add All MP's/Devices enabled ako ima MP-ova
kliknutih
+ tableModel.clearModelAddRows(selected/*,
LookingGlassTab.this.endpointList*/);
+ }
+
+ });
+ return action;
+
+ }
@Override
public PSUIAction createOptionsAction() {
@@ -104,16 +140,16 @@
@Override
public List<IPerfsonarSchema> getSupportedRequests() {
- ArrayList<IPerfsonarSchema> list = new ArrayList<IPerfsonarSchema>();
- list.add(PerfsonarSchema.getInstance("lg"));
- //this is the string appearing in MA.conf
- //is LG dealing with a single schema/service, or there is a need to
support more?
- return list;
+ ArrayList<IPerfsonarSchema> list = new
ArrayList<IPerfsonarSchema>();
+ list.add(PerfsonarSchema.getInstance("lg"));
+ //this is the string appearing in MA.conf
+ //is LG dealing with a single schema/service, or there is a
need to support more?
+ return list;
}
public PluginMainPanel createMainComponent(Component parentComponent) {
panel = new LookingGlassMainPanel(parentComponent, this);
-
+ tableModel = new WebservicesTableModel(this);
return panel;
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/MetadataKeyRequestAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/MetadataKeyRequestAction.java
2009-06-24 09:06:43 UTC (rev 5203)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/MetadataKeyRequestAction.java
2009-06-25 15:35:34 UTC (rev 5204)
@@ -127,6 +127,7 @@
//System.out.println("processingCompleted called");
}
};
+
request.makeRequest(userData,
IPerfsonarRequest.MA_MetadataKeyRequest, listener, false);
mae.setStatus("OK");
mae.setStatusExplanation("OK");
Deleted:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/LinkedWebserviceComboboxModel.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/WebservicesModel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/WebservicesModel.java
2009-06-24 09:06:43 UTC (rev 5203)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/WebservicesModel.java
2009-06-25 15:35:34 UTC (rev 5204)
@@ -79,7 +79,8 @@
if (first) {
- System.out.println("First pass --> initialise and fill
HashMap");
+ //System.out.println("First pass --> initialise and fill
HashMap");
+
webservicesMap = new HashMap<String, LGEndpoint>();
@@ -87,7 +88,7 @@
MAEndpoint mae = null;
while (i < endpoints.size()) {
mae = endpoints.get(i);
- if (mae.getEvent(0).equals("lg") && mae.isEnabled()) {
+ if (mae.getEvent().equals("lg") && mae.isEnabled()) {
webservicesMap.put(mae.getTitle(), new
LGEndpoint(mae));
System.out.println("Endpoint added to HashMap: " +
mae.getTitle() + " -- " + mae.getEndpoint());
}
@@ -317,4 +318,11 @@
index++;
endpoints.remove(index);
}
+
+ public void removeAllMPs() {
+ System.out.println("Clearing the model");
+ webservicesMap.clear();
+ //endpoints.clear();
+
+ }
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/WebservicesTableModel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/WebservicesTableModel.java
2009-06-24 09:06:43 UTC (rev 5203)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/WebservicesTableModel.java
2009-06-25 15:35:34 UTC (rev 5204)
@@ -9,9 +9,12 @@
package org.perfsonar.perfsonarui.lookingglass.model;
import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
import org.perfsonar.perfsonarui.lookingglass.LookingGlassTab;
+import org.perfsonar.perfsonarui.plugins.MAEndpoint;
/**
*
@@ -101,4 +104,21 @@
result.add("URL");
return result;
}
+
+ public void clearModelAddRows(Collection<MAEndpoint> selected){ //TODO
clear model here
+ //for (int i = 0; i < model.getNumberOfMPs(); i ++)
+ //model.removeMP(i);
+ model.removeAllMPs();
+
+ for (MAEndpoint endpoint : selected) {
+ Vector<String> data = new Vector<String>();
+ data.add(endpoint.getTitle());
+ data.add(endpoint.getEndpoint());
+
+ model.addMP(data);
+ }
+
+ fireTableDataChanged();
+ parentFrame.getMainPanel().fireMPModelChanged();
+ }
}
- perfsonar: r5204 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass: . model, svnlog, 06/25/2009
Archive powered by MHonArc 2.6.16.