-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpecialCustomizationsDemo.java
More file actions
79 lines (74 loc) · 3.1 KB
/
SpecialCustomizationsDemo.java
File metadata and controls
79 lines (74 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*-
* #%L
* Share Easy Add-on
* %%
* Copyright (C) 2023 - 2026 Flowing Code
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package com.flowingcode.vaadin.addons.shareeasy;
import com.flowingcode.vaadin.addons.demo.DemoSource;
import com.flowingcode.vaadin.addons.demo.SourceCodeViewer;
import com.flowingcode.vaadin.addons.shareeasy.enums.Driver;
import com.flowingcode.vaadin.addons.shareeasy.util.CustomDriverOptions;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;
import java.util.HashMap;
import java.util.Map;
/**
* Demo view for special customizations.
*/
@SuppressWarnings("serial")
@DemoSource
@DemoSource(value = "/src/test/java/com/flowingcode/vaadin/addons/shareeasy/TrelloDriverOptions.java")
@DemoSource(value = "/src/test/java/com/flowingcode/vaadin/addons/shareeasy/NewTwitterDriverOptions.java")
@PageTitle("Special Customizations Demo")
@Route(value = "share-easy/special-customizations", layout = ShareEasyDemoView.class)
public class SpecialCustomizationsDemo extends BaseShareEasyDemo {
public SpecialCustomizationsDemo() {
// begin-block example1
Div normalDiv1 = new Div();
NormalShareEasy.create().withDrivers(Driver.WHATSAPP, Driver.TWITTER,
Driver.TELEGRAM, Driver.LINKEDIN, Driver.FACEBOOK, Driver.COPY).forComponent(normalDiv1);
// #if vaadin eq 0
Div example1 = createContainerDivWithInfo("Default drivers with different order", normalDiv1,
"Use 'withDrivers' method to list the default drivers in the wanted order");
SourceCodeViewer.highlightOnHover(example1, "example1");
add(example1);
addSeparator();
// #endif
// show-source add(normalDiv1);
// end-block
// begin-block example2
Div normalDiv2 = new Div();
Map<String, CustomDriverOptions> customDrivers2 = new HashMap<>();
TrelloDriverOptions trelloDriver = new TrelloDriverOptions();
customDrivers2.put("trello", trelloDriver);
NormalShareEasy
.create().withCustomDrivers(customDrivers2).withDrivers(Driver.COPY,
Driver.TELEGRAM, Driver.FACEBOOK, trelloDriver, Driver.WHATSAPP, Driver.LINKEDIN)
.forComponent(normalDiv2);
// #if vaadin eq 0
Div example2 = createContainerDivWithInfo("Custom driver definition",
normalDiv2,
"Use 'withCustomDrivers' method to add the new custom drivers and then call 'withDrivers' to list the wanted drivers in the wanted order.");
SourceCodeViewer.highlightOnHover(example2, "example2");
add(example2);
addSeparator();
// #endif
// show-source add(normalDiv2);
// end-block
}
}