File tree Expand file tree Collapse file tree 3 files changed +53
-20
lines changed
java/com/vaadin/demo/dashboard
webapp/VAADIN/themes/dashboard/views Expand file tree Collapse file tree 3 files changed +53
-20
lines changed Original file line number Diff line number Diff line change 22
33import com .vaadin .data .Property ;
44import com .vaadin .data .util .ObjectProperty ;
5- import com .vaadin .demo .dashboard .data .dummy .DummyDataGenerator ;
5+ import com .vaadin .event .LayoutEvents .LayoutClickEvent ;
6+ import com .vaadin .event .LayoutEvents .LayoutClickListener ;
67import com .vaadin .server .FontAwesome ;
78import com .vaadin .shared .ui .label .ContentMode ;
89import com .vaadin .ui .Button ;
1819public class InlineTextEditor extends CustomComponent {
1920
2021 private final Property <String > property = new ObjectProperty <String >(
21- DummyDataGenerator . randomText ( 30 ) );
22+ "Enter text here..." );
2223 private final Component editor ;
2324 private final Component readOnly ;
2425
@@ -52,6 +53,14 @@ public void buttonClick(ClickEvent event) {
5253 CssLayout result = new CssLayout (text , editButton );
5354 result .addStyleName ("text-editor" );
5455 result .setSizeFull ();
56+ result .addLayoutClickListener (new LayoutClickListener () {
57+ @ Override
58+ public void layoutClick (LayoutClickEvent event ) {
59+ if (event .getChildComponent () == text && event .isDoubleClick ()) {
60+ setCompositionRoot (editor );
61+ }
62+ }
63+ });
5564 return result ;
5665 }
5766
Original file line number Diff line number Diff line change @@ -167,8 +167,9 @@ public void addComponent(PaletteItemType paletteItemType,
167167 if (placeholder .getParent () != null ) {
168168 layout .removeComponent (placeholder );
169169 }
170- layout .addComponent (new WrappedComponent (
171- createComponentFromPaletteItem (paletteItemType , prefillData )));
170+ layout .addComponent (
171+ new WrappedComponent (createComponentFromPaletteItem (
172+ paletteItemType , prefillData )), 1 );
172173 }
173174
174175 private Component createComponentFromPaletteItem (PaletteItemType type ,
Original file line number Diff line number Diff line change 2929 }
3030 }
3131
32+ .v-slot-palette {
33+ @include valo-gradient ;
34+ border-bottom : valo-border ();
35+ }
36+
3237 .palette {
33- padding : 0 ;
38+ padding : .5em 0 ;
39+ font-size : 0.9em ;
40+
41+ .v-icon {
42+ display : block ;
43+ text-align : center ;
44+ }
3445
3546 .v-label {
36- font-size : 14px ;
47+ font-size : 0.9em ;
48+ margin : 0 .4em ;
49+ cursor : move ;
3750 }
3851 }
3952
4760
4861 .v-slot-canvas {
4962 overflow : auto ;
63+ }
5064
51- .canvas {
52- padding : $view-padding ;
53-
54- .title {
55- font-size : 24px ;
56- font-weight : 600 ;
57- border : 1px solid transparent ;
58- color : #404346 ;
59- @include box-shadow (none );
60- width : 100% ;
61- text-align : center ;
62- cursor : pointer ;
63- margin-bottom : 1cm ;
64- }
65+ .canvas {
66+ padding : $view-padding ;
67+
68+ .title {
69+ font-size : 24px ;
70+ font-weight : 600 ;
71+ border : 1px solid transparent ;
72+ color : #404346 ;
73+ @include box-shadow (none );
74+ width : 100% ;
75+ text-align : center ;
76+ cursor : pointer ;
77+ margin-bottom : 1cm ;
6578 }
6679 }
80+
6781 }
6882
6983 .reports .palette .v-image {
7892 padding : 1.5cm ;
7993
8094 @include box-shadow (0 2px 10px rgba (0 ,0 ,0 ,.3 ));
95+
96+ > .v-slot > .v-widget {
97+ @include animation (valo- animate- in- fade 500ms 10ms backwards , animate- in- scale- up 300ms 10ms backwards );
98+
99+ & .title ,
100+ & .placeholder {
101+ @include animation (none );
102+ }
103+ }
81104 }
82105
83106 .reports .canvas .title :hover {
You can’t perform that action at this time.
0 commit comments