@@ -55,28 +55,28 @@ public ChipfieldDemoView() {
5555 setSizeFull ();
5656
5757 tabs .addSelectedChangeListener (e -> {
58- this . removeAll ();
58+ removeAll ();
5959 switch (e .getSelectedTab ().getLabel ()) {
6060 case DATAPROVIDER_DEMO :
61- iframe .getElement ().setAttribute ("srcdoc" , getSrcdoc (DATAPROVIDER_DEMO ));
61+ iframe .getElement ().setAttribute ("srcdoc" , getSrcdoc (DATAPROVIDER_SOURCE ));
6262 layout .addToPrimary (new DataProviderDemo ());
6363 layout .addToSecondary (iframe );
6464 add (tabs , layout );
6565 break ;
66- case "Restricted" :
67- iframe .getElement ().setAttribute ("srcdoc" , getSrcdoc (RESTRICTED_DEMO ));
66+ case RESTRICTED_DEMO :
67+ iframe .getElement ().setAttribute ("srcdoc" , getSrcdoc (RESTRICTED_SOURCE ));
6868 layout .addToPrimary (new RestrictedDemo ());
6969 layout .addToSecondary (iframe );
7070 add (tabs , layout );
7171 break ;
72- case "Disabled" :
73- iframe .getElement ().setAttribute ("srcdoc" , getSrcdoc (DISABLED_DEMO ));
72+ case DISABLED_DEMO :
73+ iframe .getElement ().setAttribute ("srcdoc" , getSrcdoc (DISABLED_SOURCE ));
7474 layout .addToPrimary (new DisabledDemo ());
7575 layout .addToSecondary (iframe );
7676 add (tabs , layout );
7777 break ;
78- case "Binder" :
79- iframe .getElement ().setAttribute ("srcdoc" , getSrcdoc (BINDER_DEMO ));
78+ case BINDER_DEMO :
79+ iframe .getElement ().setAttribute ("srcdoc" , getSrcdoc (BINDER_SOURCE ));
8080 layout .addToPrimary (new BinderDemo ());
8181 layout .addToSecondary (iframe );
8282 add (tabs , layout );
@@ -88,30 +88,8 @@ public ChipfieldDemoView() {
8888 });
8989 }
9090
91- private String getSrcdoc (String demo ) {
92- String response ;
93- switch (demo ) {
94- case DATAPROVIDER_DEMO :
95- response = "<html style=\" overflow-y:hidden; height:100%;\" ><body style=\" overflow-y: scroll; height:100%;\" ><script src=\" http://gist-it.appspot.com/"
96- + DATAPROVIDER_SOURCE + "\" ></script></body></html>" ;
97- break ;
98- case RESTRICTED_DEMO :
99- response = "<html style=\" overflow-y:hidden; height:100%;\" ><body style=\" overflow-y: scroll; height:100%;\" ><script src=\" http://gist-it.appspot.com/"
100- + RESTRICTED_SOURCE + "\" ></script></body></html>" ;
101- break ;
102- case DISABLED_DEMO :
103- response = "<html style=\" overflow-y:hidden; height:100%;\" ><body style=\" overflow-y: scroll; height:100%;\" ><script src=\" https://gist-it.appspot.com/"
104- + DISABLED_SOURCE + "\" ></script></body></html>" ;
105- break ;
106- case BINDER_DEMO :
107- response = "<html style=\" overflow-y:hidden; height:100%;\" ><body style=\" overflow-y: scroll; height:100%;\" ><script src=\" https://gist-it.appspot.com/"
108- + BINDER_SOURCE + "\" ></script></body></html>" ;
109- break ;
110- default :
111- response = "<html style=\" overflow-y:hidden; height:100%;\" ><body style=\" overflow-y: scroll; height:100%;\" ><script src=\" https://gist-it.appspot.com/"
112- + DATAPROVIDER_SOURCE + "\" ></script></body></html>" ;
113- break ;
114- }
115- return response ;
91+ private String getSrcdoc (String sourceUrl ) {
92+ return "<html style=\" overflow-y:hidden; height:100%;\" ><body style=\" overflow-y: scroll; height:100%;\" ><script src=\" https://gist-it.appspot.com/"
93+ + sourceUrl + "\" ></script></body></html>" ;
11694 }
11795}
0 commit comments