perfsonar-dev - perfsonar: r5427 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: flowsa flowsa/components ui/panels ui/panels/sileria ui/panels/sileria/table ui/panels/sileria/util
Subject: perfsonar development work
List archive
perfsonar: r5427 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: flowsa flowsa/components ui/panels ui/panels/sileria ui/panels/sileria/table ui/panels/sileria/util
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5427 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: flowsa flowsa/components ui/panels ui/panels/sileria ui/panels/sileria/table ui/panels/sileria/util
- Date: Mon, 21 Dec 2009 11:28:51 -0500
Author: rade
Date: 2009-12-21 11:28:51 -0500 (Mon, 21 Dec 2009)
New Revision: 5427
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/ExporterPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/JCheckList.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/Nameable.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/table/
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/table/AbstractListTableModel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/table/TableColumn.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/util/
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/util/CheckList.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMAUserData.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/RouterPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/TimeRangePicker.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/CheckListModel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/CheckListSelectionListener.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/DefaultCheckListModel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/JCheckList.java
Log:
ASSIGNED - bug 850: Entering router's name in Options window
https://bugzilla.perfsonar.net/show_bug.cgi?id=850
Added new implementation of checked list - the previous one was not behaving
properly even after thorough bug tracking and testing.
Added ability to custom add routers to FlowSA tab.
Marked as deprecated all classes that previously implemented checked list.
New implementation is code taken from AniqUI from www.sileria.com licenced
under Apache 2.0 licence.
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMAUserData.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMAUserData.java
2009-12-21 13:48:15 UTC (rev 5426)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMAUserData.java
2009-12-21 16:28:51 UTC (rev 5427)
@@ -8,9 +8,12 @@
package org.perfsonar.perfsonarui.flowsa;
import java.util.Calendar;
+import java.util.Collections;
import java.util.Stack;
import org.perfsonar.perfsonarui.AbstractUserData;
+import org.perfsonar.perfsonarui.ui.panels.sileria.JCheckList;
+import org.perfsonar.perfsonarui.ui.panels.sileria.util.CheckList;
/**
* Userdata object for FlowSA
@@ -75,6 +78,7 @@
private Stack<Query> previousCachedQueries = new Stack<Query>();
private Stack<Query> nextCachedQueries = new Stack<Query>();
+ private JCheckList.CheckListModel<Exporter> exportersModel = new
JCheckList.CheckListModel<Exporter>(new CheckList<Exporter>());
/**
* Default no-arg constructor
@@ -143,4 +147,12 @@
public boolean hasPreviousQuery() {
return previousCachedQueries.size() > 1;
}
+
+ public JCheckList.CheckListModel<Exporter> getExportersModel() {
+ return this.exportersModel;
+ }
+
+ public void addExporterToModel(Exporter exporter){
+ this.exportersModel.add(exporter);
+ }
}
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/ExporterPanel.java
Property changes on:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/ExporterPanel.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/RouterPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/RouterPanel.java
2009-12-21 13:48:15 UTC (rev 5426)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/RouterPanel.java
2009-12-21 16:28:51 UTC (rev 5427)
@@ -3,107 +3,143 @@
import static org.jdesktop.layout.GroupLayout.DEFAULT_SIZE;
import static org.jdesktop.layout.GroupLayout.LEADING;
import static org.jdesktop.layout.GroupLayout.PREFERRED_SIZE;
+import static org.jdesktop.layout.LayoutStyle.RELATED;
+import java.awt.Color;
import java.awt.LayoutManager;
+import java.awt.event.ActionEvent;
import java.util.Observable;
import java.util.Observer;
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
import javax.swing.JComponent;
+import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
import org.jdesktop.layout.GroupLayout;
import org.perfsonar.perfsonarui.flowsa.Exporter;
import org.perfsonar.perfsonarui.flowsa.FlowsaMAUserData;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
-import org.perfsonar.perfsonarui.ui.panels.CheckListModel;
-import org.perfsonar.perfsonarui.ui.panels.CheckListSelectionListener;
-import org.perfsonar.perfsonarui.ui.panels.DefaultCheckListModel;
-import org.perfsonar.perfsonarui.ui.panels.JCheckList;
+import org.perfsonar.perfsonarui.ui.panels.sileria.JCheckList;
+import org.perfsonar.perfsonarui.ui.panels.sileria.JCheckList.CheckListModel;
+
public class RouterPanel extends JPanel {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
public RouterPanel(FlowsaMAUserData model) {
JComponent list = createRouterList(model);
-
- setLayout(createLayoutManager(list));
+ list.setBackground(Color.BLUE);
+ JButton addNewButton = new
JButton(createAddNewExporterAction(this, model));
+ setLayout(createLayoutManager(list, addNewButton));
}
- private LayoutManager createLayoutManager(JComponent list) {
+ private AddNewExporterAction createAddNewExporterAction(JPanel
thisPanel, FlowsaMAUserData model) {
+ return new AddNewExporterAction("Add Exporter...", thisPanel,
model);
+ }
+
+ private LayoutManager createLayoutManager(JComponent list, JButton
button) {
GroupLayout layout = new GroupLayout(this);
layout.setHorizontalGroup(
layout.createParallelGroup(LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(list, PREFERRED_SIZE, DEFAULT_SIZE,
Short.MAX_VALUE)
- .addContainerGap()
)
+ .add(layout.createSequentialGroup()
+ .addPreferredGap(RELATED)
+ .add(button, PREFERRED_SIZE, PREFERRED_SIZE, 200)
+ .addPreferredGap(RELATED)
+ )
);
layout.setVerticalGroup(
layout.createParallelGroup(LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
- .add(list, PREFERRED_SIZE, 80, PREFERRED_SIZE)
- .addContainerGap()
+ .add(list, PREFERRED_SIZE, 120, PREFERRED_SIZE)
+ .addPreferredGap(RELATED)
+ .add(button, PREFERRED_SIZE, PREFERRED_SIZE,
PREFERRED_SIZE)
)
);
return layout;
}
private JComponent createRouterList(final FlowsaMAUserData model) {
- final CheckListModel<Exporter> checkListModel = new
DefaultCheckListModel<Exporter>();
- checkListModel.addItem(new
Exporter("xsr01.asd001a.surf.net","SURFnet6 Core Router Amsterdam1"));
+ final CheckListModel<Exporter> checkListModel =
model.getExportersModel();
+ /*checkListModel.addItem(new
Exporter("xsr01.asd001a.surf.net","SURFnet6 Core Router Amsterdam1"));
checkListModel.addItem(new
Exporter("xsr01.asd002a.surf.net","SURFnet6 Core Router Amsterdam2"));
checkListModel.addItem(new
Exporter("xsr03.asd001a.surf.net","SURFnet6 Border Router Amsterdam1"));
checkListModel.addItem(new
Exporter("xsr03.asd002a.surf.net","SURFnet6 Border Router Amsterdam2"));
+ */
final JCheckList<Exporter> list = new
JCheckList<Exporter>(checkListModel);
+ list.setTableHeader(null);
model.addObserver(new Observer() {
private String oldEndPoint;
public void update(Observable o, Object arg) {
MAEndpoint newEndpoint =
model.getFirstEndpoint();
-
if(newEndpoint==null) {
- checkListModel.clear();
+ //checkListModel.clear();
return;
}
if(oldEndPoint == newEndpoint.getEndpoint()) {
return;
}
oldEndPoint = newEndpoint.getEndpoint();
- checkListModel.clear();
- checkListModel.addItem(new
Exporter("xsr01.asd001a.surf.net","SURFnet6 Core Router Amsterdam1"));
- checkListModel.addItem(new
Exporter("xsr01.asd002a.surf.net","SURFnet6 Core Router Amsterdam2"));
- checkListModel.addItem(new
Exporter("xsr03.asd001a.surf.net","SURFnet6 Border Router Amsterdam1"));
- checkListModel.addItem(new
Exporter("xsr03.asd002a.surf.net","SURFnet6 Border Router Amsterdam2"));
- if(checkListModel.getSize() > 0) {
- Exporter router = list.getItem(0);
- list.checkItem(router);
- }
+
+ //TODO add oldEndPoint???
}
});
- list.addCheckListSelectionListener(new
CheckListSelectionListener<Exporter>() {
- public void selectionChanged(Exporter changedItem) {
+
+ checkListModel.addTableModelListener(new TableModelListener(){
+
+ @Override
+ public void tableChanged(TableModelEvent e) {
StringBuilder builder = new StringBuilder();
- for(Exporter item :
checkListModel.getCheckedItems()) {
+ for (Exporter item :
list.getCheckedItems(Exporter.class)) {
builder.append(item.getHostName());
builder.append(" ");
}
String routers = builder.toString();
- if(routers !=
model.getQuery(FlowsaMAUserData.ROUTERS)) {
- if(!routers.equals("")) {
+ System.out.println(routers);
+ if (routers !=
model.getQuery(FlowsaMAUserData.ROUTERS)) {
+ if (!routers.equals("")) {
model.setQuery(FlowsaMAUserData.ROUTERS, routers);
} else {
-
model.setQuery(FlowsaMAUserData.ROUTERS, "N/A");
+
model.setQuery(FlowsaMAUserData.ROUTERS, FlowsaMAUserData.NULL_DATA);
}
- }
- }
+ }
+ }
+
});
- if(checkListModel.getSize() > 0) {
- list.checkItem(0);
- }
return new
JScrollPane(list,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
}
+
+ private class AddNewExporterAction extends AbstractAction{
+
+ private static final long serialVersionUID =
904596592000047661L;
+ private JPanel ownerPanel;
+ private FlowsaMAUserData model;
+
+ public AddNewExporterAction(String string, JPanel ownerPanel,
FlowsaMAUserData model) {
+ super(string);
+ this.ownerPanel = ownerPanel;
+ this.model = model;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ExporterPanel exporterPanel = new ExporterPanel();
+ int userOption =
JOptionPane.showConfirmDialog(ownerPanel, exporterPanel, "Add exporter",
JOptionPane.OK_CANCEL_OPTION);
+ if (userOption == JOptionPane.OK_OPTION){
+
model.getExportersModel().add(exporterPanel.getExporter());
+ }
+ }
+
+ }
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/TimeRangePicker.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/TimeRangePicker.java
2009-12-21 13:48:15 UTC (rev 5426)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/TimeRangePicker.java
2009-12-21 16:28:51 UTC (rev 5427)
@@ -105,7 +105,7 @@
field.addActionListener(new ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent e) {
try {
- int value =
format.parse(field.getText()).intValue();
+ long value =
format.parse(field.getText()).longValue();
dateTime.setValue(new
Date(value*1000), field);
} catch (ParseException parseException) {
/* ignored */
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/CheckListModel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/CheckListModel.java
2009-12-21 13:48:15 UTC (rev 5426)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/CheckListModel.java
2009-12-21 16:28:51 UTC (rev 5427)
@@ -4,6 +4,13 @@
import javax.swing.ListModel;
+
+/**
+ *
+ * @deprecated see
{@link
org.perfsonar.perfsonarui.ui.panels.sileria.JCheckList}
+ * @param <Type> Data type
+ */
+@Deprecated
public interface CheckListModel<Type> extends ListModel {
public Type getElementAt(int index);
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/CheckListSelectionListener.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/CheckListSelectionListener.java
2009-12-21 13:48:15 UTC (rev 5426)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/CheckListSelectionListener.java
2009-12-21 16:28:51 UTC (rev 5427)
@@ -1,5 +1,9 @@
package org.perfsonar.perfsonarui.ui.panels;
+/**
+ * @deprecated see
{@link
org.perfsonar.perfsonarui.ui.panels.sileria.JCheckList}
+ */
+@Deprecated
public interface CheckListSelectionListener<Type> {
void selectionChanged(Type item);
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/DefaultCheckListModel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/DefaultCheckListModel.java
2009-12-21 13:48:15 UTC (rev 5426)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/DefaultCheckListModel.java
2009-12-21 16:28:51 UTC (rev 5427)
@@ -8,6 +8,10 @@
import org.perfsonar.perfsonarui.ui.panels.JCheckList.CheckableItem;
+/**
+ * @deprecated see
{@link
org.perfsonar.perfsonarui.ui.panels.sileria.JCheckList}
+ */
+@Deprecated
public class DefaultCheckListModel<Type> extends AbstractListModel
implements CheckListModel<Type> {
private static final long serialVersionUID = 1L;
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/JCheckList.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/JCheckList.java
2009-12-21 13:48:15 UTC (rev 5426)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/JCheckList.java
2009-12-21 16:28:51 UTC (rev 5427)
@@ -16,6 +16,10 @@
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
+/**
+ * @deprecated see
{@link
org.perfsonar.perfsonarui.ui.panels.sileria.JCheckList}
+ */
+@Deprecated
public class JCheckList<E> extends JList {
private static final long serialVersionUID = 1L;
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/JCheckList.java
Property changes on:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/JCheckList.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/Nameable.java
Property changes on:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/Nameable.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/table/AbstractListTableModel.java
Property changes on:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/table/AbstractListTableModel.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/table/TableColumn.java
Property changes on:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/table/TableColumn.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/util/CheckList.java
Property changes on:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/panels/sileria/util/CheckList.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
- perfsonar: r5427 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: flowsa flowsa/components ui/panels ui/panels/sileria ui/panels/sileria/table ui/panels/sileria/util, svnlog, 12/21/2009
Archive powered by MHonArc 2.6.16.