Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
Protos
Nomad 3D
nomad-3d-commons
Commits
0de515d9
Commit
0de515d9
authored
Dec 13, 2018
by
legoc
Browse files
Apply the renaming of the configuration name
parent
a4ced4fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/fr/ill/ics/n3d/io/NameConverter.java
View file @
0de515d9
...
...
@@ -5,7 +5,10 @@ package fr.ill.ics.n3d.io;
import
java.util.HashMap
;
import
org.w3c.dom.Element
;
import
fr.ill.ics.n3d.model.Component
;
import
fr.ill.ics.n3d.model.ConfigParams
;
import
fr.ill.ics.n3d.model.Model
;
/**
...
...
@@ -38,19 +41,25 @@ public class NameConverter {
}
private
void
convert
(
Component
component
,
AsciiStringConverter
ascii
)
{
// Change the filename and the name.
String
convertedFileName
=
ascii
.
convert
(
component
.
getFileName
());
String
newFileName
=
new
String
(
convertedFileName
);
// for (int i = 0 ; this.fileNameConversion.containsKey(newFileName) ; i++, newFileName = convertedFileName+"--"+Integer.toString(i));
String
newFileName
=
new
String
(
convertedFileName
);
String
convertedName
=
ascii
.
convert
(
component
.
getName
());
String
newName
=
new
String
(
convertedName
);
// for (int i = 0 ; this.nameConversion.containsKey(newName) ; i++, newName = convertedName+"--"+Integer.toString(i));
String
newName
=
new
String
(
convertedName
);
this
.
fileNameConversion
.
put
(
component
.
getFileName
(),
newFileName
);
component
.
setFileName
(
newFileName
);
this
.
nameConversion
.
put
(
component
.
getName
(),
newName
);
component
.
setName
(
newName
);
// Change the name of the configurations.
for
(
ConfigParams
config
:
component
.
getConfigurations
())
{
config
.
setConfiguration
(
ascii
.
convert
(
config
.
getConfiguration
()));
}
// Iterate the children.
for
(
Component
child
:
component
.
getChildren
())
{
convert
(
child
,
ascii
);
}
...
...
src/main/java/fr/ill/ics/n3d/model/Component.java
View file @
0de515d9
...
...
@@ -6,6 +6,7 @@ import java.util.ArrayList;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Stack
;
import
java.util.concurrent.CopyOnWriteArrayList
;
...
...
@@ -168,7 +169,7 @@ public class Component {
* Gets the configurations of the component.
* @return Array of the configurations
*/
public
CopyOnWriteArray
List
<
ConfigParams
>
getConfigurations
()
{
public
List
<
ConfigParams
>
getConfigurations
()
{
return
configurations
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment