/*
* Copyright 2009 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.itmill.toolkit.demo.coverflow.gwt.client;
import com.itmill.toolkit.demo.coverflow.gwt.client.ui.ICoverflow;
import com.itmill.toolkit.terminal.gwt.client.DefaultWidgetSet;
import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
public class CoverflowWidgetSet extends DefaultWidgetSet {
/** Creates a widget according to its class name. */
public Paintable createWidget(UIDL uidl) {
final Class classType = resolveWidgetType(uidl);
if (ICoverflow.class == classType) {
return new ICoverflow();
}
// Let the DefaultWidgetSet handle creation of default widgets
return super.createWidget(uidl);
}
/** Resolves UIDL tag name to class . */
protected Class resolveWidgetType(UIDL uidl) {
final String tag = uidl.getTag();
if ("cover".equals(tag)) {
return ICoverflow.class;
}
// Let the DefaultWidgetSet handle resolution of default widgets
return super.resolveWidgetType(uidl);
}
}
|