Skip to content

Commit

Permalink
Added new boolean tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
SG-O committed Aug 3, 2023
1 parent 03daf03 commit 79af29c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
10 changes: 10 additions & 0 deletions doc/StructureDefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ Must be one of "LONG", "DOUBLE", "ENUM", "STRING", "DATE" or "LIST".

"parameter": OPTIONAL - See parameter for details.

### Boolean

{
"key": "someKey",
"type": "BOOLEAN",
"name": "Tage Name",
"description": "Tag Description",
"required": true
}

### Enum

{
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</modules>

<properties>
<revision>0.4.0-RC1</revision>
<revision>0.4.0-RC2</revision>
<spec>1</spec>

<maven-compiler-plugin-version>3.11.0</maven-compiler-plugin-version>
Expand Down
3 changes: 2 additions & 1 deletion tagyCore/src/main/java/de/sg_o/lib/tagy/def/Type.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public enum Type {
DOUBLE,
ENUM,
STRING,
DATE;
DATE,
BOOLEAN;

private final int id;
private static final HashMap<Integer, Type> types = new HashMap<>();
Expand Down
9 changes: 7 additions & 2 deletions tagyCore/src/main/java/de/sg_o/lib/tagy/tag/Input.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import de.sg_o.lib.tagy.def.StructureDefinition;
import de.sg_o.lib.tagy.def.TagDefinition;
import de.sg_o.lib.tagy.exceptions.InputException;
import de.sg_o.lib.tagy.tag.bool.BoolInput;
import de.sg_o.lib.tagy.tag.date.DateInput;
import de.sg_o.lib.tagy.tag.enumerator.EnumInput;
import de.sg_o.lib.tagy.tag.floating.DoubleInput;
Expand Down Expand Up @@ -75,6 +76,8 @@ public static Input create(@NotNull Tag tag) {
return new StringInput(tag);
case DATE:
return new DateInput(tag);
case BOOLEAN:
return new BoolInput(tag);
}
return null;
}
Expand All @@ -93,6 +96,8 @@ public static Input create(@NotNull TagDefinition tagDefinition) {
return new StringInput(tagDefinition);
case DATE:
return new DateInput(tagDefinition);
case BOOLEAN:
return new BoolInput(tagDefinition);
}
return null;
}
Expand All @@ -112,8 +117,8 @@ public static Input create(@NotNull TagDefinition tagDefinition) {
panel.setBorder(title);
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
JComponent component = getComponent();
component.setAlignmentX(Component.LEFT_ALIGNMENT);
component.setAlignmentY(Component.BOTTOM_ALIGNMENT);
component.setAlignmentX(Component.CENTER_ALIGNMENT);
component.setAlignmentY(Component.CENTER_ALIGNMENT);
panel.add(component);
return panel;
}
Expand Down
3 changes: 3 additions & 0 deletions tagyCore/src/main/java/de/sg_o/lib/tagy/tag/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.fasterxml.jackson.databind.JsonNode;
import de.sg_o.lib.tagy.def.TagDefinition;
import de.sg_o.lib.tagy.tag.bool.TagBool;
import de.sg_o.lib.tagy.tag.date.TagDate;
import de.sg_o.lib.tagy.tag.enumerator.TagEnum;
import de.sg_o.lib.tagy.tag.floating.TagDouble;
Expand Down Expand Up @@ -50,6 +51,8 @@ public static Tag create(@NotNull TagDefinition definition, @NotNull JsonNode di
return new TagString(definition, dictionary);
case DATE:
return new TagDate(definition, dictionary);
case BOOLEAN:
return new TagBool(definition, dictionary);
default:
return null;
}
Expand Down

0 comments on commit 79af29c

Please sign in to comment.