perfsonar-dev - perfsonar: r4664 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . bwctl demo flowsa ls ma playground plugins ui ui/actions ui/panels
Subject: perfsonar development work
List archive
perfsonar: r4664 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . bwctl demo flowsa ls ma playground plugins ui ui/actions ui/panels
Chronological Thread
- From:
- To:
- Subject: perfsonar: r4664 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . bwctl demo flowsa ls ma playground plugins ui ui/actions ui/panels
- Date: Thu, 23 Oct 2008 19:15:06 -0400
Author: michael.bischoff
Date: 2008-10-23 19:15:06 -0400 (Thu, 23 Oct 2008)
New Revision: 4664
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractMARequest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLPerfsonarTab.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/DemoPlugin.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMATab.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSEndpointsPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MAPerfsonarModel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/playground/PerfsonarPlaygroundModel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IPerfsonarTab.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/EchoAction.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/EndpointsAction.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/PSActionMap.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/PSUIAction.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/SelectOneEndpointAction.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ShowEndpointsAction.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/MAEndpointsPanel.java
Log:
Improving ShowendpointsList
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractMARequest.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractMARequest.java
2008-10-23 11:58:14 UTC (rev 4663)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractMARequest.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -364,11 +364,10 @@
else
fireAxisCallException(query, e);
}
- }
- query.setServiceTime(System.currentTimeMillis()-startTime);
- queries = null;
-
-
+ } finally {
+ query.setServiceTime(System.currentTimeMillis()-startTime);
+ queries = null;
+ }
}
public SOAPEnvelope prepareEnvelope(javax.xml.soap.SOAPBodyElement
soapbodyelement) throws PSException {
return null;
@@ -422,6 +421,7 @@
for (int i=0; i < listeners.length; i++)
removePropertyChangeListener(listeners[i]);
//setRunning(false);
+ //TODO use Thread.interrupt() to signal
}
public void setInterrupted(boolean interrupted) {
this.interrupted = interrupted;
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLPerfsonarTab.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLPerfsonarTab.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLPerfsonarTab.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -1,8 +1,8 @@
package org.perfsonar.perfsonarui.bwctl;
import java.awt.Component;
-import java.awt.event.ActionEvent;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import org.perfsonar.perfsonarui.AbstractUserData;
@@ -11,7 +11,6 @@
import org.perfsonar.perfsonarui.PerfsonarSchema;
import org.perfsonar.perfsonarui.SmartMARequest;
import org.perfsonar.perfsonarui.UnsupportedTypeException;
-import org.perfsonar.perfsonarui.lookingglass.MetadataKeyRequestAction;
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
@@ -126,26 +125,24 @@
* Override in order not to create a default Options button.
*/
public PSUIAction createOptionsAction() {
- return new ShowEndpointsAction(getDestinations(),
- "BWCTL Destination")
- {
- public void actionPerformed(ActionEvent arg0)
- {
- super.actionPerformed(arg0);
+ ShowEndpointsAction action = new
ShowEndpointsAction(getDestinations(),"BWCTL Destination");
+ action.addListener(new ShowEndpointsAction.Listener() {
+
+ public void actionFinished(Collection<MAEndpoint>
selected) {
pane.updateDestination();
- }
- };
+ }
+ });
+ return action;
}
public PSUIAction createEndpointsAction(MAEndpointList endpointList)
{
- return new ShowEndpointsAction(endpointList, "BWCTL
MP/Source")
- {
- public void actionPerformed(ActionEvent arg0)
- {
- super.actionPerformed(arg0);
+ ShowEndpointsAction action = new
ShowEndpointsAction(endpointList, "BWCTL MP/Source");
+ action.addListener(new ShowEndpointsAction.Listener() {
+ public void actionFinished(Collection<MAEndpoint>
selected) {
pane.updateSource();
- }
- };
+ }
+ });
+ return action;
}
public MAEndpointList getDestinations()
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/DemoPlugin.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/DemoPlugin.java
2008-10-23 11:58:14 UTC (rev 4663)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/DemoPlugin.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -22,6 +22,7 @@
import java.awt.Component;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import javax.swing.JComponent;
@@ -55,6 +56,7 @@
import org.perfsonar.perfsonarui.ui.actions.PerfsonarRequestAction;
import org.perfsonar.perfsonarui.ui.actions.SelectOneEndpointAction;
import org.perfsonar.perfsonarui.ui.actions.SetupDataRequestAction;
+import org.perfsonar.perfsonarui.ui.actions.ShowEndpointsAction;
import org.perfsonar.perfsonarui.ui.panels.InterfaceUtilizationSeries;
import org.perfsonar.perfsonarui.ui.panels.PerfsonarTimeSeriesDataset;
@@ -96,16 +98,18 @@
@Override
public PSUIAction createEndpointsAction(MAEndpointList endpointList) {
- return new SelectOneEndpointAction(endpointList) {
- public void
actionPerformed(java.awt.event.ActionEvent arg0) {
- super.actionPerformed(arg0);
- for (int i=0; i < endpoints.size();i++)
- if (endpoints.get(i).isEnabled()) {
-
userData.setEndpoint(endpoints.get(i));
+ SelectOneEndpointAction action = new
SelectOneEndpointAction(endpointList);
+ action.addListener(new ShowEndpointsAction.Listener() {
+ public void actionFinished(Collection<MAEndpoint>
selected) {
+ for (MAEndpoint point : selected) {
+ if (point.isEnabled()) {
+ userData.setEndpoint(point);
break;
}
- };
- };
+ }
+ }
+ });
+ return action;
}
@Override
/**
@@ -119,7 +123,7 @@
new JPanel() {
public String toString() {return
"Options panel 2 ";};
},
- };
+ };
}
@Override
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMATab.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMATab.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMATab.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -24,6 +24,7 @@
import java.awt.Component;
import java.io.File;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import javax.swing.JComponent;
@@ -42,6 +43,7 @@
import org.perfsonar.perfsonarui.ui.actions.PerfsonarRequestAction;
import org.perfsonar.perfsonarui.ui.actions.SelectOneEndpointAction;
import org.perfsonar.perfsonarui.ui.actions.SetOptionsAction;
+import org.perfsonar.perfsonarui.ui.actions.ShowEndpointsAction;
import org.perfsonar.perfsonarui.ui.panels.UserDataDetailsPane;
/**
@@ -110,20 +112,18 @@
*/
@Override
public PSUIAction createEndpointsAction(MAEndpointList list) {
- return new SelectOneEndpointAction(list) {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void
actionPerformed(java.awt.event.ActionEvent event) {
- super.actionPerformed(event);
- for (int i=0; i < endpoints.size();i++) {
- if (endpoints.get(i).isEnabled()) {
- setEndpoint(endpoints.get(i));
+ SelectOneEndpointAction action = new
SelectOneEndpointAction(list);
+ action.addListener(new ShowEndpointsAction.Listener() {
+ public void actionFinished(Collection<MAEndpoint>
selected) {
+ for(MAEndpoint point : selected) {
+ if (point.isEnabled()) {
+ setEndpoint(point);
return;
}
}
- }
- };
+ }
+ });
+ return action;
}
/* (non-Javadoc)
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSEndpointsPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSEndpointsPanel.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSEndpointsPanel.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -83,6 +83,8 @@
private Set<Entry> values = new HashSet<Entry>();
private List<TableModelListener> listeners = new
CopyOnWriteArrayList<TableModelListener>();
private String currentFilter;
+ private Entry lastSelected;
+ private boolean singleSelection;
public void addTableModelListener(TableModelListener l) {
listeners.add(l);
@@ -129,7 +131,17 @@
public void setValueAt(Object value, int rowIndex, int
columnIndex) {
if(columnIndex==0) {
+ if(singleSelection && lastSelected!=null)
lastSelected.use = false;
view[rowIndex].use =
Boolean.TRUE.equals(value);
+ if(singleSelection) {
+ for(int i = 0; i< view.length;i++) {
+ if(view[i] == lastSelected) {
+ fireTableChanged(i,
i);
+ break;
+ }
+ }
+ lastSelected = view[rowIndex];
+ }
return;
}
throw new UnsupportedOperationException("columnIndex
= "+ columnIndex);
@@ -173,15 +185,20 @@
}
fireTableChanged();
}
+
+ public void setCanSelectOnlyOne(boolean canSelectOnlyOne) {
+ this.singleSelection = canSelectOnlyOne;
+ }
}
private static final long serialVersionUID = 1L;
private final LookupProcess process = new LookupProcess();
private final LsEndpointsModel myModel = new LsEndpointsModel();
- public LSEndpointsPanel() {
+ public LSEndpointsPanel(boolean canSelectOnlyOne) {
JComponent endpointList = createEndpointList(myModel);
- JComponent toolbar = createToolBar(myModel);
+ JComponent toolbar = createToolBar(myModel);
+ myModel.setCanSelectOnlyOne(canSelectOnlyOne);
decorate();
setLayout(createLayoutManager(endpointList,toolbar));
}
@@ -264,6 +281,7 @@
HORIZONTAL_SCROLLBAR_NEVER
)
);
+ table.setSelectionBackground(table.getBackground());
busyAwareComponent.setBorder(BorderFactory.createEtchedBorder());
process.addProcessListener(new
LookupProcess.ProcessListener() {
public void onStart() {
@@ -280,6 +298,7 @@
busyAwareComponent.setBusy(true,"Discovering:");
}
public void onNewResult(Set<Service> result) {
+ if(result.isEmpty()) return;
busyAwareComponent.setDiscrete(true);
myModel.add(result);
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MAPerfsonarModel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MAPerfsonarModel.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MAPerfsonarModel.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -107,7 +107,8 @@
protected String tracerouteURL="https://noc-mon.srce.hr/visual_perf/";
protected TracerouteShell tracerouteShell;
protected TracerouteAction traceAction;
-
+ protected PSUIAction dataRequestActionAll;
+ protected PerfsonarRequestAction searchAction;
protected ArrayList<Metric> metrics;
public TracerouteAction getTraceAction() {
@@ -187,11 +188,11 @@
actions.put(populate);
populate.setActions(actions);
- metadataRequestAction = new
SetupDataRetrieveAllAction(request,(UserData)userData,dataList,endpointList);
- metadataRequestAction.setOrderInGroup(4);
-
metadataRequestAction.setGroup(IPerfsonarTab.defaultGroupQuery);
+ SetupDataRetrieveAllAction action = new
SetupDataRetrieveAllAction(request,(UserData)userData,dataList,endpointList);
+ action.setOrderInGroup(4);
+ action.setGroup(IPerfsonarTab.defaultGroupQuery);
//actions.put(metadataRequestAction.getValue(Action.NAME),metadataRequestAction);
- return metadataRequestAction;
+ return action;
}
@Override
@@ -259,18 +260,9 @@
return dataRequestAction;
}
@Override
- public void setDataRequestAction(PerfsonarRequestAction
dataRequestAction) {
- this.dataRequestAction = dataRequestAction;
- }
- @Override
public PerfsonarRequestAction getMetadataRequestAction() {
return metadataRequestAction;
}
- @Override
- public void setMetadataRequestAction(PerfsonarRequestAction
metadataRequestAction) {
- this.metadataRequestAction = metadataRequestAction;
- }
-
public synchronized PerfsonarRequestAction getSearchAction() {
return searchAction;
}
@@ -308,7 +300,7 @@
super.clear();
getTracerouteShell().clear();
}
- public synchronized Vector updateSearchList(Document text) {
+ public synchronized Vector<String> updateSearchList(Document text) {
searchText.clear();
Document d = text.getDefaultRootElement().getDocument();
@@ -320,11 +312,10 @@
if (p ==-1) {
getIpFromLine(s.substring(pos));
break;
- } else {
- getIpFromLine(s.substring(pos,p));
- //searchText.add(s.substring(pos,p));
- pos = p+1;
}
+ getIpFromLine(s.substring(pos,p));
+ //searchText.add(s.substring(pos,p));
+ pos = p+1;
}
} catch (Exception x) {
logger.error(x);
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/playground/PerfsonarPlaygroundModel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/playground/PerfsonarPlaygroundModel.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/playground/PerfsonarPlaygroundModel.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -21,12 +21,10 @@
package org.perfsonar.perfsonarui.playground;
import java.awt.Component;
-import java.awt.event.ActionEvent;
import java.io.File;
+import java.util.Collection;
import java.util.List;
-import javax.swing.JComponent;
-
import org.perfsonar.perfsonarui.AbstractUserData;
import org.perfsonar.perfsonarui.IPerfsonarSchema;
import org.perfsonar.perfsonarui.SmartMARequest;
@@ -44,7 +42,7 @@
import org.perfsonar.perfsonarui.ui.actions.PSUIAction;
import org.perfsonar.perfsonarui.ui.actions.PerfsonarRequestAction;
import org.perfsonar.perfsonarui.ui.actions.SelectOneEndpointAction;
-import org.perfsonar.perfsonarui.ui.panels.RequestOptionsPanel;
+import org.perfsonar.perfsonarui.ui.actions.ShowEndpointsAction;
/**
* Simple instance of
{@link
IPerfsonarTab}.
@@ -79,17 +77,20 @@
}
@Override
public PSUIAction createEndpointsAction(MAEndpointList endpointList) {
- return new SelectOneEndpointAction(endpointList) {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- super.actionPerformed(arg0);
- for (int i=0; i < endpoints.size();i++)
- if (endpoints.get(i).isEnabled()) {
- userData.setEndpoint(endpoints.get(i));
- break;
- }
- }
- };
+ SelectOneEndpointAction action = new
SelectOneEndpointAction(endpointList);
+ action.addListener(new ShowEndpointsAction.Listener() {
+ public void actionFinished(Collection<MAEndpoint>
selected) {
+ for(MAEndpoint point : selected) {
+ if(point.isEnabled()) {
+ if(point.isEnabled()) {
+ userData.setEndpoint(point);
+ break;
+ }
+ }
+ }
+ }
+ });
+ return action;
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IPerfsonarTab.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IPerfsonarTab.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IPerfsonarTab.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -80,11 +80,6 @@
*/
public abstract MAEndpointList getEndpointList();
/**
- * Sets the list of services.
- * @param endpointList
- */
- public abstract void setEndpointList(MAEndpointList endpointList);
- /**
* A list of
{@link
IUserData} which is filled in from the response of the MetadataQuery.
* @return
*/
@@ -134,12 +129,6 @@
*/
public SmartMARequest getRequest();
/**
- * The class that actually will send requests.
- * @param request
- */
- public void setRequest(SmartMARequest request);
-
- /**
* Clears everything
*
*/
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
2008-10-23 11:58:14 UTC (rev 4663)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -24,12 +24,16 @@
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Observable;
import java.util.ResourceBundle;
+import java.util.Set;
import java.util.Vector;
+import java.util.concurrent.CopyOnWriteArraySet;
import javax.swing.Action;
import javax.swing.JComponent;
@@ -69,7 +73,6 @@
import org.perfsonar.perfsonarui.ui.actions.ShowEndpointsAction;
import org.perfsonar.perfsonarui.ui.panels.RequestOptionsPanel;
-
/**
* The base implementation of
{@link
IPerfsonarTab}. The descendant should implement:
* <ul>
@@ -111,10 +114,9 @@
* @author Nina Jeliazkova
*/
public abstract class PerfsonarModel extends Observable implements
IPerfsonarTab {
- protected ResourceBundle resourceBundle;
- protected static PSLogger logger = new PSLogger(PerfsonarModel.class);
- public SmartMARequest request = null;
- public static long timeIntervals[] = { //seconds
+ protected final static PSLogger logger = new
PSLogger(PerfsonarModel.class);
+
+ public final static long timeIntervals[] = { //seconds
15*60, //15 min
90*60, //90 min
8*60*60, //8h
@@ -126,7 +128,7 @@
12*30*24*60*60, //1 year
24*30*24*60*60 //2 year
};
- public static int timeResolution[] = { //seconds
+ public final static int timeResolution[] = { //seconds
300, //90 min
300, //90 min
300, //8h
@@ -137,8 +139,7 @@
3*600, //3 months
2*60*60 //1 year 2 h
};
-
- public static String timeIntervalsTitle[] = { //seconds
+ public final static String timeIntervalsTitle[] = { //seconds
"Last 15 min",
"Last 90 min",
"Last 8 hours",
@@ -150,33 +151,30 @@
"Last year",
"Last 2 years"
};
- protected static int statsIndex[] = {0,2,4,5,7};
+
+ protected final static int statsIndex[] = {0,2,4,5,7};
+ protected final SmartMARequest request;
+
+ protected ResourceBundle resourceBundle;
+
//data
- protected MAEndpointList endpointList;
protected IUserData userData;
protected ITimeValueResponse responseData;
protected MetaDataList dataList;
protected MetaDataList searchList;
- protected Vector<String> searchText;
-
+ protected Vector<String> searchText;
+ protected Set<MAEndpoint> selectedEndPoints = Collections.emptySet();
+ protected MAEndpointList endpointList;
+
//actions
- protected PSActionMap actions = null;
- protected PSUIAction endpointsAction;
+ protected PSActionMap actions;
protected PerfsonarRequestAction dataRequestAction;
+ protected PSUIAction endpointsAction;
+ protected PSUIAction optionsAction;
protected PerfsonarRequestAction metadataRequestAction;
- protected PSUIAction dataRequestActionAll;
protected PSUIAction clearAction;
- protected PSUIAction optionsAction;
- protected PerfsonarRequestAction searchAction;
-
+
/**
- * Will use
{@link
#createEndpoints()} method to get endpoints.
- *
- */
- public PerfsonarModel() {
- this(null);
- }
- /**
* Constructor. Calls
* <ol>
*
<li>{@link
#createSmartRequest()},
@@ -188,17 +186,23 @@
*
<li>{@link
#createEndpointsAction},
*
<li>{@link
#createClearAction}
* </ul>
+ * Will use
{@link
#createEndpoints()} method to get endpoints.
+ *
+ */
+ public PerfsonarModel() {
+ this(null);
+ }
+ /**
+
*
* @param endpoints
- * @param responseData
- * @param userData
*/
public PerfsonarModel(MAEndpointList endpoints) {
super();
- resourceBundle = createResourceBundle();
- request = createSmartRequest();
+ this.resourceBundle = createResourceBundle();
+ this.request = createSmartRequest();
this.responseData = createTimeValueResponseListener();
- searchText = new Vector<String>();
+ this.searchText = new Vector<String>();
if (endpoints == null) this.endpointList = createEndpoints();
else this.endpointList = endpoints;
@@ -207,6 +211,7 @@
//endpointList.add(new
MAEndpoint("http://archive.sonar.net.switch.ch:8090"));
endpointList.add(new
MAEndpoint("http://selena.acad.bg:8090"));
}
+
IUserDataComparator comparator = createComparator();
dataList = createDataList(comparator);
@@ -244,43 +249,8 @@
clearAction.setActions(actions);
}
+
/**
- * Creates ResourceBundle from
"org.perfsonar.perfsonarui.your_class.ResourceBundle.properties".<br>
- * If that file does not exist, loads
"org.perfsonar.perfsonarui.ResourceBundle.properties"
- * @return
- */
- protected ResourceBundle createResourceBundle() {
- try {
- String resource = getClass().getName();
- int p = resource.lastIndexOf('.');
- if (p > -1) resource = resource.substring(0,p+1) +
"ResourceBundle";
- logger.info("Loaded resources from "+resource);
- return ResourceBundle.getBundle(resource,Locale.getDefault());
- } catch (Exception x) {
- //logger.warn(x.getMessage());
- logger.info("Fall back: loading resources from
org.perfsonar.perfsonarui.ResourceBundle");
- return
ResourceBundle.getBundle("org.perfsonar.perfsonarui.ResourceBundle",new
Locale("EN"));
- }
- }
- public IUserData createUserData() {
- return new AbstractUserData();
- }
- /**
- * Will be used by default in
{@link
SetupDataRequestAction}}
- * @return
- */
- public ITimeValueResponse createTimeValueResponseListener() {
- return new ResponseData();
- }
- /**
- * Creates new (@link MAEndpointList} with supported services set by
{@link
#getSupportedRequests()}.
- * @return
- */
- public MAEndpointList createEndpoints() {
- if (endpointList == null) return new
MAEndpointList(getMAconf("MA.conf"),getSupportedRequests());
- else return endpointList;
- }
- /**
* Returns List<IPerfsonarSchema> of supported perfsonar schemas.
This is used to filter available endpoints and to load only those entries
that are going to be supported
* <br>
* (e.g.
{@link
MAPerfsonarModel} will load only
{@link
MAEndpoint}s where
{@link
MAEndpoint#getSchema()} is within the supported schemas).<br>
@@ -295,179 +265,101 @@
*/
public abstract List<IPerfsonarSchema> getSupportedRequests();
- public static File getMAconf(String filename) {
- try {
- return new File(filename);
- } catch (Exception x) {
- return null;
- }
+ public void setSelectedEndpoints(Collection<MAEndpoint> endPoints) {
+ selectedEndPoints = Collections.unmodifiableSet(new
CopyOnWriteArraySet<MAEndpoint>(endPoints));
}
- protected abstract SmartMARequest createSmartRequest();
- protected abstract PerfsonarRequestAction
createMetadataRequestAction();
+
+ public void clear() {
+ dataList.clear();
+ userData.clear();
+ searchList.clear();
+ searchText.clear();
+ }
+
+ public int compareTo(IPerfsonarTab arg0) {
+ return getOrder() - arg0.getOrder();
+ }
+
+ public PSUIAction createClearAction() {
+ return new ClearAction(this,defaultGroupQuery);
+ }
+ public PerfsonarRequestAction createDataRequestAction() {
+ return new
SetupDataRequestAction(request,userData,responseData,"Query",null,defaultGroupQuery);
+ }
- protected IUserDataComparator createComparator() {
+ public JComponent[] createDetailsComponent(Component parentComponent)
{
return null;
}
- protected MetaDataList createDataList(IUserDataComparator comparator)
{
- return new MetaDataList(comparator);
+
+ /**
+ * Creates new (@link MAEndpointList} with supported services set by
{@link
#getSupportedRequests()}.
+ * @return
+ */
+ public MAEndpointList createEndpoints() {
+ if (endpointList == null) return new
MAEndpointList(getMAconf("MA.conf"),getSupportedRequests());
+ else return endpointList;
}
+
public PSUIAction createEndpointsAction(MAEndpointList endpointList) {
return new ShowEndpointsAction(endpointList);
}
+
public PSUIAction createOptionsAction() {
return new SetOptionsAction(this);
- }
-
- public PSUIAction createClearAction() {
- return new ClearAction(this,defaultGroupQuery);
- }
- public PerfsonarRequestAction createDataRequestAction() {
- return new
SetupDataRequestAction(request,userData,responseData,"Query",null,defaultGroupQuery);
}
- public void update(Observable arg0, Object arg1) {
-
-
+ public JComponent[] createOptionsComponent(Component parentComponent)
{
+ return new JComponent[]{new RequestOptionsPanel(this)};
}
- public IUserData getUserData() {
- return userData;
- }
- public void setUserData(int index) {
- if ((index >=0) && (index < dataList.size())) {
- this.userData.assign(dataList.get(index));
- }
- }
- public void setUserData(IUserData userData) {
- this.userData = userData;
+ /**
+ * Will be used by default in
{@link
SetupDataRequestAction}}
+ * @return
+ */
+ public ITimeValueResponse createTimeValueResponseListener() {
+ return new ResponseData();
}
- public ITimeValueResponse getResponseListener() {
- return responseData;
- }
- public void setResponseListener(ITimeValueResponse responseData) {
- this.responseData = responseData;
- if (responseData instanceof Observable)
- ((Observable)responseData).addObserver(this);
- }
- public synchronized MetaDataList getSearchList() {
- return searchList;
- }
- public synchronized void setSearchList(MetaDataList searchList) {
- this.searchList = searchList;
- }
- public PSActionMap getActions() {
+ public IUserData createUserData() {
+ return new AbstractUserData();
+ }
+ public PSActionMap getActions() {
return actions;
}
- public static String timeInterval2Title(long time) {
- for (int i=0;i < timeIntervals.length;i++)
- if (timeIntervals[i] == time) return timeIntervalsTitle[i];
- return Long.toString(time/60) + " min";
- }
- public synchronized MAEndpointList getEndpointList() {
- return endpointList;
- }
- public synchronized void setEndpointList(MAEndpointList endpointList) {
- this.endpointList = endpointList;
- }
- public synchronized MetaDataList getDataList() {
+ public synchronized MetaDataList getDataList() {
return dataList;
}
- public void setDataList(MetaDataList dataList) {
- this.dataList = dataList;
- }
public PerfsonarRequestAction getDataRequestAction() {
return dataRequestAction;
}
- public void setDataRequestAction(PerfsonarRequestAction
dataRequestAction) {
- this.dataRequestAction = dataRequestAction;
+ public synchronized MAEndpointList getEndpointList() {
+ return endpointList;
+ }
+ public PSUIAction getEndpointsAction() {
+ return endpointsAction;
}
- public PerfsonarRequestAction getMetadataRequestAction() {
+ public PerfsonarRequestAction getMetadataRequestAction() {
return metadataRequestAction;
}
- public void setMetadataRequestAction(PerfsonarRequestAction
metadataRequestAction) {
- this.metadataRequestAction = metadataRequestAction;
- }
-
- public synchronized SmartMARequest getRequest() {
+ public synchronized SmartMARequest getRequest() {
return request;
}
- public synchronized void setRequest(SmartMARequest request) {
- this.request = request;
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+ public ITimeValueResponse getResponseListener() {
+ return responseData;
+ }
+ public synchronized MetaDataList getSearchList() {
+ return searchList;
}
- public void clear() {
- dataList.clear();
- userData.clear();
- searchList.clear();
- searchText.clear();
-
- }
- protected Options createOptions() {
- Options options = new Options();
- Option endpoints = OptionBuilder.withLongOpt("endpoints")
- .hasArg()
- .withArgName("URL")
- .withDescription("URL for MA.conf, default
http://http://perfsonar.acad.bg/MA.conf")
- .create( "e" );
-
- Option mds = OptionBuilder.withLongOpt("mds")
- .hasArg()
- .withArgName("URL")
- .withDescription("URL of Metadata Service, used to retrieve the list
of Identity Providers, default "+ AACertificate.MDS_DEFAULT)
- .create( "m" );
-
- Option aggregate = OptionBuilder.withLongOpt("aggregate")
- .hasArg()
- .withArgName("number_of_requests")
- .withDescription("max requests in an aggregated request, default 8")
- .create( "a" );
-
- Option parallel = OptionBuilder
- .hasArg()
- .withLongOpt("parallel")
- .withValueSeparator(' ')
- .withArgName("number")
- .withDescription("sends requests in parallel if arg > 0, default 1")
- .create( "p" );
-
- Option timeout = OptionBuilder
- .hasArg()
- .withLongOpt("timeout")
- .withArgName("milliseconds")
- .withDescription("timeout for axis conection,ms (default 300000ms =
5min)")
- .create( "t" );
-
- Option visualperfsonar = OptionBuilder
- .hasArg()
- .withLongOpt("visual")
- .withArgName("URL")
- .withDescription("URL for Visual Perfsonar")
- .create( "r" );
-
- Option truststore = OptionBuilder
- .hasArg()
- .withLongOpt("truststore")
- .withArgName("URL")
- .withDescription("URL for the temporary truststore necessary for
SASL CA client")
- .create( "s" );
-
- Option help = OptionBuilder
- .withLongOpt("help")
- .withDescription("This screen")
- .create( "h" );
-
- options.addOption(endpoints);
- options.addOption(mds);
- options.addOption(aggregate);
- options.addOption(parallel);
- options.addOption(timeout);
- options.addOption(visualperfsonar);
- options.addOption(truststore);
- options.addOption(help);
-
- return options;
- }
- /**
+ public IUserData getUserData() {
+ return userData;
+ }
+ public void setDataList(MetaDataList dataList) {
+ this.dataList = dataList;
+ }
+ /**
* -ehttp://http://perfsonar.acad.bg/MA.conf ( URL for MA.conf )
* -a8 (max requests in an aggregated
request)
* -t300000 (timeout for axis conection = default 300000ms = 5min)
@@ -492,26 +384,48 @@
logger.error( exp);
}
}
- protected void fileDownload(String url, File file) throws Exception {
- if (!file.exists()) {
- logger.info("Downloading "+url + " to
"+file.getAbsolutePath());
- URL u = new URL(url);
- InputStream in = u.openStream();
- FileOutputStream out = new FileOutputStream(file);
- byte[] bytes = new byte[512];
- int len;
- long count = 0;
-// read() returns -1 on EOF
- while ((len = in.read(bytes, 0, bytes.length)) >= 0) {
- out.write(bytes, 0, len);
- count += len;
- }
- out.flush();
- out.close();
- in.close();
- }
+ public void setResourceBundle(ResourceBundle resourceBundle) {
+ this.resourceBundle = resourceBundle;
+ }
+ public void setResponseListener(ITimeValueResponse responseData) {
+ this.responseData = responseData;
+ if (responseData instanceof Observable)
+ ((Observable)responseData).addObserver(this);
+ }
+ public synchronized void setSearchList(MetaDataList searchList) {
+ this.searchList = searchList;
}
+ public void setUserData(int index) {
+ if ((index >=0) && (index < dataList.size())) {
+ this.userData.assign(dataList.get(index));
+ }
+ }
+ public void setUserData(IUserData userData) {
+ this.userData = userData;
+ }
+
+ public void update(Observable arg0, Object arg1) { /* TODO check:
Template method? */}
+
+ public static File getMAconf(String filename) {
+ try {
+ return new File(filename);
+ } catch (Exception x) {
+ return null;
+ }
+ }
+
+ public static String timeInterval2Title(long time) {
+ for (int i=0;i < timeIntervals.length;i++)
+ if (timeIntervals[i] == time) return timeIntervalsTitle[i];
+ return Long.toString(time/60) + " min";
+ }
+ protected IUserDataComparator createComparator() {
+ return null;
+ }
+ protected MetaDataList createDataList(IUserDataComparator comparator)
{
+ return new MetaDataList(comparator);
+ }
protected void setOptions(CommandLine line) {
if( line.hasOption( 's' ) ) {
String url = line.getOptionValue( 's' );
@@ -593,26 +507,107 @@
}
}
+ protected abstract PerfsonarRequestAction createMetadataRequestAction();
+ protected Options createOptions() {
+ Options options = new Options();
+ Option endpoints = OptionBuilder.withLongOpt("endpoints")
+ .hasArg()
+ .withArgName("URL")
+ .withDescription("URL for MA.conf, default
http://http://perfsonar.acad.bg/MA.conf")
+ .create( "e" );
+
+ Option mds = OptionBuilder.withLongOpt("mds")
+ .hasArg()
+ .withArgName("URL")
+ .withDescription("URL of Metadata Service, used to retrieve the list
of Identity Providers, default "+ AACertificate.MDS_DEFAULT)
+ .create( "m" );
+
+ Option aggregate = OptionBuilder.withLongOpt("aggregate")
+ .hasArg()
+ .withArgName("number_of_requests")
+ .withDescription("max requests in an aggregated request, default 8")
+ .create( "a" );
+
+ Option parallel = OptionBuilder
+ .hasArg()
+ .withLongOpt("parallel")
+ .withValueSeparator(' ')
+ .withArgName("number")
+ .withDescription("sends requests in parallel if arg > 0, default 1")
+ .create( "p" );
- public JComponent[] createDetailsComponent(Component parentComponent)
{
- return null;
+ Option timeout = OptionBuilder
+ .hasArg()
+ .withLongOpt("timeout")
+ .withArgName("milliseconds")
+ .withDescription("timeout for axis conection,ms (default 300000ms =
5min)")
+ .create( "t" );
+
+ Option visualperfsonar = OptionBuilder
+ .hasArg()
+ .withLongOpt("visual")
+ .withArgName("URL")
+ .withDescription("URL for Visual Perfsonar")
+ .create( "r" );
+
+ Option truststore = OptionBuilder
+ .hasArg()
+ .withLongOpt("truststore")
+ .withArgName("URL")
+ .withDescription("URL for the temporary truststore necessary for
SASL CA client")
+ .create( "s" );
+
+ Option help = OptionBuilder
+ .withLongOpt("help")
+ .withDescription("This screen")
+ .create( "h" );
+
+ options.addOption(endpoints);
+ options.addOption(mds);
+ options.addOption(aggregate);
+ options.addOption(parallel);
+ options.addOption(timeout);
+ options.addOption(visualperfsonar);
+ options.addOption(truststore);
+ options.addOption(help);
+
+ return options;
+ }
+ /**
+ * Creates ResourceBundle from
"org.perfsonar.perfsonarui.your_class.ResourceBundle.properties".<br>
+ * If that file does not exist, loads
"org.perfsonar.perfsonarui.ResourceBundle.properties"
+ * @return
+ */
+ protected ResourceBundle createResourceBundle() {
+ try {
+ String resource = getClass().getName();
+ int p = resource.lastIndexOf('.');
+ if (p > -1) resource = resource.substring(0,p+1) +
"ResourceBundle";
+ logger.info("Loaded resources from "+resource);
+ return ResourceBundle.getBundle(resource,Locale.getDefault());
+ } catch (Exception x) {
+ //logger.warn(x.getMessage());
+ logger.info("Fall back: loading resources from
org.perfsonar.perfsonarui.ResourceBundle");
+ return
ResourceBundle.getBundle("org.perfsonar.perfsonarui.ResourceBundle",new
Locale("EN"));
+ }
}
- public JComponent[] createOptionsComponent(Component parentComponent)
{
- return new JComponent[]{new RequestOptionsPanel(this)};
- }
- public PSUIAction getEndpointsAction() {
- return endpointsAction;
- }
- public void setEndpointsAction(PSUIAction endpointsAction) {
- this.endpointsAction = endpointsAction;
- }
- public int compareTo(IPerfsonarTab arg0) {
- return getOrder() - arg0.getOrder();
- }
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
- public void setResourceBundle(ResourceBundle resourceBundle) {
- this.resourceBundle = resourceBundle;
- }
+ protected abstract SmartMARequest createSmartRequest();
+ protected void fileDownload(String url, File file) throws Exception {
+ if (!file.exists()) {
+ logger.info("Downloading "+url + " to
"+file.getAbsolutePath());
+ URL u = new URL(url);
+ InputStream in = u.openStream();
+ FileOutputStream out = new FileOutputStream(file);
+ byte[] bytes = new byte[512];
+ int len;
+ long count = 0;
+ while ((len = in.read(bytes, 0, bytes.length)) != -1)
{
+ out.write(bytes, 0, len);
+ count += len;
+ }
+ out.flush();
+ out.close();
+ in.close();
+ }
+ }
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/EchoAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/EchoAction.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/EchoAction.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -29,6 +29,7 @@
import javax.swing.Icon;
import org.perfsonar.perfsonarui.AbstractUserData;
+import org.perfsonar.perfsonarui.EchoMARequest;
import org.perfsonar.perfsonarui.EchoResponse;
import org.perfsonar.perfsonarui.EchoSmartRequest;
import org.perfsonar.perfsonarui.SmartMARequest;
@@ -95,6 +96,10 @@
frame.setCursor(normalCursor);
}
+ @Override
+ public synchronized void interrupt() {
+ setInterrupted(true);
+ }
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/EndpointsAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/EndpointsAction.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/EndpointsAction.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -35,7 +35,9 @@
* <b>Modified</b> 2006-1-5
*/ //
public abstract class EndpointsAction extends PSUIAction {
- protected MAEndpointList endpoints;
+
+ protected final MAEndpointList endpoints;
+
/**
* Comment for <code>serialVersionUID</code>
*/
@@ -64,5 +66,4 @@
this.endpoints = endpoints;
}
-
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/PSActionMap.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/PSActionMap.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/PSActionMap.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -25,6 +25,7 @@
package org.perfsonar.perfsonarui.ui.actions;
import java.awt.Component;
+
import javax.swing.Action;
import javax.swing.ActionMap;
@@ -34,7 +35,7 @@
* @author Nina Jeliazkova
*
*/
-public class PSActionMap extends ActionMap{
+public class PSActionMap extends ActionMap {
/**
*
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/PSUIAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/PSUIAction.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/PSUIAction.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -40,8 +40,8 @@
protected Component frame ;
protected String group;
protected int orderInGroup = 0;
- protected static Cursor hourglassCursor = new
Cursor(Cursor.WAIT_CURSOR);
- protected static Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
+ protected final static Cursor hourglassCursor = new
Cursor(Cursor.WAIT_CURSOR);
+ protected final static Cursor normalCursor = new
Cursor(Cursor.DEFAULT_CURSOR);
/**
*
@@ -65,14 +65,12 @@
this.actions = actions;
}
-
public void enableActions(boolean enable) {
if (actions != null) {
actions.enableActions(enable);
}
}
-
public synchronized Component getFrame() {
return frame;
}
@@ -105,4 +103,6 @@
}
return r;
}
+
+ public void interrupt() { /* template method */}
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/SelectOneEndpointAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/SelectOneEndpointAction.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/SelectOneEndpointAction.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -78,7 +78,7 @@
return actions;
}
*/
- protected PSUIAction[] createActions() {
+ protected PSUIAction[] createActions() {
PSUIAction[] actions = new PSUIAction[4];
EchoSmartRequest echoRequest = new EchoSmartRequest();
@@ -95,16 +95,16 @@
//actions[4] = new LSRetrieveEndpointsAction(endpoints);
return actions;
- }
+ }
@Override
- protected JComponent createEndpointsPanel(PSUIAction[] actions) {
+ protected JComponent createEndpointsPanel() {
boolean selected = false;
for (int i=0; i < endpoints.size();i++)
if (endpoints.get(i).isEnabled()) {
if (selected) endpoints.get(i).setEnabled(false);
selected = true;
}
- return super.createEndpointsPanel(actions);
+ return super.createEndpointsPanel();
}
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ShowEndpointsAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ShowEndpointsAction.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ShowEndpointsAction.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -26,8 +26,11 @@
import java.awt.Component;
import java.awt.event.ActionEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
import javax.swing.Icon;
import javax.swing.JComponent;
@@ -40,6 +43,7 @@
import org.perfsonar.perfsonarui.AbstractUserData;
import org.perfsonar.perfsonarui.EchoSmartRequest;
import org.perfsonar.perfsonarui.ls.LSEndpointsPanel;
+import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
import org.perfsonar.perfsonarui.ui.panels.MAEndpointsPanel;
@@ -50,11 +54,20 @@
*/
public class ShowEndpointsAction extends EndpointsAction {
+ public interface Listener {
+ void actionFinished(Collection<MAEndpoint> selected);
+ }
+
/**
* Comment for <code>serialVersionUID</code>
*/
private static final long serialVersionUID = 2727896306026401004L;
+ protected final Set<Listener> listeners = new
CopyOnWriteArraySet<Listener>();
+ protected final PSActionMap allActions = new PSActionMap();
+
+ protected PSUIAction[] actions;
+
/**
* @param userData
* @param dataList
@@ -81,76 +94,97 @@
super(endpoints, arg0, arg1);
putValue(SHORT_DESCRIPTION,"Select Measurement archives to be
queried");
}
+
/* (non-Javadoc)
- * @see
org.perfsonar.perfsonarui.ui.actions.MARequestAction#actionPerformed(java.awt.event.ActionEvent)
+ * @see
org.perfsonar.perfsonarui.ui.actions.MyAction#setFrame(javax.swing.JFrame)
*/
- public void actionPerformed(ActionEvent arg0) {
+ @Override
+ public synchronized void setFrame(Component frame) {
+ super.setFrame(frame);
+ }
- PSUIAction[] actions = createActions();
- PSActionMap allActions = new PSActionMap();
-
- JComponent endpointsPanel = createEndpointsPanel(actions);
+ public final void actionPerformed(ActionEvent e) {
+ JDialog dialog = createDialog();
+ dialog.setVisible(true);
+ postAction();
+ fireActionFinished(getSelectedEndpoints());
+ }
+
+ public void addListener(Listener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeListener(Listener listener) {
+ listeners.remove(listener);
+ }
+
+ protected JComponent createEndpointsPanel() {
+ actions = createActions();
+ JTabbedPane pane = new JTabbedPane(SwingConstants.BOTTOM,
JTabbedPane.SCROLL_TAB_LAYOUT);
+ pane.addTab(".conf file", new MAEndpointsPanel(endpoints,actions));
+ pane.addTab("Lookup Service", new
LSEndpointsPanel(!endpoints.isMultipleEndpoints()));
for (int i=0; i < actions.length;i++) {
actions[i].setActions(allActions);
- actions[i].setFrame(endpointsPanel);
+ actions[i].setFrame(pane);
allActions.put(Integer.toString(i+1), actions[i]);
- }
+ }
+
+ return pane;
+ }
+
+ protected void postAction() {
+ for(PSUIAction action : actions) {
+ action.interrupt();
+ }
+ allActions.clear();
+ }
- JDialog dialog = new JDialog((JFrame)frame,"Measurement archives");
- dialog.setContentPane(endpointsPanel);
+ protected JDialog createDialog() {
+ JDialog dialog = new JDialog((JFrame)frame,"Measurement
archives");
+ dialog.setContentPane(createEndpointsPanel());
dialog.setModal(true);
dialog.pack();
dialog.setComponentOrientation(((frame == null) ?
dialog.getRootPane() : frame).getComponentOrientation());
dialog.setLocationRelativeTo(frame);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- dialog.addWindowListener(new WindowAdapter() {
- @Override
- public void windowClosed(WindowEvent e) {
- //TODO save
- }
- });
- dialog.setVisible(true);
-
- if ((actions.length>0) & (actions[0] instanceof EchoAction))
- ((EchoAction)actions[0]).setInterrupted(true);
-
- allActions.clear();
+ return dialog;
+ }
+
+ protected Collection<MAEndpoint> getSelectedEndpoints() {
+ List<MAEndpoint> points = new ArrayList<MAEndpoint>();
+ for(MAEndpoint point : points) {
+ if(point.isEnabled()) {
+ points.add(point);
+ }
+ }
+ return points;
+ }
+
+ protected void fireActionFinished(Collection<MAEndpoint> selected) {
+ for(Listener listener : listeners) {
+ listener.actionFinished(selected);
+ }
}
+
protected PSUIAction[] createActions() {
- PSUIAction[] actions = new PSUIAction[7];
-
EchoSmartRequest echoRequest = new EchoSmartRequest();
echoRequest.setTimeout(10000);
-
- actions[0] = new EchoAction(echoRequest, new AbstractUserData() {
+ AbstractUserData emptyUserData = new AbstractUserData() {
@Override
public void makeQueryFromResponse() {}
- },endpoints);
+ };
+
+ PSUIAction[] actions = new PSUIAction[7];
+
+ actions[0] = new EchoAction(echoRequest, emptyUserData,endpoints);
actions[1] = new SelectAllEndpointsAction(endpoints,true,"Select
all");
actions[2] = new SelectAllEndpointsAction(endpoints,false,"Unselect
all");
actions[3] = new FileEndpointsAction(endpoints,true);
actions[4] = new FileEndpointsAction(endpoints,false);
actions[5] = new NewEndpointAction(endpoints);
actions[6] = new DeleteEndpointAction(endpoints);
-// TODO remove
-// a = new LSRetrieveEndpointsAction(endpoints);
-// actions[7] = a;
+
return actions;
}
- protected JComponent createEndpointsPanel(PSUIAction[] availableActions)
{
- JTabbedPane pane = new JTabbedPane(SwingConstants.BOTTOM,
JTabbedPane.SCROLL_TAB_LAYOUT);
- pane.addTab(".conf file", new
MAEndpointsPanel(endpoints,availableActions));
- pane.addTab("Lookup Service", new LSEndpointsPanel());
- return pane;
- }
-
- /* (non-Javadoc)
- * @see
org.perfsonar.perfsonarui.ui.actions.MyAction#setFrame(javax.swing.JFrame)
- */
- @Override
- public synchronized void setFrame(Component frame) {
- super.setFrame(frame);
- }
-
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/MAEndpointsPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/MAEndpointsPanel.java
2008-10-23 11:58:14 UTC (rev 4663)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/MAEndpointsPanel.java
2008-10-23 23:15:06 UTC (rev 4664)
@@ -44,7 +44,6 @@
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
-import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
@@ -97,8 +96,7 @@
}
*/
public MAEndpointsPanel(MAEndpointList endpoints, PSUIAction[] actions) {
- super();
- addWidgets(endpoints,actions,true);
+ this(endpoints,actions,true);
}
public MAEndpointsPanel(MAEndpointList endpoints, PSUIAction[] actions,
boolean statusColumn) {
super();
- perfsonar: r4664 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . bwctl demo flowsa ls ma playground plugins ui ui/actions ui/panels, svnlog, 10/23/2008
Archive powered by MHonArc 2.6.16.