Skip to content

Commit

Permalink
Merge pull request #4 from MEFRREEX/element-setname
Browse files Browse the repository at this point in the history
Update FormElement#setName
  • Loading branch information
MEFRREEX authored Dec 23, 2023
2 parents 43e502d + 4567ac7 commit 398e740
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>ru.contentforge</groupId>
<artifactId>FormConstructor</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
Expand Down Expand Up @@ -56,4 +56,4 @@
</resource>
</resources>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ public FormElement(String name) {
public String getName() {
return name;
}

/**
* Set element name
*/
public FormElement setName(String name) {
this.name = name;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public Dropdown(String name, List<SelectableElement> elements, int defaultIndex)
this.addElements(elements);
}

@Override
public Dropdown setName(String name) {
return (Dropdown) super.setName(name);
}

public Dropdown addElement(SelectableElement element) {
element.setIndex(elements.size());
elements.add(element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ private Input(String name, String placeholder, String defaultValue, boolean trim
this.validators = validators;
}

@Override
public Input setName(String name) {
return (Input) super.setName(name);
}

public Input setPlaceholder(String placeholder) {
this.placeholder = placeholder;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public Slider(String name, float min, float max, int step, float defaultValue) {
}
}

@Override
public Slider setName(String name) {
return (Slider) super.setName(name);
}

public Slider setMin(float min) {
this.min = min;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public StepSlider(String name, List<SelectableElement> elements, int defaultInde
this.addSteps(elements);
}

@Override
public StepSlider setName(String name) {
return (StepSlider) super.setName(name);
}

public StepSlider addStep(SelectableElement element) {
element.setIndex(elements.size());
elements.add(element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public Toggle(String name, boolean defaultValue) {
this.defaultValue = defaultValue;
}

@Override
public Toggle setName(String name) {
return (Toggle) super.setName(name);
}

public boolean getDefaultValue() {
return defaultValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public Button(String name, ImageType imageType, String image, SimpleFormHandler
this.handler = handler;
}

@Override
public Button setName(String name) {
return (Button) super.setName(name);
}

/**
* Set button image
* @param type Type of image on button
Expand Down

0 comments on commit 398e740

Please sign in to comment.