Package com.vaadin.terminal.gwt.client

Source Code of com.vaadin.terminal.gwt.client.WidgetMap

/*
* Copyright 2010 IT Mill Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.terminal.gwt.client;

import com.vaadin.terminal.gwt.client.ui.VDateFieldCalendar;
import com.vaadin.terminal.gwt.client.ui.VPasswordField;
import com.vaadin.terminal.gwt.client.ui.VSplitPanelVertical;
import com.vaadin.terminal.gwt.client.ui.VTextArea;
import com.vaadin.terminal.gwt.client.ui.VWindow;

public abstract class WidgetMap {

    public Paintable instantiate(Class<? extends Paintable> classType) {
        /*
         * Yes, this (including the generated) may look very odd code, but due
         * the nature of GWT, we cannot do this with reflect. Luckily this is
         * mostly written by WidgetSetGenerator, here are just some hacks. Extra
         * instantiation code is needed if client side widget has no "native"
         * counterpart on client side.
         */
        if (VSplitPanelVertical.class == classType) {
            return new VSplitPanelVertical();
        } else if (VTextArea.class == classType) {
            return new VTextArea();

        } else if (VDateFieldCalendar.class == classType) {
            return new VDateFieldCalendar();
        } else if (VPasswordField.class == classType) {
            return new VPasswordField();
        } else if (VWindow.class == classType) {
            return new VWindow();
        } else {
            return null; // let generated type handle this
        }
    }

    public abstract Class<? extends Paintable> getImplementationByServerSideClassName(
            String fullyqualifiedName);

}
TOP

Related Classes of com.vaadin.terminal.gwt.client.WidgetMap

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.