blob: b9984bc647ca78cb884aefe2d37efc270c8bddfe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package com.vaadin.sass.internal.tree;
import java.util.ArrayList;
import java.util.regex.Pattern;
import com.vaadin.sass.internal.ScssStylesheet;
public class KeyframesNode extends Node implements IVariableNode {
private String keyframeName;
private String animationName;
public KeyframesNode(String keyframeName, String animationName) {
this.keyframeName = keyframeName;
this.animationName = animationName;
}
@Override
public String toString() {
StringBuilder string = new StringBuilder();
string.append(keyframeName).append(" ").append(animationName)
.append(" {\n");
for (Node child : children) {
string.append("\t\t").append(child.toString()).append("\n");
}
string.append("\t}");
return string.toString();
}
@Override
public void traverse() {
replaceVariables(ScssStylesheet.getVariables());
}
@Override
public void replaceVariables(ArrayList<VariableNode> variables) {
for (final VariableNode node : variables) {
String interpolation = "#{$" + node.getName() + "}";
if (animationName != null && animationName.contains(interpolation)) {
if (animationName.contains(interpolation)) {
animationName = animationName.replaceAll(Pattern
.quote(interpolation), node.getExpr().toString());
}
}
}
}
}
|