Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
b9c1a47d
Commit
b9c1a47d
authored
Nov 22, 2017
by
Tobias Meuser
Committed by
Jose Ignacio Monreal Bailey
Aug 20, 2019
Browse files
Made selection of active layers persisent
parent
0d921e5e
Changes
2
Show whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/views/visualization/ComponentVisManager.java
View file @
b9c1a47d
...
...
@@ -26,14 +26,15 @@ import java.util.List;
import
java.util.Map
;
import
javax.swing.JComponent
;
import
javax.swing.JMenu
;
import
com.google.common.collect.ArrayListMultimap
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Multimap
;
import
de.tud.kom.p2psim.impl.topology.views.visualization.ui.SimControlPanel
;
import
de.tud.kom.p2psim.impl.topology.views.visualization.ui.VisualizationComponent
;
import
de.tud.kom.p2psim.impl.util.guirunner.Config
;
/**
* This manager keeps track of all components that are added to the UI. It can
...
...
@@ -148,8 +149,14 @@ public class ComponentVisManager {
* @param component
*/
public
void
toggleComponent
(
String
name
)
{
boolean
first
=
true
;
for
(
JComponent
component
:
nameToComponentMap
.
get
(
name
))
{
toggleComponent
(
component
);
if
(
first
)
{
Config
.
setValue
(
SimControlPanel
.
getConfMainPath
(
name
),
component
.
isVisible
());
first
=
false
;
}
}
}
...
...
src/de/tud/kom/p2psim/impl/topology/views/visualization/ui/SimControlPanel.java
View file @
b9c1a47d
...
...
@@ -43,6 +43,7 @@ import de.tud.kom.p2psim.impl.topology.views.VisualizationTopologyView.Visualiza
import
de.tud.kom.p2psim.impl.topology.views.visualization.ComponentVisManager
;
import
de.tud.kom.p2psim.impl.topology.views.visualization.ComponentVisManager.VisInfo
;
import
de.tud.kom.p2psim.impl.topology.views.visualization.ComponentVisManager.VisualizationListener
;
import
de.tud.kom.p2psim.impl.util.guirunner.Config
;
/**
* Menu-Bar containing means to alter the simulation speed, pause and un-pause
...
...
@@ -51,8 +52,9 @@ import de.tud.kom.p2psim.impl.topology.views.visualization.ComponentVisManager.V
* @author Bjoern Richerzhagen
* @version 1.0, 27.08.2012
*/
public
class
SimControlPanel
extends
JMenuBar
implements
ActionListener
,
ChangeListener
,
VisualizationListener
{
public
class
SimControlPanel
extends
JMenuBar
implements
ActionListener
,
ChangeListener
,
VisualizationListener
{
private
static
final
String
CONF_PATH
=
"GUIRunner/Menu/Layels/"
;
private
static
final
long
serialVersionUID
=
-
914578954798611308L
;
...
...
@@ -119,7 +121,14 @@ public class SimControlPanel extends JMenuBar
@Override
public
void
visualizationAdded
(
VisInfo
visInfo
)
{
JCheckBoxMenuItem
checkBox
=
new
JCheckBoxMenuItem
(
visInfo
.
getName
());
checkBox
.
setSelected
(
visInfo
.
isActiveByDefault
());
boolean
isActive
=
visInfo
.
isActiveByDefault
();
isActive
=
Config
.
getValue
(
getConfMainPath
(
visInfo
.
getName
()),
isActive
);
checkBox
.
setSelected
(
isActive
);
if
(!
isActive
)
{
getVisManager
().
deactivateComponent
(
visInfo
.
getName
());
}
checkBox
.
addActionListener
(
new
ActionListener
()
{
@Override
public
void
actionPerformed
(
ActionEvent
arg0
)
{
...
...
@@ -221,4 +230,22 @@ public class SimControlPanel extends JMenuBar
}
}
/**
* @return the confPath
*/
public
static
String
getConfPath
(
String
pName
)
{
return
CONF_PATH
+
pName
.
replace
(
":"
,
""
).
replaceAll
(
" "
,
""
);
}
/**
* @return the confPath
*/
public
static
String
getConfMainPath
(
String
pName
)
{
String
newName
=
"Layer_"
+
pName
.
replace
(
":"
,
""
).
replaceAll
(
" "
,
""
).
replace
(
"/"
,
"_"
);
if
(
newName
.
length
()
>
1
)
{
return
CONF_PATH
+
newName
+
"/Main"
;
}
return
null
;
}
}
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