Skip to content

Commit 5f45baf

Browse files
paodbjavier-godoy
authored andcommitted
refactor: move action buttons styles to css
1 parent e62baef commit 5f45baf

File tree

2 files changed

+36
-13
lines changed

2 files changed

+36
-13
lines changed

src/main/java/com/flowingcode/vaadin/addons/twincolgrid/TwinColGrid.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666

6767
@SuppressWarnings("serial")
6868
@CssImport(value = "./styles/multiselect-cb-hide.css", themeFor = "vaadin-grid")
69+
@CssImport(value = "./styles/twin-col-grid-button.css")
6970
public class TwinColGrid<T> extends VerticalLayout
7071
implements HasValue<ValueChangeEvent<Set<T>>, Set<T>>, HasComponents, HasSize {
7172

@@ -115,13 +116,13 @@ public enum Orientation {
115116
/** @deprecated Use getRightGrid().getDataProvider() */
116117
@Deprecated protected ListDataProvider<T> rightGridDataProvider;
117118

118-
private final Button addAllButton = new Button();
119+
private final Button addAllButton = createActionButton();
119120

120-
private final Button addButton = new Button();
121+
private final Button addButton = createActionButton();
121122

122-
private final Button removeButton = new Button();
123+
private final Button removeButton = createActionButton();
123124

124-
private final Button removeAllButton = new Button();
125+
private final Button removeAllButton = createActionButton();
125126

126127
private Component buttonContainer;
127128

@@ -203,7 +204,7 @@ public TwinColGrid(final ListDataProvider<T> dataProvider, String caption) {
203204

204205
/**
205206
* Sets orientation for TwinColGridComponent
206-
*
207+
*
207208
* @param orientation
208209
* @return
209210
*/
@@ -254,13 +255,9 @@ private VerticalLayout createVerticalContainer() {
254255

255256
private VerticalLayout getVerticalButtonContainer() {
256257
addButton.setIcon(VaadinIcon.ANGLE_RIGHT.create());
257-
addButton.setWidth("3em");
258258
addAllButton.setIcon(VaadinIcon.ANGLE_DOUBLE_RIGHT.create());
259-
addAllButton.setWidth("3em");
260259
removeButton.setIcon(VaadinIcon.ANGLE_LEFT.create());
261-
removeButton.setWidth("3em");
262260
removeAllButton.setIcon(VaadinIcon.ANGLE_DOUBLE_LEFT.create());
263-
removeAllButton.setWidth("3em");
264261

265262
VerticalLayout vButtonContainer =
266263
new VerticalLayout(
@@ -273,13 +270,9 @@ private VerticalLayout getVerticalButtonContainer() {
273270

274271
private HorizontalLayout getHorizontalButtonContainer() {
275272
addButton.setIcon(VaadinIcon.ANGLE_DOWN.create());
276-
addButton.setWidth("3em");
277273
addAllButton.setIcon(VaadinIcon.ANGLE_DOUBLE_DOWN.create());
278-
addAllButton.setWidth("3em");
279274
removeButton.setIcon(VaadinIcon.ANGLE_UP.create());
280-
removeButton.setWidth("3em");
281275
removeAllButton.setIcon(VaadinIcon.ANGLE_DOUBLE_UP.create());
282-
removeAllButton.setWidth("3em");
283276

284277
HorizontalLayout hButtonContainer =
285278
new HorizontalLayout(
@@ -766,4 +759,11 @@ public HasValue<? extends ValueChangeEvent<List<T>>, List<T>> asList() {
766759
public Set<T> getEmptyValue() {
767760
return Collections.emptySet();
768761
}
762+
763+
private Button createActionButton() {
764+
Button button = new Button();
765+
button.addThemeName("twin-col-grid-button");
766+
return button;
767+
}
768+
769769
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*-
2+
* #%L
3+
* TwinColGrid add-on
4+
* %%
5+
* Copyright (C) 2017 - 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+
21+
vaadin-button[theme~="twin-col-grid-button"] {
22+
width: 3em;
23+
}

0 commit comments

Comments
 (0)