Skip to content

Commit 3dcfd03

Browse files
paodbjavier-godoy
authored andcommitted
feat(demo): add new demo for readonly mode
1 parent 7d38577 commit 3dcfd03

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

src/test/java/com/flowingcode/vaadin/addons/chipfield/ChipfieldDemoView.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class ChipfieldDemoView extends TabbedDemo {
3535
private static final String RESTRICTED_DEMO = "Restricted";
3636
private static final String DISABLED_DEMO = "Disabled";
3737
private static final String BINDER_DEMO = "Binder";
38+
private static final String READONLY_DEMO = "Readonly";
3839
private static final String DATAPROVIDER_SOURCE =
3940
"https://github.com/FlowingCode/ChipFieldAddon/blob/master/src/test/java/com/flowingcode/vaadin/addons/chipfield/DataProviderDemo.java";
4041
private static final String RESTRICTED_SOURCE =
@@ -43,12 +44,15 @@ public class ChipfieldDemoView extends TabbedDemo {
4344
"https://github.com/FlowingCode/ChipFieldAddon/blob/master/src/test/java/com/flowingcode/vaadin/addons/chipfield/DisabledDemo.java";
4445
private static final String BINDER_SOURCE =
4546
"https://github.com/FlowingCode/ChipFieldAddon/blob/master/src/test/java/com/flowingcode/vaadin/addons/chipfield/BinderDemo.java";
47+
private static final String READONLY_SOURCE =
48+
"https://github.com/FlowingCode/ChipFieldAddon/blob/master/src/test/java/com/flowingcode/vaadin/addons/chipfield/ReadonlyDemo.java";
4649

4750
public ChipfieldDemoView() {
4851

4952
addDemo(new DataProviderDemo(), DATAPROVIDER_DEMO, DATAPROVIDER_SOURCE);
5053
addDemo(new RestrictedDemo(), RESTRICTED_DEMO, RESTRICTED_SOURCE);
5154
addDemo(new DisabledDemo(), DISABLED_DEMO, DISABLED_SOURCE);
5255
addDemo(new BinderDemo(), BINDER_DEMO, BINDER_SOURCE);
56+
addDemo(new ReadonlyDemo(), READONLY_DEMO, READONLY_SOURCE);
5357
}
5458
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*-
2+
* #%L
3+
* ChipField Addon
4+
* %%
5+
* Copyright (C) 2018 - 2021 Flowing Code
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
package com.flowingcode.vaadin.addons.chipfield;
21+
22+
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
23+
24+
@SuppressWarnings("serial")
25+
public class ReadonlyDemo extends VerticalLayout {
26+
public ReadonlyDemo() {
27+
ChipField<String> chf = new ChipField<>("Readonly", "Mercury", "Venus", "Earth");
28+
chf.setWidthFull();
29+
chf.addSelectedItem("Mercury");
30+
chf.addSelectedItem("Venus");
31+
chf.setReadOnly(true);
32+
33+
add(chf);
34+
}
35+
}

0 commit comments

Comments
 (0)