Skip to content

Commit

Permalink
add DateRangeBox sample and update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Sep 22, 2024
1 parent 14ee0a7 commit 15be1e6
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class Contact {
private String address;
private String about;

@JsonIgnore
private int depth =0;
@JsonIgnore
private boolean hasChildren = true;
Expand Down Expand Up @@ -156,14 +157,14 @@ public String stringBalance(){
return "$"+balance;
}

public void setFriends(List<Contact> subList) {
this.friends = subList;
}

public List<Contact> getFriends() {
return friends;
}

public void setFriends(List<Contact> subList) {
this.friends = subList;
}

public void addFriend(Contact contact){
friends.add(contact);
}
Expand All @@ -184,11 +185,11 @@ public String toString() {
'}';
}

public void setHasChildren(boolean hasChildren) {
this.hasChildren = hasChildren;
}

public boolean isHasChildren() {
return hasChildren;
}

public void setHasChildren(boolean hasChildren) {
this.hasChildren = hasChildren;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
import org.dominokit.domino.ui.datepicker.CalendarInitConfig;
import org.dominokit.domino.ui.elements.DivElement;
import org.dominokit.domino.ui.forms.DateBox;
import org.dominokit.domino.ui.forms.DateRangeBox;
import org.dominokit.domino.ui.grid.Row;
import org.dominokit.domino.ui.icons.lib.Icons;
import org.dominokit.domino.ui.menu.direction.DropDirection;
import org.dominokit.domino.ui.notifications.Notification;
import org.dominokit.domino.ui.popover.Popover;
import org.dominokit.domino.ui.typography.BlockHeader;
import org.gwtproject.i18n.shared.cldr.impl.DateTimeFormatInfoImpl_ar;
import org.gwtproject.i18n.shared.cldr.impl.DateTimeFormatInfoImpl_de;
import org.gwtproject.i18n.shared.cldr.impl.DateTimeFormatInfoImpl_es;

import java.util.Arrays;
Expand Down Expand Up @@ -62,7 +65,7 @@ protected HTMLDivElement init() {
private void inlineCalendar() {
element
.appendChild(Card.create("INLINE CALENDAR", "Different locales")
.appendChild(Calendar.create(new CalendarInitConfig()
.appendChild(Calendar.create(new DateTimeFormatInfoImpl_de(), new CalendarInitConfig()
.addPlugin(new DisableWeekendDaysPlugin())
.addPlugin(new SimpleEventsPlugin(Arrays.asList(SimpleEventsPlugin.CalendarEvent.of("My best friend birthday", new Date()))))
)
Expand Down Expand Up @@ -214,11 +217,14 @@ private void dateBox() {
.appendChild(Card.create("DATE BOX")
.setCollapsible(true)
.appendChild(Row.create()
.span4(DateBox.create("myDateBox")
.setReadOnly(true)
.span4(DateBox.create("Date Box")
.setPattern("dd.MM.yyyy")
.setParseStrict(true)
.withPopover((parent, popover) -> popover.addCss(dui_accent_blue)))
.withPopover((parent, popover) -> popover.addCss(dui_accent_blue))
.addChangeListener((oldValue, newValue) -> {
Notification.create("Value changed : old [" + oldValue + "] new [" + newValue + "]").show();
})
)
.span4(DateBox.create("With pattern", new DateTimeFormatInfoImpl_ar())
.setPattern("dd-MM-yyyy")
.withPopover((parent, popover) -> popover.addCss(dui_accent_blue))
Expand All @@ -233,6 +239,33 @@ private void dateBox() {
.withHeader())
)
)
.appendChild(Row.create()
.span4(DateRangeBox.create("Date range box")
.setPattern("dd.MM.yyyy")
.setParseStrict(true)
.withPopover((parent, popover) -> popover.addCss(dui_accent_blue))
.addChangeListener((oldValue, newValue) -> {
Notification.create("Value changed : old [" + oldValue.getFrom() + " - " +oldValue.getTo() + "] new [" + newValue.getFrom() + " - " +newValue.getTo() + "]").show();
})
)
.span4(DateRangeBox.create("Date range with pattern", new DateTimeFormatInfoImpl_ar())
.setPattern("dd-MM-yyyy")
.withPopover((parent, popover) -> popover.addCss(dui_accent_blue))
.withFromCalendar((parent, calendar) -> calendar
.withHeader())
.withToCalendar((parent, calendar) -> calendar
.withHeader())
)
.span4(DateRangeBox.create("Date range with parse strict", new DateTimeFormatInfoImpl_es())
.setPattern("dd-MM-yyyy")
.setParseStrict(true)
.withPopover((parent, popover) -> popover.addCss(dui_accent_teal))
.withFromCalendar((parent, calendar) -> calendar
.withHeader())
.withToCalendar((parent, calendar) -> calendar
.withHeader())
)
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
import org.dominokit.domino.ui.forms.FloatBox;
import org.dominokit.domino.ui.forms.IntegerBox;
import org.dominokit.domino.ui.forms.LongBox;
import org.dominokit.domino.ui.forms.Radio;
import org.dominokit.domino.ui.forms.RadioGroup;
import org.dominokit.domino.ui.forms.ShortBox;
import org.dominokit.domino.ui.forms.SwitchButton;
import org.dominokit.domino.ui.forms.TelephoneBox;
import org.dominokit.domino.ui.forms.TextBox;
import org.dominokit.domino.ui.grid.Column;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
package org.dominokit.domino.uidemoserver.shared.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.util.ArrayList;
import java.util.List;

@JsonIgnoreProperties(ignoreUnknown = true)
public class Contact {

private int index;
Expand All @@ -16,6 +23,13 @@ public class Contact {
private String address;
private String about;

@JsonIgnore
private int depth =0;
@JsonIgnore
private boolean hasChildren = true;

private List<Contact> friends = new ArrayList<>();

public Contact() {
}

Expand Down Expand Up @@ -143,6 +157,26 @@ public String stringBalance(){
return "$"+balance;
}

public List<Contact> getFriends() {
return friends;
}

public void setFriends(List<Contact> subList) {
this.friends = subList;
}

public void addFriend(Contact contact){
friends.add(contact);
}

public int getDepth() {
return depth;
}

public void setDepth(int depth) {
this.depth = depth;
}

@Override
public String toString() {
return "Contact{" +
Expand All @@ -151,4 +185,11 @@ public String toString() {
'}';
}

public boolean isHasChildren() {
return hasChildren;
}

public void setHasChildren(boolean hasChildren) {
this.hasChildren = hasChildren;
}
}

0 comments on commit 15be1e6

Please sign in to comment.