Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FUCoin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DistributedSystems4Students
FUCoin
Commits
a37596f9
Unverified
Commit
a37596f9
authored
8 years ago
by
Luca Keidel
Browse files
Options
Downloads
Patches
Plain Diff
Added a status bar showing wallet information when a node is clicked
parent
f7e401d9
No related branches found
No related tags found
1 merge request
!6
Overlay topology
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/fucoin/configurations/GephiConfiguration.java
+23
-1
23 additions, 1 deletion
src/main/java/fucoin/configurations/GephiConfiguration.java
src/main/java/fucoin/gui/gephi/GraphWindow.java
+34
-0
34 additions, 0 deletions
src/main/java/fucoin/gui/gephi/GraphWindow.java
with
57 additions
and
1 deletion
src/main/java/fucoin/configurations/GephiConfiguration.java
+
23
−
1
View file @
a37596f9
package
fucoin.configurations
;
package
fucoin.configurations
;
import
akka.actor.ActorRef
;
import
akka.pattern.Patterns
;
import
akka.util.Timeout
;
import
fucoin.actions.transaction.ActionGetAmount
;
import
fucoin.actions.transaction.ActionGetAmountAnswer
;
import
fucoin.configurations.internal.ConfigurationName
;
import
fucoin.configurations.internal.ConfigurationName
;
import
fucoin.configurations.internal.GephiLoader
;
import
fucoin.configurations.internal.GephiLoader
;
import
fucoin.gui.gephi.GraphWindow
;
import
fucoin.gui.gephi.GraphWindow
;
import
org.gephi.graph.api.Graph
;
import
org.gephi.graph.api.Graph
;
import
scala.concurrent.Await
;
import
scala.concurrent.Future
;
import
scala.concurrent.duration.Duration
;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
import
java.net.URISyntaxException
;
import
java.net.URISyntaxException
;
@ConfigurationName
(
"Gephi Test Configuration"
)
@ConfigurationName
(
"Gephi Test Configuration"
)
public
class
GephiConfiguration
extends
AbstractConfiguration
{
public
class
GephiConfiguration
extends
AbstractConfiguration
{
private
Timeout
timeout
=
new
Timeout
(
Duration
.
create
(
10
,
"seconds"
));
@Override
@Override
public
void
run
()
{
public
void
run
()
{
initSupervisor
();
initSupervisor
();
...
@@ -27,7 +38,18 @@ public class GephiConfiguration extends AbstractConfiguration {
...
@@ -27,7 +38,18 @@ public class GephiConfiguration extends AbstractConfiguration {
createOverlayNetwork
(
g
);
createOverlayNetwork
(
g
);
GraphWindow
graphWindow
=
new
GraphWindow
();
GraphWindow
graphWindow
=
new
GraphWindow
();
graphWindow
.
addNodeClickHandler
((
node
,
event
)
->
System
.
out
.
println
(
node
.
getLabel
()
+
" wurde angeklickt!"
));
graphWindow
.
addNodeClickHandler
((
node
,
event
)
->
{
ActorRef
wallet
=
walletByName
(
node
.
getLabel
());
Future
<
Object
>
future
=
Patterns
.
ask
(
wallet
,
new
ActionGetAmount
(),
timeout
);
ActionGetAmountAnswer
answer
=
null
;
try
{
answer
=
(
ActionGetAmountAnswer
)
Await
.
result
(
future
,
timeout
.
duration
());
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"An error occured while fetching the wallet info: "
+
e
.
getMessage
());
}
graphWindow
.
setInfobarText
(
node
.
getLabel
()+
" has "
+
answer
.
amount
+
" FUCs"
);
});
graphWindow
.
setVisible
(
true
);
graphWindow
.
setVisible
(
true
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/fucoin/gui/gephi/GraphWindow.java
+
34
−
0
View file @
a37596f9
...
@@ -19,6 +19,8 @@ public class GraphWindow extends JFrame implements NodeMouseListener {
...
@@ -19,6 +19,8 @@ public class GraphWindow extends JFrame implements NodeMouseListener {
private
final
PreviewController
previewController
;
private
final
PreviewController
previewController
;
private
final
PreviewSketch
previewSketch
;
private
final
PreviewSketch
previewSketch
;
private
JLabel
infobarText
;
public
GraphWindow
()
{
public
GraphWindow
()
{
super
();
super
();
...
@@ -41,8 +43,36 @@ public class GraphWindow extends JFrame implements NodeMouseListener {
...
@@ -41,8 +43,36 @@ public class GraphWindow extends JFrame implements NodeMouseListener {
G2DTarget
target
=
(
G2DTarget
)
previewController
.
getRenderTarget
(
RenderTarget
.
G2D_TARGET
);
G2DTarget
target
=
(
G2DTarget
)
previewController
.
getRenderTarget
(
RenderTarget
.
G2D_TARGET
);
previewSketch
=
new
PreviewSketch
(
target
,
isRetina
());
previewSketch
=
new
PreviewSketch
(
target
,
isRetina
());
infobarText
=
new
JLabel
(
"Click on a node to see further information."
,
SwingConstants
.
LEFT
);
this
.
add
(
previewSketch
,
BorderLayout
.
CENTER
);
this
.
add
(
previewSketch
,
BorderLayout
.
CENTER
);
JPanel
infobar
=
new
JPanel
(
new
BorderLayout
());
infobar
.
add
(
infobarText
,
BorderLayout
.
WEST
);
JPanel
zoomOptions
=
new
JPanel
(
new
FlowLayout
(
FlowLayout
.
CENTER
,
5
,
2
));
zoomOptions
.
add
(
new
JLabel
(
"Zoom: "
));
Dimension
zoomBtnSize
=
new
Dimension
(
20
,
20
);
JButton
minusButton
=
new
JButton
(
"-"
);
minusButton
.
setPreferredSize
(
zoomBtnSize
);
minusButton
.
addActionListener
(
e
->
previewSketch
.
zoomMinus
());
zoomOptions
.
add
(
minusButton
);
JButton
resetButton
=
new
JButton
(
"0"
);
resetButton
.
setPreferredSize
(
zoomBtnSize
);
resetButton
.
addActionListener
(
e
->
previewSketch
.
resetZoom
());
zoomOptions
.
add
(
resetButton
);
JButton
plusButton
=
new
JButton
(
"+"
);
plusButton
.
setPreferredSize
(
zoomBtnSize
);
plusButton
.
addActionListener
(
e
->
previewSketch
.
zoomPlus
());
zoomOptions
.
add
(
plusButton
);
infobar
.
add
(
zoomOptions
,
BorderLayout
.
EAST
);
this
.
add
(
infobar
,
BorderLayout
.
SOUTH
);
previewController
.
refreshPreview
();
previewController
.
refreshPreview
();
previewSketch
.
resetZoom
();
previewSketch
.
resetZoom
();
...
@@ -86,4 +116,8 @@ public class GraphWindow extends JFrame implements NodeMouseListener {
...
@@ -86,4 +116,8 @@ public class GraphWindow extends JFrame implements NodeMouseListener {
previewController
.
refreshPreview
();
previewController
.
refreshPreview
();
previewSketch
.
repaint
();
previewSketch
.
repaint
();
}
}
public
void
setInfobarText
(
String
text
){
SwingUtilities
.
invokeLater
(()
->
infobarText
.
setText
(
text
));
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment