2 * Copyright 2000-2021 Vaadin Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
17 package com.vaadin.v7.client.ui.twincolselect;
19 import com.vaadin.client.ApplicationConnection;
20 import com.vaadin.client.DirectionalManagedLayout;
21 import com.vaadin.client.UIDL;
22 import com.vaadin.shared.ui.Connect;
23 import com.vaadin.v7.client.ui.VTwinColSelect;
24 import com.vaadin.v7.client.ui.optiongroup.OptionGroupBaseConnector;
25 import com.vaadin.v7.shared.ui.twincolselect.TwinColSelectState;
26 import com.vaadin.v7.ui.TwinColSelect;
28 @Connect(TwinColSelect.class)
29 public class TwinColSelectConnector extends OptionGroupBaseConnector
30 implements DirectionalManagedLayout {
33 public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
34 // Captions are updated before super call to ensure the widths are set
36 if (isRealUpdate(uidl)) {
37 getWidget().updateCaptions(uidl);
38 getLayoutManager().setNeedsHorizontalLayout(this);
41 super.updateFromUIDL(uidl, client);
45 protected void init() {
47 getLayoutManager().registerDependency(this,
48 getWidget().captionWrapper.getElement());
52 public void onUnregister() {
53 getLayoutManager().unregisterDependency(this,
54 getWidget().captionWrapper.getElement());
58 public VTwinColSelect getWidget() {
59 return (VTwinColSelect) super.getWidget();
63 public TwinColSelectState getState() {
64 return (TwinColSelectState) super.getState();
68 public void layoutVertically() {
69 if (isUndefinedHeight()) {
70 getWidget().clearInternalHeights();
72 getWidget().setInternalHeights();
77 public void layoutHorizontally() {
78 if (isUndefinedWidth()) {
79 getWidget().clearInternalWidths();
81 getWidget().setInternalWidths();