Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sfp-plus-i2c
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
sfp-plus-i2c
Commits
c795c870
Commit
c795c870
authored
Apr 18, 2017
by
Vincent van Beveren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started on clone tool. Added some icons.
Changed device module serial to module name
parent
c0e74b50
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
146 additions
and
38 deletions
+146
-38
SFPDevice.java
sw/jsfp/src/nl/nikhef/sfp/SFPDevice.java
+1
-1
SFPDeviceBase.java
sw/jsfp/src/nl/nikhef/sfp/SFPDeviceBase.java
+1
-1
MultiSFPTest.java
sw/jsfp/src/nl/nikhef/sfp/test/MultiSFPTest.java
+1
-1
ModuleManager.java
sw/safaripark/src/nl/nikhef/safaripark/ModuleManager.java
+1
-1
SaFariPark.java
sw/safaripark/src/nl/nikhef/safaripark/SaFariPark.java
+6
-22
Title.java
sw/safaripark/src/nl/nikhef/safaripark/Title.java
+6
-0
DeviceManager.java
...ripark/src/nl/nikhef/safaripark/devmgr/DeviceManager.java
+5
-4
DeviceManagerModel.java
...k/src/nl/nikhef/safaripark/devmgr/DeviceManagerModel.java
+1
-1
DollyModel.java
sw/safaripark/src/nl/nikhef/safaripark/dolly/DollyModel.java
+6
-0
DollyPanel.java
sw/safaripark/src/nl/nikhef/safaripark/dolly/DollyPanel.java
+72
-2
Module.java
sw/safaripark/src/nl/nikhef/safaripark/extra/Module.java
+27
-0
MonitorModel.java
...ripark/src/nl/nikhef/safaripark/monitor/MonitorModel.java
+2
-2
Resources.java
sw/safaripark/src/nl/nikhef/safaripark/res/Resources.java
+14
-0
connect.png
sw/safaripark/src/nl/nikhef/safaripark/res/connect.png
+0
-0
disconnect.png
sw/safaripark/src/nl/nikhef/safaripark/res/disconnect.png
+0
-0
emblem-documents.png
...aripark/src/nl/nikhef/safaripark/res/emblem-documents.png
+0
-0
network-wired.png
sw/safaripark/src/nl/nikhef/safaripark/res/network-wired.png
+0
-0
ValueSelectionPane.java
...park/src/nl/nikhef/safaripark/vsp/ValueSelectionPane.java
+3
-3
No files found.
sw/jsfp/src/nl/nikhef/sfp/SFPDevice.java
View file @
c795c870
...
...
@@ -29,7 +29,7 @@ public interface SFPDevice extends Comparable<SFPDevice>
*
* @return the serial, or null if non is connected.
*/
public
String
getModule
Serial
(
int
bay
);
public
String
getModule
Name
(
int
bay
);
/**
* Returns a I2CLink to the specified device.
...
...
sw/jsfp/src/nl/nikhef/sfp/SFPDeviceBase.java
View file @
c795c870
...
...
@@ -33,7 +33,7 @@ public abstract class SFPDeviceBase implements SFPDevice {
* @see nl.nikhef.sfp.SFPDevice#getModuleSerial(int)
*/
@Override
public
String
getModule
Serial
(
int
bay
)
{
public
String
getModule
Name
(
int
bay
)
{
if
(
isModulePresent
(
bay
))
{
...
...
sw/jsfp/src/nl/nikhef/sfp/test/MultiSFPTest.java
View file @
c795c870
...
...
@@ -78,7 +78,7 @@ public class MultiSFPTest {
@Override
public
void
sfpModuleStateChanged
(
SFPDevice
dev
,
int
bay
)
{
if
(
dev
.
isModulePresent
(
bay
))
{
System
.
out
.
printf
(
"Module added to bay %d: %s\n"
,
bay
,
dev
.
getModule
Serial
(
bay
));
System
.
out
.
printf
(
"Module added to bay %d: %s\n"
,
bay
,
dev
.
getModule
Name
(
bay
));
if
(
bay
==
1
)
{
try
{
...
...
sw/safaripark/src/nl/nikhef/safaripark/ModuleManager.java
View file @
c795c870
...
...
@@ -89,7 +89,7 @@ public class ModuleManager implements BaySelectionListener
{
_ctx
=
_ctxCache
.
getContextFor
(
dev
,
bay
);
_moduleName
=
dev
.
getModule
Serial
(
bay
);
_moduleName
=
dev
.
getModule
Name
(
bay
);
_binExport
.
setEnabled
(
true
);
}
else
{
_ctx
=
null
;
...
...
sw/safaripark/src/nl/nikhef/safaripark/SaFariPark.java
View file @
c795c870
...
...
@@ -41,6 +41,7 @@ import org.codejargon.feather.Provides;
import
nl.nikhef.safaripark.devmgr.BaySelectionListener
;
import
nl.nikhef.safaripark.devmgr.DeviceManager
;
import
nl.nikhef.safaripark.dolly.DollyModel
;
import
nl.nikhef.safaripark.dolly.DollyPanel
;
import
nl.nikhef.safaripark.editpane.EditPane
;
import
nl.nikhef.safaripark.extra.GuiUtils
;
...
...
@@ -83,7 +84,7 @@ public class SaFariPark extends JFrame implements BaySelectionListener, WindowLi
}
};
private
Action
_saveBinary
=
new
ExtendedAbstractAction
(
"Save
module contents
"
,
Resources
.
getIcon
(
"document-export-4"
),
"Save a binary export"
)
{
private
Action
_saveBinary
=
new
ExtendedAbstractAction
(
"Save
binary content
"
,
Resources
.
getIcon
(
"document-export-4"
),
"Save a binary export"
)
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
...
...
@@ -109,7 +110,7 @@ public class SaFariPark extends JFrame implements BaySelectionListener, WindowLi
setTitle
(
"SaFariPark "
+
getFullRevision
());
setSize
(
640
,
480
);
setIconImage
(
loadImage
(
"res/appicon.png
"
));
setIconImage
(
Resources
.
getImage
(
"appicon
"
));
setDefaultCloseOperation
(
JFrame
.
DISPOSE_ON_CLOSE
);
_sfpManager
=
sfpMgr
;
...
...
@@ -126,13 +127,15 @@ public class SaFariPark extends JFrame implements BaySelectionListener, WindowLi
_status
=
new
StatusBar
();
_modMgr
=
new
ModuleManager
(
_saveBinary
,
_loader
,
_ctxCache
);
_devMgr
.
addDeviceSelectedListener
(
_modMgr
);
_dp
=
new
DollyPanel
(
_loader
);
_dp
=
new
DollyPanel
(
_loader
,
new
DollyModel
()
);
makeToolbar
();
JSplitPane
split
=
new
JSplitPane
(
JSplitPane
.
HORIZONTAL_SPLIT
);
split
.
setDividerLocation
(
300
);
JSplitPane
split3
=
new
JSplitPane
(
JSplitPane
.
VERTICAL_SPLIT
);
split3
.
setTopComponent
(
_devMgr
);
split3
.
setBottomComponent
(
_dp
);
split3
.
setDividerLocation
(
300
);
split
.
setLeftComponent
(
split3
);
JSplitPane
split2
=
new
JSplitPane
(
JSplitPane
.
VERTICAL_SPLIT
);
...
...
@@ -360,26 +363,7 @@ public class SaFariPark extends JFrame implements BaySelectionListener, WindowLi
return
true
;
}
public
static
ImageIcon
loadImageIcon
(
String
path
,
String
description
)
{
java
.
net
.
URL
imgURL
=
SaFariPark
.
class
.
getResource
(
path
);
if
(
imgURL
!=
null
)
{
return
new
ImageIcon
(
imgURL
,
description
);
}
else
{
System
.
err
.
println
(
"Couldn't find file: "
+
path
);
return
null
;
}
}
public
static
BufferedImage
loadImage
(
String
path
)
{
java
.
net
.
URL
imgURL
=
SaFariPark
.
class
.
getResource
(
path
);
try
{
return
ImageIO
.
read
(
imgURL
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
...
...
sw/safaripark/src/nl/nikhef/safaripark/Title.java
View file @
c795c870
package
nl
.
nikhef
.
safaripark
;
import
javax.swing.BorderFactory
;
import
javax.swing.Icon
;
import
javax.swing.JLabel
;
import
javax.swing.UIManager
;
...
...
@@ -16,5 +17,10 @@ public class Title extends JLabel {
setForeground
(
UIManager
.
getColor
(
"activeCaptionText"
));
}
public
Title
(
String
name
,
Icon
icon
)
{
this
(
name
);
setIcon
(
icon
);
}
}
sw/safaripark/src/nl/nikhef/safaripark/devmgr/DeviceManager.java
View file @
c795c870
...
...
@@ -16,6 +16,7 @@ import nl.nikhef.safaripark.SaFariPark;
import
nl.nikhef.safaripark.Title
;
import
nl.nikhef.safaripark.devmgr.DeviceManagerModel.DeviceBayNode
;
import
nl.nikhef.safaripark.devmgr.DeviceManagerModel.DeviceNode
;
import
nl.nikhef.safaripark.res.Resources
;
import
nl.nikhef.sfp.SFPDevice
;
import
nl.nikhef.sfp.SFPDeviceListener
;
import
nl.nikhef.sfp.SFPManager
;
...
...
@@ -38,9 +39,9 @@ public class DeviceManager extends JPanel implements TreeSelectionListener, SFPD
private
TreeRenderer
()
{
setOpenIcon
(
SaFariPark
.
loadImageIcon
(
"res/pcb16.png"
,
"Device
"
));
setClosedIcon
(
SaFariPark
.
loadImageIcon
(
"res/pcb16.png"
,
"Device
"
));
setLeafIcon
(
SaFariPark
.
loadImageIcon
(
"res/eye16_off.png"
,
"Device
"
));
setOpenIcon
(
Resources
.
getIcon
(
"pcb16
"
));
setClosedIcon
(
Resources
.
getIcon
(
"pcb16
"
));
setLeafIcon
(
Resources
.
getIcon
(
"connect
"
));
}
...
...
@@ -70,7 +71,7 @@ public class DeviceManager extends JPanel implements TreeSelectionListener, SFPD
JScrollPane
sp
=
new
JScrollPane
(
_tree
);
expandAll
();
add
(
new
Title
(
"Device Manager"
),
BorderLayout
.
NORTH
);
add
(
new
Title
(
"Device Manager"
,
Resources
.
getIcon
(
"network-wired"
)
),
BorderLayout
.
NORTH
);
add
(
sp
,
BorderLayout
.
CENTER
);
}
...
...
sw/safaripark/src/nl/nikhef/safaripark/devmgr/DeviceManagerModel.java
View file @
c795c870
...
...
@@ -177,7 +177,7 @@ public class DeviceManagerModel implements SFPProviderListener, SFPDeviceListene
SFPDevice
dev
=
_parent
.
getDevice
();
if
(
dev
.
isModulePresent
(
pos
))
{
String
serial
=
dev
.
getModule
Serial
(
pos
);
String
serial
=
dev
.
getModule
Name
(
pos
);
// small window between isPresent and reading serial may allow for null value to be returned
if
(
serial
==
null
)
serial
=
"<none>"
;
...
...
sw/safaripark/src/nl/nikhef/safaripark/dolly/DollyModel.java
View file @
c795c870
package
nl
.
nikhef
.
safaripark
.
dolly
;
import
javax.swing.DefaultComboBoxModel
;
import
nl.nikhef.safaripark.devmgr.BaySelectionListener
;
import
nl.nikhef.sfp.SFPDevice
;
import
nl.nikhef.sfp.SFPDeviceListener
;
public
class
DollyModel
implements
SFPDeviceListener
,
BaySelectionListener
{
private
DefaultComboBoxModel
<
Module
>
_dcb
;
public
DollyModel
()
{
}
@Override
public
void
sfpModuleStateChanged
(
SFPDevice
dev
,
int
bay
)
...
...
sw/safaripark/src/nl/nikhef/safaripark/dolly/DollyPanel.java
View file @
c795c870
...
...
@@ -2,9 +2,23 @@ package nl.nikhef.safaripark.dolly;
import
java.awt.BorderLayout
;
import
javax.swing.BorderFactory
;
import
javax.swing.BoxLayout
;
import
javax.swing.ButtonGroup
;
import
javax.swing.JButton
;
import
javax.swing.JCheckBox
;
import
javax.swing.JComboBox
;
import
javax.swing.JLabel
;
import
javax.swing.JList
;
import
javax.swing.JPanel
;
import
javax.swing.JRadioButton
;
import
javax.swing.JScrollPane
;
import
javax.swing.JSeparator
;
import
javax.swing.plaf.basic.BasicBorders.RadioButtonBorder
;
import
net.miginfocom.swing.MigLayout
;
import
nl.nikhef.safaripark.Title
;
import
nl.nikhef.safaripark.res.Resources
;
import
nl.nikhef.safaripark.vsp.ValueSelectionPane
;
import
nl.nikhef.sfp.ddmi.DDMIElement
;
import
nl.nikhef.sfp.ddmi.DDMILoader
;
...
...
@@ -15,16 +29,65 @@ public class DollyPanel extends JPanel {
private
ValueSelectionPane
_vsp
;
public
DollyPanel
(
DDMILoader
loader
)
{
private
JRadioButton
_sourceFile
=
new
JRadioButton
(
"File:"
);
private
JLabel
_sourceFileName
=
new
JLabel
(
"<none>"
);
private
JButton
_sourceFileSelect
=
new
JButton
(
"..."
);
private
JRadioButton
_sourceDevice
=
new
JRadioButton
(
"Device:"
);
private
JCheckBox
_targetFile
=
new
JCheckBox
(
"File: "
);
private
JLabel
_targetFileName
=
new
JLabel
(
"<none>"
);
private
JButton
_targetFileSelect
=
new
JButton
(
"..."
);
private
JButton
_clone
=
new
JButton
(
"Clone"
);
private
DollyModel
_model
;
public
DollyPanel
(
DDMILoader
loader
,
DollyModel
model
)
{
_model
=
model
;
setLayout
(
new
BorderLayout
());
add
(
new
Title
(
"Clone Tool"
),
BorderLayout
.
NORTH
);
add
(
new
Title
(
"Clone Tool"
,
Resources
.
getIcon
(
"emblem-documents"
)
),
BorderLayout
.
NORTH
);
_vsp
=
new
ValueSelectionPane
(
loader
);
JPanel
core
=
new
JPanel
();
core
.
setLayout
(
new
BorderLayout
());
JPanel
source
=
new
JPanel
();
source
.
setLayout
(
new
MigLayout
(
""
,
"[][grow][]"
,
""
));
source
.
add
(
new
JLabel
(
"Source"
),
"wrap"
);
source
.
add
(
new
JSeparator
(),
"growx, span 3, wrap"
);
ButtonGroup
bg
=
new
ButtonGroup
();
bg
.
add
(
_sourceDevice
);
bg
.
add
(
_sourceFile
);
_sourceDevice
.
setSelected
(
true
);
source
.
add
(
_sourceDevice
);
source
.
add
(
new
JComboBox
<
String
>(),
"growx, span 2,wrap"
);
source
.
add
(
_sourceFile
);
source
.
add
(
_sourceFileName
);
source
.
add
(
_sourceFileSelect
,
"wrap"
);
core
.
add
(
source
,
BorderLayout
.
NORTH
);
_vsp
.
setBorder
(
BorderFactory
.
createEmptyBorder
(
0
,
8
,
0
,
8
));
core
.
add
(
_vsp
,
BorderLayout
.
CENTER
);
JPanel
target
=
new
JPanel
();
target
.
setLayout
(
new
MigLayout
(
""
,
"[][grow][]"
,
""
));
target
.
add
(
new
JLabel
(
"Targets"
),
"wrap"
);
target
.
add
(
new
JSeparator
(),
"growx, span 3, wrap"
);
target
.
add
(
new
JLabel
(
"Devices: "
));
target
.
add
(
new
JScrollPane
(
new
JList
<
String
>()),
"growx, span 2, wrap"
);
target
.
add
(
_targetFile
);
target
.
add
(
_targetFileName
);
target
.
add
(
_targetFileSelect
,
"wrap"
);
core
.
add
(
target
,
BorderLayout
.
SOUTH
);
_vsp
.
init
(
new
Filter
<
DDMIElement
>()
{
@Override
...
...
@@ -46,6 +109,13 @@ public class DollyPanel extends JPanel {
},
"dolly"
);
add
(
core
,
BorderLayout
.
CENTER
);
JPanel
buttons
=
new
JPanel
();
buttons
.
setLayout
(
new
BorderLayout
());
buttons
.
add
(
_clone
,
BorderLayout
.
EAST
);
add
(
buttons
,
BorderLayout
.
SOUTH
);
}
}
sw/safaripark/src/nl/nikhef/safaripark/extra/Module.java
0 → 100644
View file @
c795c870
package
nl
.
nikhef
.
safaripark
.
extra
;
import
nl.nikhef.sfp.SFPDevice
;
public
class
Module
{
public
final
SFPDevice
dev
;
public
final
int
bay
;
public
Module
(
SFPDevice
dev
,
int
bay
)
{
this
.
dev
=
dev
;
this
.
bay
=
bay
;
}
public
boolean
isPresent
()
{
return
dev
.
isModulePresent
(
bay
);
}
public
String
toString
()
{
return
dev
.
getModuleName
(
bay
);
}
}
sw/safaripark/src/nl/nikhef/safaripark/monitor/MonitorModel.java
View file @
c795c870
...
...
@@ -135,7 +135,7 @@ public class MonitorModel extends AbstractTableModel implements SFPDeviceListene
DevAndBay
dab
=
_rows
.
get
(
row
);
if
(
col
==
0
)
{
return
dab
.
dev
.
getModule
Serial
(
dab
.
bay
);
return
dab
.
dev
.
getModule
Name
(
dab
.
bay
);
}
else
{
if
(
dab
.
data
!=
null
&&
(
col
-
1
)
<
dab
.
data
.
length
)
{
...
...
@@ -224,7 +224,7 @@ public class MonitorModel extends AbstractTableModel implements SFPDeviceListene
{
DevAndBay
dab
=
_rows
.
get
(
i
);
logFile
.
print
(
dab
.
dev
.
getModule
Serial
(
dab
.
bay
));
logFile
.
print
(
dab
.
dev
.
getModule
Name
(
dab
.
bay
));
for
(
int
j
=
0
;
j
<
_columns
.
size
();
j
++)
{
...
...
sw/safaripark/src/nl/nikhef/safaripark/res/Resources.java
View file @
c795c870
package
nl
.
nikhef
.
safaripark
.
res
;
import
java.awt.Image
;
import
java.awt.image.BufferedImage
;
import
java.io.IOException
;
import
java.net.URL
;
...
...
@@ -8,6 +9,8 @@ import javax.imageio.ImageIO;
import
javax.swing.Icon
;
import
javax.swing.ImageIcon
;
import
nl.nikhef.safaripark.SaFariPark
;
public
class
Resources
{
public
static
final
Icon
getIcon
(
String
name
)
{
...
...
@@ -19,5 +22,16 @@ public class Resources {
}
return
null
;
}
public
static
Image
getImage
(
String
name
)
{
URL
imgURL
=
Resources
.
class
.
getResource
(
name
+
".png"
);
try
{
return
ImageIO
.
read
(
imgURL
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
}
sw/safaripark/src/nl/nikhef/safaripark/res/connect.png
0 → 100644
View file @
c795c870
1.19 KB
sw/safaripark/src/nl/nikhef/safaripark/res/disconnect.png
0 → 100644
View file @
c795c870
1.24 KB
sw/safaripark/src/nl/nikhef/safaripark/res/emblem-documents.png
0 → 100644
View file @
c795c870
1.17 KB
sw/safaripark/src/nl/nikhef/safaripark/res/network-wired.png
0 → 100644
View file @
c795c870
1018 Bytes
sw/safaripark/src/nl/nikhef/safaripark/vsp/ValueSelectionPane.java
View file @
c795c870
...
...
@@ -49,7 +49,7 @@ import nl.nikhef.tools.Filter;
public
class
ValueSelectionPane
extends
JPanel
implements
ItemListener
{
private
JTree
tree
=
new
JTree
();
private
static
final
Dimension
MIN_SIZE
=
new
Dimension
(
400
,
400
);
//
private static final Dimension MIN_SIZE = new Dimension(400, 400);
private
CheckableTreeNode
_root
;
private
DDMI
_ddmi
;
...
...
@@ -154,8 +154,8 @@ public class ValueSelectionPane extends JPanel implements ItemListener {
JScrollPane
scrollPane
=
new
JScrollPane
(
tree
);
add
(
scrollPane
,
BorderLayout
.
CENTER
);
setMinimumSize
(
MIN_SIZE
);
setPreferredSize
(
MIN_SIZE
);
//
setMinimumSize(MIN_SIZE);
//
setPreferredSize(MIN_SIZE);
_ddmi
=
loader
.
getDDMI
();
_root
=
new
CheckableTreeNode
(
_ddmi
,
"DDMI"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment