perfsonar-dev - perfsonar: r4898 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . demo flowsa flowsa/components ippm ippm/ui/actions ippm/ui/panels ma ma/ui/actions ma/ui/panels playground plugins test ui ui/actions ui/panels
Subject: perfsonar development work
List archive
perfsonar: r4898 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . demo flowsa flowsa/components ippm ippm/ui/actions ippm/ui/panels ma ma/ui/actions ma/ui/panels playground plugins test ui ui/actions ui/panels
Chronological Thread
- From:
- To:
- Subject: perfsonar: r4898 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . demo flowsa flowsa/components ippm ippm/ui/actions ippm/ui/panels ma ma/ui/actions ma/ui/panels playground plugins test ui ui/actions ui/panels
- Date: Wed, 21 Jan 2009 09:20:22 -0500
Author: nina
Date: 2009-01-21 09:20:21 -0500 (Wed, 21 Jan 2009)
New Revision: 4898
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/TimeRange.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/AbstractDatePanel.java
Removed:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/playground_success.png
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/playground_unknown.png
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/playground_warn.png
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractUserData.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/DemoPlugin.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/DemoPluginMainPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/Lesson2.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/Lesson4.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMAResponse.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/Statistics.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/StatisticsPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/IPPMPerfsonarModel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/IPPMRequest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/actions/IPPMMetadataKeyRequest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/panels/IPPMPairsTablePanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/panels/IPPMTimeIntervalPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/panels/MainPanelIPPM.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MANIFEST_MA_plugin.MFT
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MAPerfsonarModel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/UserData.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/actions/SearchByIPAction.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/actions/SetupDataRefreshActionAll.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/actions/SetupDataRetrieveAllAction.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/BarChartPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MAResponseChartPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MainPanelMA.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MetadataChartSet.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MetadataRadarSet.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MetricsOptionPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/RadarChartPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/SearchPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/playground/PlaygroundPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/playground/PlaygroundPredefined.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IPerfsonarTab.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IUserData.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MetaDataList.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/CalendarTest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/MARequest_NMWG2_Test.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/SmartMARequestTest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/UserDataTest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarTaskPane.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PluginMainContainer.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ITimeSet.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/SetupDataRequestAction.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/TimeSetAction.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/DatePanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/TimeOptionsPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/TimeOptionsToolbar.java
Log:
Introduced TimeRange class (moved from flowsa code) to represent a query time
range. Modified request and gui classes to work with it.
Time picking GUI refactored
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractUserData.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractUserData.java
2009-01-21 14:13:05 UTC (rev 4897)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractUserData.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -21,18 +21,17 @@
import java.net.URI;
import java.util.ArrayList;
-import java.util.Calendar;
import java.util.Collection;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Observable;
-import java.util.TimeZone;
import org.perfsonar.lsclient.data.EventType;
import org.perfsonar.perfsonarui.plugins.EventTypeFactory;
import org.perfsonar.perfsonarui.plugins.IUserData;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.w3c.dom.Document;
/**
@@ -230,9 +229,10 @@
notifyObservers();
}
- public void setTime(long time, long interval) {
- setQuery(getStartTimeKey(),Long.toString(time));
- setQuery(getEndTimeKey(),Long.toString(time + interval));
+ public void setTimeRange(TimeRange time) {
+ //im seconds!
+
setQuery(getStartTimeKey(),Long.toString(time.getStartTime()/1000));
+
setQuery(getEndTimeKey(),Long.toString(time.getEndTime()/1000));
setChanged();
notifyObservers();
}
@@ -250,22 +250,15 @@
setQuery(RESOLUTION, resolution);
}
- public void lastSeconds(long seconds) {
+ /*
+ public void lastSeconds(long startTime,long seconds) {
long timeNow =
Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis()/1000;
setTime(timeNow - seconds,seconds);
setChanged();
notifyObservers();
}
-
- public void lastHour() {
- lastSeconds(360);
- }
- public void lastDay() {
- lastSeconds(24*60*60);
- }
- public void lastWeek() {
- lastSeconds(7*24*60*60);
- }
+ */
+
public int compareTo(IUserData arg0) {
return 1;
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/DemoPlugin.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/DemoPlugin.java
2009-01-21 14:13:05 UTC (rev 4897)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/DemoPlugin.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -134,7 +134,7 @@
return new
SetupDataRequestAction(request,userData,responseData,
"Query",null,defaultGroupQuery) {
public void prepareQuery(IUserData userData) {
- userData.setTime(startTime - timeInterval ,
timeInterval);
+ userData.setTimeRange(getTimeRange());
//force retrieval of data for both directions
userData.setQuery(UserData.C_DIRECTION,AbstractUserData.NULL_DATA);
};
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/DemoPluginMainPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/DemoPluginMainPanel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/DemoPluginMainPanel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -94,7 +94,8 @@
queryPanel.setBorder(BorderFactory.createTitledBorder("Query"));
//Calendar UI
DatePanel datePanel = new DatePanel();
-
datePanel.addTimeAction((ITimeSet)((PerfsonarModel)model).getDataRequestAction());
+ //TODO update with listeners
+
//datePanel.addTimeAction((ITimeSet)((PerfsonarModel)model).getDataRequestAction());
datePanel.setBorder(BorderFactory.createTitledBorder("Select
date"));
topPanel.add(queryPanel);
topPanel.add(datePanel);
Modified: branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/Lesson2.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/Lesson2.java
2009-01-21 14:13:05 UTC (rev 4897)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/Lesson2.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -46,6 +46,7 @@
import org.perfsonar.perfsonarui.plugins.IUserData;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MetaDataList;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.panels.QueryDetailsPanel;
import org.perfsonar.perfsonarui.ui.panels.ResponseDetailsPane;
import org.perfsonar.perfsonarui.ui.panels.UserDataPanel;
@@ -81,7 +82,7 @@
data.setQuery("ifAddress", "62.40.124.109");
long now = System.currentTimeMillis()/1000;
- data.setTime(now,now - 3*60*60); //Last 3 hours
+ data.setTimeRange(new TimeRange(now,3*60*60*1000)); //Last 3
hours
for (MAEndpoint e: data.getEndpoints())
System.out.println("Service\t"+e);
Modified: branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/Lesson4.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/Lesson4.java
2009-01-21 14:13:05 UTC (rev 4897)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/demo/Lesson4.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -24,6 +24,9 @@
package org.perfsonar.perfsonarui.demo;
+import java.util.Calendar;
+import java.util.TimeZone;
+
import org.perfsonar.perfsonarui.IPerfsonarSchema;
import org.perfsonar.perfsonarui.MetadataListResponseListener;
import org.perfsonar.perfsonarui.PSException;
@@ -41,6 +44,7 @@
import org.perfsonar.perfsonarui.plugins.IUserData;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MetaDataList;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.plugins.UnsupportedSchemaException;
public class Lesson4 {
@@ -68,8 +72,7 @@
//set the interface to be queried
data.setQuery(UserData.C_IFADDRESS, "62.40.124.109");
data.setQuery(UserData.C_DIRECTION,UserData.NULL_DATA);
- long time = System.currentTimeMillis()/1000 - 60*24;
- data.setTime(time,60*24);
+ data.setTimeRange(new
TimeRange(System.currentTimeMillis(),TimeRange.getDayRange()));
//now send the request
smartRequest.makeRequest(data,
IPerfsonarRequest.MA_SetupDataRequest, new
TimeValueResponseListener(response), false);
}
@@ -80,7 +83,7 @@
}
public void getUtilization(MetaDataList list, ITimeValueResponse
response) {
- list.setTimeInterval(60*24);
+ list.setTimeRange(new
TimeRange(System.currentTimeMillis(),TimeRange.getDayRange()));
//now send the request
smartRequest.makeRequest(new
MAEndpoint("GEANT2,http://stats.geant2.net/perfsonar/RRDMA-access/MeasurementArchiveService,http://schemas.perfsonar.net/2.0,\"\",http://ggf.org/ns/nmwg/characteristic/utilization/2.0,http://ggf.org/ns/nmwg/characteristic/utilization/2.0"),
list,
@@ -136,8 +139,8 @@
MetaDataList interfaces = lesson4.getMetadata("194.141.0.11");
interfaces.get(0).makeQueryFromResponse();
interfaces.get(0).setQuery(UserData.C_DIRECTION,UserData.NULL_DATA);
- long time = System.currentTimeMillis()/1000 - 60*24;
- interfaces.get(0).setTime(time,60*24);
+
+ interfaces.get(0).setTimeRange(new
TimeRange(System.currentTimeMillis(),TimeRange.getDayRange()));
//now send the request
lesson4.smartRequest.makeRequest(interfaces.get(0),
IPerfsonarRequest.MA_SetupDataRequest, new
TimeValueResponseListener(response), false);
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMAResponse.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMAResponse.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMAResponse.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -25,6 +25,7 @@
import org.perfsonar.perfsonarui.flowsa.FlowsaMAUserData.QueryType;
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
import org.perfsonar.perfsonarui.plugins.IUserData;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/Statistics.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/Statistics.java
2009-01-21 14:13:05 UTC (rev 4897)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/Statistics.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -1,5 +1,7 @@
package org.perfsonar.perfsonarui.flowsa;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
+
/**
* A data object/ java bean that holds statistics data
*
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/StatisticsPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/StatisticsPanel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/StatisticsPanel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -25,7 +25,7 @@
import org.jdesktop.layout.GroupLayout;
import org.perfsonar.perfsonarui.flowsa.Statistics;
-import org.perfsonar.perfsonarui.flowsa.TimeRange;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
public class StatisticsPanel extends JPanel{
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/IPPMPerfsonarModel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/IPPMPerfsonarModel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/IPPMPerfsonarModel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -47,6 +47,7 @@
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
import org.perfsonar.perfsonarui.plugins.MetaDataList;
import org.perfsonar.perfsonarui.plugins.PerfsonarTabsList;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.PerfsonarModel;
import org.perfsonar.perfsonarui.ui.actions.ClearAction;
import org.perfsonar.perfsonarui.ui.actions.ITimeSetAction;
@@ -114,17 +115,16 @@
userData.setEndpoint(endpointList.get(enabledEndpoint));
userData.setQuery("nmwgt:dst", "N/A");
userData.setQuery("nmwgt:src", "N/A");
-
- ((IPPMUserData)userData).lastDay();
+
userData.setQuery(IPPMUserData.NMWG_STARTTIME,"");
userData.setQuery(IPPMUserData.NMWG_ENDTIME, "");
- timeAction = new TimeSetAction((ITimeSetAction)
getDataRequestAction(),24*60*60,300,"Set time for the query") ;
+ timeAction = new TimeSetAction((ITimeSetAction)
getDataRequestAction(),24*60*60*1000,300,"Set time for the query") ;
timeAction.putValue(Action.SHORT_DESCRIPTION, "Retrieves data
for the selected day and endpoint pair");
((TimeSetAction)timeAction).setGroup(defaultGroupHidden);
actions.put(timeAction.getValue(Action.NAME),timeAction);
-
+ ((IPPMUserData)userData).setTimeRange(timeAction.getTimeRange());
}
public IPPMPerfsonarModel(MAEndpointList endpoints,
ITimeValueResponse response, IPPMUserData data) {
this(endpoints);
@@ -294,20 +294,7 @@
}
@Override
public PerfsonarRequestAction createDataRequestAction() {
- SetupDataRequestAction dr = new
SetupDataRequestAction(request,userData,responseData,"Query") {
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID =
-8931412130944565832L;
-
- @Override
- public long getStartTime() { return startTime; };
-
- };
-
- //dr.setGroup(defaultGroupQuery);
- dr.setGroup(defaultGroupHidden);
- return dr;
+ return new
SetupDataRequestAction(request,userData,responseData,"Query") ;
}
/**
* Creates
{@link
MainPanelIPPM}.
@@ -349,4 +336,13 @@
public void setPairsPanel(IPPMPairsTablePanel pairsPanel){
this.pairsPanel = pairsPanel;
}
+ @Override
+ public void timeRangeChange(String name, TimeRange newValue) {
+ getTimeAction().setTimeRange(newValue);
+ getTimeAction().actionPerformed(null);
+
((ITimeSetAction)getMetadataRequestAction()).setTimeRange(newValue);
+ getMetadataRequestAction().actionPerformed(null);
+ //((IPPMPerfsonarModel)getModel())..addTimeAction(new
IPPMCalendarSyncAction(timeControls));
+
+ }
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/IPPMRequest.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/IPPMRequest.java
2009-01-21 14:13:05 UTC (rev 4897)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/IPPMRequest.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -30,6 +30,7 @@
import org.perfsonar.perfsonarui.MetadataListResponseListener;
import org.perfsonar.perfsonarui.NMWGHelper;
import org.perfsonar.perfsonarui.PSErrorCodeException;
+import org.perfsonar.perfsonarui.PSException;
import org.perfsonar.perfsonarui.PSLogger;
import org.perfsonar.perfsonarui.PerfsonarResponseEvent;
import org.perfsonar.perfsonarui.TimeValueResponseListener;
@@ -96,51 +97,7 @@
public String getMessageNamespace() {
return URI_nmwg[version][1];
}
- /*
- * - Precedence: the QoS bits, may be e.g. 0x0 or 0xb8
- * - Packet size: size of the UDP packet, e.g. 41 (minimum) or
1427 (maximum) byte
- * - Group size: number of packets sent together by the sender,
e.g. 5
- * - Packet interval: inter-packet gap in a group, e.g. 20 ms
- * - Group interval: sending interval between groups, e.g. 30 s
- *
-<pre>
- /*
-<nmwg:message xmlns:nmtm="http://ggf.org/ns/nmwg/time/2.0/"
- xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
- xmlns:nmwgt="http://ggf.org/ns/nmwg/topology/2.0/"
- xmlns:select="http://ggf.org/ns/nmwg/ops/select/2.0/"
- xmlns:hades="http://ggf.org/ns/nmwg/tools/hades/"
- id="datarq2-1" type="SetupDataRequest">
- <nmwg:metadata id="meta1">
- <hades:subject id="subj1">
- <nmwgt:endPointPair>
- <nmwgt:src type="IFname" value="Ljubljana_ARNES"/>
- <nmwgt:dst type="IFname" value="Amsterdam_SURFnet"/>
- </nmwgt:endPointPair>
- </hades:subject>
- <hades:parameters id="params1">
- <nmwg:parameter name="mid" value="6461"/>
- </hades:parameters>
-
- <nmwg:eventType>http://ggf.org/ns/nmwg/tools/hades/</nmwg:eventType>
- </nmwg:metadata>
-
- <nmwg:metadata id="meta2">
- <select:subject id="subj2" metadataIdRef="meta1"/>
- <nmwg:eventType>http://ggf.org/ns/nmwg/ops/select/</nmwg:eventType>
- <select:parameters id="param2">
- <nmwg:parameter name="startTime">1208296800</nmwg:parameter>
- <nmwg:parameter name="endTime">1208383200</nmwg:parameter>
- </select:parameters>
- </nmwg:metadata>
-
- <!-- triggers to indicate head of chains -->
- <nmwg:data id="1" metadataIdRef="meta2"/>
-</nmwg:message>
-
-</pre>
- */
protected Document createSetupDataReq(IUserData userData) throws
Exception {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
@@ -293,7 +250,7 @@
return createMetadataKeyReq(userData,userData !=
null);
else
throw new Exception("Unknown Message
type!\t"+messageType);
- } else return null;
+ } else throw new PSException(IPPMUserData.class.getName() + "
expected instead of "+uData);
}
public void process(IUserData uData, Document response,
IPerfsonarResponse listener) throws Exception {
@@ -487,122 +444,7 @@
logger.error(x);
}
}
- /*
-
- public void presentDataFromResponse(Document
dataSetupResp,TimeValueResponseListener responseListener, IUserData userData){
- ITimeValueResponse response =
responseListener.getTimeValueResponse();
- //Now traversing org.w3c.dom.Document directly, without File i/o
to get jdom ...
- fireStatusMessage(STATUS_PARSINGRESPONSE);
- if (response != null) {
-
- if (logger.isDebugEnabled()) try {
-
- logger.debug(dataSetupResp);
-
- } catch (Exception x) {
- logger.error(x);
- }
-
- //response.clear(userData.isInput());
- //response.setUserData(userData);
- //response.initializeResponse();
- }
- try{
-
- //NodeList nodelist =
dataSetupResp.getElementsByTagName("nmwgt:interface");
- //NodeList nodelist =
dataSetupResp.getElementsByTagNameNS(URI_nmwgt[version][1],E_INTERFACE);
-
- NodeList nodes =
dataSetupResp.getElementsByTagName(IPPMUserData.ENDPOINT_PAIR);
- for (int i=0; i < nodes.getLength();i++) {
- NodeList children = ((org.w3c.dom.Element)
nodes.item(i)).getElementsByTagName(IPPMUserData.IFNAME_SRC);
- for (int j=0; j < children.getLength();j++)
{
- String value =
((org.w3c.dom.Element)
children.item(j)).getAttribute(IPPMUserData.ATTR_VALUE);
-
userData.setResponse(IPPMUserData.IFNAME_SRC, value);
- }
- children = ((org.w3c.dom.Element)
nodes.item(i)).getElementsByTagName(IPPMUserData.IFNAME_DST);
- for (int j=0; j < children.getLength();j++)
{
- String value =
((org.w3c.dom.Element)
children.item(j)).getAttribute(IPPMUserData.ATTR_VALUE);
-
userData.setResponse(IPPMUserData.IFNAME_DST, value);
- }
- }
-
-
- nodes =
dataSetupResp.getElementsByTagName(IPPMUserData.NMWG_PARAMETERS);
- for (int i=0; i < nodes.getLength();i++) {
- NodeList children = ((org.w3c.dom.Element)
nodes.item(i)).getElementsByTagName(IPPMUserData.NMWG_PARAMETER);
- for (int j=0; j < children.getLength();j++)
{
- String name =
((org.w3c.dom.Element) children.item(j)).getAttribute("name");
- String value =
((org.w3c.dom.Element)
children.item(j)).getAttribute(IPPMUserData.ATTR_VALUE);
- userData.setResponse(name,
value);
- }
- }
-
- nodes =
dataSetupResp.getElementsByTagName(IPPMUserData.NMWG_DATA);
- response.initializeResponse();
- response.setUserData(userData);
-
- for (int i=0; i < nodes.getLength();i++) {
- String dataId = ((org.w3c.dom.Element)
nodes.item(i)).getAttribute("id");
- NodeList children = ((org.w3c.dom.Element)
nodes.item(i)).getElementsByTagName(IPPMUserData.NMWG_DATUM);
- for (int j=0; j < children.getLength();j++)
{
- String time =
((org.w3c.dom.Element) children.item(j)).getAttribute("time");
- if (!time.equals(""))
- for (int k =0; k <
types.length;k++) {
- String value =
((org.w3c.dom.Element) children.item(j)).getAttribute(types[k]);
- if (!value.equals(""))
-
response.setData(dataId, types[k],time, value, "");
- } else {
- //TODO throw an
exception instead of this stupid box
- Node node =
(org.w3c.dom.Element) children.item(j);
-
-
JOptionPane.showMessageDialog(null,
node.getFirstChild().getNodeValue(),"Error",JOptionPane.ERROR_MESSAGE);
- }
-
- }
- }
- response.finalizeResponse();
- fireStatusMessage("Response parsed");
- }
- catch (Exception e)
- {
- fireStatusMessage(ERR_NODATARECEIVED+e.getMessage());
- logger.error(ERR_NODATARECEIVED,e);
- return;
- }
-
- }
- */
- /*
-<pre>
-<nmwg:message xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
- xmlns:nmwgm="http://ggf.org/ns/nmwg/time/2.0/"
- xmlns:nmwgt="http://ggf.org/ns/nmwg/topology/2.0/"
- xmlns:select="http://ggf.org/ns/nmwg/ops/select/2.0/"
- xmlns:hades="http://ggf.org/ns/nmwg/tools/hades/"
- id="1208356112" type="MetadataKeyRequest">
- <nmwg:metadata id="meta1">
- <hades:subject id="subject1">
- <nmwgt:endpointPair/>
- </hades:subject>
- <nmwg:eventType>http://ggf.org/ns/nmwg/tools/hades/</nmwg:eventType>
- </nmwg:metadata>
- <nmwg:metadata id="meta2" metadataIdRef="meta1">
- <select:subject id="subject2"/>
- <select:parameters id="param1">
- <nmwg:parameter name="startTime">1208296800</nmwg:parameter>
- <nmwg:parameter name="endTime">1208383200</nmwg:parameter>
- </select:parameters>
- <nmwg:eventType>http://ggf.org/ns/nmwg/ops/select/</nmwg:eventType>
- </nmwg:metadata>
- <nmwg:data id="data1" metadataIdRef="meta2"/>
-</nmwg:message>
-</pre>
- protected static String[][] URI_nmwgt =
{{"nmwgt","http://ggf.org/ns/nmwg/topology/2.0/"}};
- protected static String[][] URI_nmwg =
{{"nmwg","http://ggf.org/ns/nmwg/base/2.0/"}};
- protected static String[][] URI_nmwgm =
{{"nmwgm","http://ggf.org/ns/nmwg/time/2.0/"}};
- protected static String[][] URI_nmwgs =
{{"select","http://ggf.org/ns/nmwg/ops/select/2.0/"}};
-protected static String[][] URI_hades =
{{"hades","http://ggf.org/ns/nmwg/tools/hades/"}};
- */
+
protected Document createMetadataKeyReq(IUserData userData, boolean
useData) throws Exception
{
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/actions/IPPMMetadataKeyRequest.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/actions/IPPMMetadataKeyRequest.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/actions/IPPMMetadataKeyRequest.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -36,6 +36,7 @@
import org.perfsonar.perfsonarui.plugins.IUserData;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.actions.ITimeSetAction;
import org.perfsonar.perfsonarui.ui.actions.MetadataRequestAction;
import org.w3c.dom.Document;
@@ -47,8 +48,8 @@
*/
public class IPPMMetadataKeyRequest extends MetadataRequestAction implements
ITimeSetAction {
- protected long starttime;
- protected long timeinterval;
+
+ protected TimeRange timeRange = new TimeRange();
/**
*
@@ -87,16 +88,17 @@
dataList.clear();
dataList.setNotificationEnabled(false);
- Date date = new Date(getStartTime()*1000);
+ Date date = timeRange.getStart();
((IPPMMetaDataList) dataList).setDate(date);
- //datePanel = null;
+ userData.setTimeRange(getTimeRange());
+ /*
userData.setQuery(IPPMUserData.NMWG_STARTTIME,
Long.toString(getStartTime()));
userData.setQuery(IPPMUserData.NMWG_ENDTIME,
Long.toString(getStartTime()+getTimeInterval()));
+ */
enableActions(false);
- //endpointsPanel = null;
+
-
boolean ok = false;
for (int i=0; i < endpoints.size();i++) {
if (isInterrupted()) break;
@@ -175,35 +177,16 @@
if (endpoint != null)
endpoint.setEnabled(false);
}
-
- /**
- * seconds
- */
- public long getStartTime() {
- return starttime;
+ public TimeRange getTimeRange() {
+ return timeRange;
}
- /**
- * seconds
- */
- public void setStartTime(long seconds) {
- starttime = seconds-getTimeInterval();
+ public void setTimeRange(TimeRange value) {
+ timeRange = new
TimeRange(value.getStart(),TimeRange.getDayRange());
}
/**
- * 24 hours (in seconds)
- */
- public long getTimeInterval() {
- return 24*60*60;
- }
- /**
* Not used
*/
- public void setTimeInterval(long timeInterval) {
-
- }
- /**
- * Not used
- */
public int getResolution() {
return 300;
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/panels/IPPMPairsTablePanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/panels/IPPMPairsTablePanel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/panels/IPPMPairsTablePanel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -70,7 +70,7 @@
protected JLabel dateLabel;
protected IPPMPairsTableModel model;
protected IPPMUserData query;
- protected int cellSize = 16;
+ protected int cellSize = 24;
protected ITimeSetAction timeAction = null;
protected MAEndpoint hopsEndpoint;
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/panels/IPPMTimeIntervalPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/panels/IPPMTimeIntervalPanel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/panels/IPPMTimeIntervalPanel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -6,6 +6,8 @@
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@@ -18,6 +20,7 @@
import javax.swing.JToolBar;
import javax.swing.SwingConstants;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.actions.ITimeSetAction;
import org.perfsonar.perfsonarui.ui.panels.ActionPanel;
/**
@@ -25,7 +28,7 @@
* @author Nemanja Zutic
*
*/
-public class IPPMTimeIntervalPanel extends JPanel implements ActionListener {
+public class IPPMTimeIntervalPanel extends JPanel implements ActionListener,
PropertyChangeListener {
private static final long serialVersionUID = 4841817966908270018L;
public static long timeIntervals[] = {
@@ -228,8 +231,9 @@
protected void setTime(ActionEvent e,ITimeSetAction action) {
if (!action.isEnabled()) return;
- action.setStartTime(currentGraphTime+24*60*60);
- action.setTimeInterval(currentGraphInterval);
+ TimeRange newTimeRange = new
TimeRange((currentGraphTime+24*60*60-currentGraphInterval)*1000,currentGraphInterval*1000);
+ firePropertyChange("date", null,newTimeRange);
+ action.setTimeRange(newTimeRange);
action.setResolution(getGraphResolution());
action.actionPerformed(e);
}
@@ -261,5 +265,13 @@
timeToLabel.setText("To: "+
new Date((currentGraphTime+24*60*60-1)*1000));
}
-
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getNewValue() instanceof TimeRange) {
+ TimeRange tr = (TimeRange)evt.getNewValue();
+ currentGraphTime = tr.getStartTime()/1000;
+ currentGraphInterval = tr.getDuration()/1000;
+ setTimeLabels();
+ }
+
+ }
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/panels/MainPanelIPPM.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/panels/MainPanelIPPM.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/ui/panels/MainPanelIPPM.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -30,14 +30,13 @@
import javax.swing.JPanel;
import org.perfsonar.perfsonarui.PSLogger;
-import org.perfsonar.perfsonarui.ippm.IPPMCalendarSyncAction;
import org.perfsonar.perfsonarui.ippm.IPPMMetaDataList;
import org.perfsonar.perfsonarui.ippm.IPPMPerfsonarModel;
import org.perfsonar.perfsonarui.ippm.IPPMUserData;
import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.PerfsonarModel;
import org.perfsonar.perfsonarui.ui.PluginMainContainer;
-import org.perfsonar.perfsonarui.ui.actions.ITimeSet;
import org.perfsonar.perfsonarui.ui.actions.ITimeSetAction;
import org.perfsonar.perfsonarui.ui.panels.DatePanel;
import org.perfsonar.perfsonarui.ui.panels.PerfsonarTimeSeriesDataset;
@@ -70,7 +69,7 @@
}
@Override
- protected Collection<JComponent> createComponents() {
+ public Collection<JComponent> createComponents() {
bottomPanel = new JPanel(new BorderLayout()) {
@Override
public String toString() {
@@ -81,8 +80,8 @@
IPPMPerfsonarModel psModel = (IPPMPerfsonarModel) model;
DatePanel datePanel = new DatePanel();
- datePanel.addTimeAction(psModel.getTimeAction());
-
datePanel.addTimeAction((ITimeSet)psModel.getMetadataRequestAction());
+ datePanel.addPropertyChangeListener(psModel);
+
topPanel = new JPanel(new BorderLayout()) {
@Override
@@ -119,14 +118,17 @@
psModel.getRequest().addPropertyChangeListener(responsePanel);
PSLogger.configureLog4j("/org/perfsonar/perfsonarui/log4.properties");
-
+
//Panel for controling the time interval displayed on the
graph
- IPPMTimeIntervalPanel timeControls = new
IPPMTimeIntervalPanel(datePanel.getDate().getTime()/1000);
+ IPPMTimeIntervalPanel timeControls = new
IPPMTimeIntervalPanel(TimeRange.getToday().getTime()/1000);
timeControls.addTimeAction((ITimeSetAction)((PerfsonarModel)model).getDataRequestAction());
+ datePanel.addPropertyChangeListener(timeControls);
+ timeControls.addPropertyChangeListener(datePanel);
//adding calendar sync action (whenever the a day in the
calendar is selected the
//time inteval panel updates its time
- datePanel.addTimeAction(new
IPPMCalendarSyncAction(timeControls));
+
bottomPanel.add(timeControls, BorderLayout.NORTH);
+
responsePanel = new IPPMResponseChartPanel(model,
(PerfsonarTimeSeriesDataset)model.getResponseListener());
@@ -135,11 +137,12 @@
return Arrays.asList(new JComponent[]
{topPanel,bottomPanel});
}
-
+
@Override
public void setModel(IPerfsonarTab model) {
if (model instanceof IPPMPerfsonarModel)
super.setModel(model);
else super.setModel(null);
}
+
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MANIFEST_MA_plugin.MFT
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MANIFEST_MA_plugin.MFT
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MANIFEST_MA_plugin.MFT
2009-01-21 14:20:21 UTC (rev 4898)
@@ -1,4 +1,5 @@
Manifest-Version: 1.0
+Class-Path: plugins-ippm.jar
Ant-Version: Apache Ant 1.6.2
Specification-Title: PerfsonarUI extensions
Specification-Version: 1.00
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MAPerfsonarModel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MAPerfsonarModel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MAPerfsonarModel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -23,6 +23,7 @@
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
+import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -45,16 +46,19 @@
import org.perfsonar.perfsonarui.SmartMARequest;
import org.perfsonar.perfsonarui.TracerouteShell;
import org.perfsonar.perfsonarui.UnsupportedTypeException;
+import org.perfsonar.perfsonarui.ippm.IPPMMetaDataList;
+import org.perfsonar.perfsonarui.ippm.IPPMPerfsonarModel;
import org.perfsonar.perfsonarui.ippm.IPPMRequest;
+import org.perfsonar.perfsonarui.ippm.IPPMUserData;
import org.perfsonar.perfsonarui.ma.ui.actions.MASetupDataRequestAction;
import org.perfsonar.perfsonarui.ma.ui.actions.SearchByIPAction;
import org.perfsonar.perfsonarui.ma.ui.actions.SetupDataRefreshActionAll;
import org.perfsonar.perfsonarui.ma.ui.actions.SetupDataRetrieveAllAction;
import org.perfsonar.perfsonarui.ma.ui.actions.TracerouteAction;
import org.perfsonar.perfsonarui.ma.ui.panels.MainPanelMA;
-import org.perfsonar.perfsonarui.ma.ui.panels.MetricsOptionPanel;
import org.perfsonar.perfsonarui.ma.ui.panels.RadarChartPanel;
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
+import org.perfsonar.perfsonarui.plugins.IPerfsonarResponse;
import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
import org.perfsonar.perfsonarui.plugins.ITimeValueResponse;
import org.perfsonar.perfsonarui.plugins.IUserData;
@@ -64,7 +68,9 @@
import org.perfsonar.perfsonarui.plugins.MetaDataList;
import org.perfsonar.perfsonarui.plugins.Metric;
import org.perfsonar.perfsonarui.plugins.PerfsonarTabsList;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.PerfsonarModel;
+import org.perfsonar.perfsonarui.ui.actions.ITimeSet;
import org.perfsonar.perfsonarui.ui.actions.ITimeSetAction;
import org.perfsonar.perfsonarui.ui.actions.PSUIAction;
import org.perfsonar.perfsonarui.ui.actions.PerfsonarRequestAction;
@@ -74,7 +80,6 @@
import org.perfsonar.perfsonarui.ui.panels.PerfsonarTimeSeriesDataset;
import org.perfsonar.perfsonarui.ui.panels.RequestOptionsPanel;
import org.perfsonar.perfsonarui.ui.panels.ResponseDetailsPane;
-import org.perfsonar.perfsonarui.ui.panels.TimeOptionsPanel;
/**
* An implementation of
{@link
IPerfsonarTab} for querying Measurement Archives.
@@ -114,8 +119,24 @@
protected TracerouteAction traceAction;
protected PSUIAction dataRequestActionAll;
protected PerfsonarRequestAction searchAction;
+ protected SetupDataRetrieveAllAction populateAction;
protected ArrayList<Metric> metrics;
+
+
+ protected IPPMPerfsonarModel ippmModel;
+ public IPPMPerfsonarModel getIppmModel() {
+ return ippmModel;
+ }
+ public void setIppmModel(IPPMPerfsonarModel ippmModel) {
+ this.ippmModel = ippmModel;
+ }
+ public ArrayList<Metric> getMetrics() {
+ return metrics;
+ }
+ public void setMetrics(ArrayList<Metric> metrics) {
+ this.metrics = metrics;
+ }
public TracerouteAction getTraceAction() {
return traceAction;
}
@@ -133,6 +154,12 @@
metrics.add(Metric.getInstance(MARequest_NMWG2.NS_UTILIZATION_2_0,"Utilisation","org.perfsonar.perfsonarui.ma.MARequestPerfsonar2_0",0));
metrics.add(Metric.getInstance(MARequest_NMWG2.NS_ERRORS_2_0,"Input
Errors","org.perfsonar.perfsonarui.ma.MARequest_Errors",1));
metrics.add(Metric.getInstance(MARequest_NMWG2.NS_DISCARDS_2_0,"Output
Drops","org.perfsonar.perfsonarui.ma.MARequest_Discards",2));
+ Metric m =
Metric.getInstance("http://ggf.org/ns/nmwg/tools/hades/traceroute/aggregated/2.0","OWD","org.perfsonar.perfsonarui.ippm.IPPMRequest",3);
+ m.setEnabled(false);
+ metrics.add(m);
+ m =
Metric.getInstance("http://ggf.org/ns/nmwg/tools/hades/traceroute/traceroute/2.0","Traceroute","org.perfsonar.perfsonarui.ippm.HoplistRequest",4);
+ m.setEnabled(false);
+ metrics.add(m);
Collections.sort(metrics);
tracerouteShell = new TracerouteShell();
@@ -154,6 +181,8 @@
dataRequestActionAll.setGroup(IPerfsonarTab.defaultGroupQuery);
actions.put("1",dataRequestActionAll);
dataRequestActionAll.setActions(actions);
+
+ ippmModel = new IPPMPerfsonarModel(endpoints);
}
@@ -185,13 +214,13 @@
@Override
protected PerfsonarRequestAction createMetadataRequestAction() {
//metadata only
- SetupDataRetrieveAllAction populate = new
SetupDataRetrieveAllAction(request,(UserData)userData,dataList,endpointList,"Populate");
- populate.setMetadataOnly(true);
- populate.putValue(Action.SHORT_DESCRIPTION, "Retrieves metadata of
all defined interfaces of selected MA services");
- populate.setGroup(IPerfsonarTab.defaultGroupQuery);
- populate.setOrderInGroup(-3);
- actions.put(populate);
- populate.setActions(actions);
+ populateAction = new
SetupDataRetrieveAllAction(request,(UserData)userData,dataList,endpointList,"Populate");
+ populateAction.setMetadataOnly(true);
+ populateAction.putValue(Action.SHORT_DESCRIPTION, "Retrieves
metadata of all defined interfaces of selected MA services");
+ populateAction.setGroup(IPerfsonarTab.defaultGroupQuery);
+ populateAction.setOrderInGroup(-3);
+ actions.put(populateAction);
+ populateAction.setActions(actions);
SetupDataRetrieveAllAction action = new
SetupDataRetrieveAllAction(request,(UserData)userData,dataList,endpointList);
action.setOrderInGroup(4);
@@ -218,16 +247,50 @@
for (Metric m: metrics) {
if
(m.getEvent().equals(endpoint.getEvent()))
- if (m.isEnabled()) {
+ try {
return
m.createRequest();
- }
- else
- throw new
PSNotConfiguredTypeException(endpoint,m.getEvent().toString());
+ } catch
(PSNotConfiguredTypeException x) {
+ //ignore
+ }
}
throw new
UnsupportedTypeException(endpoint,endpoint.getEvent().toString());
}
throw new UnsupportedTypeException(endpoint);
}
+ @Override
+ public void makeRequest(IUserData data, String
messageType,
+ IPerfsonarResponse response, boolean
runInThread) {
+ if (data instanceof IPPMUserData)
+
ippmModel.getRequest().makeRequest(data, messageType, response, runInThread);
+ else
+ super.makeRequest(data, messageType,
response, runInThread);
+ }
+ @Override
+ public void makeRequest(MAEndpoint endpoint,
IUserData data,
+ String messageType,
IPerfsonarResponse response,
+ boolean runInThread) {
+ if (data instanceof IPPMUserData)
+
ippmModel.getRequest().makeRequest(endpoint, data, messageType, response,
runInThread);
+ else
+ super.makeRequest(endpoint, data,
messageType, response, runInThread);
+ }
+ @Override
+ public void makeRequest(MAEndpoint endpoint,
+ MetaDataList queryList, String
messageType,
+ IPerfsonarResponse response, boolean
runInThread) {
+ if (queryList instanceof IPPMMetaDataList)
+
ippmModel.getRequest().makeRequest(endpoint, queryList, messageType,
response, runInThread);
+ else
+ super.makeRequest(endpoint,
queryList, messageType, response, runInThread);
+ }
+ @Override
+ public org.w3c.dom.Document createRequest(IUserData
data,
+ String messageType) throws Exception {
+ if (data instanceof IPPMUserData)
+ return
ippmModel.getRequest().createRequest(data, messageType);
+ else
+ return super.createRequest(data,
messageType);
+ }
};
}
public IUserData createUserData() {
@@ -253,6 +316,7 @@
supported.add(PerfsonarSchema.getInstance("NMWG2v2"));
supported.add(PerfsonarSchema.getInstance("NMWG2v2_netutil"));
supported.add(PerfsonarSchema.getInstance("http://schemas.perfsonar.net/2.0"));
+ supported.add(PerfsonarSchema.getInstance("ippm"));
return supported;
}
@@ -294,7 +358,7 @@
public void selectRow(int row) {
setUserData(row);
- getUserData().lastWeek();
+ //getUserData().lastWeek();
getDataRequestAction().setUserData(getUserData());
getDataRequestAction().actionPerformed(new ActionEvent(this,0,""));
getDataList().setSelectedItemIndex(row);
@@ -331,7 +395,7 @@
@Override
public SetupDataRequestAction createDataRequestAction() {
MASetupDataRequestAction a = new
MASetupDataRequestAction(request,(UserData)userData,responseData,"Interface
details");
- a.setTimeInterval(timeIntervals[4]);
+ a.setTimeRange(new
TimeRange(System.currentTimeMillis(),TimeRange.timeIntervals[4]));
return a;
}
public String getTracerouteURL() {
@@ -354,17 +418,18 @@
public void setTracerouteShell(TracerouteShell tracerouteShell) {
this.tracerouteShell = tracerouteShell;
}
-
+
@Override
public JComponent[] createOptionsComponent(Component parentComponent)
{
- TimeOptionsPanel tp = new TimeOptionsPanel(timeIntervals,
timeIntervalsTitle, "average");
+ /*
+ TimeOptionsPanel tp = new TimeOptionsPanel();
//timeIntervals, timeIntervalsTitle, "average");
tp.addTimeAction((ITimeSetAction)searchAction);
//tp.addTimeAction((ITimeSetAction)dataRequestAction);
tp.addTimeAction((ITimeSetAction)dataRequestActionAll);
tp.addTimeAction((ITimeSetAction)metadataRequestAction);
-
- return new JComponent[]{tp,new RequestOptionsPanel(this),new
MetricsOptionPanel(metrics)};
+ */
+ return new JComponent[]{new RequestOptionsPanel(this)};
}
@Override
public JComponent[] createDetailsComponent(Component parentComponent)
{
@@ -422,4 +487,24 @@
eventTypes.add("http://ggf.org/ns/nmwg/characteristic/discards/2.0");
return
org.perfsonar.perfsonarui.util.Collections.umodifiableCopy(eventTypes);
}
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener
listener) {
+ super.addPropertyChangeListener(listener);
+ ippmModel.addPropertyChangeListener(listener);
+ }
+ @Override
+ public void timeRangeChange(String name, TimeRange value) {
+ ((ITimeSetAction)getSearchAction()).setTimeRange(value);
+ ((ITimeSetAction)getDataRequestAction()).setTimeRange(value);
+ ((ITimeSetAction)getMetadataRequestAction()).setTimeRange(value);
+ ((ITimeSetAction)dataRequestActionAll).setTimeRange(value);
+ populateAction.setTimeRange(value);
+
+ Object[] keys = ippmModel.getActions().allKeys();
+ for (Object key:keys) {
+ Action action = ippmModel.getActions().get(key);
+ if (action instanceof ITimeSet)
+ ((ITimeSet)action).setTimeRange(value);
+ }
+ }
}
Modified: branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/UserData.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/UserData.java
2009-01-21 14:13:05 UTC (rev 4897)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/UserData.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -27,6 +27,7 @@
import org.perfsonar.lsclient.data.TopologyElement;
import org.perfsonar.perfsonarui.AbstractUserData;
import org.perfsonar.perfsonarui.plugins.IUserData;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.PerfsonarModel;
/**
@@ -198,7 +199,7 @@
direction = DIRECTION.IN;
setQuery(names[INDEX_EVENTTYPE],"utilization");
- setTime(timeNow-24*60*60, 24*60*60);
+ setTimeRange(new
TimeRange(System.currentTimeMillis(),TimeRange.getDayRange()));
setQuery(names[INDEX_CONSOLIDATION],"AVERAGE");
setQuery(names[INDEX_RESOLUTION],"300");
@@ -520,9 +521,17 @@
tStart = Long.parseLong(getQuery(names[INDEX_STARTTIME]));
} catch (Exception x) {};
long timeInterval = tEnd - tStart;
+ b.append(" \n( ");
+ b.append(" From ");
+ b.append(new Date(tStart*1000));
+ b.append(" To ");
+ b.append(new Date(tEnd*1000));
+ b.append(" )");
+ /*
b.append(" ( ");
b.append(PerfsonarModel.timeInterval2Title(timeInterval));
b.append(" )");
+ */
//if (input) b.append("in"); else b.append("out");
return b.toString();
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/actions/SearchByIPAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/actions/SearchByIPAction.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/actions/SearchByIPAction.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -135,7 +135,7 @@
System.out.println(">>
"+topoElement.getEndpoints());
topoElement.makeQueryFromResponse();
-
topoElement.lastSeconds(timeInterval);
+
topoElement.setTimeRange(getTimeRange());
((UserData)topoElement).setDirection(UserData.DIRECTION.UNKNOWN);
request.makeRequest(topoElement,
IPerfsonarRequest.MA_SetupDataRequest,
new
TimeValueListResponseListener(dataList), true);
@@ -195,7 +195,7 @@
for (int i=0; i < dataList.size();i++) {
// responce --> query
dataList.get(i).makeQueryFromResponse();
- dataList.get(i).lastSeconds(timeInterval);
+ dataList.get(i).setTimeRange(getTimeRange());
UserData data = (UserData)dataList.get(i);
data.setDirection(UserData.DIRECTION.UNKNOWN);
PSLogger.threadlog(getClass().getName()+"\t"+dataList.get(i));
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/actions/SetupDataRefreshActionAll.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/actions/SetupDataRefreshActionAll.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/actions/SetupDataRefreshActionAll.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -31,7 +31,7 @@
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
import org.perfsonar.perfsonarui.plugins.MetaDataList;
-import org.perfsonar.perfsonarui.ui.PerfsonarModel;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.actions.ITimeSetAction;
import org.perfsonar.perfsonarui.ui.actions.MetadataRequestAction;
@@ -41,7 +41,7 @@
*
*/
public class SetupDataRefreshActionAll extends MetadataRequestAction
implements ITimeSetAction {
- protected long timeInterval = PerfsonarModel.timeIntervals[0];
//seconds
+ protected TimeRange timeRange = new
TimeRange(System.currentTimeMillis(),TimeRange.timeIntervals[0]);
protected int timeResolution = 300;
protected int ready = 0;
/**
@@ -71,13 +71,8 @@
ready = 0;
request.fireStatusMessage("");
if (request == null) return null; //TODO check if this should
silently fail
- //long timeNow =
Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis()/1000 - 660;
- //double p = 100.0/dataList.size();
- dataList.setTimeInterval(timeInterval);
- //String resolution =
Long.toString(dataList.getTimeInterval()); // 2 hours average
- //String oldResolution = "300";
- dataList.setTimeInterval(dataList.getTimeInterval());
-
+ dataList.setTimeRange(getTimeRange());
+ System.out.println(getClass().getName() + " run
"+getTimeRange());
for (int i=0; i < dataList.size();i++) {
UserData data = (UserData)dataList.get(i);
data.makeQueryFromResponse();
@@ -125,19 +120,13 @@
return null;
}
- public synchronized long getTimeInterval() {
- return dataList.getTimeInterval();
- }
- public synchronized void setTimeInterval(long timeInterval) {
- this.timeInterval = timeInterval;
- }
- public long getStartTime() {
- return
Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis()/1000;
- }
- public void setStartTime(long milliseconds) {
-
- }
-
+ public TimeRange getTimeRange() {
+ return timeRange;
+ }
+ public void setTimeRange(TimeRange value) {
+ System.out.println(getClass().getName() + " set "+value);
+ timeRange = value;
+ }
public int getResolution() {
return timeResolution;
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/actions/SetupDataRetrieveAllAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/actions/SetupDataRetrieveAllAction.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/actions/SetupDataRetrieveAllAction.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -64,7 +64,7 @@
@Override
public Object run(ActionEvent arg0) {
//if (dataList.getProgress() > 0) return;
- dataList.setTimeInterval(timeInterval);
+ dataList.setTimeRange(getTimeRange());
if (request == null) return null; //TODO check if this should
silently fail
dataList.clear();
@@ -129,7 +129,7 @@
} else {
-
dataList.setTimeInterval(timeInterval);
+ dataList.setTimeRange(getTimeRange());
request.fireStatusMessage("");
if (!isInterrupted()) {
@@ -148,10 +148,6 @@
}
- @Override
- public synchronized void setTimeInterval(long timeInterval) {
- this.timeInterval = timeInterval;
- }
public synchronized boolean isMetadataOnly() {
return metadataOnly;
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/BarChartPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/BarChartPanel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/BarChartPanel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -425,7 +425,7 @@
action.setUserData(psModel.getUserData());
((MetadataChartSet)
dataset).setSelected((UserData)item.getColumnKey());
if (action instanceof ITimeSet)
-
((UserData)psModel.getUserData()).lastSeconds(((ITimeSet)action).getTimeInterval());
+
((UserData)psModel.getUserData()).setTimeRange(((ITimeSet)action).getTimeRange());
action.actionPerformed(null);
} else
JOptionPane.showMessageDialog(null,item.getColumnKey() + "
,"+item.getRowKey());
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MAResponseChartPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MAResponseChartPanel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MAResponseChartPanel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -48,6 +48,7 @@
import org.perfsonar.perfsonarui.ma.MAPerfsonarModel;
import org.perfsonar.perfsonarui.ma.MAResourceKeys;
import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.PerfsonarModel;
import org.perfsonar.perfsonarui.ui.actions.ITimeSetAction;
import org.perfsonar.perfsonarui.ui.panels.PerfsonarTimeSeries;
@@ -91,13 +92,13 @@
public void addWidgets(IPerfsonarTab psModel,
PerfsonarTimeSeriesDataset ifDataset) {
super.addWidgets(psModel, ifDataset);
- TimeOptionsToolbar tp = new
TimeOptionsToolbar(PerfsonarModel.timeIntervals,
PerfsonarModel.timeIntervalsTitle) ;
+ TimeOptionsToolbar tp = new
TimeOptionsToolbar(TimeRange.timeIntervals, TimeRange.timeIntervalsTitle) ;
tp.addTimeAction((ITimeSetAction)
((PerfsonarModel)psModel).getDataRequestAction());
add(tp, BorderLayout.EAST);
- setMinimumSize(new Dimension(200,
24*PerfsonarModel.timeIntervals.length));
- setPreferredSize(new Dimension(200,
24*PerfsonarModel.timeIntervals.length));
+ setMinimumSize(new Dimension(200,
24*TimeRange.timeIntervals.length));
+ setPreferredSize(new Dimension(200,
24*TimeRange.timeIntervals.length));
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MainPanelMA.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MainPanelMA.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MainPanelMA.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -22,33 +22,27 @@
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.util.Arrays;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.Hashtable;
-import java.util.List;
-import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JPanel;
-import javax.swing.JScrollPane;
import javax.swing.JTable;
-import javax.swing.UIManager;
-import javax.swing.plaf.BorderUIResource;
+import javax.swing.JToolBar;
+import javax.swing.SwingConstants;
-import org.jdesktop.swingx.JXTaskPane;
-import org.jdesktop.swingx.JXTaskPaneContainer;
-import org.jdesktop.swingx.border.DropShadowBorder;
-import org.jdesktop.swingx.border.IconBorder;
+import org.perfsonar.perfsonarui.ippm.ui.panels.MainPanelIPPM;
import org.perfsonar.perfsonarui.ma.MAPerfsonarModel;
import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
-import org.perfsonar.perfsonarui.ui.PerfsonarPaneUI;
-import org.perfsonar.perfsonarui.ui.PerfsonarTaskPaneContainerUI;
import org.perfsonar.perfsonarui.ui.PluginMainContainer;
-import org.perfsonar.perfsonarui.ui.PluginMainPanel;
import org.perfsonar.perfsonarui.ui.panels.PerfsonarTimeSeriesDataset;
-import org.perfsonar.perfsonarui.util.Collections;
+import org.perfsonar.perfsonarui.ui.panels.TimeOptionsPanel;
/**
*
@@ -61,10 +55,6 @@
protected MetaDataPanel metadataPanel = null;
protected BarChartPanel barPanel = null;
protected MAResponseChartPanel responsePanel = null;
- /*
- protected TimerTask requestTask;
- protected Timer timer;
- */
/**
*
@@ -75,7 +65,7 @@
super(parentFrame,psModel);
}
@Override
- protected Collection<JComponent> createComponents() {
+ public Collection<JComponent> createComponents() {
//Create panels
responsePanel = new
MAResponseChartPanel(model,(PerfsonarTimeSeriesDataset)model.getResponseListener());
@@ -101,15 +91,63 @@
model.getRequest().addPropertyChangeListener(responsePanel);
+ JPanel top = new JPanel() {
+ @Override
+ public String toString() {
+ return "Traceroute";
+ }
+ };
+ top.setLayout(new BorderLayout());
SearchPanel searchPanel = new
SearchPanel((MAPerfsonarModel)model);
searchPanel.setMinimumSize(new Dimension(200,160));
searchPanel.setPreferredSize(new Dimension(360,200));
//fills the panel with traceroute outcome
((MAPerfsonarModel)model).getTracerouteShell().addPropertyChangeListener(searchPanel);
+ top.add(searchPanel,BorderLayout.CENTER);
+ top.add(new
MetricsOptionPanel(((MAPerfsonarModel)model).getMetrics()),BorderLayout.EAST);
+
top.add(createSearchToolbar((MAPerfsonarModel)model),BorderLayout.NORTH);
- return Arrays.asList(new JComponent[]
{searchPanel,metadataPanel,barPanel,responsePanel});
+ MainPanelIPPM ippmPanel = new
MainPanelIPPM(null,((MAPerfsonarModel)getModel()).getIppmModel());
+ ArrayList<JComponent> components = new
ArrayList<JComponent>();
+ components.add(top);
+ components.add(metadataPanel);
+ components.add(barPanel);
+ components.add(responsePanel);
+ for (JComponent c : ippmPanel.createComponents())
+ components.add(c);
+ ippmPanel = null;
+ return components;
+
}
+
+ protected JComponent createSearchToolbar(final MAPerfsonarModel psModel)
{
+ TimeOptionsPanel timePanel = new TimeOptionsPanel();
+ timePanel.addPropertyChangeListener(psModel);
+ //timePanel.addTimeAction((ITimeSetAction)psModel.get());
+
+ JToolBar bar = new JToolBar(SwingConstants.HORIZONTAL);
+ bar.setFloatable(false);
+ bar.add(timePanel);
+
+ bar.addSeparator();
+
+ bar.add(new JButton(psModel.getSearchAction()));
+ bar.addSeparator();
+ bar.add(new JButton(psModel.getTraceAction()));
+ bar.addSeparator();
+ JCheckBox gls = new JCheckBox("Use Lookup Service");
+ gls.setSelected(psModel.getTraceAction().isUseGLS());
+ gls.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ psModel.getTraceAction().setUseGLS(
+ e.getStateChange() ==
ItemEvent.SELECTED
+ );
+ }
+ });
+ bar.add(gls);
+ return bar;
+ }
@Override
public void setModel(IPerfsonarTab model) {
if (model instanceof MAPerfsonarModel)
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MetadataChartSet.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MetadataChartSet.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MetadataChartSet.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -30,7 +30,7 @@
import org.perfsonar.perfsonarui.ma.MAMetadataList;
import org.perfsonar.perfsonarui.ma.UserData;
import org.perfsonar.perfsonarui.plugins.MetaDataList;
-import org.perfsonar.perfsonarui.ui.PerfsonarModel;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
/**
* Dataset for the bar chart.
@@ -243,7 +243,7 @@
public String toString() {
if (dataList.size()==0) return "";
else return "Summary for all interfaces ( "
- +
PerfsonarModel.timeInterval2Title(dataList.getTimeInterval()) + " )";
+ + dataList.getTimeRange() + " )";
}
public synchronized int getPage() {
return page;
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MetadataRadarSet.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MetadataRadarSet.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MetadataRadarSet.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -207,8 +207,8 @@
@Override
public String toString() {
- return "Summary for all interfaces ("
- +
PerfsonarModel.timeInterval2Title(dataList.getTimeInterval()) + " )";
+ return "Summary for all interfaces " +
dataList.getTimeRange();
+
}
public void setSelected (int index) {
selectedIndex = index;
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MetricsOptionPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MetricsOptionPanel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/MetricsOptionPanel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -30,8 +30,6 @@
package org.perfsonar.perfsonarui.ma.ui.panels;
import java.awt.ItemSelectable;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
@@ -40,8 +38,6 @@
import javax.swing.JCheckBox;
import javax.swing.JPanel;
-import org.perfsonar.perfsonarui.ma.MAPerfsonarModel;
-import org.perfsonar.perfsonarui.ma.MARequest_NMWG2;
import org.perfsonar.perfsonarui.plugins.Metric;
public class MetricsOptionPanel extends JPanel implements ItemListener {
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/RadarChartPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/RadarChartPanel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/RadarChartPanel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -24,7 +24,6 @@
import java.awt.Dimension;
import java.awt.Font;
-import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
@@ -227,7 +226,7 @@
psModel.getUserData().assign((UserData)item.getColumnKey());
action.setUserData(psModel.getUserData());
((MetadataRadarSet)
dataset).setSelected((UserData)item.getColumnKey());
-
((UserData)psModel.getUserData()).lastWeek();
+
//((UserData)psModel.getUserData()).lastWeek();
action.actionPerformed(null);
} else
JOptionPane.showMessageDialog(null,item.getColumnKey());
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/SearchPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/SearchPanel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/ui/panels/SearchPanel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -66,7 +66,6 @@
public SearchPanel(MAPerfsonarModel psModel) {
super(psModel,"Search by interface IP");
this.model = psModel;
- add(createMenuPanel(model),BorderLayout.NORTH);
createPopupmenu(model);
textArea.getDocument().addDocumentListener(this);
setBorder(null);
@@ -78,27 +77,7 @@
super.addWidgets(psModel,title);
textArea.setToolTipText("Enter one IP address per row or paste a
traceroute output");
}
- protected JComponent createMenuPanel(final MAPerfsonarModel psModel) {
- JToolBar bar = new JToolBar(SwingConstants.HORIZONTAL);
- /* available via popup menu
- bar.add(new JButton(loadFromFileAction));
- bar.add(new JButton(pasteAction));
- */
- bar.add(new JButton(psModel.getSearchAction()));
- bar.add(new JButton(psModel.getTraceAction()));
- JCheckBox gls = new JCheckBox("Use Lookup Service");
- gls.setSelected(psModel.getTraceAction().isUseGLS());
- gls.addItemListener(new ItemListener() {
- public void itemStateChanged(ItemEvent e) {
- psModel.getTraceAction().setUseGLS(
- e.getStateChange() ==
ItemEvent.SELECTED
- );
- }
- });
- bar.add(gls);
- return bar;
- }
/*
protected JPanel createMenuPanel(MAPerfsonarModel psModel) {
PSUIAction[] timeActions = psModel.getStatsTimeActions();
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/playground/PlaygroundPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/playground/PlaygroundPanel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/playground/PlaygroundPanel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -91,7 +91,7 @@
super(parentFrame,psModel);
}
@Override
- protected Collection<JComponent> createComponents() {
+ public Collection<JComponent> createComponents() {
query = new TextPanel(getModel(),"Query");
query.setBorder(null);
query.getTextArea().getDocument().addDocumentListener(this);
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/playground/PlaygroundPredefined.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/playground/PlaygroundPredefined.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/playground/PlaygroundPredefined.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -18,6 +18,7 @@
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
import org.perfsonar.perfsonarui.plugins.IUserData;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.panels.BusyIdleEvent;
import org.w3c.dom.Document;
@@ -123,8 +124,7 @@
}
else if(type.equals("IPPM meta-data request")){
data = new IPPMUserData();
- long time = System.currentTimeMillis()/1000;
- data.setTime(time-30*60,30*60);
+ data.setTimeRange(new
TimeRange(System.currentTimeMillis(),30*60*1000));
request = new IPPMRequest();
try {
doc =
request.createRequest(data,IPerfsonarRequest.MA_MetadataKeyRequest);
@@ -140,8 +140,7 @@
data = new IPPMUserData();
data.setQuery(IPPMUserData.IFNAME_SRC,"Ljubljana_ARNES");
data.setQuery(IPPMUserData.IFNAME_DST, "Amsterdam_SURFnet");
- long time = System.currentTimeMillis()/1000;
- data.setTime(time-30*60,30*60);
+ data.setTimeRange(new
TimeRange(System.currentTimeMillis(),30*60*1000));
request = new IPPMRequest();
try {
doc =
request.createRequest(data,IPerfsonarRequest.MA_SetupDataRequest);
@@ -157,8 +156,8 @@
data = new IPPMUserData();
data.setQuery(IPPMUserData.IFNAME_SRC,"Geneva_GEANT");
data.setQuery(IPPMUserData.IFNAME_DST, "Frankfurt_GEANT");
- long time = System.currentTimeMillis()/1000;
- data.setTime(time-120*60,120*60);
+ long time = System.currentTimeMillis();
+ data.setTimeRange(new TimeRange(time,120*60*1000));
request = new HoplistRequest();
try {
doc =
request.createRequest(data,IPerfsonarRequest.MA_SetupDataRequest);
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IPerfsonarTab.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IPerfsonarTab.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IPerfsonarTab.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -21,6 +21,7 @@
package org.perfsonar.perfsonarui.plugins;
import java.awt.Component;
+import java.beans.PropertyChangeListener;
import java.util.Observer;
import java.util.ResourceBundle;
@@ -45,7 +46,8 @@
* @author Nina Jeliazkova
* <b>Modified</b> Sep 4, 2006
*/
-public interface IPerfsonarTab extends Observer, Comparable<IPerfsonarTab> {
+public interface IPerfsonarTab extends Observer, Comparable<IPerfsonarTab> ,
PropertyChangeListener {
+ //TODO replace Observer by PropertyChangeListener
public static String defaultGroupQueryOption = "Query options";
public static String defaultGroupQuery = "Execute query";
public static String defaultGroupHidden = "HIDDEN";
@@ -147,4 +149,11 @@
public int getOrder();
public ResourceBundle getResourceBundle();
-}
\ No newline at end of file
+ /**
+ * model to take care of adding listeners
+ * @param listener
+ */
+ public void addPropertyChangeListener(PropertyChangeListener
listener);
+
+
+}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IUserData.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IUserData.java
2009-01-21 14:13:05 UTC (rev 4897)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IUserData.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -148,7 +148,7 @@
public long getUiTime();
public void setUiTime(long uiTime);
public void assign(IUserData userData) ;
- public void setTime(long time, long interval);
+ public void setTimeRange(TimeRange time);
public String getStartTime();
public String getEndTime();
public String getResolution();
@@ -179,10 +179,11 @@
*
*/
public void makeQueryFromResponse();
- public void lastSeconds(long seconds) ;
- public void lastHour();
- public void lastDay();
- public void lastWeek();
+ /**
+ *
+ * @param start time in seconds
+ */
+ //public void lastSeconds(long start,long seconds) ;
public boolean isNotificationEnabled();
public void setNotificationEnabled(boolean value);
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MetaDataList.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MetaDataList.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MetaDataList.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -26,7 +26,6 @@
import java.util.Observer;
import org.perfsonar.perfsonarui.PSLogger;
-import org.perfsonar.perfsonarui.ui.PerfsonarModel;
/**
*
@@ -39,7 +38,7 @@
protected ArrayList<IUserData> list;
protected static double eps = 0;
protected IUserDataComparator comparator;
- protected long timeInterval = PerfsonarModel.timeIntervals[0];
+ protected TimeRange timeRange = new TimeRange();
protected static Double DoubleZERO = new Double(eps);
protected static Double Double100 = new Double(100);
protected int selectedItemIndex = 0;
@@ -176,17 +175,18 @@
public List<? extends IUserData> getList() {
return list;
}
- public long getTimeInterval() {
- return timeInterval;
+ public TimeRange getTimeRange() {
+ return timeRange;
}
+
/**
*
* @param timeInterval seconds
*/
- public void setTimeInterval(long timeInterval) {
- this.timeInterval = timeInterval;
+ public void setTimeRange(TimeRange value) {
+ this.timeRange = value;
for (int i = 0; i < list.size();i++)
- ((IUserData)list.get(i)).lastSeconds(timeInterval);
+ ((IUserData)list.get(i)).setTimeRange(value);
setChanged();
notifyObservers();
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/TimeRange.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/CalendarTest.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/test/CalendarTest.java
2009-01-21 14:13:05 UTC (rev 4897)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/test/CalendarTest.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -26,18 +26,31 @@
import junit.framework.TestCase;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.panels.DatePanel;
+import org.perfsonar.perfsonarui.ui.panels.TimeOptionsPanel;
public class CalendarTest extends TestCase {
public static void main(String[] args) {
junit.textui.TestRunner.run(CalendarTest.class);
}
- public void test() {
+ public void xtest() {
DatePanel dp = new DatePanel(new Date(1138025449000L));
if (JOptionPane.showConfirmDialog(null,dp) ==
JOptionPane.OK_OPTION) {
System.out.println(DateFormat.getInstance().format(dp.getDate()));
}
}
+ public void testTime() {
+ TimeOptionsPanel dp = new TimeOptionsPanel(new
Date(1138025449000L));
+ if (JOptionPane.showConfirmDialog(null,dp) ==
JOptionPane.OK_OPTION) {
+
System.out.println(DateFormat.getInstance().format(dp.getDate()));
+
+ }
+ }
+ public void testRange() {
+ TimeRange r = new TimeRange();
+ System.out.println(r);
+ }
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/MARequest_NMWG2_Test.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/MARequest_NMWG2_Test.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/MARequest_NMWG2_Test.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -21,6 +21,8 @@
package org.perfsonar.perfsonarui.test;
import java.io.File;
+import java.util.Calendar;
+import java.util.TimeZone;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -43,6 +45,7 @@
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MetaDataList;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.w3c.dom.Document;
/**
@@ -117,7 +120,7 @@
list.getUserData(i).setDirection(UserData.DIRECTION.UNKNOWN);
newList.add(list.get(i));
}
- newList.setTimeInterval(120*60);//2 hours
+ newList.setTimeRange(new
TimeRange(Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis(),TimeRange.getHourRange()*2));//2
hours
MAEndpoint m = new
MAEndpoint("ISTF-Java,http://selena.acad.bg:8080/axis/services/MeasurementArchiveService,NMWG2v2_netutil,\"\",utilization,utilization");
MARequest_NMWG2 r = (MARequest_NMWG2) createRequest(m.getSchema());
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/SmartMARequestTest.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/SmartMARequestTest.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/SmartMARequestTest.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -48,6 +48,7 @@
import org.perfsonar.perfsonarui.plugins.IUserData;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MetaDataList;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.plugins.UnsupportedSchemaException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -125,8 +126,8 @@
//smartRequest.makeRequest(ud, response);
ud.makeQueryFromResponse();
ud.setDirection(UserData.DIRECTION.OUT);
- long time = System.currentTimeMillis()/1000 -
60*24;
- ud.setTime(time,60*24);
+
+ ud.setTimeRange(new
TimeRange(System.currentTimeMillis(),TimeRange.getDayRange()));
smartRequest.makeRequest( ud,
IPerfsonarRequest.MA_SetupDataRequest, new
TimeValueResponseListener(response), false);
assertEquals(0,responseListener.getCountInitiated());
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/UserDataTest.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/test/UserDataTest.java
2009-01-21 14:13:05 UTC (rev 4897)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/test/UserDataTest.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -26,8 +26,8 @@
import org.perfsonar.perfsonarui.AbstractUserData;
import org.perfsonar.perfsonarui.ma.UserData;
-import org.perfsonar.perfsonarui.ma.UserData.DIRECTION;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
public class UserDataTest extends TestCase {
@@ -73,85 +73,15 @@
/*
* Test method for 'org.perfsonar.perfsonarui.UserData.setTime(long,
long)'
*/
- public void testSetTime() {
- long timeNow =
Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis()/1000;
+ public void testSetTimeRange() {
+ long timeNow = System.currentTimeMillis();
UserData data = new UserData();
- data.setTime(timeNow,600);
-
assertEquals(Long.toString(timeNow+600),data.getEndTime(AbstractUserData.ID_QUERY));
+ data.setTimeRange(new TimeRange(timeNow,600000));
+
assertEquals(Long.toString(timeNow/1000+600),data.getEndTime(AbstractUserData.ID_QUERY));
data = null;
}
/*
- * Test method for
'org.perfsonar.perfsonarui.UserData.setStartTime(long)'
- */
- public void testSetStartTime() {
- long timeNow =
Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis()/1000;
- UserData data = new UserData();
- data.setStartTime(timeNow);
-
assertEquals(Long.toString(timeNow),data.getStartTime(AbstractUserData.ID_QUERY));
- data = null;
- }
-
- /*
- * Test method for
'org.perfsonar.perfsonarui.UserData.setEndTime(long)'
- */
- public void testSetEndTime() {
- long timeNow =
Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis()/1000;
- UserData data = new UserData();
- data.setEndTime(timeNow);
-
assertEquals(Long.toString(timeNow),data.getEndTime(AbstractUserData.ID_QUERY));
- data = null;
- }
-
- /*
- * Test method for
'org.perfsonar.perfsonarui.UserData.lastSeconds(long)'
- */
- public void testLastSeconds() {
- UserData data = new UserData();
- data.lastSeconds(600);
- long from =
Long.parseLong(data.getStartTime(AbstractUserData.ID_QUERY));
- long to =
Long.parseLong(data.getEndTime(AbstractUserData.ID_QUERY));
- assertEquals(to-from,600);
- data = null;
- }
-
- /*
- * Test method for 'org.perfsonar.perfsonarui.UserData.lastHour()'
- */
- public void testLastHour() {
- UserData data = new UserData();
- data.lastSeconds(360);
- long from =
Long.parseLong(data.getStartTime(AbstractUserData.ID_QUERY));
- long to =
Long.parseLong(data.getEndTime(AbstractUserData.ID_QUERY));
- assertEquals(to-from,360);
- data = null;
- }
-
- /*
- * Test method for 'org.perfsonar.perfsonarui.UserData.lastDay()'
- */
- public void testLastDay() {
- UserData data = new UserData();
- data.lastSeconds(24*60*60);
- long from =
Long.parseLong(data.getStartTime(AbstractUserData.ID_QUERY));
- long to =
Long.parseLong(data.getEndTime(AbstractUserData.ID_QUERY));
- assertEquals(to-from,24*60*60);
- data = null;
- }
-
- /*
- * Test method for 'org.perfsonar.perfsonarui.UserData.lastWeek()'
- */
- public void testLastWeek() {
- UserData data = new UserData();
- data.lastSeconds(7*24*60*60);
- long from =
Long.parseLong(data.getStartTime(AbstractUserData.ID_QUERY));
- long to =
Long.parseLong(data.getEndTime(AbstractUserData.ID_QUERY));
- assertEquals(to-from,7*24*60*60);
- data = null;
- }
-
- /*
* Test method for 'org.perfsonar.perfsonarui.UserData.clear()'
*/
public void testClear() {
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/AbstractDatePanel.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -20,6 +20,8 @@
package org.perfsonar.perfsonarui.ui;
import java.awt.Component;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
@@ -62,6 +64,7 @@
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
import org.perfsonar.perfsonarui.plugins.MetaDataList;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.actions.ClearAction;
import org.perfsonar.perfsonarui.ui.actions.EndpointsAction;
import org.perfsonar.perfsonarui.ui.actions.MetadataRequestAction;
@@ -115,19 +118,8 @@
*/
public abstract class PerfsonarModel extends Observable implements
IPerfsonarTab {
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
- 24*60*60, //24h
- 72*60*60, //72h
- 7*24*60*60, //7 days
- 30*24*60*60, //1 month
- 3*30*24*60*60, //3 months
- 12*30*24*60*60, //1 year
- 24*30*24*60*60 //2 year
- };
+
+
public final static int timeResolution[] = { //seconds
300, //90 min
300, //90 min
@@ -139,20 +131,8 @@
3*600, //3 months
2*60*60 //1 year 2 h
};
- public final static String timeIntervalsTitle[] = { //seconds
- "Last 15 min",
- "Last 90 min",
- "Last 8 hours",
- "Last 24 hours",
- "Last 3 days",
- "Last week",
- "Last month",
- "Last 3 months",
- "Last year",
- "Last 2 years"
- };
- protected final static int statsIndex[] = {0,2,4,5,7};
+
protected final SmartMARequest request;
protected ResourceBundle resourceBundle;
@@ -249,7 +229,7 @@
clearAction.setActions(actions);
}
-
+
/**
* 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>
@@ -416,12 +396,6 @@
}
}
- 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;
@@ -613,5 +587,15 @@
in.close();
}
}
-
+ public void addPropertyChangeListener(PropertyChangeListener
listener) {
+ getRequest().addPropertyChangeListener(listener);
+ }
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getNewValue() instanceof TimeRange)
+
timeRangeChange(evt.getPropertyName(),(TimeRange)evt.getNewValue());
+
+ }
+ public void timeRangeChange(String name, TimeRange rimeRange) {
+
+ }
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarTaskPane.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarTaskPane.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarTaskPane.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -122,7 +122,7 @@
actionPanel.setPreferredSize(new Dimension(180,40));
actionPanel.setMaximumSize(new Dimension(180,40));
//actionPanel.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
-
perfsonarModel.getRequest().addPropertyChangeListener(actionPanel);
+ perfsonarModel.addPropertyChangeListener(actionPanel);
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p,BoxLayout.PAGE_AXIS));
p.add(actionPanel);
@@ -140,7 +140,7 @@
add(split,BorderLayout.CENTER);
StatusBar sp = new StatusBar(perfsonarModel);
- perfsonarModel.getRequest().addPropertyChangeListener(sp);
+ perfsonarModel.addPropertyChangeListener(sp);
add(sp,BorderLayout.SOUTH);
setBorder(null);
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PluginMainContainer.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PluginMainContainer.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PluginMainContainer.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -108,7 +108,7 @@
* Override this method in order to provide components for the right
pane
* @return
*/
- protected Collection<JComponent> createComponents() {
+ public Collection<JComponent> createComponents() {
return null;
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ITimeSet.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ITimeSet.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ITimeSet.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -24,25 +24,22 @@
package org.perfsonar.perfsonarui.ui.actions;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
+
/**
*
* @author Nina Jeliazkova
*
*/
public interface ITimeSet {
+
+ TimeRange getTimeRange();
+ void setTimeRange(TimeRange value);
- public abstract long getStartTime();
+ int getResolution();
- public abstract void setStartTime(long seconds);
-
- public abstract long getTimeInterval();
-
- public abstract void setTimeInterval(long timeInterval);
-
- public abstract int getResolution();
-
- public abstract void setResolution(int resolution);
+ void setResolution(int resolution);
- public boolean isEnabled();
+ boolean isEnabled();
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/SetupDataRequestAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/SetupDataRequestAction.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/SetupDataRequestAction.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -25,8 +25,6 @@
package org.perfsonar.perfsonarui.ui.actions;
import java.awt.event.ActionEvent;
-import java.util.Calendar;
-import java.util.TimeZone;
import javax.swing.Icon;
import javax.swing.JOptionPane;
@@ -38,7 +36,7 @@
import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
import org.perfsonar.perfsonarui.plugins.ITimeValueResponse;
import org.perfsonar.perfsonarui.plugins.IUserData;
-import org.perfsonar.perfsonarui.ui.PerfsonarModel;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
/**
* Performs SetupDataRequest with the query parameters defined in the
{@link
IUserData}.
@@ -47,8 +45,7 @@
*/
public class SetupDataRequestAction extends PerfsonarRequestAction
implements ITimeSetAction {
protected ITimeValueResponse response = null;
- protected long timeInterval = PerfsonarModel.timeIntervals[0];
- protected long startTime =
Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis()/1000 - 10*60;
+ protected TimeRange timeRange = new
TimeRange(System.currentTimeMillis(),TimeRange.timeIntervals[0]); //15 min
protected int resolution = 300;
@@ -112,8 +109,7 @@
return null;
}
public void prepareQuery(IUserData userData) {
- long timeNow = getStartTime();
- userData.setTime(timeNow - timeInterval , timeInterval);
+ userData.setTimeRange(timeRange);
userData.setResolution(Integer.toString(getResolution()));
}
@Override
@@ -128,20 +124,13 @@
this.response = response;
}
- public long getTimeInterval() {
- return timeInterval;
+ public TimeRange getTimeRange() {
+ return timeRange;
}
-
- public void setTimeInterval(long timeInterval) {
- this.timeInterval = timeInterval;
+ public void setTimeRange(TimeRange value) {
+ this.timeRange = value;
}
- public long getStartTime() {
- return
Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis()/1000;
- }
- public void setStartTime(long milliseconds) {
- startTime = milliseconds;
- }
public void setResolution(int resolution) {
this.resolution = resolution;
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/TimeSetAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/TimeSetAction.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/TimeSetAction.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -25,11 +25,11 @@
package org.perfsonar.perfsonarui.ui.actions;
import java.awt.event.ActionEvent;
-import java.util.Calendar;
-import java.util.TimeZone;
import javax.swing.Icon;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
+
/**
* Selects a time interval.
* @author Nina Jeliazkova
@@ -40,8 +40,7 @@
* Comment for <code>serialVersionUID</code>
*/
private static final long serialVersionUID = 4704887241070521797L;
- protected long timeInterval = 90*600*600;
- protected long startTime;
+ protected TimeRange timeRange = new
TimeRange(System.currentTimeMillis(),TimeRange.getDayRange());
protected int resolution = 300;
protected ITimeSet action;
/**
@@ -65,8 +64,7 @@
public TimeSetAction(ITimeSet action, long time,int resoluion, String
arg0, Icon arg1) {
super(arg0, arg1,"Details");
this.action = action;
-
setStartTime(Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis()/1000);
- setTimeInterval(time);
+ setTimeRange(new TimeRange(System.currentTimeMillis(),time));
setResolution(resolution);
}
@@ -75,25 +73,17 @@
*/
public void actionPerformed(ActionEvent e) {
if (action != null) {
- action.setTimeInterval(timeInterval);
- action.setStartTime(startTime);
+ action.setTimeRange(timeRange);
}
}
- public synchronized long getTimeInterval() {
- return timeInterval;
+ public TimeRange getTimeRange() {
+ return timeRange;
}
- public synchronized void setTimeInterval(long timeInterval) {
- this.timeInterval = timeInterval;
- if (action != null) action.setTimeInterval(timeInterval);
+ public void setTimeRange(TimeRange value) {
+ this.timeRange = value;
+
}
- public long getStartTime() {
- return startTime;
- }
- public void setStartTime(long milliseconds) {
- startTime = milliseconds;
- if (action != null) action.setStartTime(milliseconds);
- }
public int getResolution() {
return resolution;
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/DatePanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/DatePanel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/DatePanel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -2,57 +2,52 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.util.ArrayList;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import org.jdesktop.swingx.JXMonthView;
-import org.perfsonar.perfsonarui.ui.actions.ITimeSet;
-import org.perfsonar.perfsonarui.ui.actions.ITimeSetAction;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
+import org.perfsonar.perfsonarui.ui.AbstractDatePanel;
-public class DatePanel extends JXMonthView {
- protected ArrayList<ITimeSet> timeActions = null;
+public class DatePanel extends AbstractDatePanel implements
PropertyChangeListener {
/**
*
*/
private static final long serialVersionUID = -9154737925821794260L;
+ protected JXMonthView monthview;
public DatePanel() {
this(Calendar.getInstance(TimeZone.getDefault()).getTime());
}
public DatePanel(Date date) {
super();
- setSelectionDate(date);
- setTraversable(true);
- timeActions = new ArrayList<ITimeSet>();
- addActionListener(new ActionListener() {
+ monthview = new JXMonthView();
+ add(monthview);
+ monthview.setSelectionDate(date);
+ monthview.setTraversable(true);
+
+ monthview.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
-
setFlaggedDates(((JXMonthView)e.getSource()).getSelectionDate());
-
runActions(((JXMonthView)e.getSource()).getSelectionDate());
+
monthview.setFlaggedDates(((JXMonthView)e.getSource()).getSelectionDate());
+ setTimeRange(new TimeRange(
+
((JXMonthView)e.getSource()).getSelectionDate(),
+ TimeRange.getDayRange())
+ );
}
});
}
- protected void runActions(Date date) {
- if (timeActions != null)
- for (int i=0; i < timeActions.size();i++) {
- ITimeSet action = timeActions.get(i);
- setTime(timeActions.get(i),date);
- if (action instanceof ITimeSetAction)
- ((ITimeSetAction)
action).actionPerformed(null);
- }
- }
- public ArrayList<ITimeSet> getTimeActions() {
- return timeActions;
- }
- public void addTimeAction(ITimeSet timeAction) {
- timeActions.add(timeAction);
- setTime(timeAction, getSelectionDate());
- }
- protected void setTime(ITimeSet action, Date date) {
- action.setStartTime(date.getTime()/1000+24*60*60);
- action.setTimeInterval(24*60*60);
- }
+
public Date getDate() {
- return super.getSelectionDate();
+ return monthview.getSelectionDate();
}
+ public void propertyChange(PropertyChangeEvent evt) {
+ if ((evt.getPropertyName()=="date") && (evt.getNewValue() instanceof
TimeRange)) {
+ setTimeRange(new
TimeRange(((TimeRange)evt.getNewValue()).getStart(),TimeRange.getDayRange()),false);
//silent, otherwise will go cyclic notification
+ monthview.setSelectionDate(getTimeRange().getStart());
+ monthview.setFlaggedDates(getTimeRange().getStart());
+ }
+
+ }
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/TimeOptionsPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/TimeOptionsPanel.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/TimeOptionsPanel.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -1,111 +1,126 @@
-/*
-Copyright (C) 2005-2007
-
-Contact:
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-All we ask is that proper credit is given for our work, which includes
-- but is not limited to - adding the above copyright notice to the beginning
-of your source code files, and to any copyright notice that you may
distribute
-with programs based on this work.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
-*/
-
package org.perfsonar.perfsonarui.ui.panels;
import java.awt.Dimension;
-import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.util.ArrayList;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
-import javax.swing.ButtonGroup;
-import javax.swing.JPanel;
+import javax.swing.BoxLayout;
+import javax.swing.JComboBox;
+import javax.swing.JFormattedTextField;
+import javax.swing.JLabel;
import javax.swing.JRadioButton;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerDateModel;
+import javax.swing.JSpinner.DefaultEditor;
+import javax.swing.text.DateFormatter;
+import javax.swing.text.DefaultFormatterFactory;
-import org.perfsonar.perfsonarui.PSLogger;
-import org.perfsonar.perfsonarui.ui.actions.ITimeSet;
+import org.jdesktop.swingx.JXDatePicker;
+import org.jdesktop.swingx.calendar.SingleDaySelectionModel;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
+import org.perfsonar.perfsonarui.ui.AbstractDatePanel;
-/**
- * Time options.
- * @author Nina Jeliazkova
- *
- */
-public class TimeOptionsPanel extends JPanel implements ActionListener {
- protected static PSLogger logger = new PSLogger(TimeOptionsPanel.class);
+public class TimeOptionsPanel extends AbstractDatePanel {
+ protected long timeInterval=TimeRange.timeIntervals[0];
+ protected final JSpinner spinner;
+ protected final JXDatePicker picker;
+ protected JRadioButton[] rb;
+
/**
*
*/
- private static final long serialVersionUID = -1578433402575956467L;
- protected ArrayList<ITimeSet> timeActions = null;
- protected JRadioButton[] rb;
-
- public TimeOptionsPanel(long timeIntervals[],String timeTitles[]) {
- this(timeIntervals,timeTitles,"");
+ private static final long serialVersionUID = -8195404202961314014L;
+ public TimeOptionsPanel() {
+ this(new
Date(),TimeRange.timeIntervals,TimeRange.timeIntervalsTitle,"");
}
- public TimeOptionsPanel(long timeIntervals[],String timeTitles[],
String hint) {
- super(new GridLayout(timeIntervals.length,1));
- timeActions = new ArrayList<ITimeSet>();
- ButtonGroup bg = new ButtonGroup();
- rb = new JRadioButton[timeIntervals.length];
+ public TimeOptionsPanel(Date date) {
+
this(date,TimeRange.timeIntervals,TimeRange.timeIntervalsTitle,"");
+ }
+
+ public TimeOptionsPanel(Date date,final long timeIntervals[],final
String timeTitles[], String hint) {
+ super(date);
+ setLayout(new BoxLayout(this,BoxLayout.LINE_AXIS));
+ spinner = new JSpinner(new SpinnerDateModel());
+ picker = new JXDatePicker();
- for (int i=0; i < timeIntervals.length;i++) {
- rb[i] = new JRadioButton(timeTitles[i]);
-
rb[i].setActionCommand(Long.toString(timeIntervals[i]));
- rb[i].setContentAreaFilled(false);
- rb[i].addActionListener(this);
- rb[i].setToolTipText(rb[i].getText() + " " + hint + "
utilization");
- bg.add(rb[i]);
- add(rb[i]);
- rb[i].setSelected(i==0);
- }
- setMinimumSize(new Dimension(32,12*timeIntervals.length));
+ SingleDaySelectionModel selectionModel = new
SingleDaySelectionModel();
+ picker.getMonthView().setSelectionModel(selectionModel);
+ picker.setTimeZone(TimeZone.getDefault());
+ picker.setDate(date);
+ spinner.setValue(picker.getDate());
+ SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss",
picker.getLocale());
+ format.setTimeZone(picker.getTimeZone());
+ JFormattedTextField textField = ((DefaultEditor)
spinner.getEditor()).getTextField();
+ textField.setFormatterFactory(new DefaultFormatterFactory(new
DateFormatter(format)));
+
+ PropertyChangeListener l = new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if ("value".equals(evt.getPropertyName())) {
+ Date time = (Date) spinner.getValue();
+ getDate().setHours(time.getHours());
+ getDate().setMinutes(time.getMinutes());
+ getDate().setSeconds(time.getSeconds());
+ setTimeRange(new
TimeRange(picker.getDate(),getTimeInterval()));
+ } else
+ if ("date".equals(evt.getPropertyName())) {
+ if (picker.getDate() != null) {
+ spinner.setValue(picker.getDate());
+ //this will fire proprety "value"
+ }
+ }
+ }
+ };
+ picker.addPropertyChangeListener(l);
+ textField.addPropertyChangeListener(l);
+ JLabel fromLabel = new JLabel("From: ");
+ add(fromLabel);
+ add(picker);
+ add(spinner);
+
+ JLabel duration = new JLabel(" Duration: ");
+ add(duration);
+ JComboBox intervals = new JComboBox(timeTitles);
+ intervals.setSelectedIndex(0);
+ intervals.setEditable(false);
+ intervals.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ JComboBox cb = (JComboBox)e.getSource();
+ timeInterval = timeIntervals[cb.getSelectedIndex()];
+ setTimeRange(new
TimeRange(picker.getDate(),getTimeInterval()));
+ }
+ });
+ timeInterval = timeIntervals[intervals.getSelectedIndex()];
+ add(intervals);
+
+ setPreferredSize(new Dimension(
+ (int)(
+ fromLabel.getPreferredSize().width+
+ picker.getPreferredSize().width+
+ spinner.getPreferredSize().width+
+ duration.getPreferredSize().width*2+
+ intervals.getPreferredSize().getWidth()
+ ),
+ picker.getPreferredSize().height));
+ setMaximumSize(getPreferredSize());
+ setMinimumSize(getPreferredSize());
+
+ }
+
+ public Date getDate() {
+ return picker.getDate();
+ }
+
+ public long getTimeInterval() {
+ return timeInterval;
}
- @Override
public String toString() {
return "Summary statistics";
}
- @Override
- public void setEnabled(boolean value) {
- super.setEnabled(value);
- for (int i=0; i < rb.length;i++)
- rb[i].setEnabled(value);
-
- }
- public void actionPerformed(ActionEvent e) {
- if (timeActions == null) return;
- //setEnabled(false);
- try {
- long ti = Long.parseLong(e.getActionCommand());
- for (int i=0; i < timeActions.size();i++) {
- ITimeSet action = timeActions.get(i);
- setTime(e,action, ti);
- }
- } catch (Exception x) {
- logger.error(x);
- }
- //setEnabled(true);
- }
- protected void setTime(ActionEvent e,ITimeSet action,long timeInterval) {
- if (!action.isEnabled()) return;
- action.setStartTime(System.currentTimeMillis()/1000);
- action.setTimeInterval(timeInterval);
- }
- public void addTimeAction(ITimeSet timeAction) {
- timeActions.add(timeAction);
- //setTime(null, timeAction, 90*60);
- }
+
}
-
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/TimeOptionsToolbar.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/TimeOptionsToolbar.java
2009-01-21 14:13:05 UTC (rev 4897)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/TimeOptionsToolbar.java
2009-01-21 14:20:21 UTC (rev 4898)
@@ -35,6 +35,7 @@
import javax.swing.JToolBar;
import javax.swing.SwingConstants;
+import org.perfsonar.perfsonarui.plugins.TimeRange;
import org.perfsonar.perfsonarui.ui.actions.ITimeSetAction;
/**
* Time options.
@@ -106,13 +107,11 @@
}
protected void setTime(ActionEvent e,ITimeSetAction action,long
timeInterval) {
if (!action.isEnabled()) return;
- action.setStartTime(System.currentTimeMillis()/1000);
- action.setTimeInterval(timeInterval);
+ action.setTimeRange(new
TimeRange(action.getTimeRange().getStart(),timeInterval));
action.actionPerformed(e);
}
public void addTimeAction(ITimeSetAction timeAction) {
timeActions.add(timeAction);
- //setTime(null, timeAction, 90*60);
}
}
Deleted:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/playground_success.png
Deleted:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/playground_unknown.png
Deleted:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/playground_warn.png
- perfsonar: r4898 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . demo flowsa flowsa/components ippm ippm/ui/actions ippm/ui/panels ma ma/ui/actions ma/ui/panels playground plugins test ui ui/actions ui/panels, svnlog, 01/21/2009
Archive powered by MHonArc 2.6.16.