Commit b04fd51c authored by Anastasia Stepanchenko's avatar Anastasia Stepanchenko
Browse files

fixed LabelVisualizer to work with empty strings and null

parent 06a9e9ed
......@@ -328,9 +328,11 @@ public class LabelVisualizer extends DataVisualizerPlugin implements ActionListe
public Label(Node<?,?,?> node, Object data) {
String label = generateDataString(data);
labelComponent = new SceneGraphComponent(getNodePrefix() + String.format("%0"+getNumDigits()+"d",node.getIndex())); //name the sgc with its prefix, e.g. V, and format s.t. leading zeros are added
if(!label.trim().isEmpty()) {
IndexedLineSet labelLineSet = ttfLineSetFactory.getIndexLineSet(prefix + label); //with the factory: generate a lineset out of the string
labelComponent.setGeometry(labelLineSet); // and set this lineset as geometry of the SGC
* Generates a String from given Data with chosen options. If the data is a Double it is rounded to have the chosen decimals.
......@@ -341,7 +343,9 @@ public class LabelVisualizer extends DataVisualizerPlugin implements ActionListe
NumberFormat n = NumberFormat.getInstance();
String label = new String();
if(data.getClass() == Double.class){
if(data == null) {
label = "";
} else if(data.getClass() == Double.class){
label = n.format(data); //cuts off the Double to have #decimals after comma and makes it a string
label = data.toString();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment