- Timestamp:
- 06/22/13 21:51:33 (11 years ago)
- Location:
- java/main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main
-
Property
svn:ignore
set to
target
-
Property
svn:ignore
set to
-
java/main/src/main/java/com/framsticks/core/ListChange.java
r77 r84 2 2 3 3 import com.framsticks.params.FramsClass; 4 import com.framsticks.params.ListSource;5 4 import com.framsticks.params.ParamBuilder; 6 5 import com.framsticks.params.types.DecimalParam; 7 6 import com.framsticks.params.types.EnumParam; 8 7 import com.framsticks.params.types.StringParam; 9 import com.framsticks.util. Strings;8 import com.framsticks.util.lang.Strings; 10 9 11 import java.util.ArrayList;12 10 import java.util.Arrays; 13 11 … … 17 15 public class ListChange { 18 16 19 20 21 17 public Action getAction() { 18 return action; 19 } 22 20 23 24 25 21 public Integer getPosition() { 22 return position; 23 } 26 24 27 28 29 25 public String getIdentifier() { 26 return identifier; 27 } 30 28 31 32 33 34 35 29 public static enum Action { 30 Add, 31 Remove, 32 Modify 33 } 36 34 37 38 39 35 private Action action; 36 private Integer position; 37 private String identifier; 40 38 41 42 39 public Integer getType() { return action.ordinal(); } 40 public void setType(Integer type) { action = Action.values()[type]; } 43 41 44 42 public Integer getPos() { return position; } … … 48 46 public void setId(String id) { identifier = id; } 49 47 50 51 52 53 54 55 48 public String getBestIdentifier() { 49 if (Strings.notEmpty(identifier)) { 50 return identifier; 51 } 52 return position.toString(); 53 } 56 54 57 public static FramsClass getFramsClass() { 55 public static FramsClass getFramsClass() { 56 return new FramsClass("ListChange", "ListChange", null) 57 .append(new ParamBuilder().setId("type").setName("type").setType(new EnumParam(Arrays.asList("Add", "Remove", "Modify"))).build()) 58 .append(new ParamBuilder().setId("id").setName("identifier").setType(StringParam.class).build()) 59 .append(new ParamBuilder().setId("pos").setName("position").setType(DecimalParam.class).build()); 60 } 58 61 59 ArrayList<String> actions = new ArrayList<String>(); 60 actions.add("Add"); 61 actions.add("Remove"); 62 actions.add("Modify"); 63 return new FramsClass("ListChange", "ListChange", null) 64 .append(new ParamBuilder().setId("type").setName("type").setType(new EnumParam(actions)).build()) 65 .append(new ParamBuilder().setId("id").setName("identifier").setType(StringParam.class).build()) 66 .append(new ParamBuilder().setId("pos").setName("position").setType(DecimalParam.class).build()); 67 } 68 69 @Override 70 public String toString() { 71 return action + " " + identifier + " " + position; 72 } 62 @Override 63 public String toString() { 64 return action + " " + identifier + " " + position; 65 } 73 66 }
Note: See TracChangeset
for help on using the changeset viewer.