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
4e64d4d7
Unverified
Commit
4e64d4d7
authored
8 years ago
by
Luca Keidel
Browse files
Options
Downloads
Patches
Plain Diff
Node info will now only be display for a certain amount of time in the GraphWindow info bar
parent
3bd8710a
No related branches found
Branches containing commit
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
+4
-0
4 additions, 0 deletions
src/main/java/fucoin/configurations/GephiConfiguration.java
src/main/java/fucoin/gui/gephi/GraphWindow.java
+19
-1
19 additions, 1 deletion
src/main/java/fucoin/gui/gephi/GraphWindow.java
with
23 additions
and
1 deletion
src/main/java/fucoin/configurations/GephiConfiguration.java
+
4
−
0
View file @
4e64d4d7
...
...
@@ -46,13 +46,17 @@ public class GephiConfiguration extends AbstractConfiguration {
graphWindow
.
setDisplayedFilename
(
selectedTopology
.
getName
());
graphWindow
.
setVisible
(
true
);
// add a click listener for displaying further information about a wallet when clicking on a node
graphWindow
.
addNodeClickHandler
((
node
,
event
)
->
{
// get associated wallet and ask for its amount
ActorRef
wallet
=
walletByName
(
node
.
getLabel
());
Future
<
Object
>
future
=
Patterns
.
ask
(
wallet
,
new
ActionGetAmount
(),
timeout
);
future
.
onSuccess
(
new
OnSuccess
<
Object
>()
{
@Override
public
void
onSuccess
(
Object
result
)
throws
Throwable
{
// display the amount when an answer is received
ActionGetAmountAnswer
answer
=
(
ActionGetAmountAnswer
)
result
;
graphWindow
.
setInfobarText
(
node
.
getLabel
()+
" has "
+
answer
.
amount
+
" FUCs"
);
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/fucoin/gui/gephi/GraphWindow.java
+
19
−
1
View file @
4e64d4d7
...
...
@@ -11,6 +11,7 @@ import java.awt.*;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Timer
;
public
class
GraphWindow
extends
JFrame
implements
NodeMouseListener
{
...
...
@@ -19,12 +20,16 @@ public class GraphWindow extends JFrame implements NodeMouseListener {
private
final
PreviewSketch
previewSketch
;
private
JLabel
infobarText
;
private
Timer
timer
;
private
final
String
baseWindowTitle
=
"Network Overlay Graph"
;
private
final
String
defaultInfoBarText
=
"Click on a node to see further information."
;
public
GraphWindow
()
{
super
();
timer
=
new
Timer
();
setTitle
(
baseWindowTitle
);
setDefaultCloseOperation
(
WindowConstants
.
EXIT_ON_CLOSE
);
...
...
@@ -44,7 +49,7 @@ public class GraphWindow extends JFrame implements NodeMouseListener {
G2DTarget
target
=
(
G2DTarget
)
previewController
.
getRenderTarget
(
RenderTarget
.
G2D_TARGET
);
previewSketch
=
new
PreviewSketch
(
target
,
isRetina
());
infobarText
=
new
JLabel
(
"Click on a node to see further information."
,
SwingConstants
.
LEFT
);
infobarText
=
new
JLabel
(
defaultInfoBarText
,
SwingConstants
.
LEFT
);
this
.
add
(
previewSketch
,
BorderLayout
.
CENTER
);
...
...
@@ -122,7 +127,20 @@ public class GraphWindow extends JFrame implements NodeMouseListener {
previewSketch
.
refreshSketch
();
}
/**
* Sets the displayed text of the infobar to text.
* After a certain time the text will be reset to the default text.
*
* @param text new infobar text
*/
public
void
setInfobarText
(
String
text
)
{
SwingUtilities
.
invokeLater
(()
->
infobarText
.
setText
(
text
));
// set text back to default text after 2 seconds
timer
.
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
SwingUtilities
.
invokeLater
(()
->
infobarText
.
setText
(
defaultInfoBarText
));
}
},
2000
);
}
}
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