perfsonar-dev - perfsonar: r5430 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass: . model
Subject: perfsonar development work
List archive
perfsonar: r5430 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass: . model
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5430 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass: . model
- Date: Wed, 23 Dec 2009 07:43:52 -0500
Author: rade
Date: 2009-12-23 07:43:52 -0500 (Wed, 23 Dec 2009)
New Revision: 5430
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/model/LookingGlassClientModel.java
Log:
RESOLVED - bug 737: Application freeze when choosing 'Add All MP's/Devices'
https://bugzilla.perfsonar.net/show_bug.cgi?id=737
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGRequest.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGRequest.java
2009-12-23 10:26:07 UTC (rev 5429)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGRequest.java
2009-12-23 12:43:52 UTC (rev 5430)
@@ -252,7 +252,7 @@
}
} catch (Exception e) {
- e.printStackTrace();
+ //e.printStackTrace();
if (!isInterrupted()) {
logger.error("request exception");
if (queries != null) {
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassMainPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassMainPanel.java
2009-12-23 10:26:07 UTC (rev 5429)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassMainPanel.java
2009-12-23 12:43:52 UTC (rev 5430)
@@ -19,7 +19,6 @@
*/
package org.perfsonar.perfsonarui.lookingglass;
-import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.io.File;
@@ -28,10 +27,12 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
+
import javax.swing.Action;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
@@ -39,11 +40,13 @@
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
+
import org.perfsonar.base.exceptions.PerfSONARException;
import org.perfsonar.perfsonarui.lookingglass.model.Command;
import org.perfsonar.perfsonarui.lookingglass.model.DeviceComboboxModel;
@@ -55,7 +58,6 @@
import org.perfsonar.perfsonarui.lookingglass.model.WebserviceComboboxModel;
import org.perfsonar.perfsonarui.lookingglass.model.WebservicesModel;
import org.perfsonar.perfsonarui.lookingglass.support.TextHighlighter;
-
import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
import org.perfsonar.perfsonarui.ui.PluginMainPanel;
import org.perfsonar.perfsonarui.ui.actions.PSActionMap;
@@ -112,7 +114,6 @@
private javax.swing.JTextField searchTextField;
private LookingGlassClientModel model;
private WebserviceComboboxModel webserviceComboboxModel;
- private boolean busy = false;
private ChangeEvent changeEvent;
private DeviceComboboxModel deviceComboboxModel;
private FunctionComboboxModel functionComboboxModel;
@@ -574,51 +575,47 @@
**/
public void webserviceComboboxActionperformedHandler(Document response) {
- System.out.println("[LookingGlassMainPanel] Response caught, updating
model...");
+ System.out.println("[LookingGlassMainPanel] Response caught,
updating model...");
+
+ try {
+ this.deviceCombobox.removeAllItems();
+ this.deviceComboboxModel.removeAllElements();
+ this.functionCombobox.removeAllItems();
+ this.functionComboboxModel.removeAllElements();
+ this.deviceCombobox.setEnabled(false);
+ this.functionCombobox.setEnabled(false);
+
+ System.out.println("adding metadata");
+
model.addMetadataForCurrentMP((LGEndpoint)webserviceCombobox.getSelectedItem(),response);
+
+ System.out.println("initiating combobox");
+
deviceComboboxModel.initComboBox(this.webserviceCombobox.getSelectedItem());
+
+ System.out.println("setting selected item");
+ deviceCombobox.setSelectedIndex(0);
+
+ parameterStringTextField.setText("");
+ //this.parameterStringTextField.setEnabled(true);
+ this.deviceCombobox.setEnabled(true);
+ this.functionCombobox.setEnabled(true);
+
+ } catch (PerfSONARException ex) {
+ System.out.println("Perfsonar exception caught");
+ javax.swing.JOptionPane.showMessageDialog(this,
ex.getResultDescription(), "Error!", javax.swing.JOptionPane.ERROR_MESSAGE);
- busy = true;
+ //ex.printStackTrace();
+ } catch (Exception ex) {
+ System.out.println("exception caught");
+ javax.swing.JOptionPane.showMessageDialog(this, "An error
occured while getting\n" +
+ "the metadata from the Measurement Point",
"Error!", javax.swing.JOptionPane.ERROR_MESSAGE);
- try {
- this.deviceCombobox.removeAllItems();
- this.deviceComboboxModel.removeAllElements();
- this.functionCombobox.removeAllItems();
- this.functionComboboxModel.removeAllElements();
- this.deviceCombobox.setEnabled(false);
- this.functionCombobox.setEnabled(false);
-
- System.out.println("adding metadata");
-
model.addMetadataForCurrentMP((LGEndpoint)webserviceCombobox.getSelectedItem(),response);
-
- System.out.println("initiating combobox");
-
deviceComboboxModel.initComboBox(this.webserviceCombobox.getSelectedItem());
-
- System.out.println("setting selected item");
- deviceCombobox.setSelectedIndex(0);
-
- parameterStringTextField.setText("");
- //this.parameterStringTextField.setEnabled(true);
- this.deviceCombobox.setEnabled(true);
- this.functionCombobox.setEnabled(true);
-
- } catch (PerfSONARException ex) {
- System.out.println("Perfsonar exception caught");
- javax.swing.JOptionPane.showMessageDialog(this,
ex.getResultDescription(), "Error!", javax.swing.JOptionPane.ERROR_MESSAGE);
-
- //ex.printStackTrace();
- } catch (Exception ex) {
- System.out.println("exception caught");
- javax.swing.JOptionPane.showMessageDialog(this, "An error occured
while getting\n" +
- "the metadata from the Measurement Point", "Error!",
javax.swing.JOptionPane.ERROR_MESSAGE);
-
- //ex.printStackTrace();
- }
+ //ex.printStackTrace();
+ }
+
+ if (deviceCombobox.getItemCount() != 0) {
+ addAllDevicesButton.setEnabled(true);
+ }
- if (deviceCombobox.getItemCount() != 0) {
- addAllDevicesButton.setEnabled(true);
- }
-
- busy = false;
-
//System.out.println("[LookingGlassMainPanel] Model updated.");
}
@@ -651,7 +648,8 @@
functionComboboxModel.initComboBox(devices);
}
functionCombobox.setEnabled(true);
- functionCombobox.setSelectedIndex(0);
+ if (functionCombobox.getItemCount() > 0)
+ functionCombobox.setSelectedIndex(0);
addDeviceButton.setEnabled(true);
addAllDevicesButton.setEnabled(true);
@@ -952,47 +950,37 @@
public void
addAllDevicesAndMPsActionPerformed(java.awt.event.ActionEvent evt){
//System.out.println("[LookingGlassMainPanel] Number of MPs
to contact: " + webserviceCombobox.getItemCount());
+ final MetadataKeyRequestAction getDevicesAction =
(MetadataKeyRequestAction) super.model.getActions().get("0");
+ final Action oldAction = webserviceCombobox.getAction();
+ webserviceCombobox.setAction(null);
+// deviceCombobox.setEnabled(false);
+// deviceList.setEnabled(false);
+
for (int j = 0; j < webserviceCombobox.getItemCount(); j++) {
- busy = true;
- //System.out.println("[LookingGlassMainPanel] Selecting
next MP...");
+ webserviceCombobox.setSelectedIndex(j);
+ getDevicesAction.run(null);
- //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.");
-
}
- deviceCombobox.setSelectedIndex(0);
+ //clean up
+ System.out.println("All done!!!");
+
+ getDevicesAction.restoreName();
+// deviceCombobox.setEnabled(false);
+// deviceList.setEnabled(false);
+ if(deviceCombobox.getItemCount() > 0)
+ deviceCombobox.setSelectedIndex(0);
removeDeviceButton.setEnabled(true);
clearButton.setEnabled(true);
if (importExportEnabled)
exportButton.setEnabled(true);
+ webserviceCombobox.setAction(oldAction);
}
@@ -1027,45 +1015,35 @@
}
public void clearDeviceListActionPerformed(java.awt.event.ActionEvent
evt) {
- deviceListModel.clear();
- //model.clearSelectedEndpoints();
-
- removeDeviceButton.setEnabled(false);
- clearButton.setEnabled(false);
- if (importExportEnabled)
- exportButton.setEnabled(false);
+ deviceListModel.clear();
+ //model.clearSelectedEndpoints();
+
+ removeDeviceButton.setEnabled(false);
+ clearButton.setEnabled(false);
+ if (importExportEnabled)
+ exportButton.setEnabled(false);
}
-
- public void setBusy(boolean busy){
- this.busy = busy;
- }
/**
* Housekeeping code for ChangeListeners
**/
public void addChangeListener(ChangeListener l) {
-
- listenerList.add(ChangeListener.class, l);
-
+ listenerList.add(ChangeListener.class, l);
}
public void removeChangeListener(ChangeListener l) {
-
- listenerList.remove(ChangeListener.class, l);
-
+ listenerList.remove(ChangeListener.class, l);
}
public void fireStateChanged() {
-
- Object[] listeners = listenerList.getListenerList();
- for (int i = listeners.length - 2; i >= 0; i -= 2) {
-
- if (listeners[i] == ChangeListener.class) {
- ((ChangeListener) listeners[i + 1]).stateChanged(changeEvent);
- }
-
- }
-
+
+ Object[] listeners = listenerList.getListenerList();
+ for (int i = listeners.length - 2; i >= 0; i -= 2) {
+
+ if (listeners[i] == ChangeListener.class) {
+ ((ChangeListener) listeners[i +
1]).stateChanged(changeEvent);
+ }
+ }
}
public void fireMPModelChanged() {
@@ -1079,9 +1057,8 @@
deviceListModel.clear();
functionComboboxModel.removeAllElements();*/
- //da li je ovo dovoljno?
- clear();
-
+ //why am I doing the following???
+ clear();
repaint();
}
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassTab.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassTab.java
2009-12-23 10:26:07 UTC (rev 5429)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassTab.java
2009-12-23 12:43:52 UTC (rev 5430)
@@ -109,7 +109,7 @@
tableModel.addRow(data);
}*/
- //Add All MP's/Devices enabled ako ima MP-ova
kliknutih
+ //Add All MP's/Devices
tableModel.clearModelAddRows(selected/*,
LookingGlassTab.this.endpointList*/);
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/LookingGlassClientModel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/LookingGlassClientModel.java
2009-12-23 10:26:07 UTC (rev 5429)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/model/LookingGlassClientModel.java
2009-12-23 12:43:52 UTC (rev 5430)
@@ -507,6 +507,8 @@
public Vector getFunctions(MPDevicePair pair) {
Vector v = commands.get(pair);
+ if (v == null)
+ v = new Vector();
System.out.println("[LookingGlassClientModel] getFunctions(" + pair +
") -> returns " + v.size() + " elements");
return v;
}
- perfsonar: r5430 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass: . model, svnlog, 12/23/2009
Archive powered by MHonArc 2.6.16.