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
16 package com.vaadin.v7.client.ui.colorpicker;
18 import com.google.gwt.core.client.GWT;
19 import com.google.gwt.event.dom.client.ClickEvent;
20 import com.google.gwt.user.client.ui.Widget;
21 import com.vaadin.client.VCaption;
22 import com.vaadin.client.communication.RpcProxy;
23 import com.vaadin.client.ui.VColorPickerArea;
24 import com.vaadin.shared.ui.Connect;
25 import com.vaadin.shared.ui.Connect.LoadStyle;
26 import com.vaadin.v7.shared.ui.colorpicker.ColorPickerServerRpc;
27 import com.vaadin.v7.ui.ColorPickerArea;
30 * A class that defines an implementation for a color picker connector. Connects
31 * the server side {@link ColorPickerArea} with the client side counterpart
32 * {@link VColorPickerArea}
37 @Connect(value = ColorPickerArea.class, loadStyle = LoadStyle.LAZY)
38 public class ColorPickerAreaConnector extends AbstractColorPickerConnector {
40 private ColorPickerServerRpc rpc = RpcProxy
41 .create(ColorPickerServerRpc.class, this);
44 protected Widget createWidget() {
45 return GWT.create(VColorPickerArea.class);
49 public VColorPickerArea getWidget() {
50 return (VColorPickerArea) super.getWidget();
54 public void onClick(ClickEvent event) {
55 rpc.openPopup(getWidget().isOpen());
59 protected void setCaption(String caption) {
60 VCaption.setCaptionText(getWidget(), getState());
64 protected void refreshColor() {
65 getWidget().refreshColor();