Przeglądaj źródła

Adding name (short string description) to the Range object.

Sam Jaffe 8 lat temu
rodzic
commit
cf2b5c6839

+ 6 - 3
src/org/leumasjaffe/charsheet/model/magic/Range.java

@@ -5,6 +5,7 @@ import java.util.Map;
 import com.fasterxml.jackson.annotation.JsonCreator;
 
 import lombok.AccessLevel;
+import lombok.Getter;
 import lombok.NonNull;
 import lombok.RequiredArgsConstructor;
 import lombok.experimental.FieldDefaults;
@@ -17,6 +18,8 @@ public interface Range {
 			Long = new WithLevelGrowth("Long", 400, 40, 1), 
 			Unlimited = new Basic("Unlimited");
 	
+	public String getName();
+	
 	@JsonCreator
 	public static Range select(final String name) {
 		switch (name.toLowerCase()) {
@@ -45,7 +48,7 @@ public interface Range {
 	@RequiredArgsConstructor
 	@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
 	public static class Basic implements Range {
-		@NonNull String name;
+		@NonNull @Getter String name;
 		
 		public String toString() {
 			return name;
@@ -55,7 +58,7 @@ public interface Range {
 	@RequiredArgsConstructor
 	@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
 	public static class WithDistance implements Range {
-		@NonNull String name;
+		@NonNull @Getter String name;
 		int range;
 		
 		public String toString() {
@@ -68,7 +71,7 @@ public interface Range {
 	@RequiredArgsConstructor
 	@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
 	public static class WithLevelGrowth implements Range {
-		@NonNull String name;
+		@NonNull @Getter String name;
 		int range;
 		int per;
 		int step;

+ 16 - 2
src/org/leumasjaffe/charsheet/view/magic/SpellLine.java

@@ -21,9 +21,9 @@ public class SpellLine extends JPanel {
 
 	public SpellLine(final DDSpell spell) {
 		GridBagLayout gridBagLayout = new GridBagLayout();
-		gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0, 0};
+		gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 		gridBagLayout.rowHeights = new int[]{0, 0};
-		gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
+		gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
 		gridBagLayout.rowWeights = new double[]{0.0, Double.MIN_VALUE};
 		setLayout(gridBagLayout);
 		
@@ -82,10 +82,24 @@ public class SpellLine extends JPanel {
 		
 		JLabel lblAction = new JLabel(spell.getCastingTime().name());
 		GridBagConstraints gbc_lblAction = new GridBagConstraints();
+		gbc_lblAction.insets = new Insets(0, 0, 0, 5);
 		gbc_lblAction.gridx = 6;
 		gbc_lblAction.gridy = 0;
 		add(lblAction, gbc_lblAction);
 		
+		Component horizontalStrut_3 = Box.createHorizontalStrut(20);
+		GridBagConstraints gbc_horizontalStrut_3 = new GridBagConstraints();
+		gbc_horizontalStrut_3.insets = new Insets(0, 0, 0, 5);
+		gbc_horizontalStrut_3.gridx = 7;
+		gbc_horizontalStrut_3.gridy = 0;
+		add(horizontalStrut_3, gbc_horizontalStrut_3);
+		
+		JLabel lblRange = new JLabel(spell.getRange().getName());
+		GridBagConstraints gbc_lblAction_1 = new GridBagConstraints();
+		gbc_lblAction_1.gridx = 8;
+		gbc_lblAction_1.gridy = 0;
+		add(lblRange, gbc_lblAction_1);
+		
 		addMouseListener(new PopClickListener(new SpellMenu(spell)));
 	}