Commit 7dd1df24 authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

Proper ID saving for Anchor, Group & Panel

parent 40427f89
......@@ -64,7 +64,7 @@ public class Anchor extends Item implements ActionListener{
*/
public Anchor(Node n, Skin s_) {
s = s_;
id = type+" #"+s.getNewId();
id = XML.getStringAttributeValue(n, "id", Language.get("UNNAMED").replaceAll("%t",type).replaceAll("%i",String.valueOf(s.getNewId())));
points = XML.getStringAttributeValue(n, "points", points);
priority = XML.getIntAttributeValue(n, "priority", priority);
range = XML.getIntAttributeValue(n, "range", range);
......@@ -357,12 +357,12 @@ public class Anchor extends Item implements ActionListener{
@Override
public String returnCode(String indent) {
String code = indent+"<Anchor";
if (!id.equals(ID_DEFAULT)) code+=" id=\""+id+"\"";
if (x!=X_DEFAULT) code+=" x=\""+String.valueOf(x)+"\"";
if (y!=Y_DEFAULT) code+=" y=\""+String.valueOf(y)+"\"";
code+=" priority=\""+String.valueOf(priority)+"\"";
if (!lefttop.equals(LEFTTOP_DEFAULT)) code+=" lefttop=\""+lefttop+"\"";
code+="/>";
//if (id!=ID_DEFAULT) code+="<!-- id=\""+id+"\" -->";
return code;
}
@Override
......
......@@ -302,11 +302,11 @@ public class Group extends Item implements ActionListener{
}
@Override
public String returnCode(String indent) {
String code = indent+"<Group";
String code = indent+"<Group";
if (!id.equals(ID_DEFAULT)) code+=" id=\""+id+"\"";
if (x!=X_DEFAULT) code+=" x=\""+String.valueOf(x)+"\"";
if (y!=Y_DEFAULT) code+=" y=\""+String.valueOf(y)+"\"";
code+=">";
//if (id!=ID_DEFAULT) code+="<!-- id=\""+id+"\" -->";
code+=">";
for (int i=0;i<items.size();i++) {
code+="\n"+items.get(i).returnCode(indent+Skin.indentation);
}
......
......@@ -436,7 +436,8 @@ public class Panel extends Item implements ActionListener{
}
}
public String returnCode(String indent) {
String code = indent+"<Panel";
String code = indent+"<Panel";
if (!id.equals(ID_DEFAULT)) code+=" id=\""+id+"\"";
if (x!=X_DEFAULT) code+=" x=\""+String.valueOf(x)+"\"";
if (y!=Y_DEFAULT) code+=" y=\""+String.valueOf(y)+"\"";
code+=" width=\""+String.valueOf(width)+"\" height=\""+String.valueOf(height)+"\"";
......@@ -445,7 +446,6 @@ public class Panel extends Item implements ActionListener{
if (xkeepratio!=XKEEPRATIO_DEFAULT) code+=" xkeepratio=\""+String.valueOf(xkeepratio)+"\"";
if (ykeepratio!=YKEEPRATIO_DEFAULT) code+=" ykeepratio=\""+String.valueOf(ykeepratio)+"\"";
code+=">";
if (!id.equals(ID_DEFAULT)) code+="<!-- id=\""+id+"\" -->";
for (int i=0;i<items.size();i++) {
code+="\n"+items.get(i).returnCode(indent+Skin.indentation);
}
......
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